aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig1658
-rw-r--r--arch/mips/Kconfig.debug76
-rw-r--r--arch/mips/Makefile767
-rw-r--r--arch/mips/arc/Makefile10
-rw-r--r--arch/mips/arc/arc_con.c50
-rw-r--r--arch/mips/arc/cmdline.c108
-rw-r--r--arch/mips/arc/console.c63
-rw-r--r--arch/mips/arc/env.c27
-rw-r--r--arch/mips/arc/file.c75
-rw-r--r--arch/mips/arc/identify.c119
-rw-r--r--arch/mips/arc/init.c48
-rw-r--r--arch/mips/arc/memory.c170
-rw-r--r--arch/mips/arc/misc.c108
-rw-r--r--arch/mips/arc/promlib.c43
-rw-r--r--arch/mips/arc/salone.c24
-rw-r--r--arch/mips/arc/time.c25
-rw-r--r--arch/mips/arc/tree.c127
-rw-r--r--arch/mips/au1000/common/Makefile15
-rw-r--r--arch/mips/au1000/common/au1xxx_irqmap.c224
-rw-r--r--arch/mips/au1000/common/clocks.c96
-rw-r--r--arch/mips/au1000/common/cputable.c55
-rw-r--r--arch/mips/au1000/common/dbdma.c836
-rw-r--r--arch/mips/au1000/common/dbg_io.c122
-rw-r--r--arch/mips/au1000/common/dma.c243
-rw-r--r--arch/mips/au1000/common/int-handler.S68
-rw-r--r--arch/mips/au1000/common/irq.c654
-rw-r--r--arch/mips/au1000/common/pci.c97
-rw-r--r--arch/mips/au1000/common/platform.c53
-rw-r--r--arch/mips/au1000/common/power.c493
-rw-r--r--arch/mips/au1000/common/prom.c162
-rw-r--r--arch/mips/au1000/common/puts.c145
-rw-r--r--arch/mips/au1000/common/reset.c195
-rw-r--r--arch/mips/au1000/common/setup.c195
-rw-r--r--arch/mips/au1000/common/sleeper.S149
-rw-r--r--arch/mips/au1000/common/time.c469
-rw-r--r--arch/mips/au1000/common/usbdev.c1557
-rw-r--r--arch/mips/au1000/csb250/Makefile8
-rw-r--r--arch/mips/au1000/csb250/board_setup.c239
-rw-r--r--arch/mips/au1000/csb250/init.c95
-rw-r--r--arch/mips/au1000/csb250/irqmap.c60
-rw-r--r--arch/mips/au1000/db1x00/Makefile9
-rw-r--r--arch/mips/au1000/db1x00/board_setup.c127
-rw-r--r--arch/mips/au1000/db1x00/init.c74
-rw-r--r--arch/mips/au1000/db1x00/irqmap.c72
-rw-r--r--arch/mips/au1000/db1x00/mirage_ts.c261
-rw-r--r--arch/mips/au1000/hydrogen3/Makefile9
-rw-r--r--arch/mips/au1000/hydrogen3/board_setup.c70
-rw-r--r--arch/mips/au1000/hydrogen3/init.c77
-rw-r--r--arch/mips/au1000/hydrogen3/irqmap.c56
-rw-r--r--arch/mips/au1000/mtx-1/Makefile10
-rw-r--r--arch/mips/au1000/mtx-1/board_setup.c89
-rw-r--r--arch/mips/au1000/mtx-1/init.c71
-rw-r--r--arch/mips/au1000/mtx-1/irqmap.c58
-rw-r--r--arch/mips/au1000/pb1000/Makefile8
-rw-r--r--arch/mips/au1000/pb1000/board_setup.c182
-rw-r--r--arch/mips/au1000/pb1000/init.c69
-rw-r--r--arch/mips/au1000/pb1000/irqmap.c54
-rw-r--r--arch/mips/au1000/pb1100/Makefile8
-rw-r--r--arch/mips/au1000/pb1100/board_setup.c116
-rw-r--r--arch/mips/au1000/pb1100/init.c70
-rw-r--r--arch/mips/au1000/pb1100/irqmap.c57
-rw-r--r--arch/mips/au1000/pb1500/Makefile8
-rw-r--r--arch/mips/au1000/pb1500/board_setup.c138
-rw-r--r--arch/mips/au1000/pb1500/init.c69
-rw-r--r--arch/mips/au1000/pb1500/irqmap.c58
-rw-r--r--arch/mips/au1000/pb1550/Makefile9
-rw-r--r--arch/mips/au1000/pb1550/board_setup.c69
-rw-r--r--arch/mips/au1000/pb1550/init.c69
-rw-r--r--arch/mips/au1000/pb1550/irqmap.c55
-rw-r--r--arch/mips/au1000/xxs1500/Makefile9
-rw-r--r--arch/mips/au1000/xxs1500/board_setup.c91
-rw-r--r--arch/mips/au1000/xxs1500/init.c68
-rw-r--r--arch/mips/au1000/xxs1500/irqmap.c66
-rw-r--r--arch/mips/boot/Makefile49
-rw-r--r--arch/mips/boot/addinitrd.c131
-rw-r--r--arch/mips/boot/ecoff.h62
-rw-r--r--arch/mips/boot/elf2ecoff.c616
-rw-r--r--arch/mips/cobalt/Makefile7
-rw-r--r--arch/mips/cobalt/int-handler.S25
-rw-r--r--arch/mips/cobalt/irq.c102
-rw-r--r--arch/mips/cobalt/promcon.c87
-rw-r--r--arch/mips/cobalt/reset.c68
-rw-r--r--arch/mips/cobalt/setup.c150
-rw-r--r--arch/mips/configs/atlas_defconfig1104
-rw-r--r--arch/mips/configs/capcella_defconfig705
-rw-r--r--arch/mips/configs/cobalt_defconfig680
-rw-r--r--arch/mips/configs/db1000_defconfig763
-rw-r--r--arch/mips/configs/db1100_defconfig758
-rw-r--r--arch/mips/configs/db1500_defconfig1018
-rw-r--r--arch/mips/configs/db1550_defconfig932
-rw-r--r--arch/mips/configs/ddb5476_defconfig726
-rw-r--r--arch/mips/configs/ddb5477_defconfig680
-rw-r--r--arch/mips/configs/decstation_defconfig660
-rw-r--r--arch/mips/configs/e55_defconfig683
-rw-r--r--arch/mips/configs/ev64120_defconfig672
-rw-r--r--arch/mips/configs/ev96100_defconfig626
-rw-r--r--arch/mips/configs/ip22_defconfig962
-rw-r--r--arch/mips/configs/ip27_defconfig827
-rw-r--r--arch/mips/configs/ip32_defconfig750
-rw-r--r--arch/mips/configs/it8172_defconfig740
-rw-r--r--arch/mips/configs/ivr_defconfig686
-rw-r--r--arch/mips/configs/jaguar-atx_defconfig620
-rw-r--r--arch/mips/configs/jmr3927_defconfig696
-rw-r--r--arch/mips/configs/lasat200_defconfig791
-rw-r--r--arch/mips/configs/malta_defconfig1132
-rw-r--r--arch/mips/configs/mpc30x_defconfig694
-rw-r--r--arch/mips/configs/ocelot_3_defconfig886
-rw-r--r--arch/mips/configs/ocelot_c_defconfig664
-rw-r--r--arch/mips/configs/ocelot_defconfig624
-rw-r--r--arch/mips/configs/ocelot_g_defconfig667
-rw-r--r--arch/mips/configs/osprey_defconfig618
-rw-r--r--arch/mips/configs/pb1100_defconfig826
-rw-r--r--arch/mips/configs/pb1500_defconfig855
-rw-r--r--arch/mips/configs/pb1550_defconfig847
-rw-r--r--arch/mips/configs/rm200_defconfig1383
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig734
-rw-r--r--arch/mips/configs/sead_defconfig493
-rw-r--r--arch/mips/configs/tb0226_defconfig763
-rw-r--r--arch/mips/configs/tb0229_defconfig775
-rw-r--r--arch/mips/configs/workpad_defconfig687
-rw-r--r--arch/mips/configs/yosemite_defconfig615
-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.c142
-rw-r--r--arch/mips/ddb5xxx/common/rtc_ds1386.c164
-rw-r--r--arch/mips/ddb5xxx/ddb5074/Makefile8
-rw-r--r--arch/mips/ddb5xxx/ddb5074/int-handler.S120
-rw-r--r--arch/mips/ddb5xxx/ddb5074/irq.c159
-rw-r--r--arch/mips/ddb5xxx/ddb5074/nile4_pic.c287
-rw-r--r--arch/mips/ddb5xxx/ddb5074/setup.c235
-rw-r--r--arch/mips/ddb5xxx/ddb5476/Makefile9
-rw-r--r--arch/mips/ddb5xxx/ddb5476/dbg_io.c136
-rw-r--r--arch/mips/ddb5xxx/ddb5476/int-handler.S112
-rw-r--r--arch/mips/ddb5xxx/ddb5476/irq.c143
-rw-r--r--arch/mips/ddb5xxx/ddb5476/nile4_pic.c190
-rw-r--r--arch/mips/ddb5xxx/ddb5476/setup.c297
-rw-r--r--arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c112
-rw-r--r--arch/mips/ddb5xxx/ddb5477/Makefile10
-rw-r--r--arch/mips/ddb5xxx/ddb5477/debug.c160
-rw-r--r--arch/mips/ddb5xxx/ddb5477/int-handler.S75
-rw-r--r--arch/mips/ddb5xxx/ddb5477/irq.c199
-rw-r--r--arch/mips/ddb5xxx/ddb5477/irq_5477.c168
-rw-r--r--arch/mips/ddb5xxx/ddb5477/kgdb_io.c136
-rw-r--r--arch/mips/ddb5xxx/ddb5477/lcd44780.c92
-rw-r--r--arch/mips/ddb5xxx/ddb5477/lcd44780.h15
-rw-r--r--arch/mips/ddb5xxx/ddb5477/setup.c405
-rw-r--r--arch/mips/dec/Makefile11
-rw-r--r--arch/mips/dec/boot/Makefile12
-rw-r--r--arch/mips/dec/boot/decstation.c83
-rw-r--r--arch/mips/dec/boot/ld.ecoff43
-rw-r--r--arch/mips/dec/ecc-berr.c280
-rw-r--r--arch/mips/dec/int-handler.S297
-rw-r--r--arch/mips/dec/ioasic-irq.c157
-rw-r--r--arch/mips/dec/kn02-irq.c127
-rw-r--r--arch/mips/dec/prom/Makefile11
-rw-r--r--arch/mips/dec/prom/call_o32.S91
-rw-r--r--arch/mips/dec/prom/cmdline.c39
-rw-r--r--arch/mips/dec/prom/console.c55
-rw-r--r--arch/mips/dec/prom/dectypes.h14
-rw-r--r--arch/mips/dec/prom/identify.c177
-rw-r--r--arch/mips/dec/prom/init.c134
-rw-r--r--arch/mips/dec/prom/locore.S30
-rw-r--r--arch/mips/dec/prom/memory.c130
-rw-r--r--arch/mips/dec/promcon.c55
-rw-r--r--arch/mips/dec/reset.c41
-rw-r--r--arch/mips/dec/setup.c750
-rw-r--r--arch/mips/dec/time.c200
-rw-r--r--arch/mips/dec/wbflush.c94
-rw-r--r--arch/mips/defconfig962
-rw-r--r--arch/mips/galileo-boards/ev96100/Makefile9
-rw-r--r--arch/mips/galileo-boards/ev96100/init.c173
-rw-r--r--arch/mips/galileo-boards/ev96100/int-handler.S33
-rw-r--r--arch/mips/galileo-boards/ev96100/irq.c66
-rw-r--r--arch/mips/galileo-boards/ev96100/puts.c138
-rw-r--r--arch/mips/galileo-boards/ev96100/reset.c70
-rw-r--r--arch/mips/galileo-boards/ev96100/setup.c162
-rw-r--r--arch/mips/galileo-boards/ev96100/time.c89
-rw-r--r--arch/mips/gt64120/common/Makefile6
-rw-r--r--arch/mips/gt64120/common/pci.c147
-rw-r--r--arch/mips/gt64120/common/time.c100
-rw-r--r--arch/mips/gt64120/ev64120/Makefile11
-rw-r--r--arch/mips/gt64120/ev64120/int-handler.S113
-rw-r--r--arch/mips/gt64120/ev64120/irq.c145
-rw-r--r--arch/mips/gt64120/ev64120/promcon.c53
-rw-r--r--arch/mips/gt64120/ev64120/reset.c45
-rw-r--r--arch/mips/gt64120/ev64120/serialGT.c212
-rw-r--r--arch/mips/gt64120/ev64120/setup.c103
-rw-r--r--arch/mips/gt64120/momenco_ocelot/Makefile9
-rw-r--r--arch/mips/gt64120/momenco_ocelot/dbg_io.c126
-rw-r--r--arch/mips/gt64120/momenco_ocelot/int-handler.S131
-rw-r--r--arch/mips/gt64120/momenco_ocelot/irq.c67
-rw-r--r--arch/mips/gt64120/momenco_ocelot/ocelot_pld.h30
-rw-r--r--arch/mips/gt64120/momenco_ocelot/prom.c73
-rw-r--r--arch/mips/gt64120/momenco_ocelot/reset.c47
-rw-r--r--arch/mips/gt64120/momenco_ocelot/setup.c369
-rw-r--r--arch/mips/ite-boards/generic/Makefile15
-rw-r--r--arch/mips/ite-boards/generic/dbg_io.c125
-rw-r--r--arch/mips/ite-boards/generic/int-handler.S63
-rw-r--r--arch/mips/ite-boards/generic/irq.c304
-rw-r--r--arch/mips/ite-boards/generic/it8172_cir.c171
-rw-r--r--arch/mips/ite-boards/generic/it8172_setup.c309
-rw-r--r--arch/mips/ite-boards/generic/lpc.c144
-rw-r--r--arch/mips/ite-boards/generic/pmon_prom.c136
-rw-r--r--arch/mips/ite-boards/generic/puts.c139
-rw-r--r--arch/mips/ite-boards/generic/reset.c60
-rw-r--r--arch/mips/ite-boards/generic/time.c247
-rw-r--r--arch/mips/ite-boards/ivr/Makefile10
-rw-r--r--arch/mips/ite-boards/ivr/README3
-rw-r--r--arch/mips/ite-boards/ivr/init.c84
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/Makefile10
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/README2
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/init.c85
-rw-r--r--arch/mips/jazz/Makefile7
-rw-r--r--arch/mips/jazz/int-handler.S282
-rw-r--r--arch/mips/jazz/io.c135
-rw-r--r--arch/mips/jazz/irq.c100
-rw-r--r--arch/mips/jazz/jazzdma.c565
-rw-r--r--arch/mips/jazz/reset.c69
-rw-r--r--arch/mips/jazz/setup.c101
-rw-r--r--arch/mips/jmr3927/common/Makefile5
-rw-r--r--arch/mips/jmr3927/common/prom.c81
-rw-r--r--arch/mips/jmr3927/common/puts.c168
-rw-r--r--arch/mips/jmr3927/common/rtc_ds1742.c165
-rw-r--r--arch/mips/jmr3927/rbhma3100/Makefile9
-rw-r--r--arch/mips/jmr3927/rbhma3100/init.c77
-rw-r--r--arch/mips/jmr3927/rbhma3100/int-handler.S74
-rw-r--r--arch/mips/jmr3927/rbhma3100/irq.c466
-rw-r--r--arch/mips/jmr3927/rbhma3100/kgdb_io.c155
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c510
-rw-r--r--arch/mips/kernel/Makefile65
-rw-r--r--arch/mips/kernel/binfmt_elfn32.c119
-rw-r--r--arch/mips/kernel/binfmt_elfo32.c139
-rw-r--r--arch/mips/kernel/branch.c199
-rw-r--r--arch/mips/kernel/cpu-bugs64.c321
-rw-r--r--arch/mips/kernel/cpu-probe.c598
-rw-r--r--arch/mips/kernel/entry.S155
-rw-r--r--arch/mips/kernel/gdb-low.S370
-rw-r--r--arch/mips/kernel/gdb-stub.c1091
-rw-r--r--arch/mips/kernel/genex.S302
-rw-r--r--arch/mips/kernel/genrtc.c64
-rw-r--r--arch/mips/kernel/head.S221
-rw-r--r--arch/mips/kernel/i8259.c331
-rw-r--r--arch/mips/kernel/init_task.c42
-rw-r--r--arch/mips/kernel/ioctl32.c58
-rw-r--r--arch/mips/kernel/irix5sys.S1041
-rw-r--r--arch/mips/kernel/irixelf.c1326
-rw-r--r--arch/mips/kernel/irixinv.c77
-rw-r--r--arch/mips/kernel/irixioctl.c261
-rw-r--r--arch/mips/kernel/irixsig.c853
-rw-r--r--arch/mips/kernel/irq-msc01.c189
-rw-r--r--arch/mips/kernel/irq-mv6434x.c161
-rw-r--r--arch/mips/kernel/irq-rm7000.c98
-rw-r--r--arch/mips/kernel/irq-rm9000.c149
-rw-r--r--arch/mips/kernel/irq.c140
-rw-r--r--arch/mips/kernel/irq_cpu.c118
-rw-r--r--arch/mips/kernel/linux32.c1469
-rw-r--r--arch/mips/kernel/mips_ksyms.c67
-rw-r--r--arch/mips/kernel/module-elf32.c250
-rw-r--r--arch/mips/kernel/module-elf64.c274
-rw-r--r--arch/mips/kernel/module.c53
-rw-r--r--arch/mips/kernel/offset.c314
-rw-r--r--arch/mips/kernel/proc.c149
-rw-r--r--arch/mips/kernel/process.c364
-rw-r--r--arch/mips/kernel/ptrace.c338
-rw-r--r--arch/mips/kernel/ptrace32.c285
-rw-r--r--arch/mips/kernel/r2300_fpu.S126
-rw-r--r--arch/mips/kernel/r2300_switch.S174
-rw-r--r--arch/mips/kernel/r4k_fpu.S191
-rw-r--r--arch/mips/kernel/r4k_switch.S221
-rw-r--r--arch/mips/kernel/r6000_fpu.S87
-rw-r--r--arch/mips/kernel/reset.c43
-rw-r--r--arch/mips/kernel/scall32-o32.S641
-rw-r--r--arch/mips/kernel/scall64-64.S451
-rw-r--r--arch/mips/kernel/scall64-n32.S365
-rw-r--r--arch/mips/kernel/scall64-o32.S488
-rw-r--r--arch/mips/kernel/semaphore.c164
-rw-r--r--arch/mips/kernel/setup.c571
-rw-r--r--arch/mips/kernel/signal-common.h137
-rw-r--r--arch/mips/kernel/signal.c517
-rw-r--r--arch/mips/kernel/signal32.c905
-rw-r--r--arch/mips/kernel/signal_n32.c197
-rw-r--r--arch/mips/kernel/smp.c425
-rw-r--r--arch/mips/kernel/syscall.c407
-rw-r--r--arch/mips/kernel/sysirix.c2179
-rw-r--r--arch/mips/kernel/time.c755
-rw-r--r--arch/mips/kernel/traps.c1062
-rw-r--r--arch/mips/kernel/unaligned.c550
-rw-r--r--arch/mips/kernel/vmlinux.lds.S183
-rw-r--r--arch/mips/lasat/Makefile14
-rw-r--r--arch/mips/lasat/at93c.c148
-rw-r--r--arch/mips/lasat/at93c.h18
-rw-r--r--arch/mips/lasat/ds1603.c174
-rw-r--r--arch/mips/lasat/ds1603.h33
-rw-r--r--arch/mips/lasat/image/Makefile53
-rw-r--r--arch/mips/lasat/image/head.S31
-rw-r--r--arch/mips/lasat/image/romscript.normal22
-rw-r--r--arch/mips/lasat/interrupt.c160
-rw-r--r--arch/mips/lasat/lasatIRQ.S69
-rw-r--r--arch/mips/lasat/lasat_board.c277
-rw-r--r--arch/mips/lasat/lasat_models.h63
-rw-r--r--arch/mips/lasat/picvue.c240
-rw-r--r--arch/mips/lasat/picvue.h48
-rw-r--r--arch/mips/lasat/picvue_proc.c186
-rw-r--r--arch/mips/lasat/prom.c143
-rw-r--r--arch/mips/lasat/prom.h6
-rw-r--r--arch/mips/lasat/reset.c67
-rw-r--r--arch/mips/lasat/setup.c192
-rw-r--r--arch/mips/lasat/sysctl.c355
-rw-r--r--arch/mips/lasat/sysctl.h24
-rw-r--r--arch/mips/lib-32/Makefile25
-rw-r--r--arch/mips/lib-32/csum_partial.S240
-rw-r--r--arch/mips/lib-32/dump_tlb.c222
-rw-r--r--arch/mips/lib-32/memset.S145
-rw-r--r--arch/mips/lib-32/r3k_dump_tlb.c176
-rw-r--r--arch/mips/lib-32/watch.S60
-rw-r--r--arch/mips/lib-64/Makefile25
-rw-r--r--arch/mips/lib-64/csum_partial.S242
-rw-r--r--arch/mips/lib-64/dump_tlb.c211
-rw-r--r--arch/mips/lib-64/memset.S142
-rw-r--r--arch/mips/lib-64/watch.S57
-rw-r--r--arch/mips/lib/Makefile10
-rw-r--r--arch/mips/lib/csum_partial_copy.c49
-rw-r--r--arch/mips/lib/dec_and_lock.c55
-rw-r--r--arch/mips/lib/iomap.c78
-rw-r--r--arch/mips/lib/memcpy.S508
-rw-r--r--arch/mips/lib/promlib.c24
-rw-r--r--arch/mips/lib/strlen_user.S39
-rw-r--r--arch/mips/lib/strncpy_user.S58
-rw-r--r--arch/mips/lib/strnlen_user.S45
-rw-r--r--arch/mips/math-emu/Makefile11
-rw-r--r--arch/mips/math-emu/cp1emu.c1322
-rw-r--r--arch/mips/math-emu/dp_add.c183
-rw-r--r--arch/mips/math-emu/dp_cmp.c67
-rw-r--r--arch/mips/math-emu/dp_div.c157
-rw-r--r--arch/mips/math-emu/dp_fint.c80
-rw-r--r--arch/mips/math-emu/dp_flong.c78
-rw-r--r--arch/mips/math-emu/dp_frexp.c53
-rw-r--r--arch/mips/math-emu/dp_fsp.c74
-rw-r--r--arch/mips/math-emu/dp_logb.c54
-rw-r--r--arch/mips/math-emu/dp_modf.c80
-rw-r--r--arch/mips/math-emu/dp_mul.c177
-rw-r--r--arch/mips/math-emu/dp_scalb.c58
-rw-r--r--arch/mips/math-emu/dp_simple.c84
-rw-r--r--arch/mips/math-emu/dp_sqrt.c165
-rw-r--r--arch/mips/math-emu/dp_sub.c191
-rw-r--r--arch/mips/math-emu/dp_tint.c124
-rw-r--r--arch/mips/math-emu/dp_tlong.c127
-rw-r--r--arch/mips/math-emu/dsemul.c172
-rw-r--r--arch/mips/math-emu/dsemul.h23
-rw-r--r--arch/mips/math-emu/ieee754.c138
-rw-r--r--arch/mips/math-emu/ieee754.h489
-rw-r--r--arch/mips/math-emu/ieee754d.c138
-rw-r--r--arch/mips/math-emu/ieee754dp.c243
-rw-r--r--arch/mips/math-emu/ieee754dp.h83
-rw-r--r--arch/mips/math-emu/ieee754int.h165
-rw-r--r--arch/mips/math-emu/ieee754m.c56
-rw-r--r--arch/mips/math-emu/ieee754sp.c243
-rw-r--r--arch/mips/math-emu/ieee754sp.h89
-rw-r--r--arch/mips/math-emu/ieee754xcpt.c49
-rw-r--r--arch/mips/math-emu/kernel_linkage.c125
-rw-r--r--arch/mips/math-emu/sp_add.c177
-rw-r--r--arch/mips/math-emu/sp_cmp.c67
-rw-r--r--arch/mips/math-emu/sp_div.c157
-rw-r--r--arch/mips/math-emu/sp_fdp.c77
-rw-r--r--arch/mips/math-emu/sp_fint.c80
-rw-r--r--arch/mips/math-emu/sp_flong.c79
-rw-r--r--arch/mips/math-emu/sp_frexp.c53
-rw-r--r--arch/mips/math-emu/sp_logb.c54
-rw-r--r--arch/mips/math-emu/sp_modf.c80
-rw-r--r--arch/mips/math-emu/sp_mul.c171
-rw-r--r--arch/mips/math-emu/sp_scalb.c58
-rw-r--r--arch/mips/math-emu/sp_simple.c84
-rw-r--r--arch/mips/math-emu/sp_sqrt.c117
-rw-r--r--arch/mips/math-emu/sp_sub.c184
-rw-r--r--arch/mips/math-emu/sp_tint.c128
-rw-r--r--arch/mips/math-emu/sp_tlong.c123
-rw-r--r--arch/mips/mips-boards/atlas/Makefile20
-rw-r--r--arch/mips/mips-boards/atlas/atlas_gdb.c97
-rw-r--r--arch/mips/mips-boards/atlas/atlas_int.c142
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c95
-rw-r--r--arch/mips/mips-boards/generic/Makefile26
-rw-r--r--arch/mips/mips-boards/generic/cmdline.c59
-rw-r--r--arch/mips/mips-boards/generic/display.c39
-rw-r--r--arch/mips/mips-boards/generic/gdb_hook.c133
-rw-r--r--arch/mips/mips-boards/generic/init.c343
-rw-r--r--arch/mips/mips-boards/generic/memory.c173
-rw-r--r--arch/mips/mips-boards/generic/mipsIRQ.S153
-rw-r--r--arch/mips/mips-boards/generic/pci.c163
-rw-r--r--arch/mips/mips-boards/generic/printf.c79
-rw-r--r--arch/mips/mips-boards/generic/reset.c73
-rw-r--r--arch/mips/mips-boards/generic/time.c167
-rw-r--r--arch/mips/mips-boards/malta/Makefile22
-rw-r--r--arch/mips/mips-boards/malta/malta_int.c187
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c231
-rw-r--r--arch/mips/mips-boards/sead/Makefile26
-rw-r--r--arch/mips/mips-boards/sead/sead_int.c51
-rw-r--r--arch/mips/mips-boards/sead/sead_setup.c84
-rw-r--r--arch/mips/mm/Makefile44
-rw-r--r--arch/mips/mm/c-r3k.c349
-rw-r--r--arch/mips/mm/c-r4k.c1260
-rw-r--r--arch/mips/mm/c-sb1.c558
-rw-r--r--arch/mips/mm/c-tx39.c493
-rw-r--r--arch/mips/mm/cache.c157
-rw-r--r--arch/mips/mm/cerr-sb1.c543
-rw-r--r--arch/mips/mm/cex-gen.S42
-rw-r--r--arch/mips/mm/cex-sb1.S170
-rw-r--r--arch/mips/mm/dma-coherent.c255
-rw-r--r--arch/mips/mm/dma-ip27.c257
-rw-r--r--arch/mips/mm/dma-ip32.c382
-rw-r--r--arch/mips/mm/dma-noncoherent.c400
-rw-r--r--arch/mips/mm/extable.c21
-rw-r--r--arch/mips/mm/fault.c236
-rw-r--r--arch/mips/mm/highmem.c103
-rw-r--r--arch/mips/mm/init.c304
-rw-r--r--arch/mips/mm/ioremap.c202
-rw-r--r--arch/mips/mm/pg-r4k.c489
-rw-r--r--arch/mips/mm/pg-sb1.c287
-rw-r--r--arch/mips/mm/pgtable-32.c97
-rw-r--r--arch/mips/mm/pgtable-64.c58
-rw-r--r--arch/mips/mm/pgtable.c36
-rw-r--r--arch/mips/mm/sc-ip22.c177
-rw-r--r--arch/mips/mm/sc-r5k.c108
-rw-r--r--arch/mips/mm/sc-rm7k.c193
-rw-r--r--arch/mips/mm/tlb-andes.c257
-rw-r--r--arch/mips/mm/tlb-r3k.c289
-rw-r--r--arch/mips/mm/tlb-r4k.c419
-rw-r--r--arch/mips/mm/tlb-r8k.c250
-rw-r--r--arch/mips/mm/tlb-sb1.c376
-rw-r--r--arch/mips/mm/tlbex-fault.S28
-rw-r--r--arch/mips/mm/tlbex.c1815
-rw-r--r--arch/mips/momentum/jaguar_atx/Makefile12
-rw-r--r--arch/mips/momentum/jaguar_atx/dbg_io.c126
-rw-r--r--arch/mips/momentum/jaguar_atx/int-handler.S128
-rw-r--r--arch/mips/momentum/jaguar_atx/irq.c67
-rw-r--r--arch/mips/momentum/jaguar_atx/ja-console.c106
-rw-r--r--arch/mips/momentum/jaguar_atx/jaguar_atx_fpga.h52
-rw-r--r--arch/mips/momentum/jaguar_atx/prom.c266
-rw-r--r--arch/mips/momentum/jaguar_atx/reset.c57
-rw-r--r--arch/mips/momentum/jaguar_atx/setup.c474
-rw-r--r--arch/mips/momentum/ocelot_3/Makefile8
-rw-r--r--arch/mips/momentum/ocelot_3/int-handler.S137
-rw-r--r--arch/mips/momentum/ocelot_3/irq.c81
-rw-r--r--arch/mips/momentum/ocelot_3/ocelot_3_fpga.h57
-rw-r--r--arch/mips/momentum/ocelot_3/prom.c248
-rw-r--r--arch/mips/momentum/ocelot_3/reset.c59
-rw-r--r--arch/mips/momentum/ocelot_3/setup.c398
-rw-r--r--arch/mips/momentum/ocelot_c/Makefile8
-rw-r--r--arch/mips/momentum/ocelot_c/cpci-irq.c153
-rw-r--r--arch/mips/momentum/ocelot_c/dbg_io.c126
-rw-r--r--arch/mips/momentum/ocelot_c/int-handler.S102
-rw-r--r--arch/mips/momentum/ocelot_c/irq.c83
-rw-r--r--arch/mips/momentum/ocelot_c/ocelot_c_fpga.h60
-rw-r--r--arch/mips/momentum/ocelot_c/prom.c243
-rw-r--r--arch/mips/momentum/ocelot_c/reset.c59
-rw-r--r--arch/mips/momentum/ocelot_c/setup.c363
-rw-r--r--arch/mips/momentum/ocelot_c/uart-irq.c147
-rw-r--r--arch/mips/momentum/ocelot_g/Makefile8
-rw-r--r--arch/mips/momentum/ocelot_g/dbg_io.c126
-rw-r--r--arch/mips/momentum/ocelot_g/gt-irq.c214
-rw-r--r--arch/mips/momentum/ocelot_g/int-handler.S131
-rw-r--r--arch/mips/momentum/ocelot_g/irq.c69
-rw-r--r--arch/mips/momentum/ocelot_g/ocelot_pld.h30
-rw-r--r--arch/mips/momentum/ocelot_g/prom.c86
-rw-r--r--arch/mips/momentum/ocelot_g/reset.c47
-rw-r--r--arch/mips/momentum/ocelot_g/setup.c266
-rw-r--r--arch/mips/oprofile/Kconfig23
-rw-r--r--arch/mips/oprofile/Makefile15
-rw-r--r--arch/mips/oprofile/common.c106
-rw-r--r--arch/mips/oprofile/op_impl.h37
-rw-r--r--arch/mips/oprofile/op_model_rm9000.c137
-rw-r--r--arch/mips/pci/Makefile54
-rw-r--r--arch/mips/pci/fixup-atlas.c69
-rw-r--r--arch/mips/pci/fixup-au1000.c123
-rw-r--r--arch/mips/pci/fixup-capcella.c50
-rw-r--r--arch/mips/pci/fixup-cobalt.c112
-rw-r--r--arch/mips/pci/fixup-ddb5074.c21
-rw-r--r--arch/mips/pci/fixup-ddb5477.c78
-rw-r--r--arch/mips/pci/fixup-ev64120.c34
-rw-r--r--arch/mips/pci/fixup-ev96100.c48
-rw-r--r--arch/mips/pci/fixup-ip32.c51
-rw-r--r--arch/mips/pci/fixup-ite8172g.c80
-rw-r--r--arch/mips/pci/fixup-ivr.c75
-rw-r--r--arch/mips/pci/fixup-jaguar.c43
-rw-r--r--arch/mips/pci/fixup-jmr3927.c105
-rw-r--r--arch/mips/pci/fixup-malta.c103
-rw-r--r--arch/mips/pci/fixup-mpc30x.c50
-rw-r--r--arch/mips/pci/fixup-ocelot-c.c41
-rw-r--r--arch/mips/pci/fixup-ocelot-g.c37
-rw-r--r--arch/mips/pci/fixup-ocelot.c75
-rw-r--r--arch/mips/pci/fixup-ocelot3.c41
-rw-r--r--arch/mips/pci/fixup-rbtx4927.c140
-rw-r--r--arch/mips/pci/fixup-sb1250.c24
-rw-r--r--arch/mips/pci/fixup-sni.c89
-rw-r--r--arch/mips/pci/fixup-tb0219.c66
-rw-r--r--arch/mips/pci/fixup-tb0226.c85
-rw-r--r--arch/mips/pci/fixup-vr4133.c204
-rw-r--r--arch/mips/pci/fixup-yosemite.c41
-rw-r--r--arch/mips/pci/ops-au1000.c325
-rw-r--r--arch/mips/pci/ops-bonito64.c196
-rw-r--r--arch/mips/pci/ops-ddb5074.c271
-rw-r--r--arch/mips/pci/ops-ddb5476.c286
-rw-r--r--arch/mips/pci/ops-ddb5477.c278
-rw-r--r--arch/mips/pci/ops-gt64111.c100
-rw-r--r--arch/mips/pci/ops-gt64120.c154
-rw-r--r--arch/mips/pci/ops-gt96100.c169
-rw-r--r--arch/mips/pci/ops-it8172.c215
-rw-r--r--arch/mips/pci/ops-mace.c91
-rw-r--r--arch/mips/pci/ops-marvell.c93
-rw-r--r--arch/mips/pci/ops-msc.c169
-rw-r--r--arch/mips/pci/ops-nile4.c147
-rw-r--r--arch/mips/pci/ops-sni.c89
-rw-r--r--arch/mips/pci/ops-titan-ht.c125
-rw-r--r--arch/mips/pci/ops-titan.c100
-rw-r--r--arch/mips/pci/ops-tx3927.c391
-rw-r--r--arch/mips/pci/ops-tx4927.c209
-rw-r--r--arch/mips/pci/ops-vr41xx.c126
-rw-r--r--arch/mips/pci/pci-ddb5074.c79
-rw-r--r--arch/mips/pci/pci-ddb5476.c93
-rw-r--r--arch/mips/pci/pci-ddb5477.c207
-rw-r--r--arch/mips/pci/pci-ev96100.c63
-rw-r--r--arch/mips/pci/pci-ip27.c489
-rw-r--r--arch/mips/pci/pci-ip32.c145
-rw-r--r--arch/mips/pci/pci-jmr3927.c58
-rw-r--r--arch/mips/pci/pci-lasat.c95
-rw-r--r--arch/mips/pci/pci-ocelot-c.c143
-rw-r--r--arch/mips/pci/pci-ocelot-g.c97
-rw-r--r--arch/mips/pci/pci-ocelot.c107
-rw-r--r--arch/mips/pci/pci-sb1250.c292
-rw-r--r--arch/mips/pci/pci-vr41xx.c291
-rw-r--r--arch/mips/pci/pci-vr41xx.h151
-rw-r--r--arch/mips/pci/pci-yosemite.c60
-rw-r--r--arch/mips/pci/pci.c304
-rw-r--r--arch/mips/pmc-sierra/yosemite/Makefile8
-rw-r--r--arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c171
-rw-r--r--arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.h69
-rw-r--r--arch/mips/pmc-sierra/yosemite/dbg_io.c180
-rw-r--r--arch/mips/pmc-sierra/yosemite/ht-irq.c53
-rw-r--r--arch/mips/pmc-sierra/yosemite/ht.c454
-rw-r--r--arch/mips/pmc-sierra/yosemite/i2c-yosemite.c188
-rw-r--r--arch/mips/pmc-sierra/yosemite/i2c-yosemite.h96
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq-handler.S93
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq.c167
-rw-r--r--arch/mips/pmc-sierra/yosemite/prom.c141
-rw-r--r--arch/mips/pmc-sierra/yosemite/py-console.c114
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c235
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.h32
-rw-r--r--arch/mips/pmc-sierra/yosemite/smp.c172
-rw-r--r--arch/mips/sgi-ip22/Makefile11
-rw-r--r--arch/mips/sgi-ip22/ip22-berr.c114
-rw-r--r--arch/mips/sgi-ip22/ip22-eisa.c308
-rw-r--r--arch/mips/sgi-ip22/ip22-hpc.c63
-rw-r--r--arch/mips/sgi-ip22/ip22-int.c410
-rw-r--r--arch/mips/sgi-ip22/ip22-irq.S118
-rw-r--r--arch/mips/sgi-ip22/ip22-mc.c208
-rw-r--r--arch/mips/sgi-ip22/ip22-nvram.c119
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c247
-rw-r--r--arch/mips/sgi-ip22/ip22-setup.c144
-rw-r--r--arch/mips/sgi-ip22/ip22-time.c214
-rw-r--r--arch/mips/sgi-ip27/Makefile12
-rw-r--r--arch/mips/sgi-ip27/TODO23
-rw-r--r--arch/mips/sgi-ip27/ip27-berr.c94
-rw-r--r--arch/mips/sgi-ip27/ip27-console.c76
-rw-r--r--arch/mips/sgi-ip27/ip27-dbgio.c60
-rw-r--r--arch/mips/sgi-ip27/ip27-hubio.c186
-rw-r--r--arch/mips/sgi-ip27/ip27-init.c252
-rw-r--r--arch/mips/sgi-ip27/ip27-irq-glue.S45
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c457
-rw-r--r--arch/mips/sgi-ip27/ip27-klconfig.c135
-rw-r--r--arch/mips/sgi-ip27/ip27-klnuma.c135
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c586
-rw-r--r--arch/mips/sgi-ip27/ip27-nmi.c249
-rw-r--r--arch/mips/sgi-ip27/ip27-reset.c81
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c225
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c243
-rw-r--r--arch/mips/sgi-ip27/ip27-xtalk.c135
-rw-r--r--arch/mips/sgi-ip32/Makefile9
-rw-r--r--arch/mips/sgi-ip32/crime.c103
-rw-r--r--arch/mips/sgi-ip32/ip32-berr.c36
-rw-r--r--arch/mips/sgi-ip32/ip32-irq-glue.S86
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c590
-rw-r--r--arch/mips/sgi-ip32/ip32-memory.c49
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c202
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c159
-rw-r--r--arch/mips/sibyte/cfe/Makefile3
-rw-r--r--arch/mips/sibyte/cfe/cfe_api.c502
-rw-r--r--arch/mips/sibyte/cfe/cfe_api.h185
-rw-r--r--arch/mips/sibyte/cfe/cfe_api_int.h152
-rw-r--r--arch/mips/sibyte/cfe/cfe_error.h85
-rw-r--r--arch/mips/sibyte/cfe/console.c80
-rw-r--r--arch/mips/sibyte/cfe/setup.c358
-rw-r--r--arch/mips/sibyte/cfe/smp.c92
-rw-r--r--arch/mips/sibyte/sb1250/Makefile8
-rw-r--r--arch/mips/sibyte/sb1250/bcm1250_tbprof.c390
-rw-r--r--arch/mips/sibyte/sb1250/bus_watcher.c259
-rw-r--r--arch/mips/sibyte/sb1250/irq.c431
-rw-r--r--arch/mips/sibyte/sb1250/irq_handler.S147
-rw-r--r--arch/mips/sibyte/sb1250/prom.c98
-rw-r--r--arch/mips/sibyte/sb1250/setup.c206
-rw-r--r--arch/mips/sibyte/sb1250/smp.c98
-rw-r--r--arch/mips/sibyte/sb1250/time.c136
-rw-r--r--arch/mips/sibyte/swarm/Makefile3
-rw-r--r--arch/mips/sibyte/swarm/dbg_io.c76
-rw-r--r--arch/mips/sibyte/swarm/rtc_m41t81.c224
-rw-r--r--arch/mips/sibyte/swarm/rtc_xicor1241.c203
-rw-r--r--arch/mips/sibyte/swarm/setup.c163
-rw-r--r--arch/mips/sibyte/swarm/time.c244
-rw-r--r--arch/mips/sni/Makefile7
-rw-r--r--arch/mips/sni/int-handler.S106
-rw-r--r--arch/mips/sni/irq.c194
-rw-r--r--arch/mips/sni/pcimt_scache.c37
-rw-r--r--arch/mips/sni/reset.c51
-rw-r--r--arch/mips/sni/setup.c203
-rw-r--r--arch/mips/tx4927/common/Makefile12
-rw-r--r--arch/mips/tx4927/common/tx4927_dbgio.c47
-rw-r--r--arch/mips/tx4927/common/tx4927_irq.c584
-rw-r--r--arch/mips/tx4927/common/tx4927_irq_handler.S103
-rw-r--r--arch/mips/tx4927/common/tx4927_prom.c146
-rw-r--r--arch/mips/tx4927/common/tx4927_setup.c237
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/Makefile5
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c786
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c97
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c1024
-rw-r--r--arch/mips/vr4181/common/Makefile7
-rw-r--r--arch/mips/vr4181/common/int_handler.S206
-rw-r--r--arch/mips/vr4181/common/irq.c239
-rw-r--r--arch/mips/vr4181/common/serial.c51
-rw-r--r--arch/mips/vr4181/common/time.c145
-rw-r--r--arch/mips/vr4181/osprey/Makefile7
-rw-r--r--arch/mips/vr4181/osprey/dbg_io.c136
-rw-r--r--arch/mips/vr4181/osprey/prom.c49
-rw-r--r--arch/mips/vr4181/osprey/reset.c40
-rw-r--r--arch/mips/vr4181/osprey/setup.c68
-rw-r--r--arch/mips/vr41xx/casio-e55/Makefile5
-rw-r--r--arch/mips/vr41xx/casio-e55/setup.c40
-rw-r--r--arch/mips/vr41xx/common/Makefile8
-rw-r--r--arch/mips/vr41xx/common/bcu.c222
-rw-r--r--arch/mips/vr41xx/common/cmu.c257
-rw-r--r--arch/mips/vr41xx/common/giu.c455
-rw-r--r--arch/mips/vr41xx/common/icu.c757
-rw-r--r--arch/mips/vr41xx/common/init.c85
-rw-r--r--arch/mips/vr41xx/common/int-handler.S114
-rw-r--r--arch/mips/vr41xx/common/pmu.c81
-rw-r--r--arch/mips/vr41xx/common/vrc4173.c581
-rw-r--r--arch/mips/vr41xx/ibm-workpad/Makefile5
-rw-r--r--arch/mips/vr41xx/ibm-workpad/setup.c40
-rw-r--r--arch/mips/vr41xx/nec-cmbvr4133/Makefile8
-rw-r--r--arch/mips/vr41xx/nec-cmbvr4133/init.c78
-rw-r--r--arch/mips/vr41xx/nec-cmbvr4133/irq.c114
-rw-r--r--arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c250
-rw-r--r--arch/mips/vr41xx/nec-cmbvr4133/setup.c96
-rw-r--r--arch/mips/vr41xx/tanbac-tb0226/Makefile5
-rw-r--r--arch/mips/vr41xx/tanbac-tb0226/setup.c24
-rw-r--r--arch/mips/vr41xx/tanbac-tb0229/Makefile5
-rw-r--r--arch/mips/vr41xx/tanbac-tb0229/setup.c27
-rw-r--r--arch/mips/vr41xx/victor-mpc30x/Makefile5
-rw-r--r--arch/mips/vr41xx/victor-mpc30x/setup.c24
-rw-r--r--arch/mips/vr41xx/zao-capcella/Makefile5
-rw-r--r--arch/mips/vr41xx/zao-capcella/setup.c24
658 files changed, 138221 insertions, 0 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
new file mode 100644
index 000000000000..5e666aad8815
--- /dev/null
+++ b/arch/mips/Kconfig
@@ -0,0 +1,1658 @@
1config MIPS
2 bool
3 default y
4 # Horrible source of confusion. Die, die, die ...
5 select EMBEDDED
6
7config MIPS64
8 bool "64-bit kernel"
9 help
10 Select this option if you want to build a 64-bit kernel. You should
11 only select this option if you have hardware that actually has a
12 64-bit processor and if your application will actually benefit from
13 64-bit processing, otherwise say N. You must say Y for kernels for
14 SGI IP27 (Origin 200 and 2000) and SGI IP32 (O2). If in doubt say N.
15
16config 64BIT
17 def_bool MIPS64
18
19config MIPS32
20 bool
21 depends on MIPS64 = 'n'
22 default y
23
24mainmenu "Linux/MIPS Kernel Configuration"
25
26source "init/Kconfig"
27
28menu "Machine selection"
29
30config MACH_JAZZ
31 bool "Support for the Jazz family of machines"
32 select ARC
33 select ARC32
34 select GENERIC_ISA_DMA
35 select I8259
36 select ISA
37 help
38 This a family of machines based on the MIPS R4030 chipset which was
39 used by several vendors to build RISC/os and Windows NT workstations.
40 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and
41 Olivetti M700-10 workstations.
42
43config ACER_PICA_61
44 bool "Support for Acer PICA 1 chipset (EXPERIMENTAL)"
45 depends on MACH_JAZZ && EXPERIMENTAL
46 select DMA_NONCOHERENT
47 help
48 This is a machine with a R4400 133/150 MHz CPU. To compile a Linux
49 kernel that runs on these, say Y here. For details about Linux on
50 the MIPS architecture, check out the Linux/MIPS FAQ on the WWW at
51 <http://www.linux-mips.org/>.
52
53config MIPS_MAGNUM_4000
54 bool "Support for MIPS Magnum 4000"
55 depends on MACH_JAZZ
56 select DMA_NONCOHERENT
57 help
58 This is a machine with a R4000 100 MHz CPU. To compile a Linux
59 kernel that runs on these, say Y here. For details about Linux on
60 the MIPS architecture, check out the Linux/MIPS FAQ on the WWW at
61 <http://www.linux-mips.org/>.
62
63config OLIVETTI_M700
64 bool "Support for Olivetti M700-10"
65 depends on MACH_JAZZ
66 select DMA_NONCOHERENT
67 help
68 This is a machine with a R4000 100 MHz CPU. To compile a Linux
69 kernel that runs on these, say Y here. For details about Linux on
70 the MIPS architecture, check out the Linux/MIPS FAQ on the WWW at
71 <http://www.linux-mips.org/>.
72
73config MACH_VR41XX
74 bool "Support for NEC VR41XX-based machines"
75
76config NEC_CMBVR4133
77 bool "Support for NEC CMB-VR4133"
78 depends on MACH_VR41XX
79 select CPU_VR41XX
80 select DMA_NONCOHERENT
81 select IRQ_CPU
82 select HW_HAS_PCI
83 select PCI_VR41XX
84
85config ROCKHOPPER
86 bool "Support for Rockhopper baseboard"
87 depends on NEC_CMBVR4133
88 select I8259
89 select HAVE_STD_PC_SERIAL_PORT
90
91config CASIO_E55
92 bool "Support for CASIO CASSIOPEIA E-10/15/55/65"
93 depends on MACH_VR41XX
94 select DMA_NONCOHERENT
95 select IRQ_CPU
96 select ISA
97
98config IBM_WORKPAD
99 bool "Support for IBM WorkPad z50"
100 depends on MACH_VR41XX
101 select DMA_NONCOHERENT
102 select IRQ_CPU
103 select ISA
104
105config TANBAC_TB0226
106 bool "Support for TANBAC TB0226 (Mbase)"
107 depends on MACH_VR41XX
108 select DMA_NONCOHERENT
109 select HW_HAS_PCI
110 select IRQ_CPU
111 help
112 The TANBAC TB0226 (Mbase) is a MIPS-based platform manufactured by TANBAC.
113 Please refer to <http://www.tanbac.co.jp/> about Mbase.
114
115config TANBAC_TB0229
116 bool "Support for TANBAC TB0229 (VR4131DIMM)"
117 depends on MACH_VR41XX
118 select DMA_NONCOHERENT
119 select HW_HAS_PCI
120 select IRQ_CPU
121 help
122 The TANBAC TB0229 (VR4131DIMM) is a MIPS-based platform manufactured by TANBAC.
123 Please refer to <http://www.tanbac.co.jp/> about VR4131DIMM.
124
125config VICTOR_MPC30X
126 bool "Support for Victor MP-C303/304"
127 select DMA_NONCOHERENT
128 select HW_HAS_PCI
129 select IRQ_CPU
130 depends on MACH_VR41XX
131
132config ZAO_CAPCELLA
133 bool "Support for ZAO Networks Capcella"
134 depends on MACH_VR41XX
135 select DMA_NONCOHERENT
136 select HW_HAS_PCI
137 select IRQ_CPU
138
139config PCI_VR41XX
140 bool "Add PCI control unit support of NEC VR4100 series"
141 depends on MACH_VR41XX && PCI
142
143config VRC4171
144 tristate "Add NEC VRC4171 companion chip support"
145 depends on MACH_VR41XX && ISA
146 ---help---
147 The NEC VRC4171/4171A is a companion chip for NEC VR4111/VR4121.
148
149config VRC4173
150 tristate "Add NEC VRC4173 companion chip support"
151 depends on MACH_VR41XX && PCI_VR41XX
152 ---help---
153 The NEC VRC4173 is a companion chip for NEC VR4122/VR4131.
154
155config TOSHIBA_JMR3927
156 bool "Support for Toshiba JMR-TX3927 board"
157 depends on MIPS32
158 select DMA_NONCOHERENT
159 select HW_HAS_PCI
160 select SWAP_IO_SPACE
161
162config MIPS_COBALT
163 bool "Support for Cobalt Server (EXPERIMENTAL)"
164 depends on EXPERIMENTAL
165 select DMA_NONCOHERENT
166 select HW_HAS_PCI
167 select I8259
168 select IRQ_CPU
169
170config MACH_DECSTATION
171 bool "Support for DECstations"
172 select BOOT_ELF32
173 select DMA_NONCOHERENT
174 select IRQ_CPU
175 depends on MIPS32 || EXPERIMENTAL
176 ---help---
177 This enables support for DEC's MIPS based workstations. For details
178 see the Linux/MIPS FAQ on <http://www.linux-mips.org/> and the
179 DECstation porting pages on <http://decstation.unix-ag.org/>.
180
181 If you have one of the following DECstation Models you definitely
182 want to choose R4xx0 for the CPU Type:
183
184 DECstation 5000/50
185 DECstation 5000/150
186 DECstation 5000/260
187 DECsystem 5900/260
188
189 otherwise choose R3000.
190
191config MIPS_EV64120
192 bool "Support for Galileo EV64120 Evaluation board (EXPERIMENTAL)"
193 depends on EXPERIMENTAL
194 select DMA_NONCOHERENT
195 select HW_HAS_PCI
196 select MIPS_GT64120
197 help
198 This is an evaluation board based on the Galileo GT-64120
199 single-chip system controller that contains a MIPS R5000 compatible
200 core running at 75/100MHz. Their website is located at
201 <http://www.marvell.com/>. Say Y here if you wish to build a
202 kernel for this platform.
203
204config EVB_PCI1
205 bool "Enable Second PCI (PCI1)"
206 depends on MIPS_EV64120
207
208config MIPS_EV96100
209 bool "Support for Galileo EV96100 Evaluation board (EXPERIMENTAL)"
210 depends on EXPERIMENTAL
211 select DMA_NONCOHERENT
212 select HW_HAS_PCI
213 select IRQ_CPU
214 select MIPS_GT96100
215 select RM7000_CPU_SCACHE
216 select SWAP_IO_SPACE
217 help
218 This is an evaluation board based on the Galileo GT-96100 LAN/WAN
219 communications controllers containing a MIPS R5000 compatible core
220 running at 83MHz. Their website is <http://www.marvell.com/>. Say Y
221 here if you wish to build a kernel for this platform.
222
223config MIPS_IVR
224 bool "Support for Globespan IVR board"
225 select DMA_NONCOHERENT
226 select HW_HAS_PCI
227 help
228 This is an evaluation board built by Globespan to showcase thir
229 iVR (Internet Video Recorder) design. It utilizes a QED RM5231
230 R5000 MIPS core. More information can be found out their website
231 located at <http://www.globespan.net/>. Say Y here if you wish to
232 build a kernel for this platform.
233
234config LASAT
235 bool "Support for LASAT Networks platforms"
236 select DMA_NONCOHERENT
237 select HW_HAS_PCI
238 select MIPS_GT64120
239 select R5000_CPU_SCACHE
240
241config PICVUE
242 tristate "PICVUE LCD display driver"
243 depends on LASAT
244
245config PICVUE_PROC
246 tristate "PICVUE LCD display driver /proc interface"
247 depends on PICVUE
248
249config DS1603
250 bool "DS1603 RTC driver"
251 depends on LASAT
252
253config LASAT_SYSCTL
254 bool "LASAT sysctl interface"
255 depends on LASAT
256
257config MIPS_ITE8172
258 bool "Support for ITE 8172G board"
259 select DMA_NONCOHERENT
260 select HW_HAS_PCI
261 help
262 Ths is an evaluation board made by ITE <http://www.ite.com.tw/>
263 with ATX form factor that utilizes a MIPS R5000 to work with its
264 ITE8172G companion internet appliance chip. The MIPS core can be
265 either a NEC Vr5432 or QED RM5231. Say Y here if you wish to build
266 a kernel for this platform.
267
268config IT8172_REVC
269 bool "Support for older IT8172 (Rev C)"
270 depends on MIPS_ITE8172
271 help
272 Say Y here to support the older, Revision C version of the Integrated
273 Technology Express, Inc. ITE8172 SBC. Vendor page at
274 <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the
275 board at <http://www.mvista.com/partners/semiconductor/ite.html>.
276
277config MIPS_ATLAS
278 bool "Support for MIPS Atlas board"
279 select BOOT_ELF32
280 select DMA_NONCOHERENT
281 select HW_HAS_PCI
282 select MIPS_GT64120
283 select SWAP_IO_SPACE
284 help
285 This enables support for the QED R5231-based MIPS Atlas evaluation
286 board.
287
288config MIPS_MALTA
289 bool "Support for MIPS Malta board"
290 select BOOT_ELF32
291 select HAVE_STD_PC_SERIAL_PORT
292 select DMA_NONCOHERENT
293 select GENERIC_ISA_DMA
294 select HW_HAS_PCI
295 select I8259
296 select MIPS_GT64120
297 select SWAP_IO_SPACE
298 help
299 This enables support for the VR5000-based MIPS Malta evaluation
300 board.
301
302config MIPS_SEAD
303 bool "Support for MIPS SEAD board (EXPERIMENTAL)"
304 depends on EXPERIMENTAL
305 select IRQ_CPU
306 select DMA_NONCOHERENT
307
308config MOMENCO_OCELOT
309 bool "Support for Momentum Ocelot board"
310 select DMA_NONCOHERENT
311 select HW_HAS_PCI
312 select IRQ_CPU
313 select IRQ_CPU_RM7K
314 select MIPS_GT64120
315 select RM7000_CPU_SCACHE
316 select SWAP_IO_SPACE
317 help
318 The Ocelot is a MIPS-based Single Board Computer (SBC) made by
319 Momentum Computer <http://www.momenco.com/>.
320
321config MOMENCO_OCELOT_G
322 bool "Support for Momentum Ocelot-G board"
323 select DMA_NONCOHERENT
324 select HW_HAS_PCI
325 select IRQ_CPU
326 select IRQ_CPU_RM7K
327 select PCI_MARVELL
328 select RM7000_CPU_SCACHE
329 select SWAP_IO_SPACE
330 help
331 The Ocelot is a MIPS-based Single Board Computer (SBC) made by
332 Momentum Computer <http://www.momenco.com/>.
333
334config MOMENCO_OCELOT_C
335 bool "Support for Momentum Ocelot-C board"
336 select DMA_NONCOHERENT
337 select HW_HAS_PCI
338 select IRQ_CPU
339 select IRQ_MV64340
340 select PCI_MARVELL
341 select RM7000_CPU_SCACHE
342 select SWAP_IO_SPACE
343 help
344 The Ocelot is a MIPS-based Single Board Computer (SBC) made by
345 Momentum Computer <http://www.momenco.com/>.
346
347config MOMENCO_OCELOT_3
348 bool "Support for Momentum Ocelot-3 board"
349 select BOOT_ELF32
350 select DMA_NONCOHERENT
351 select HW_HAS_PCI
352 select IRQ_CPU
353 select IRQ_CPU_RM7K
354 select IRQ_MV64340
355 select PCI_MARVELL
356 select RM7000_CPU_SCACHE
357 select SWAP_IO_SPACE
358 help
359 The Ocelot-3 is based off Discovery III System Controller and
360 PMC-Sierra Rm79000 core.
361
362config MOMENCO_JAGUAR_ATX
363 bool "Support for Momentum Jaguar board"
364 select BOOT_ELF32
365 select DMA_NONCOHERENT
366 select HW_HAS_PCI
367 select IRQ_CPU
368 select IRQ_CPU_RM7K
369 select IRQ_MV64340
370 select LIMITED_DMA
371 select PCI_MARVELL
372 select RM7000_CPU_SCACHE
373 select SWAP_IO_SPACE
374 help
375 The Jaguar ATX is a MIPS-based Single Board Computer (SBC) made by
376 Momentum Computer <http://www.momenco.com/>.
377
378config JAGUAR_DMALOW
379 bool "Low DMA Mode"
380 depends on MOMENCO_JAGUAR_ATX
381 help
382 Select to Y if jump JP5 is set on your board, N otherwise. Normally
383 the jumper is set, so if you feel unsafe, just say Y.
384
385config PMC_YOSEMITE
386 bool "Support for PMC-Sierra Yosemite eval board"
387 select DMA_COHERENT
388 select HW_HAS_PCI
389 select IRQ_CPU
390 select IRQ_CPU_RM7K
391 select IRQ_CPU_RM9K
392 select SWAP_IO_SPACE
393 help
394 Yosemite is an evaluation board for the RM9000x2 processor
395 manufactured by PMC-Sierra
396
397config HYPERTRANSPORT
398 bool "Hypertransport Support for PMC-Sierra Yosemite"
399 depends on PMC_YOSEMITE
400
401config DDB5074
402 bool "Support for NEC DDB Vrc-5074 (EXPERIMENTAL)"
403 depends on EXPERIMENTAL
404 select DMA_NONCOHERENT
405 select HAVE_STD_PC_SERIAL_PORT
406 select HW_HAS_PCI
407 select IRQ_CPU
408 select I8259
409 select ISA
410 help
411 This enables support for the VR5000-based NEC DDB Vrc-5074
412 evaluation board.
413
414config DDB5476
415 bool "Support for NEC DDB Vrc-5476"
416 select DMA_NONCOHERENT
417 select HAVE_STD_PC_SERIAL_PORT
418 select HW_HAS_PCI
419 select IRQ_CPU
420 select I8259
421 select ISA
422 help
423 This enables support for the R5432-based NEC DDB Vrc-5476
424 evaluation board.
425
426 Features : kernel debugging, serial terminal, NFS root fs, on-board
427 ether port USB, AC97, PCI, PCI VGA card & framebuffer console,
428 IDE controller, PS2 keyboard, PS2 mouse, etc.
429
430config DDB5477
431 bool "Support for NEC DDB Vrc-5477"
432 select DMA_NONCOHERENT
433 select HW_HAS_PCI
434 select I8259
435 select IRQ_CPU
436 help
437 This enables support for the R5432-based NEC DDB Vrc-5477,
438 or Rockhopper/SolutionGear boards with R5432/R5500 CPUs.
439
440 Features : kernel debugging, serial terminal, NFS root fs, on-board
441 ether port USB, AC97, PCI, etc.
442
443config DDB5477_BUS_FREQUENCY
444 int "bus frequency (in kHZ, 0 for auto-detect)"
445 depends on DDB5477
446 default 0
447
448config NEC_OSPREY
449 bool "Support for NEC Osprey board"
450 select DMA_NONCOHERENT
451 select IRQ_CPU
452
453config SGI_IP22
454 bool "Support for SGI IP22 (Indy/Indigo2)"
455 select ARC
456 select ARC32
457 select BOOT_ELF32
458 select DMA_NONCOHERENT
459 select IP22_CPU_SCACHE
460 select IRQ_CPU
461 select SWAP_IO_SPACE
462 help
463 This are the SGI Indy, Challenge S and Indigo2, as well as certain
464 OEM variants like the Tandem CMN B006S. To compile a Linux kernel
465 that runs on these, say Y here.
466
467config SGI_IP27
468 bool "Support for SGI IP27 (Origin200/2000)"
469 depends on MIPS64
470 select ARC
471 select ARC64
472 select DMA_IP27
473 select HW_HAS_PCI
474 select PCI_DOMAINS
475 help
476 This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics
477 workstations. To compile a Linux kernel that runs on these, say Y
478 here.
479
480#config SGI_SN0_XXL
481# bool "IP27 XXL"
482# depends on SGI_IP27
483# This options adds support for userspace processes upto 16TB size.
484# Normally the limit is just .5TB.
485
486config SGI_SN0_N_MODE
487 bool "IP27 N-Mode"
488 depends on SGI_IP27
489 help
490 The nodes of Origin 200, Origin 2000 and Onyx 2 systems can be
491 configured in either N-Modes which allows for more nodes or M-Mode
492 which allows for more memory. Your system is most probably
493 running in M-Mode, so you should say N here.
494
495config DISCONTIGMEM
496 bool
497 default y if SGI_IP27
498 help
499 Say Y to upport efficient handling of discontiguous physical memory,
500 for architectures which are either NUMA (Non-Uniform Memory Access)
501 or have huge holes in the physical address space for other reasons.
502 See <file:Documentation/vm/numa> for more.
503
504config NUMA
505 bool "NUMA Support"
506 depends on SGI_IP27
507 help
508 Say Y to compile the kernel to support NUMA (Non-Uniform Memory
509 Access). This option is for configuring high-end multiprocessor
510 server machines. If in doubt, say N.
511
512config MAPPED_KERNEL
513 bool "Mapped kernel support"
514 depends on SGI_IP27
515 help
516 Change the way a Linux kernel is loaded into memory on a MIPS64
517 machine. This is required in order to support text replication and
518 NUMA. If you need to understand it, read the source code.
519
520config REPLICATE_KTEXT
521 bool "Kernel text replication support"
522 depends on SGI_IP27
523 help
524 Say Y here to enable replicating the kernel text across multiple
525 nodes in a NUMA cluster. This trades memory for speed.
526
527config REPLICATE_EXHANDLERS
528 bool "Exception handler replication support"
529 depends on SGI_IP27
530 help
531 Say Y here to enable replicating the kernel exception handlers
532 across multiple nodes in a NUMA cluster. This trades memory for
533 speed.
534
535config SGI_IP32
536 bool "Support for SGI IP32 (O2) (EXPERIMENTAL)"
537 depends on MIPS64 && EXPERIMENTAL
538 select ARC
539 select ARC32
540 select BOOT_ELF32
541 select OWN_DMA
542 select DMA_IP32
543 select DMA_NONCOHERENT
544 select HW_HAS_PCI
545 select R5000_CPU_SCACHE
546 select RM7000_CPU_SCACHE
547 help
548 If you want this kernel to run on SGI O2 workstation, say Y here.
549
550config SOC_AU1X00
551 depends on MIPS32
552 bool "Support for AMD/Alchemy Au1X00 SOCs"
553
554choice
555 prompt "Au1X00 SOC Type"
556 depends on SOC_AU1X00
557 help
558 Say Y here to enable support for one of three AMD/Alchemy
559 SOCs. For additional documentation see www.amd.com.
560
561config SOC_AU1000
562 bool "SOC_AU1000"
563config SOC_AU1100
564 bool "SOC_AU1100"
565config SOC_AU1500
566 bool "SOC_AU1500"
567config SOC_AU1550
568 bool "SOC_AU1550"
569
570endchoice
571
572choice
573 prompt "AMD/Alchemy Au1x00 board support"
574 depends on SOC_AU1X00
575 help
576 These are evaluation boards built by AMD/Alchemy to
577 showcase their Au1X00 Internet Edge Processors. The SOC design
578 is based on the MIPS32 architecture running at 266/400/500MHz
579 with many integrated peripherals. Further information can be
580 found at their website, <http://www.amd.com/>. Say Y here if you
581 wish to build a kernel for this platform.
582
583config MIPS_PB1000
584 bool "PB1000 board"
585 depends on SOC_AU1000
586 select DMA_NONCOHERENT
587 select HW_HAS_PCI
588 select SWAP_IO_SPACE
589
590config MIPS_PB1100
591 bool "PB1100 board"
592 depends on SOC_AU1100
593 select DMA_NONCOHERENT
594 select HW_HAS_PCI
595 select SWAP_IO_SPACE
596
597config MIPS_PB1500
598 bool "PB1500 board"
599 depends on SOC_AU1500
600 select DMA_COHERENT
601 select HW_HAS_PCI
602
603config MIPS_PB1550
604 bool "PB1550 board"
605 depends on SOC_AU1550
606 select DMA_COHERENT
607 select HW_HAS_PCI
608 select MIPS_DISABLE_OBSOLETE_IDE
609
610config MIPS_DB1000
611 bool "DB1000 board"
612 depends on SOC_AU1000
613 select DMA_NONCOHERENT
614 select HW_HAS_PCI
615
616config MIPS_DB1100
617 bool "DB1100 board"
618 depends on SOC_AU1100
619 select DMA_NONCOHERENT
620
621config MIPS_DB1500
622 bool "DB1500 board"
623 depends on SOC_AU1500
624 select DMA_COHERENT
625 select HW_HAS_PCI
626 select MIPS_DISABLE_OBSOLETE_IDE
627
628config MIPS_DB1550
629 bool "DB1550 board"
630 depends on SOC_AU1550
631 select HW_HAS_PCI
632 select DMA_COHERENT
633 select MIPS_DISABLE_OBSOLETE_IDE
634
635config MIPS_BOSPORUS
636 bool "Bosporus board"
637 depends on SOC_AU1500
638 select DMA_NONCOHERENT
639
640config MIPS_MIRAGE
641 bool "Mirage board"
642 depends on SOC_AU1500
643 select DMA_NONCOHERENT
644
645config MIPS_XXS1500
646 bool "MyCable XXS1500 board"
647 depends on SOC_AU1500
648 select DMA_NONCOHERENT
649
650config MIPS_MTX1
651 bool "4G Systems MTX-1 board"
652 depends on SOC_AU1500
653 select HW_HAS_PCI
654 select DMA_NONCOHERENT
655
656endchoice
657
658config SIBYTE_SB1xxx_SOC
659 bool "Support for Broadcom BCM1xxx SOCs (EXPERIMENTAL)"
660 depends on EXPERIMENTAL
661 select BOOT_ELF32
662 select DMA_COHERENT
663 select SWAP_IO_SPACE
664
665choice
666 prompt "BCM1xxx SOC-based board"
667 depends on SIBYTE_SB1xxx_SOC
668 default SIBYTE_SWARM
669 help
670 Enable support for boards based on the SiByte line of SOCs
671 from Broadcom. There are configurations for the known
672 evaluation boards, or you can choose "Other" and add your
673 own board support code.
674
675config SIBYTE_SWARM
676 bool "BCM91250A-SWARM"
677 select SIBYTE_SB1250
678
679config SIBYTE_SENTOSA
680 bool "BCM91250E-Sentosa"
681 select SIBYTE_SB1250
682
683config SIBYTE_RHONE
684 bool "BCM91125E-Rhone"
685 select SIBYTE_BCM1125H
686
687config SIBYTE_CARMEL
688 bool "BCM91120x-Carmel"
689 select SIBYTE_BCM1120
690
691config SIBYTE_PTSWARM
692 bool "BCM91250PT-PTSWARM"
693 select SIBYTE_SB1250
694
695config SIBYTE_LITTLESUR
696 bool "BCM91250C2-LittleSur"
697 select SIBYTE_SB1250
698
699config SIBYTE_CRHINE
700 bool "BCM91120C-CRhine"
701 select SIBYTE_BCM1120
702
703config SIBYTE_CRHONE
704 bool "BCM91125C-CRhone"
705 select SIBYTE_BCM1125
706
707config SIBYTE_UNKNOWN
708 bool "Other"
709
710endchoice
711
712config SIBYTE_BOARD
713 bool
714 depends on SIBYTE_SB1xxx_SOC && !SIBYTE_UNKNOWN
715 default y
716
717choice
718 prompt "BCM1xxx SOC Type"
719 depends on SIBYTE_UNKNOWN
720 default SIBYTE_UNK_BCM1250
721 help
722 Since you haven't chosen a known evaluation board from
723 Broadcom, you must explicitly pick the SOC this kernel is
724 targetted for.
725
726config SIBYTE_UNK_BCM1250
727 bool "BCM1250"
728 select SIBYTE_SB1250
729
730config SIBYTE_UNK_BCM1120
731 bool "BCM1120"
732 select SIBYTE_BCM1120
733
734config SIBYTE_UNK_BCM1125
735 bool "BCM1125"
736 select SIBYTE_BCM1125
737
738config SIBYTE_UNK_BCM1125H
739 bool "BCM1125H"
740 select SIBYTE_BCM1125H
741
742endchoice
743
744config SIBYTE_SB1250
745 bool
746 select HW_HAS_PCI
747
748config SIBYTE_BCM1120
749 bool
750 select SIBYTE_BCM112X
751
752config SIBYTE_BCM1125
753 bool
754 select HW_HAS_PCI
755 select SIBYTE_BCM112X
756
757config SIBYTE_BCM1125H
758 bool
759 select HW_HAS_PCI
760 select SIBYTE_BCM112X
761
762config SIBYTE_BCM112X
763 bool
764
765choice
766 prompt "SiByte SOC Stepping"
767 depends on SIBYTE_SB1xxx_SOC
768
769config CPU_SB1_PASS_1
770 bool "1250 Pass1"
771 depends on SIBYTE_SB1250
772 select CPU_HAS_PREFETCH
773
774config CPU_SB1_PASS_2_1250
775 bool "1250 An"
776 depends on SIBYTE_SB1250
777 select CPU_SB1_PASS_2
778 help
779 Also called BCM1250 Pass 2
780
781config CPU_SB1_PASS_2_2
782 bool "1250 Bn"
783 depends on SIBYTE_SB1250
784 select CPU_HAS_PREFETCH
785 help
786 Also called BCM1250 Pass 2.2
787
788config CPU_SB1_PASS_4
789 bool "1250 Cn"
790 depends on SIBYTE_SB1250
791 select CPU_HAS_PREFETCH
792 help
793 Also called BCM1250 Pass 3
794
795config CPU_SB1_PASS_2_112x
796 bool "112x Hybrid"
797 depends on SIBYTE_BCM112X
798 select CPU_SB1_PASS_2
799
800config CPU_SB1_PASS_3
801 bool "112x An"
802 depends on SIBYTE_BCM112X
803 select CPU_HAS_PREFETCH
804
805endchoice
806
807config CPU_SB1_PASS_2
808 bool
809
810config SIBYTE_HAS_LDT
811 bool
812 depends on PCI && (SIBYTE_SB1250 || SIBYTE_BCM1125H)
813 default y
814
815config SIMULATION
816 bool "Running under simulation"
817 depends on SIBYTE_SB1xxx_SOC
818 help
819 Build a kernel suitable for running under the GDB simulator.
820 Primarily adjusts the kernel's notion of time.
821
822config SIBYTE_CFE
823 bool "Booting from CFE"
824 depends on SIBYTE_SB1xxx_SOC
825 help
826 Make use of the CFE API for enumerating available memory,
827 controlling secondary CPUs, and possibly console output.
828
829config SIBYTE_CFE_CONSOLE
830 bool "Use firmware console"
831 depends on SIBYTE_CFE
832 help
833 Use the CFE API's console write routines during boot. Other console
834 options (VT console, sb1250 duart console, etc.) should not be
835 configured.
836
837config SIBYTE_STANDALONE
838 bool
839 depends on SIBYTE_SB1xxx_SOC && !SIBYTE_CFE
840 default y
841
842config SIBYTE_STANDALONE_RAM_SIZE
843 int "Memory size (in megabytes)"
844 depends on SIBYTE_STANDALONE
845 default "32"
846
847config SIBYTE_BUS_WATCHER
848 bool "Support for Bus Watcher statistics"
849 depends on SIBYTE_SB1xxx_SOC
850 help
851 Handle and keep statistics on the bus error interrupts (COR_ECC,
852 BAD_ECC, IO_BUS).
853
854config SIBYTE_BW_TRACE
855 bool "Capture bus trace before bus error"
856 depends on SIBYTE_BUS_WATCHER
857 help
858 Run a continuous bus trace, dumping the raw data as soon as
859 a ZBbus error is detected. Cannot work if ZBbus profiling
860 is turned on, and also will interfere with JTAG-based trace
861 buffer activity. Raw buffer data is dumped to console, and
862 must be processed off-line.
863
864config SIBYTE_SB1250_PROF
865 bool "Support for SB1/SOC profiling - SB1/SCD perf counters"
866 depends on SIBYTE_SB1xxx_SOC
867
868config SIBYTE_TBPROF
869 bool "Support for ZBbus profiling"
870 depends on SIBYTE_SB1xxx_SOC
871
872config SNI_RM200_PCI
873 bool "Support for SNI RM200 PCI"
874 select ARC
875 select ARC32
876 select BOOT_ELF32
877 select DMA_NONCOHERENT
878 select GENERIC_ISA_DMA
879 select HAVE_STD_PC_SERIAL_PORT
880 select HW_HAS_PCI
881 select I8259
882 select ISA
883 help
884 The SNI RM200 PCI was a MIPS-based platform manufactured by Siemens
885 Nixdorf Informationssysteme (SNI), parent company of Pyramid
886 Technology and now in turn merged with Fujitsu. Say Y here to
887 support this machine type.
888
889config TOSHIBA_RBTX4927
890 bool "Support for Toshiba TBTX49[23]7 board"
891 depends on MIPS32
892 select DMA_NONCOHERENT
893 select HAS_TXX9_SERIAL
894 select HW_HAS_PCI
895 select I8259
896 select ISA
897 select SWAP_IO_SPACE
898 help
899 This Toshiba board is based on the TX4927 processor. Say Y here to
900 support this machine type
901
902config TOSHIBA_FPCIB0
903 bool "FPCIB0 Backplane Support"
904 depends on TOSHIBA_RBTX4927
905
906config RWSEM_GENERIC_SPINLOCK
907 bool
908 default y
909
910config RWSEM_XCHGADD_ALGORITHM
911 bool
912
913config GENERIC_CALIBRATE_DELAY
914 bool
915 default y
916
917config HAVE_DEC_LOCK
918 bool
919 default y
920
921#
922# Select some configuration options automatically based on user selections.
923#
924config ARC
925 bool
926 depends on SNI_RM200_PCI || SGI_IP32 || SGI_IP27 || SGI_IP22 || MIPS_MAGNUM_4000 || OLIVETTI_M700 || ACER_PICA_61
927 default y
928
929config DMA_COHERENT
930 bool
931
932config DMA_IP27
933 bool
934
935config DMA_NONCOHERENT
936 bool
937
938config EARLY_PRINTK
939 bool
940 depends on MACH_DECSTATION
941 default y
942
943config GENERIC_ISA_DMA
944 bool
945 depends on SNI_RM200_PCI || MIPS_MAGNUM_4000 || OLIVETTI_M700 || ACER_PICA_61 || MIPS_MALTA
946 default y
947
948config I8259
949 bool
950 depends on SNI_RM200_PCI || DDB5477 || DDB5476 || DDB5074 || MACH_JAZZ || MIPS_MALTA || MIPS_COBALT
951 default y
952
953config LIMITED_DMA
954 bool
955 select HIGHMEM
956
957config MIPS_BONITO64
958 bool
959 depends on MIPS_ATLAS || MIPS_MALTA
960 default y
961
962config MIPS_MSC
963 bool
964 depends on MIPS_ATLAS || MIPS_MALTA
965 default y
966
967config MIPS_NILE4
968 bool
969 depends on LASAT
970 default y
971
972config MIPS_DISABLE_OBSOLETE_IDE
973 bool
974
975config CPU_LITTLE_ENDIAN
976 bool "Generate little endian code"
977 default y if ACER_PICA_61 || CASIO_E55 || DDB5074 || DDB5476 || DDB5477 || MACH_DECSTATION || IBM_WORKPAD || LASAT || MIPS_COBALT || MIPS_ITE8172 || MIPS_IVR || SOC_AU1X00 || NEC_OSPREY || OLIVETTI_M700 || SNI_RM200_PCI || VICTOR_MPC30X || ZAO_CAPCELLA
978 default n if MIPS_EV64120 || MIPS_EV96100 || MOMENCO_OCELOT || MOMENCO_OCELOT_G || SGI_IP22 || SGI_IP27 || SGI_IP32 || TOSHIBA_JMR3927
979 help
980 Some MIPS machines can be configured for either little or big endian
981 byte order. These modes require different kernels. Say Y if your
982 machine is little endian, N if it's a big endian machine.
983
984config IRQ_CPU
985 bool
986
987config IRQ_CPU_RM7K
988 bool
989
990config IRQ_MV64340
991 bool
992
993config DDB5XXX_COMMON
994 bool
995 depends on DDB5074 || DDB5476 || DDB5477
996 default y
997
998config MIPS_BOARDS_GEN
999 bool
1000 depends on MIPS_ATLAS || MIPS_MALTA || MIPS_SEAD
1001 default y
1002
1003config MIPS_GT64111
1004 bool
1005 depends on MIPS_COBALT
1006 default y
1007
1008config MIPS_GT64120
1009 bool
1010 depends on MIPS_EV64120 || MIPS_EV96100 || LASAT || MIPS_ATLAS || MIPS_MALTA || MOMENCO_OCELOT
1011 default y
1012
1013config MIPS_TX3927
1014 bool
1015 depends on TOSHIBA_JMR3927
1016 select HAS_TXX9_SERIAL
1017 default y
1018
1019config PCI_MARVELL
1020 bool
1021
1022config ITE_BOARD_GEN
1023 bool
1024 depends on MIPS_IVR || MIPS_ITE8172
1025 default y
1026
1027config SWAP_IO_SPACE
1028 bool
1029
1030#
1031# Unfortunately not all GT64120 systems run the chip at the same clock.
1032# As the user for the clock rate and try to minimize the available options.
1033#
1034choice
1035 prompt "Galileo Chip Clock"
1036 #default SYSCLK_83 if MIPS_EV64120
1037 depends on MIPS_EV64120 || MOMENCO_OCELOT || MOMENCO_OCELOT_G
1038 default SYSCLK_83 if MIPS_EV64120
1039 default SYSCLK_100 if MOMENCO_OCELOT || MOMENCO_OCELOT_G
1040
1041config SYSCLK_75
1042 bool "75" if MIPS_EV64120
1043
1044config SYSCLK_83
1045 bool "83.3" if MIPS_EV64120
1046
1047config SYSCLK_100
1048 bool "100" if MIPS_EV64120 || MOMENCO_OCELOT || MOMENCO_OCELOT_G
1049
1050endchoice
1051
1052config AU1X00_USB_DEVICE
1053 bool
1054 depends on MIPS_PB1500 || MIPS_PB1100 || MIPS_PB1000
1055 default n
1056
1057config MIPS_GT96100
1058 bool
1059 depends on MIPS_EV96100
1060 default y
1061 help
1062 Say Y here to support the Galileo Technology GT96100 communications
1063 controller card. There is a web page at <http://www.galileot.com/>.
1064
1065config IT8172_CIR
1066 bool
1067 depends on MIPS_ITE8172 || MIPS_IVR
1068 default y
1069
1070config IT8712
1071 bool
1072 depends on MIPS_ITE8172
1073 default y
1074
1075config BOOT_ELF32
1076 bool
1077 depends on MACH_DECSTATION || MIPS_ATLAS || MIPS_MALTA || MOMENCO_JAGUAR_ATX || MOMENCO_OCELOT_3 || SIBYTE_SB1xxx_SOC || SGI_IP32 || SGI_IP22 || SNI_RM200_PCI
1078 default y
1079
1080config MIPS_L1_CACHE_SHIFT
1081 int
1082 default "4" if MACH_DECSTATION
1083 default "7" if SGI_IP27
1084 default "5"
1085
1086config ARC32
1087 bool
1088 depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32
1089 default y
1090
1091config FB
1092 bool
1093 depends on MIPS_MAGNUM_4000 || OLIVETTI_M700
1094 default y
1095 ---help---
1096 The frame buffer device provides an abstraction for the graphics
1097 hardware. It represents the frame buffer of some video hardware and
1098 allows application software to access the graphics hardware through
1099 a well-defined interface, so the software doesn't need to know
1100 anything about the low-level (hardware register) stuff.
1101
1102 Frame buffer devices work identically across the different
1103 architectures supported by Linux and make the implementation of
1104 application programs easier and more portable; at this point, an X
1105 server exists which uses the frame buffer device exclusively.
1106 On several non-X86 architectures, the frame buffer device is the
1107 only way to use the graphics hardware.
1108
1109 The device is accessed through special device nodes, usually located
1110 in the /dev directory, i.e. /dev/fb*.
1111
1112 You need an utility program called fbset to make full use of frame
1113 buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
1114 and the Framebuffer-HOWTO at <http://www.tldp.org/docs.html#howto>
1115 for more information.
1116
1117 Say Y here and to the driver for your graphics board below if you
1118 are compiling a kernel for a non-x86 architecture.
1119
1120 If you are compiling for the x86 architecture, you can say Y if you
1121 want to play with it, but it is not essential. Please note that
1122 running graphical applications that directly touch the hardware
1123 (e.g. an accelerated X server) and that are not frame buffer
1124 device-aware may cause unexpected results. If unsure, say N.
1125
1126config HAVE_STD_PC_SERIAL_PORT
1127 bool
1128
1129config VR4181
1130 bool
1131 depends on NEC_OSPREY
1132 default y
1133
1134config ARC_CONSOLE
1135 bool "ARC console support"
1136 depends on SGI_IP22 || SNI_RM200_PCI
1137
1138config ARC_MEMORY
1139 bool
1140 depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP32
1141 default y
1142
1143config ARC_PROMLIB
1144 bool
1145 depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32
1146 default y
1147
1148config ARC64
1149 bool
1150 depends on SGI_IP27
1151 default y
1152
1153config BOOT_ELF64
1154 bool
1155 depends on SGI_IP27
1156 default y
1157
1158#config MAPPED_PCI_IO y
1159# bool
1160# depends on SGI_IP27
1161# default y
1162
1163config QL_ISP_A64
1164 bool
1165 depends on SGI_IP27
1166 default y
1167
1168config TOSHIBA_BOARDS
1169 bool
1170 depends on TOSHIBA_JMR3927 || TOSHIBA_RBTX4927
1171 default y
1172
1173endmenu
1174
1175menu "CPU selection"
1176
1177choice
1178 prompt "CPU type"
1179 default CPU_R4X00
1180
1181config CPU_MIPS32
1182 bool "MIPS32"
1183
1184config CPU_MIPS64
1185 bool "MIPS64"
1186
1187config CPU_R3000
1188 bool "R3000"
1189 depends on MIPS32
1190 help
1191 Please make sure to pick the right CPU type. Linux/MIPS is not
1192 designed to be generic, i.e. Kernels compiled for R3000 CPUs will
1193 *not* work on R4000 machines and vice versa. However, since most
1194 of the supported machines have an R4000 (or similar) CPU, R4x00
1195 might be a safe bet. If the resulting kernel does not work,
1196 try to recompile with R3000.
1197
1198config CPU_TX39XX
1199 bool "R39XX"
1200 depends on MIPS32
1201
1202config CPU_VR41XX
1203 bool "R41xx"
1204 help
1205 The options selects support for the NEC VR41xx series of processors.
1206 Only choose this option if you have one of these processors as a
1207 kernel built with this option will not run on any other type of
1208 processor or vice versa.
1209
1210config CPU_R4300
1211 bool "R4300"
1212 help
1213 MIPS Technologies R4300-series processors.
1214
1215config CPU_R4X00
1216 bool "R4x00"
1217 help
1218 MIPS Technologies R4000-series processors other than 4300, including
1219 the R4000, R4400, R4600, and 4700.
1220
1221config CPU_TX49XX
1222 bool "R49XX"
1223
1224config CPU_R5000
1225 bool "R5000"
1226 help
1227 MIPS Technologies R5000-series processors other than the Nevada.
1228
1229config CPU_R5432
1230 bool "R5432"
1231
1232config CPU_R6000
1233 bool "R6000"
1234 depends on MIPS32 && EXPERIMENTAL
1235 help
1236 MIPS Technologies R6000 and R6000A series processors. Note these
1237 processors are extremly rare and the support for them is incomplete.
1238
1239config CPU_NEVADA
1240 bool "RM52xx"
1241 help
1242 QED / PMC-Sierra RM52xx-series ("Nevada") processors.
1243
1244config CPU_R8000
1245 bool "R8000"
1246 depends on MIPS64 && EXPERIMENTAL
1247 help
1248 MIPS Technologies R8000 processors. Note these processors are
1249 uncommon and the support for them is incomplete.
1250
1251config CPU_R10000
1252 bool "R10000"
1253 help
1254 MIPS Technologies R10000-series processors.
1255
1256config CPU_RM7000
1257 bool "RM7000"
1258
1259config CPU_RM9000
1260 bool "RM9000"
1261
1262config CPU_SB1
1263 bool "SB1"
1264
1265endchoice
1266
1267choice
1268 prompt "Kernel page size"
1269 default PAGE_SIZE_4KB
1270
1271config PAGE_SIZE_4KB
1272 bool "4kB"
1273 help
1274 This option select the standard 4kB Linux page size. On some
1275 R3000-family processors this is the only available page size. Using
1276 4kB page size will minimize memory consumption and is therefore
1277 recommended for low memory systems.
1278
1279config PAGE_SIZE_8KB
1280 bool "8kB"
1281 depends on EXPERIMENTAL && CPU_R8000
1282 help
1283 Using 8kB page size will result in higher performance kernel at
1284 the price of higher memory consumption. This option is available
1285 only on the R8000 processor. Not that at the time of this writing
1286 this option is still high experimental; there are also issues with
1287 compatibility of user applications.
1288
1289config PAGE_SIZE_16KB
1290 bool "16kB"
1291 depends on EXPERIMENTAL && !CPU_R3000 && !CPU_TX39XX
1292 help
1293 Using 16kB page size will result in higher performance kernel at
1294 the price of higher memory consumption. This option is available on
1295 all non-R3000 family processor. Not that at the time of this
1296 writing this option is still high experimental; there are also
1297 issues with compatibility of user applications.
1298
1299config PAGE_SIZE_64KB
1300 bool "64kB"
1301 depends on EXPERIMENTAL && !CPU_R3000 && !CPU_TX39XX
1302 help
1303 Using 64kB page size will result in higher performance kernel at
1304 the price of higher memory consumption. This option is available on
1305 all non-R3000 family processor. Not that at the time of this
1306 writing this option is still high experimental; there are also
1307 issues with compatibility of user applications.
1308
1309endchoice
1310
1311config BOARD_SCACHE
1312 bool
1313
1314config IP22_CPU_SCACHE
1315 bool
1316 select BOARD_SCACHE
1317
1318config R5000_CPU_SCACHE
1319 bool
1320 select BOARD_SCACHE
1321
1322config RM7000_CPU_SCACHE
1323 bool
1324 select BOARD_SCACHE
1325
1326config SIBYTE_DMA_PAGEOPS
1327 bool "Use DMA to clear/copy pages"
1328 depends on CPU_SB1
1329 help
1330 Instead of using the CPU to zero and copy pages, use a Data Mover
1331 channel. These DMA channels are otherwise unused by the standard
1332 SiByte Linux port. Seems to give a small performance benefit.
1333
1334config CPU_HAS_PREFETCH
1335 bool "Enable prefetches" if CPU_SB1 && !CPU_SB1_PASS_2
1336 default y if CPU_MIPS32 || CPU_MIPS64 || CPU_RM7000 || CPU_RM9000 || CPU_R10000
1337
1338config VTAG_ICACHE
1339 bool "Support for Virtual Tagged I-cache" if CPU_MIPS64 || CPU_MIPS32
1340 default y if CPU_SB1
1341
1342config SB1_PASS_1_WORKAROUNDS
1343 bool
1344 depends on CPU_SB1_PASS_1
1345 default y
1346
1347config SB1_PASS_2_WORKAROUNDS
1348 bool
1349 depends on CPU_SB1 && (CPU_SB1_PASS_2_2 || CPU_SB1_PASS_2)
1350 default y
1351
1352config SB1_PASS_2_1_WORKAROUNDS
1353 bool
1354 depends on CPU_SB1 && CPU_SB1_PASS_2
1355 default y
1356
1357config 64BIT_PHYS_ADDR
1358 bool "Support for 64-bit physical address space"
1359 depends on (CPU_R4X00 || CPU_R5000 || CPU_RM7000 || CPU_RM9000 || CPU_R10000 || CPU_SB1 || CPU_MIPS32 || CPU_MIPS64) && MIPS32
1360
1361config CPU_ADVANCED
1362 bool "Override CPU Options"
1363 depends on MIPS32
1364 help
1365 Saying yes here allows you to select support for various features
1366 your CPU may or may not have. Most people should say N here.
1367
1368config CPU_HAS_LLSC
1369 bool "ll/sc Instructions available" if CPU_ADVANCED
1370 default y if !CPU_ADVANCED && !CPU_R3000 && !CPU_VR41XX && !CPU_TX39XX
1371 help
1372 MIPS R4000 series and later provide the Load Linked (ll)
1373 and Store Conditional (sc) instructions. More information is
1374 available at <http://www.go-ecs.com/mips/miptek1.htm>.
1375
1376 Say Y here if your CPU has the ll and sc instructions. Say Y here
1377 for better performance, N if you don't know. You must say Y here
1378 for multiprocessor machines.
1379
1380config CPU_HAS_LLDSCD
1381 bool "lld/scd Instructions available" if CPU_ADVANCED
1382 default y if !CPU_ADVANCED && !CPU_R3000 && !CPU_VR41XX && !CPU_TX39XX && !CPU_MIPS32
1383 help
1384 Say Y here if your CPU has the lld and scd instructions, the 64-bit
1385 equivalents of ll and sc. Say Y here for better performance, N if
1386 you don't know. You must say Y here for multiprocessor machines.
1387
1388config CPU_HAS_WB
1389 bool "Writeback Buffer available" if CPU_ADVANCED
1390 default y if !CPU_ADVANCED && CPU_R3000 && MACH_DECSTATION
1391 help
1392 Say N here for slightly better performance. You must say Y here for
1393 machines which require flushing of write buffers in software. Saying
1394 Y is the safe option; N may result in kernel malfunction and crashes.
1395
1396config CPU_HAS_SYNC
1397 bool
1398 depends on !CPU_R3000
1399 default y
1400
1401#
1402# - Highmem only makes sense for the 32-bit kernel.
1403# - The current highmem code will only work properly on physically indexed
1404# caches such as R3000, SB1, R7000 or those that look like they're virtually
1405# indexed such as R4000/R4400 SC and MC versions or R10000. So for the
1406# moment we protect the user and offer the highmem option only on machines
1407# where it's known to be safe. This will not offer highmem on a few systems
1408# such as MIPS32 and MIPS64 CPUs which may have virtual and physically
1409# indexed CPUs but we're playing safe.
1410# - We should not offer highmem for system of which we already know that they
1411# don't have memory configurations that could gain from highmem support in
1412# the kernel because they don't support configurations with RAM at physical
1413# addresses > 0x20000000.
1414#
1415config HIGHMEM
1416 bool "High Memory Support"
1417 depends on MIPS32 && (CPU_R3000 || CPU_SB1 || CPU_R7000 || CPU_RM9000 || CPU_R10000) && !(MACH_DECSTATION || MOMENCO_JAGUAR_ATX)
1418
1419config SMP
1420 bool "Multi-Processing support"
1421 depends on CPU_RM9000 || (SIBYTE_SB1250 && !SIBYTE_STANDALONE) || SGI_IP27
1422 ---help---
1423 This enables support for systems with more than one CPU. If you have
1424 a system with only one CPU, like most personal computers, say N. If
1425 you have a system with more than one CPU, say Y.
1426
1427 If you say N here, the kernel will run on single and multiprocessor
1428 machines, but will use only one CPU of a multiprocessor machine. If
1429 you say Y here, the kernel will run on many, but not all,
1430 singleprocessor machines. On a singleprocessor machine, the kernel
1431 will run faster if you say N here.
1432
1433 People using multiprocessor machines who say Y here should also say
1434 Y to "Enhanced Real Time Clock Support", below.
1435
1436 See also the <file:Documentation/smp.txt> and the SMP-HOWTO
1437 available at <http://www.tldp.org/docs.html#howto>.
1438
1439 If you don't know what to do here, say N.
1440
1441config NR_CPUS
1442 int "Maximum number of CPUs (2-64)"
1443 range 2 64
1444 depends on SMP
1445 default "64" if SGI_IP27
1446 default "2"
1447 help
1448 This allows you to specify the maximum number of CPUs which this
1449 kernel will support. The maximum supported value is 32 for 32-bit
1450 kernel and 64 for 64-bit kernels; the minimum value which makes
1451 sense is 2.
1452
1453 This is purely to save memory - each supported CPU adds
1454 approximately eight kilobytes to the kernel image.
1455
1456config PREEMPT
1457 bool "Preemptible Kernel"
1458 help
1459 This option reduces the latency of the kernel when reacting to
1460 real-time or interactive events by allowing a low priority process to
1461 be preempted even if it is in kernel mode executing a system call.
1462 This allows applications to run more reliably even when the system is
1463 under load.
1464
1465config RTC_DS1742
1466 bool "DS1742 BRAM/RTC support"
1467 depends on TOSHIBA_JMR3927 || TOSHIBA_RBTX4927
1468
1469config MIPS_INSANE_LARGE
1470 bool "Support for large 64-bit configurations"
1471 depends on CPU_R10000 && MIPS64
1472 help
1473 MIPS R10000 does support a 44 bit / 16TB address space as opposed to
1474 previous 64-bit processors which only supported 40 bit / 1TB. If you
1475 need processes of more than 1TB virtual address space, say Y here.
1476 This will result in additional memory usage, so it is not
1477 recommended for normal users.
1478
1479config RWSEM_GENERIC_SPINLOCK
1480 bool
1481 default y
1482
1483endmenu
1484
1485menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
1486
1487config HW_HAS_PCI
1488 bool
1489
1490config PCI
1491 bool "Support for PCI controller"
1492 depends on HW_HAS_PCI
1493 help
1494 Find out whether you have a PCI motherboard. PCI is the name of a
1495 bus system, i.e. the way the CPU talks to the other stuff inside
1496 your box. Other bus systems are ISA, EISA, or VESA. If you have PCI,
1497 say Y, otherwise N.
1498
1499 The PCI-HOWTO, available from
1500 <http://www.tldp.org/docs.html#howto>, contains valuable
1501 information about which PCI hardware does work under Linux and which
1502 doesn't.
1503
1504config PCI_DOMAINS
1505 bool
1506 depends on PCI
1507
1508source "drivers/pci/Kconfig"
1509
1510#
1511# ISA support is now enabled via select. Too many systems still have the one
1512# or other ISA chip on the board that users don't know about so don't expect
1513# users to choose the right thing ...
1514#
1515config ISA
1516 bool
1517
1518config EISA
1519 bool "EISA support"
1520 depends on SGI_IP22 || SNI_RM200_PCI
1521 select ISA
1522 ---help---
1523 The Extended Industry Standard Architecture (EISA) bus was
1524 developed as an open alternative to the IBM MicroChannel bus.
1525
1526 The EISA bus provided some of the features of the IBM MicroChannel
1527 bus while maintaining backward compatibility with cards made for
1528 the older ISA bus. The EISA bus saw limited use between 1988 and
1529 1995 when it was made obsolete by the PCI bus.
1530
1531 Say Y here if you are building a kernel for an EISA-based machine.
1532
1533 Otherwise, say N.
1534
1535source "drivers/eisa/Kconfig"
1536
1537config TC
1538 bool "TURBOchannel support"
1539 depends on MACH_DECSTATION
1540 help
1541 TurboChannel is a DEC (now Compaq (now HP)) bus for Alpha and MIPS
1542 processors. Documentation on writing device drivers for TurboChannel
1543 is available at:
1544 <http://www.cs.arizona.edu/computer.help/policy/DIGITAL_unix/AA-PS3HD-TET1_html/TITLE.html>.
1545
1546#config ACCESSBUS
1547# bool "Access.Bus support"
1548# depends on TC
1549
1550config MMU
1551 bool
1552 default y
1553
1554config MCA
1555 bool
1556
1557config SBUS
1558 bool
1559
1560source "drivers/pcmcia/Kconfig"
1561
1562source "drivers/pci/hotplug/Kconfig"
1563
1564endmenu
1565
1566menu "Executable file formats"
1567
1568source "fs/Kconfig.binfmt"
1569
1570config TRAD_SIGNALS
1571 bool
1572 default y if MIPS32
1573
1574config BUILD_ELF64
1575 bool "Use 64-bit ELF format for building"
1576 depends on MIPS64
1577 help
1578 A 64-bit kernel is usually built using the 64-bit ELF binary object
1579 format as it's one that allows arbitrary 64-bit constructs. For
1580 kernels that are loaded within the KSEG compatibility segments the
1581 32-bit ELF format can optionally be used resulting in a somewhat
1582 smaller binary, but this option is not explicitly supported by the
1583 toolchain and since binutils 2.14 it does not even work at all.
1584
1585 Say Y to use the 64-bit format or N to use the 32-bit one.
1586
1587 If unsure say Y.
1588
1589config BINFMT_IRIX
1590 bool "Include IRIX binary compatibility"
1591 depends on !CPU_LITTLE_ENDIAN && MIPS32 && BROKEN
1592
1593config MIPS32_COMPAT
1594 bool "Kernel support for Linux/MIPS 32-bit binary compatibility"
1595 depends on MIPS64
1596 help
1597 Select this option if you want Linux/MIPS 32-bit binary
1598 compatibility. Since all software available for Linux/MIPS is
1599 currently 32-bit you should say Y here.
1600
1601config COMPAT
1602 bool
1603 depends on MIPS32_COMPAT
1604 default y
1605
1606config MIPS32_O32
1607 bool "Kernel support for o32 binaries"
1608 depends on MIPS32_COMPAT
1609 help
1610 Select this option if you want to run o32 binaries. These are pure
1611 32-bit binaries as used by the 32-bit Linux/MIPS port. Most of
1612 existing binaries are in this format.
1613
1614 If unsure, say Y.
1615
1616config MIPS32_N32
1617 bool "Kernel support for n32 binaries"
1618 depends on MIPS32_COMPAT
1619 help
1620 Select this option if you want to run n32 binaries. These are
1621 64-bit binaries using 32-bit quantities for addressing and certain
1622 data that would normally be 64-bit. They are used in special
1623 cases.
1624
1625 If unsure, say N.
1626
1627config BINFMT_ELF32
1628 bool
1629 default y if MIPS32_O32 || MIPS32_N32
1630
1631config PM
1632 bool "Power Management support (EXPERIMENTAL)"
1633 depends on EXPERIMENTAL && MACH_AU1X00
1634
1635endmenu
1636
1637source "drivers/Kconfig"
1638
1639source "fs/Kconfig"
1640
1641source "arch/mips/Kconfig.debug"
1642
1643source "security/Kconfig"
1644
1645source "crypto/Kconfig"
1646
1647source "lib/Kconfig"
1648
1649#
1650# Use the generic interrupt handling code in kernel/irq/:
1651#
1652config GENERIC_HARDIRQS
1653 bool
1654 default y
1655
1656config GENERIC_IRQ_PROBE
1657 bool
1658 default y
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
new file mode 100644
index 000000000000..d3c5cc3b9c9d
--- /dev/null
+++ b/arch/mips/Kconfig.debug
@@ -0,0 +1,76 @@
1menu "Kernel hacking"
2
3source "lib/Kconfig.debug"
4
5config CROSSCOMPILE
6 bool "Are you using a crosscompiler"
7 help
8 Say Y here if you are compiling the kernel on a different
9 architecture than the one it is intended to run on.
10
11config CMDLINE
12 string "Default kernel command string"
13 default ""
14 help
15 On some platforms, there is currently no way for the boot loader to
16 pass arguments to the kernel. For these platforms, you can supply
17 some command-line options at build time by entering them here. In
18 other cases you can specify kernel args so that you don't have
19 to set them up in board prom initialization routines.
20
21config DEBUG_STACK_USAGE
22 bool "Enable stack utilization instrumentation"
23 depends on DEBUG_KERNEL
24 help
25 Enables the display of the minimum amount of free stack which each
26 task has ever had available in the sysrq-T and sysrq-P debug output.
27
28 This option will slow down process creation somewhat.
29
30config KGDB
31 bool "Remote GDB kernel debugging"
32 depends on DEBUG_KERNEL
33 select DEBUG_INFO
34 help
35 If you say Y here, it will be possible to remotely debug the MIPS
36 kernel using gdb. This enlarges your kernel image disk size by
37 several megabytes and requires a machine with more than 16 MB,
38 better 32 MB RAM to avoid excessive linking time. This is only
39 useful for kernel hackers. If unsure, say N.
40
41config GDB_CONSOLE
42 bool "Console output to GDB"
43 depends on KGDB
44 help
45 If you are using GDB for remote debugging over a serial port and
46 would like kernel messages to be formatted into GDB $O packets so
47 that GDB prints them as program output, say 'Y'.
48
49config SB1XXX_CORELIS
50 bool "Corelis Debugger"
51 depends on SIBYTE_SB1xxx_SOC
52 select DEBUG_INFO
53 help
54 Select compile flags that produce code that can be processed by the
55 Corelis mksym utility and UDB Emulator.
56
57config RUNTIME_DEBUG
58 bool "Enable run-time debugging"
59 depends on DEBUG_KERNEL
60 help
61 If you say Y here, some debugging macros will do run-time checking.
62 If you say N here, those macros will mostly turn to no-ops. See
63 include/asm-mips/debug.h for debuging macros.
64 If unsure, say N.
65
66config MIPS_UNCACHED
67 bool "Run uncached"
68 depends on DEBUG_KERNEL && !SMP && !SGI_IP27
69 help
70 If you say Y here there kernel will disable all CPU caches. This will
71 reduce the system's performance dramatically but can help finding
72 otherwise hard to track bugs. It can also useful if you're doing
73 hardware debugging with a logic analyzer and need to see all traffic
74 on the bus.
75
76endmenu
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
new file mode 100644
index 000000000000..bc1c44274a58
--- /dev/null
+++ b/arch/mips/Makefile
@@ -0,0 +1,767 @@
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) 1994, 95, 96, 2003 by Ralf Baechle
7# DECStation modifications by Paul M. Antoine, 1996
8# Copyright (C) 2002, 2003, 2004 Maciej W. Rozycki
9#
10# This file is included by the global makefile so that you can add your own
11# architecture-specific flags and dependencies. Remember to do have actions
12# for "archclean" cleaning up for this architecture.
13#
14
15as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \
16 -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \
17 else echo "$(2)"; fi ;)
18
19cflags-y :=
20
21#
22# Select the object file format to substitute into the linker script.
23#
24ifdef CONFIG_CPU_LITTLE_ENDIAN
2532bit-tool-prefix = mipsel-linux-
2664bit-tool-prefix = mips64el-linux-
2732bit-bfd = elf32-tradlittlemips
2864bit-bfd = elf64-tradlittlemips
2932bit-emul = elf32ltsmip
3064bit-emul = elf64ltsmip
31else
3232bit-tool-prefix = mips-linux-
3364bit-tool-prefix = mips64-linux-
3432bit-bfd = elf32-tradbigmips
3564bit-bfd = elf64-tradbigmips
3632bit-emul = elf32btsmip
3764bit-emul = elf64btsmip
38endif
39
40ifdef CONFIG_MIPS32
41gcc-abi = 32
42tool-prefix = $(32bit-tool-prefix)
43UTS_MACHINE := mips
44endif
45ifdef CONFIG_MIPS64
46gcc-abi = 64
47tool-prefix = $(64bit-tool-prefix)
48UTS_MACHINE := mips64
49endif
50
51ifdef CONFIG_CROSSCOMPILE
52CROSS_COMPILE := $(tool-prefix)
53endif
54
55ifdef CONFIG_BUILD_ELF64
56gas-abi = 64
57ld-emul = $(64bit-emul)
58vmlinux-32 = vmlinux.32
59vmlinux-64 = vmlinux
60else
61gas-abi = 32
62ld-emul = $(32bit-emul)
63vmlinux-32 = vmlinux
64vmlinux-64 = vmlinux.64
65
66cflags-$(CONFIG_MIPS64) += $(call cc-option,-mno-explicit-relocs)
67endif
68
69#
70# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel
71# code since it only slows down the whole thing. At some point we might make
72# use of global pointer optimizations but their use of $28 conflicts with
73# the current pointer optimization.
74#
75# The DECStation requires an ECOFF kernel for remote booting, other MIPS
76# machines may also. Since BFD is incredibly buggy with respect to
77# crossformat linking we rely on the elf2ecoff tool for format conversion.
78#
79cflags-y += -I $(TOPDIR)/include/asm/gcc
80cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
81cflags-y += $(call cc-option, -finline-limit=100000)
82LDFLAGS_vmlinux += -G 0 -static -n
83MODFLAGS += -mlong-calls
84
85cflags-$(CONFIG_SB1XXX_CORELIS) += -mno-sched-prolog -fno-omit-frame-pointer
86
87#
88# Use: $(call set_gccflags,<cpu0>,<isa0>,<cpu1>,<isa1>,<isa2>)
89#
90# <cpu0>,<isa0> -- preferred CPU and ISA designations (may require
91# recent tools)
92# <cpu1>,<isa1> -- fallback CPU and ISA designations (have to work
93# with up to the oldest supported tools)
94# <isa2> -- an ISA designation used as an ABI selector for
95# gcc versions that do not support "-mabi=32"
96# (depending on the CPU type, either "mips1" or
97# "mips2")
98#
99set_gccflags = $(shell \
100while :; do \
101 cpu=$(1); isa=-$(2); \
102 for gcc_opt in -march= -mcpu=; do \
103 $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
104 -xc /dev/null > /dev/null 2>&1 && \
105 break 2; \
106 done; \
107 cpu=$(3); isa=-$(4); \
108 for gcc_opt in -march= -mcpu=; do \
109 $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
110 -xc /dev/null > /dev/null 2>&1 && \
111 break 2; \
112 done; \
113 break; \
114done; \
115gcc_abi=-mabi=$(gcc-abi); gcc_cpu=$$cpu; \
116if $(CC) $$gcc_abi -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then \
117 gcc_isa=$$isa; \
118else \
119 gcc_abi=; gcc_isa=-$(5); \
120fi; \
121gas_abi=-Wa,-$(gcc-abi); gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \
122while :; do \
123 for gas_opt in -Wa,-march= -Wa,-mcpu=; do \
124 $(CC) $$gas_abi $$gas_opt$$cpu $$gas_isa -Wa,-Z -c \
125 -o /dev/null -xassembler /dev/null > /dev/null 2>&1 && \
126 break 2; \
127 done; \
128 gas_abi=; gas_opt=; gas_cpu=; gas_isa=; \
129 break; \
130done; \
131if test "$(gcc-abi)" != "$(gas-abi)"; then \
132 gas_abi="-Wa,-$(gas-abi) -Wa,-mgp$(gcc-abi)"; \
133fi; \
134if test "$$gcc_opt" = -march= && test -n "$$gcc_abi"; then \
135 $(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \
136 -xc /dev/null > /dev/null 2>&1 && \
137 gcc_isa=; \
138fi; \
139echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
140
141#
142# CPU-dependent compiler/assembler options for optimization.
143#
144cflags-$(CONFIG_CPU_R3000) += \
145 $(call set_gccflags,r3000,mips1,r3000,mips1,mips1)
146
147cflags-$(CONFIG_CPU_TX39XX) += \
148 $(call set_gccflags,r3900,mips1,r3000,mips1,mips1)
149
150cflags-$(CONFIG_CPU_R6000) += \
151 $(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \
152 -Wa,--trap
153
154cflags-$(CONFIG_CPU_R4300) += \
155 $(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \
156 -Wa,--trap
157
158cflags-$(CONFIG_CPU_VR41XX) += \
159 $(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \
160 -Wa,--trap
161
162cflags-$(CONFIG_CPU_R4X00) += \
163 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
164 -Wa,--trap
165
166cflags-$(CONFIG_CPU_TX49XX) += \
167 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
168 -Wa,--trap
169
170cflags-$(CONFIG_CPU_MIPS32) += \
171 $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
172 -Wa,--trap
173
174cflags-$(CONFIG_CPU_MIPS64) += \
175 $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \
176 -Wa,--trap
177
178cflags-$(CONFIG_CPU_R5000) += \
179 $(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \
180 -Wa,--trap
181
182cflags-$(CONFIG_CPU_R5432) += \
183 $(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \
184 -Wa,--trap
185
186cflags-$(CONFIG_CPU_NEVADA) += \
187 $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \
188 -Wa,--trap
189# $(call cc-option,-mmad)
190
191cflags-$(CONFIG_CPU_RM7000) += \
192 $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \
193 -Wa,--trap
194
195cflags-$(CONFIG_CPU_RM9000) += \
196 $(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \
197 -Wa,--trap
198
199cflags-$(CONFIG_CPU_SB1) += \
200 $(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \
201 -Wa,--trap
202
203cflags-$(CONFIG_CPU_R8000) += \
204 $(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \
205 -Wa,--trap
206
207cflags-$(CONFIG_CPU_R10000) += \
208 $(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \
209 -Wa,--trap
210
211ifdef CONFIG_CPU_SB1
212ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
213MODFLAGS += -msb1-pass1-workarounds
214endif
215endif
216
217#
218# Firmware support
219#
220libs-$(CONFIG_ARC) += arch/mips/arc/
221libs-$(CONFIG_SIBYTE_CFE) += arch/mips/sibyte/cfe/
222
223#
224# Board-dependent options and extra files
225#
226
227#
228# Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
229#
230core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/
231cflags-$(CONFIG_MACH_JAZZ) += -Iinclude/asm-mips/mach-jazz
232load-$(CONFIG_MACH_JAZZ) += 0xffffffff80080000
233
234#
235# Common Alchemy Au1x00 stuff
236#
237core-$(CONFIG_SOC_AU1X00) += arch/mips/au1000/common/
238cflags-$(CONFIG_SOC_AU1X00) += -Iinclude/asm-mips/mach-au1x00
239
240#
241# AMD Alchemy Pb1000 eval board
242#
243libs-$(CONFIG_MIPS_PB1000) += arch/mips/au1000/pb1000/
244cflags-$(CONFIG_MIPS_PB1000) += -Iinclude/asm-mips/mach-pb1x00
245load-$(CONFIG_MIPS_PB1000) += 0xffffffff80100000
246
247#
248# AMD Alchemy Pb1100 eval board
249#
250libs-$(CONFIG_MIPS_PB1100) += arch/mips/au1000/pb1100/
251cflags-$(CONFIG_MIPS_PB1100) += -Iinclude/asm-mips/mach-pb1x00
252load-$(CONFIG_MIPS_PB1100) += 0xffffffff80100000
253
254#
255# AMD Alchemy Pb1500 eval board
256#
257libs-$(CONFIG_MIPS_PB1500) += arch/mips/au1000/pb1500/
258cflags-$(CONFIG_MIPS_PB1500) += -Iinclude/asm-mips/mach-pb1x00
259load-$(CONFIG_MIPS_PB1500) += 0xffffffff80100000
260
261#
262# AMD Alchemy Pb1550 eval board
263#
264libs-$(CONFIG_MIPS_PB1550) += arch/mips/au1000/pb1550/
265cflags-$(CONFIG_MIPS_PB1550) += -Iinclude/asm-mips/mach-pb1x00
266load-$(CONFIG_MIPS_PB1550) += 0xffffffff80100000
267
268#
269# AMD Alchemy Db1000 eval board
270#
271libs-$(CONFIG_MIPS_DB1000) += arch/mips/au1000/db1x00/
272cflags-$(CONFIG_MIPS_DB1000) += -Iinclude/asm-mips/mach-db1x00
273load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000
274
275#
276# AMD Alchemy Db1100 eval board
277#
278libs-$(CONFIG_MIPS_DB1100) += arch/mips/au1000/db1x00/
279cflags-$(CONFIG_MIPS_DB1100) += -Iinclude/asm-mips/mach-db1x00
280load-$(CONFIG_MIPS_DB1100) += 0xffffffff80100000
281
282#
283# AMD Alchemy Db1500 eval board
284#
285libs-$(CONFIG_MIPS_DB1500) += arch/mips/au1000/db1x00/
286cflags-$(CONFIG_MIPS_DB1500) += -Iinclude/asm-mips/mach-db1x00
287load-$(CONFIG_MIPS_DB1500) += 0xffffffff80100000
288
289#
290# AMD Alchemy Db1550 eval board
291#
292libs-$(CONFIG_MIPS_DB1550) += arch/mips/au1000/db1x00/
293cflags-$(CONFIG_MIPS_DB1550) += -Iinclude/asm-mips/mach-db1x00
294load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000
295
296#
297# AMD Alchemy Bosporus eval board
298#
299libs-$(CONFIG_MIPS_BOSPORUS) += arch/mips/au1000/db1x00/
300cflags-$(CONFIG_MIPS_BOSPORUS) += -Iinclude/asm-mips/mach-db1x00
301load-$(CONFIG_MIPS_BOSPORUS) += 0xffffffff80100000
302
303#
304# AMD Alchemy Mirage eval board
305#
306libs-$(CONFIG_MIPS_MIRAGE) += arch/mips/au1000/db1x00/
307cflags-$(CONFIG_MIPS_MIRAGE) += -Iinclude/asm-mips/mach-db1x00
308load-$(CONFIG_MIPS_MIRAGE) += 0xffffffff80100000
309
310#
311# 4G-Systems eval board
312#
313libs-$(CONFIG_MIPS_MTX1) += arch/mips/au1000/mtx-1/
314load-$(CONFIG_MIPS_MTX1) += 0xffffffff80100000
315
316#
317# MyCable eval board
318#
319libs-$(CONFIG_MIPS_XXS1500) += arch/mips/au1000/xxs1500/
320load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000
321
322#
323# Cobalt Server
324#
325core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/
326load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000
327
328#
329# DECstation family
330#
331core-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/
332cflags-$(CONFIG_MACH_DECSTATION)+= -Iinclude/asm-mips/mach-dec
333libs-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/prom/
334load-$(CONFIG_MACH_DECSTATION) += 0xffffffff80040000
335CLEAN_FILES += drivers/tc/lk201-map.c
336
337#
338# Galileo EV64120 Board
339#
340core-$(CONFIG_MIPS_EV64120) += arch/mips/gt64120/ev64120/
341core-$(CONFIG_MIPS_EV64120) += arch/mips/gt64120/common/
342cflags-$(CONFIG_MIPS_EV64120) += -Iinclude/asm-mips/mach-ev64120
343load-$(CONFIG_MIPS_EV64120) += 0xffffffff80100000
344
345#
346# Galileo EV96100 Board
347#
348core-$(CONFIG_MIPS_EV96100) += arch/mips/galileo-boards/ev96100/
349cflags-$(CONFIG_MIPS_EV96100) += -Iinclude/asm-mips/mach-ev96100
350load-$(CONFIG_MIPS_EV96100) += 0xffffffff80100000
351
352#
353# Globespan IVR eval board with QED 5231 CPU
354#
355core-$(CONFIG_ITE_BOARD_GEN) += arch/mips/ite-boards/generic/
356core-$(CONFIG_MIPS_IVR) += arch/mips/ite-boards/ivr/
357load-$(CONFIG_MIPS_IVR) += 0xffffffff80100000
358
359#
360# ITE 8172 eval board with QED 5231 CPU
361#
362core-$(CONFIG_MIPS_ITE8172) += arch/mips/ite-boards/qed-4n-s01b/
363load-$(CONFIG_MIPS_ITE8172) += 0xffffffff80100000
364
365#
366# For all MIPS, Inc. eval boards
367#
368core-$(CONFIG_MIPS_BOARDS_GEN) += arch/mips/mips-boards/generic/
369
370#
371# MIPS Atlas board
372#
373core-$(CONFIG_MIPS_ATLAS) += arch/mips/mips-boards/atlas/
374cflags-$(CONFIG_MIPS_ATLAS) += -Iinclude/asm-mips/mach-atlas
375cflags-$(CONFIG_MIPS_ATLAS) += -Iinclude/asm-mips/mach-mips
376load-$(CONFIG_MIPS_ATLAS) += 0xffffffff80100000
377
378#
379# MIPS Malta board
380#
381core-$(CONFIG_MIPS_MALTA) += arch/mips/mips-boards/malta/
382cflags-$(CONFIG_MIPS_MALTA) += -Iinclude/asm-mips/mach-mips
383load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000
384
385#
386# MIPS SEAD board
387#
388core-$(CONFIG_MIPS_SEAD) += arch/mips/mips-boards/sead/
389load-$(CONFIG_MIPS_SEAD) += 0xffffffff80100000
390
391#
392# Momentum Ocelot board
393#
394# The Ocelot setup.o must be linked early - it does the ioremap() for the
395# mips_io_port_base.
396#
397core-$(CONFIG_MOMENCO_OCELOT) += arch/mips/gt64120/common/ \
398 arch/mips/gt64120/momenco_ocelot/
399cflags-$(CONFIG_MOMENCO_OCELOT) += -Iinclude/asm-mips/mach-ocelot
400load-$(CONFIG_MOMENCO_OCELOT) += 0xffffffff80100000
401
402#
403# Momentum Ocelot-G board
404#
405# The Ocelot-G setup.o must be linked early - it does the ioremap() for the
406# mips_io_port_base.
407#
408core-$(CONFIG_MOMENCO_OCELOT_G) += arch/mips/momentum/ocelot_g/
409load-$(CONFIG_MOMENCO_OCELOT_G) += 0xffffffff80100000
410
411#
412# Momentum Ocelot-C and -CS boards
413#
414# The Ocelot-C[S] setup.o must be linked early - it does the ioremap() for the
415# mips_io_port_base.
416core-$(CONFIG_MOMENCO_OCELOT_C) += arch/mips/momentum/ocelot_c/
417load-$(CONFIG_MOMENCO_OCELOT_C) += 0xffffffff80100000
418
419#
420# PMC-Sierra Yosemite
421#
422core-$(CONFIG_PMC_YOSEMITE) += arch/mips/pmc-sierra/yosemite/
423cflags-$(CONFIG_PMC_YOSEMITE) += -Iinclude/asm-mips/mach-yosemite
424load-$(CONFIG_PMC_YOSEMITE) += 0xffffffff80100000
425
426#
427# Momentum Ocelot-3
428#
429core-$(CONFIG_MOMENCO_OCELOT_3) += arch/mips/momentum/ocelot_3/
430cflags-$(CONFIG_MOMENCO_OCELOT_3) += -Iinclude/asm-mips/mach-ocelot3
431load-$(CONFIG_MOMENCO_OCELOT_3) += 0xffffffff80100000
432
433#
434# Momentum Jaguar ATX
435#
436core-$(CONFIG_MOMENCO_JAGUAR_ATX) += arch/mips/momentum/jaguar_atx/
437cflags-$(CONFIG_MOMENCO_JAGUAR_ATX) += -Iinclude/asm-mips/mach-ja
438#ifdef CONFIG_JAGUAR_DMALOW
439#load-$(CONFIG_MOMENCO_JAGUAR_ATX) += 0xffffffff88000000
440#else
441load-$(CONFIG_MOMENCO_JAGUAR_ATX) += 0xffffffff80100000
442#endif
443
444#
445# NEC DDB
446#
447core-$(CONFIG_DDB5XXX_COMMON) += arch/mips/ddb5xxx/common/
448
449#
450# NEC DDB Vrc-5074
451#
452core-$(CONFIG_DDB5074) += arch/mips/ddb5xxx/ddb5074/
453load-$(CONFIG_DDB5074) += 0xffffffff80080000
454
455#
456# NEC DDB Vrc-5476
457#
458core-$(CONFIG_DDB5476) += arch/mips/ddb5xxx/ddb5476/
459load-$(CONFIG_DDB5476) += 0xffffffff80080000
460
461#
462# NEC DDB Vrc-5477
463#
464core-$(CONFIG_DDB5477) += arch/mips/ddb5xxx/ddb5477/
465load-$(CONFIG_DDB5477) += 0xffffffff80100000
466
467core-$(CONFIG_LASAT) += arch/mips/lasat/
468cflags-$(CONFIG_LASAT) += -Iinclude/asm-mips/mach-lasat
469load-$(CONFIG_LASAT) += 0xffffffff80000000
470
471#
472# NEC Osprey (vr4181) board
473#
474core-$(CONFIG_NEC_OSPREY) += arch/mips/vr4181/common/ \
475 arch/mips/vr4181/osprey/
476load-$(CONFIG_NEC_OSPREY) += 0xffffffff80002000
477
478#
479# Common VR41xx
480#
481core-$(CONFIG_MACH_VR41XX) += arch/mips/vr41xx/common/
482cflags-$(CONFIG_MACH_VR41XX) += -Iinclude/asm-mips/mach-vr41xx
483
484#
485# NEC VR4133
486#
487core-$(CONFIG_NEC_CMBVR4133) += arch/mips/vr41xx/nec-cmbvr4133/
488load-$(CONFIG_NEC_CMBVR4133) += 0xffffffff80100000
489
490#
491# ZAO Networks Capcella (VR4131)
492#
493core-$(CONFIG_ZAO_CAPCELLA) += arch/mips/vr41xx/zao-capcella/
494load-$(CONFIG_ZAO_CAPCELLA) += 0xffffffff80000000
495
496#
497# Victor MP-C303/304 (VR4122)
498#
499core-$(CONFIG_VICTOR_MPC30X) += arch/mips/vr41xx/victor-mpc30x/
500load-$(CONFIG_VICTOR_MPC30X) += 0xffffffff80001000
501
502#
503# IBM WorkPad z50 (VR4121)
504#
505core-$(CONFIG_IBM_WORKPAD) += arch/mips/vr41xx/ibm-workpad/
506load-$(CONFIG_IBM_WORKPAD) += 0xffffffff80004000
507
508#
509# CASIO CASSIPEIA E-55/65 (VR4111)
510#
511core-$(CONFIG_CASIO_E55) += arch/mips/vr41xx/casio-e55/
512load-$(CONFIG_CASIO_E55) += 0xffffffff80004000
513
514#
515# TANBAC TB0226 Mbase (VR4131)
516#
517core-$(CONFIG_TANBAC_TB0226) += arch/mips/vr41xx/tanbac-tb0226/
518load-$(CONFIG_TANBAC_TB0226) += 0xffffffff80000000
519
520#
521# TANBAC TB0229 VR4131DIMM (VR4131)
522#
523core-$(CONFIG_TANBAC_TB0229) += arch/mips/vr41xx/tanbac-tb0229/
524load-$(CONFIG_TANBAC_TB0229) += 0xffffffff80000000
525
526#
527# SGI IP22 (Indy/Indigo2)
528#
529# Set the load address to >= 0xffffffff88069000 if you want to leave space for
530# symmon, 0xffffffff80002000 for production kernels. Note that the value must
531# be aligned to a multiple of the kernel stack size or the handling of the
532# current variable will break so for 64-bit kernels we have to raise the start
533# address by 8kb.
534#
535core-$(CONFIG_SGI_IP22) += arch/mips/sgi-ip22/
536cflags-$(CONFIG_SGI_IP22) += -Iinclude/asm-mips/mach-ip22
537ifdef CONFIG_MIPS32
538load-$(CONFIG_SGI_IP22) += 0xffffffff88002000
539endif
540ifdef CONFIG_MIPS64
541load-$(CONFIG_SGI_IP22) += 0xffffffff88004000
542endif
543
544#
545# SGI-IP27 (Origin200/2000)
546#
547# Set the load address to >= 0xc000000000300000 if you want to leave space for
548# symmon, 0xc00000000001c000 for production kernels. Note that the value must
549# be 16kb aligned or the handling of the current variable will break.
550#
551ifdef CONFIG_SGI_IP27
552core-$(CONFIG_SGI_IP27) += arch/mips/sgi-ip27/
553cflags-$(CONFIG_SGI_IP27) += -Iinclude/asm-mips/mach-ip27
554ifdef CONFIG_BUILD_ELF64
555ifdef CONFIG_MAPPED_KERNEL
556load-$(CONFIG_SGI_IP27) += 0xc00000004001c000
557OBJCOPYFLAGS := --change-addresses=0x3fffffff80000000
558dataoffset-$(CONFIG_SGI_IP27) += 0x01000000
559else
560load-$(CONFIG_SGI_IP27) += 0xa80000000001c000
561OBJCOPYFLAGS := --change-addresses=0x57ffffff80000000
562endif
563else
564ifdef CONFIG_MAPPED_KERNEL
565load-$(CONFIG_SGI_IP27) += 0xffffffffc001c000
566OBJCOPYFLAGS := --change-addresses=0xc000000080000000
567dataoffset-$(CONFIG_SGI_IP27) += 0x01000000
568else
569load-$(CONFIG_SGI_IP27) += 0xffffffff8001c000
570OBJCOPYFLAGS := --change-addresses=0xa800000080000000
571endif
572endif
573endif
574
575#
576# SGI-IP32 (O2)
577#
578# Set the load address to >= 80069000 if you want to leave space for symmon,
579# 0xffffffff80004000 for production kernels. Note that the value must be aligned to
580# a multiple of the kernel stack size or the handling of the current variable
581# will break.
582#
583core-$(CONFIG_SGI_IP32) += arch/mips/sgi-ip32/
584cflags-$(CONFIG_SGI_IP32) += -Iinclude/asm-mips/mach-ip32
585load-$(CONFIG_SGI_IP32) += 0xffffffff80004000
586
587#
588# Sibyte SB1250 SOC
589#
590# This is a LIB so that it links at the end, and initcalls are later
591# the sequence; but it is built as an object so that modules don't get
592# removed (as happens, even if they have __initcall/module_init)
593#
594core-$(CONFIG_SIBYTE_BCM112X) += arch/mips/sibyte/sb1250/
595cflags-$(CONFIG_SIBYTE_BCM112X) += -Iinclude/asm-mips/mach-sibyte
596
597core-$(CONFIG_SIBYTE_SB1250) += arch/mips/sibyte/sb1250/
598cflags-$(CONFIG_SIBYTE_SB1250) += -Iinclude/asm-mips/mach-sibyte
599
600#
601# Sibyte BCM91120x (Carmel) board
602# Sibyte BCM91120C (CRhine) board
603# Sibyte BCM91125C (CRhone) board
604# Sibyte BCM91125E (Rhone) board
605# Sibyte SWARM board
606#
607libs-$(CONFIG_SIBYTE_CARMEL) += arch/mips/sibyte/swarm/
608load-$(CONFIG_SIBYTE_CARMEL) := 0xffffffff80100000
609libs-$(CONFIG_SIBYTE_CRHINE) += arch/mips/sibyte/swarm/
610load-$(CONFIG_SIBYTE_CRHINE) := 0xffffffff80100000
611libs-$(CONFIG_SIBYTE_CRHONE) += arch/mips/sibyte/swarm/
612load-$(CONFIG_SIBYTE_CRHONE) := 0xffffffff80100000
613libs-$(CONFIG_SIBYTE_RHONE) += arch/mips/sibyte/swarm/
614load-$(CONFIG_SIBYTE_RHONE) := 0xffffffff80100000
615libs-$(CONFIG_SIBYTE_SENTOSA) += arch/mips/sibyte/swarm/
616load-$(CONFIG_SIBYTE_SENTOSA) := 0xffffffff80100000
617libs-$(CONFIG_SIBYTE_SWARM) += arch/mips/sibyte/swarm/
618load-$(CONFIG_SIBYTE_SWARM) := 0xffffffff80100000
619
620#
621# SNI RM200 PCI
622#
623core-$(CONFIG_SNI_RM200_PCI) += arch/mips/sni/
624cflags-$(CONFIG_SNI_RM200_PCI) += -Iinclude/asm-mips/mach-rm200
625load-$(CONFIG_SNI_RM200_PCI) += 0xffffffff80600000
626
627#
628# Toshiba JMR-TX3927 board
629#
630core-$(CONFIG_TOSHIBA_JMR3927) += arch/mips/jmr3927/rbhma3100/ \
631 arch/mips/jmr3927/common/
632load-$(CONFIG_TOSHIBA_JMR3927) += 0xffffffff80050000
633
634#
635# Toshiba RBTX4927 board or
636# Toshiba RBTX4937 board
637#
638core-$(CONFIG_TOSHIBA_RBTX4927) += arch/mips/tx4927/toshiba_rbtx4927/
639core-$(CONFIG_TOSHIBA_RBTX4927) += arch/mips/tx4927/common/
640load-$(CONFIG_TOSHIBA_RBTX4927) += 0xffffffff80020000
641
642cflags-y += -Iinclude/asm-mips/mach-generic
643drivers-$(CONFIG_PCI) += arch/mips/pci/
644
645ifdef CONFIG_MIPS32
646ifdef CONFIG_CPU_LITTLE_ENDIAN
647JIFFIES = jiffies_64
648else
649JIFFIES = jiffies_64 + 4
650endif
651else
652JIFFIES = jiffies_64
653endif
654
655AFLAGS += $(cflags-y)
656CFLAGS += $(cflags-y)
657
658LDFLAGS += -m $(ld-emul)
659
660OBJCOPYFLAGS += --remove-section=.reginfo
661
662#
663# Choosing incompatible machines durings configuration will result in
664# error messages during linking. Select a default linkscript if
665# none has been choosen above.
666#
667
668CPPFLAGS_vmlinux.lds := \
669 $(CFLAGS) \
670 -D"LOADADDR=$(load-y)" \
671 -D"JIFFIES=$(JIFFIES)" \
672 -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"
673
674head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
675
676libs-y += arch/mips/lib/
677libs-$(CONFIG_MIPS32) += arch/mips/lib-32/
678libs-$(CONFIG_MIPS64) += arch/mips/lib-64/
679
680core-y += arch/mips/kernel/ arch/mips/mm/ arch/mips/math-emu/
681
682drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/
683
684ifdef CONFIG_LASAT
685rom.bin rom.sw: vmlinux
686 $(call descend,arch/mips/lasat/image,$@)
687endif
688
689#
690# Some machines like the Indy need 32-bit ELF binaries for booting purposes.
691# Other need ECOFF, so we build a 32-bit ELF binary for them which we then
692# convert to ECOFF using elf2ecoff.
693#
694vmlinux.32: vmlinux
695 $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
696
697#
698# The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
699# ELF files from 32-bit files by conversion.
700#
701vmlinux.64: vmlinux
702 $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
703
704makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) $(1)
705
706ifdef CONFIG_BOOT_ELF32
707all: $(vmlinux-32)
708endif
709
710ifdef CONFIG_BOOT_ELF64
711all: $(vmlinux-64)
712endif
713
714ifdef CONFIG_SNI_RM200_PCI
715all: vmlinux.ecoff
716endif
717
718vmlinux.ecoff vmlinux.rm200: $(vmlinux-32)
719 +@$(call makeboot,$@)
720
721vmlinux.srec: $(vmlinux-32)
722 +@$(call makeboot,$@)
723
724CLEAN_FILES += vmlinux.ecoff \
725 vmlinux.srec \
726 vmlinux.rm200.tmp \
727 vmlinux.rm200
728
729archclean:
730 @$(MAKE) $(clean)=arch/mips/boot
731 @$(MAKE) $(clean)=arch/mips/lasat
732
733# Generate <asm/offset.h
734#
735# The default rule is suffering from funny problems on MIPS so we using our
736# own ...
737#
738# ---------------------------------------------------------------------------
739
740define filechk_gen-asm-offset.h
741 (set -e; \
742 echo "#ifndef _ASM_OFFSET_H"; \
743 echo "#define _ASM_OFFSET_H"; \
744 echo "/*"; \
745 echo " * DO NOT MODIFY."; \
746 echo " *"; \
747 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
748 echo " *"; \
749 echo " */"; \
750 echo ""; \
751 sed -ne "/^@@@/s///p"; \
752 echo "#endif /* _ASM_OFFSET_H */" )
753endef
754
755prepare: include/asm-$(ARCH)/offset.h
756
757arch/$(ARCH)/kernel/offset.s: include/asm include/linux/version.h \
758 include/config/MARKER
759
760include/asm-$(ARCH)/offset.h: arch/$(ARCH)/kernel/offset.s
761 $(call filechk,gen-asm-offset.h)
762
763CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \
764 include/asm-$(ARCH)/offset.h \
765 vmlinux.32 \
766 vmlinux.64 \
767 vmlinux.ecoff
diff --git a/arch/mips/arc/Makefile b/arch/mips/arc/Makefile
new file mode 100644
index 000000000000..e8424932e1a3
--- /dev/null
+++ b/arch/mips/arc/Makefile
@@ -0,0 +1,10 @@
1#
2# Makefile for the ARC prom monitor library routines under Linux.
3#
4
5lib-y += cmdline.o env.o file.o identify.o init.o \
6 misc.o time.o tree.o
7
8lib-$(CONFIG_ARC_MEMORY) += memory.o
9lib-$(CONFIG_ARC_CONSOLE) += arc_con.o
10lib-$(CONFIG_ARC_PROMLIB) += promlib.o
diff --git a/arch/mips/arc/arc_con.c b/arch/mips/arc/arc_con.c
new file mode 100644
index 000000000000..51785a6a7328
--- /dev/null
+++ b/arch/mips/arc/arc_con.c
@@ -0,0 +1,50 @@
1/*
2 * Wrap-around code for a console using the
3 * ARC io-routines.
4 *
5 * Copyright (c) 1998 Harald Koerfgen
6 * Copyright (c) 2001 Ralf Baechle
7 * Copyright (c) 2002 Thiemo Seufer
8 */
9#include <linux/tty.h>
10#include <linux/major.h>
11#include <linux/init.h>
12#include <linux/console.h>
13#include <linux/fs.h>
14#include <asm/sgialib.h>
15
16static void prom_console_write(struct console *co, const char *s,
17 unsigned count)
18{
19 /* Do each character */
20 while (count--) {
21 if (*s == '\n')
22 prom_putchar('\r');
23 prom_putchar(*s++);
24 }
25}
26
27static int __init prom_console_setup(struct console *co, char *options)
28{
29 return !(prom_flags & PROM_FLAG_USE_AS_CONSOLE);
30}
31
32static struct console arc_cons = {
33 .name = "arc",
34 .write = prom_console_write,
35 .setup = prom_console_setup,
36 .flags = CON_PRINTBUFFER,
37 .index = -1,
38};
39
40/*
41 * Register console.
42 */
43
44static int __init arc_console_init(void)
45{
46 register_console(&arc_cons);
47
48 return 0;
49}
50console_initcall(arc_console_init);
diff --git a/arch/mips/arc/cmdline.c b/arch/mips/arc/cmdline.c
new file mode 100644
index 000000000000..fd604ef28823
--- /dev/null
+++ b/arch/mips/arc/cmdline.c
@@ -0,0 +1,108 @@
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 * cmdline.c: Kernel command line creation using ARCS argc/argv.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/string.h>
13
14#include <asm/sgialib.h>
15#include <asm/bootinfo.h>
16
17#undef DEBUG_CMDLINE
18
19char * __init prom_getcmdline(void)
20{
21 return arcs_cmdline;
22}
23
24static char *ignored[] = {
25 "ConsoleIn=",
26 "ConsoleOut=",
27 "SystemPartition=",
28 "OSLoader=",
29 "OSLoadPartition=",
30 "OSLoadFilename=",
31 "OSLoadOptions="
32};
33
34static char *used_arc[][2] = {
35 { "OSLoadPartition=", "root=" },
36 { "OSLoadOptions=", "" }
37};
38
39static char * __init move_firmware_args(char* cp)
40{
41 char *s;
42 int actr, i;
43
44 actr = 1; /* Always ignore argv[0] */
45
46 while (actr < prom_argc) {
47 for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
48 int len = strlen(used_arc[i][0]);
49
50 if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
51 /* Ok, we want it. First append the replacement... */
52 strcat(cp, used_arc[i][1]);
53 cp += strlen(used_arc[i][1]);
54 /* ... and now the argument */
55 s = strstr(prom_argv(actr), "=");
56 if (s) {
57 s++;
58 strcpy(cp, s);
59 cp += strlen(s);
60 }
61 *cp++ = ' ';
62 break;
63 }
64 }
65 actr++;
66 }
67
68 return cp;
69}
70
71void __init prom_init_cmdline(void)
72{
73 char *cp;
74 int actr, i;
75
76 actr = 1; /* Always ignore argv[0] */
77
78 cp = arcs_cmdline;
79 /*
80 * Move ARC variables to the beginning to make sure they can be
81 * overridden by later arguments.
82 */
83 cp = move_firmware_args(cp);
84
85 while (actr < prom_argc) {
86 for (i = 0; i < ARRAY_SIZE(ignored); i++) {
87 int len = strlen(ignored[i]);
88
89 if (!strncmp(prom_argv(actr), ignored[i], len))
90 goto pic_cont;
91 }
92 /* Ok, we want it. */
93 strcpy(cp, prom_argv(actr));
94 cp += strlen(prom_argv(actr));
95 *cp++ = ' ';
96
97 pic_cont:
98 actr++;
99 }
100
101 if (cp != arcs_cmdline) /* get rid of trailing space */
102 --cp;
103 *cp = '\0';
104
105#ifdef DEBUG_CMDLINE
106 printk(KERN_DEBUG "prom cmdline: %s\n", arcs_cmdline);
107#endif
108}
diff --git a/arch/mips/arc/console.c b/arch/mips/arc/console.c
new file mode 100644
index 000000000000..6a9d144512c0
--- /dev/null
+++ b/arch/mips/arc/console.c
@@ -0,0 +1,63 @@
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) 1996 David S. Miller (dm@sgi.com)
7 * Compability with board caches, Ulf Carlsson
8 */
9#include <linux/kernel.h>
10#include <asm/sgialib.h>
11#include <asm/bcache.h>
12
13/*
14 * IP22 boardcache is not compatible with board caches. Thus we disable it
15 * during romvec action. Since r4xx0.c is always compiled and linked with your
16 * kernel, this shouldn't cause any harm regardless what MIPS processor you
17 * have.
18 *
19 * The ARC write and read functions seem to interfere with the serial lines
20 * in some way. You should be careful with them.
21 */
22
23void prom_putchar(char c)
24{
25 ULONG cnt;
26 CHAR it = c;
27
28 bc_disable();
29 ArcWrite(1, &it, 1, &cnt);
30 bc_enable();
31}
32
33char prom_getchar(void)
34{
35 ULONG cnt;
36 CHAR c;
37
38 bc_disable();
39 ArcRead(0, &c, 1, &cnt);
40 bc_enable();
41
42 return c;
43}
44
45void prom_printf(char *fmt, ...)
46{
47 va_list args;
48 char ppbuf[1024];
49 char *bptr;
50
51 va_start(args, fmt);
52 vsprintf(ppbuf, fmt, args);
53
54 bptr = ppbuf;
55
56 while (*bptr != 0) {
57 if (*bptr == '\n')
58 prom_putchar('\r');
59
60 prom_putchar(*bptr++);
61 }
62 va_end(args);
63}
diff --git a/arch/mips/arc/env.c b/arch/mips/arc/env.c
new file mode 100644
index 000000000000..e521a6e010aa
--- /dev/null
+++ b/arch/mips/arc/env.c
@@ -0,0 +1,27 @@
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 * env.c: ARCS environment variable routines.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/string.h>
13
14#include <asm/arc/types.h>
15#include <asm/sgialib.h>
16
17PCHAR __init
18ArcGetEnvironmentVariable(CHAR *name)
19{
20 return (CHAR *) ARC_CALL1(get_evar, name);
21}
22
23LONG __init
24ArcSetEnvironmentVariable(PCHAR name, PCHAR value)
25{
26 return ARC_CALL2(set_evar, name, value);
27}
diff --git a/arch/mips/arc/file.c b/arch/mips/arc/file.c
new file mode 100644
index 000000000000..a43425b3c838
--- /dev/null
+++ b/arch/mips/arc/file.c
@@ -0,0 +1,75 @@
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 * ARC firmware interface.
7 *
8 * Copyright (C) 1994, 1995, 1996, 1999 Ralf Baechle
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 */
11#include <linux/init.h>
12
13#include <asm/arc/types.h>
14#include <asm/sgialib.h>
15
16LONG __init
17ArcGetDirectoryEntry(ULONG FileID, struct linux_vdirent *Buffer,
18 ULONG N, ULONG *Count)
19{
20 return ARC_CALL4(get_vdirent, FileID, Buffer, N, Count);
21}
22
23LONG __init
24ArcOpen(CHAR *Path, enum linux_omode OpenMode, ULONG *FileID)
25{
26 return ARC_CALL3(open, Path, OpenMode, FileID);
27}
28
29LONG __init
30ArcClose(ULONG FileID)
31{
32 return ARC_CALL1(close, FileID);
33}
34
35LONG __init
36ArcRead(ULONG FileID, VOID *Buffer, ULONG N, ULONG *Count)
37{
38 return ARC_CALL4(read, FileID, Buffer, N, Count);
39}
40
41LONG __init
42ArcGetReadStatus(ULONG FileID)
43{
44 return ARC_CALL1(get_rstatus, FileID);
45}
46
47LONG __init
48ArcWrite(ULONG FileID, PVOID Buffer, ULONG N, PULONG Count)
49{
50 return ARC_CALL4(write, FileID, Buffer, N, Count);
51}
52
53LONG __init
54ArcSeek(ULONG FileID, struct linux_bigint *Position, enum linux_seekmode SeekMode)
55{
56 return ARC_CALL3(seek, FileID, Position, SeekMode);
57}
58
59LONG __init
60ArcMount(char *name, enum linux_mountops op)
61{
62 return ARC_CALL2(mount, name, op);
63}
64
65LONG __init
66ArcGetFileInformation(ULONG FileID, struct linux_finfo *Information)
67{
68 return ARC_CALL2(get_finfo, FileID, Information);
69}
70
71LONG __init ArcSetFileInformation(ULONG FileID, ULONG AttributeFlags,
72 ULONG AttributeMask)
73{
74 return ARC_CALL3(set_finfo, FileID, AttributeFlags, AttributeMask);
75}
diff --git a/arch/mips/arc/identify.c b/arch/mips/arc/identify.c
new file mode 100644
index 000000000000..0dd7a345eb79
--- /dev/null
+++ b/arch/mips/arc/identify.c
@@ -0,0 +1,119 @@
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 * identify.c: identify machine by looking up system identifier
7 *
8 * Copyright (C) 1998 Thomas Bogendoerfer
9 *
10 * This code is based on arch/mips/sgi/kernel/system.c, which is
11 *
12 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
13 */
14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/types.h>
18#include <linux/string.h>
19
20#include <asm/sgialib.h>
21#include <asm/bootinfo.h>
22
23struct smatch {
24 char *arcname;
25 char *liname;
26 int group;
27 int type;
28 int flags;
29};
30
31static struct smatch mach_table[] = {
32 { "SGI-IP22",
33 "SGI Indy",
34 MACH_GROUP_SGI,
35 MACH_SGI_IP22,
36 PROM_FLAG_ARCS
37 }, { "SGI-IP27",
38 "SGI Origin",
39 MACH_GROUP_SGI,
40 MACH_SGI_IP27,
41 PROM_FLAG_ARCS
42 }, { "SGI-IP28",
43 "SGI IP28",
44 MACH_GROUP_SGI,
45 MACH_SGI_IP28,
46 PROM_FLAG_ARCS
47 }, { "SGI-IP32",
48 "SGI O2",
49 MACH_GROUP_SGI,
50 MACH_SGI_IP32,
51 PROM_FLAG_ARCS
52 }, { "Microsoft-Jazz",
53 "Jazz MIPS_Magnum_4000",
54 MACH_GROUP_JAZZ,
55 MACH_MIPS_MAGNUM_4000,
56 0
57 }, { "PICA-61",
58 "Jazz Acer_PICA_61",
59 MACH_GROUP_JAZZ,
60 MACH_ACER_PICA_61,
61 0
62 }, { "RM200PCI",
63 "SNI RM200_PCI",
64 MACH_GROUP_SNI_RM,
65 MACH_SNI_RM200_PCI,
66 PROM_FLAG_DONT_FREE_TEMP
67 }
68};
69
70int prom_flags;
71
72static struct smatch * __init string_to_mach(const char *s)
73{
74 int i;
75
76 for (i = 0; i < (sizeof(mach_table) / sizeof (mach_table[0])); i++) {
77 if (!strcmp(s, mach_table[i].arcname))
78 return &mach_table[i];
79 }
80
81 panic("Yeee, could not determine architecture type <%s>", s);
82}
83
84char *system_type;
85
86const char *get_system_type(void)
87{
88 return system_type;
89}
90
91void __init prom_identify_arch(void)
92{
93 pcomponent *p;
94 struct smatch *mach;
95 const char *iname;
96
97 /*
98 * The root component tells us what machine architecture we have here.
99 */
100 p = ArcGetChild(PROM_NULL_COMPONENT);
101 if (p == NULL) {
102#ifdef CONFIG_SGI_IP27
103 /* IP27 PROM misbehaves, seems to not implement ARC
104 GetChild(). So we just assume it's an IP27. */
105 iname = "SGI-IP27";
106#else
107 iname = "Unknown";
108#endif
109 } else
110 iname = (char *) (long) p->iname;
111
112 printk("ARCH: %s\n", iname);
113 mach = string_to_mach(iname);
114 system_type = mach->liname;
115
116 mips_machgroup = mach->group;
117 mips_machtype = mach->type;
118 prom_flags = mach->flags;
119}
diff --git a/arch/mips/arc/init.c b/arch/mips/arc/init.c
new file mode 100644
index 000000000000..76ab505ca693
--- /dev/null
+++ b/arch/mips/arc/init.c
@@ -0,0 +1,48 @@
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 * PROM library initialisation code.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12
13#include <asm/bootinfo.h>
14#include <asm/sgialib.h>
15
16#undef DEBUG_PROM_INIT
17
18/* Master romvec interface. */
19struct linux_romvec *romvec;
20int prom_argc;
21LONG *_prom_argv, *_prom_envp;
22
23void __init prom_init(void)
24{
25 PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK;
26 romvec = ROMVECTOR;
27 prom_argc = fw_arg0;
28 _prom_argv = (LONG *) fw_arg1;
29 _prom_envp = (LONG *) fw_arg2;
30
31 if (pb->magic != 0x53435241) {
32 prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic);
33 while(1)
34 ;
35 }
36
37 prom_init_cmdline();
38 prom_identify_arch();
39 printk(KERN_INFO "PROMLIB: ARC firmware Version %d Revision %d\n",
40 pb->ver, pb->rev);
41 prom_meminit();
42
43#ifdef DEBUG_PROM_INIT
44 prom_printf("Press a key to reboot\n");
45 prom_getchar();
46 ArcEnterInteractiveMode();
47#endif
48}
diff --git a/arch/mips/arc/memory.c b/arch/mips/arc/memory.c
new file mode 100644
index 000000000000..958d2eb78862
--- /dev/null
+++ b/arch/mips/arc/memory.c
@@ -0,0 +1,170 @@
1/*
2 * memory.c: PROM library functions for acquiring/using memory descriptors
3 * given to us from the ARCS firmware.
4 *
5 * Copyright (C) 1996 by David S. Miller
6 * Copyright (C) 1999, 2000, 2001 by Ralf Baechle
7 * Copyright (C) 1999, 2000 by Silicon Graphics, Inc.
8 *
9 * PROM library functions for acquiring/using memory descriptors given to us
10 * from the ARCS firmware. This is only used when CONFIG_ARC_MEMORY is set
11 * because on some machines like SGI IP27 the ARC memory configuration data
12 * completly bogus and alternate easier to use mechanisms are available.
13 */
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/sched.h>
18#include <linux/mm.h>
19#include <linux/bootmem.h>
20#include <linux/swap.h>
21
22#include <asm/sgialib.h>
23#include <asm/page.h>
24#include <asm/pgtable.h>
25#include <asm/bootinfo.h>
26
27#undef DEBUG
28
29/*
30 * For ARC firmware memory functions the unit of meassuring memory is always
31 * a 4k page of memory
32 */
33#define ARC_PAGE_SHIFT 12
34
35struct linux_mdesc * __init ArcGetMemoryDescriptor(struct linux_mdesc *Current)
36{
37 return (struct linux_mdesc *) ARC_CALL1(get_mdesc, Current);
38}
39
40#ifdef DEBUG /* convenient for debugging */
41static char *arcs_mtypes[8] = {
42 "Exception Block",
43 "ARCS Romvec Page",
44 "Free/Contig RAM",
45 "Generic Free RAM",
46 "Bad Memory",
47 "Standalone Program Pages",
48 "ARCS Temp Storage Area",
49 "ARCS Permanent Storage Area"
50};
51
52static char *arc_mtypes[8] = {
53 "Exception Block",
54 "SystemParameterBlock",
55 "FreeMemory",
56 "Bad Memory",
57 "LoadedProgram",
58 "FirmwareTemporary",
59 "FirmwarePermanent",
60 "FreeContiguous"
61};
62#define mtypes(a) (prom_flags & PROM_FLAG_ARCS) ? arcs_mtypes[a.arcs] \
63 : arc_mtypes[a.arc]
64#endif
65
66static inline int memtype_classify_arcs (union linux_memtypes type)
67{
68 switch (type.arcs) {
69 case arcs_fcontig:
70 case arcs_free:
71 return BOOT_MEM_RAM;
72 case arcs_atmp:
73 return BOOT_MEM_ROM_DATA;
74 case arcs_eblock:
75 case arcs_rvpage:
76 case arcs_bmem:
77 case arcs_prog:
78 case arcs_aperm:
79 return BOOT_MEM_RESERVED;
80 default:
81 BUG();
82 }
83 while(1); /* Nuke warning. */
84}
85
86static inline int memtype_classify_arc (union linux_memtypes type)
87{
88 switch (type.arc) {
89 case arc_free:
90 case arc_fcontig:
91 return BOOT_MEM_RAM;
92 case arc_atmp:
93 return BOOT_MEM_ROM_DATA;
94 case arc_eblock:
95 case arc_rvpage:
96 case arc_bmem:
97 case arc_prog:
98 case arc_aperm:
99 return BOOT_MEM_RESERVED;
100 default:
101 BUG();
102 }
103 while(1); /* Nuke warning. */
104}
105
106static int __init prom_memtype_classify (union linux_memtypes type)
107{
108 if (prom_flags & PROM_FLAG_ARCS) /* SGI is ``different'' ... */
109 return memtype_classify_arcs(type);
110
111 return memtype_classify_arc(type);
112}
113
114void __init prom_meminit(void)
115{
116 struct linux_mdesc *p;
117
118#ifdef DEBUG
119 int i = 0;
120
121 prom_printf("ARCS MEMORY DESCRIPTOR dump:\n");
122 p = ArcGetMemoryDescriptor(PROM_NULL_MDESC);
123 while(p) {
124 prom_printf("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
125 i, p, p->base, p->pages, mtypes(p->type));
126 p = ArcGetMemoryDescriptor(p);
127 i++;
128 }
129#endif
130
131 p = PROM_NULL_MDESC;
132 while ((p = ArcGetMemoryDescriptor(p))) {
133 unsigned long base, size;
134 long type;
135
136 base = p->base << ARC_PAGE_SHIFT;
137 size = p->pages << ARC_PAGE_SHIFT;
138 type = prom_memtype_classify(p->type);
139
140 add_memory_region(base, size, type);
141 }
142}
143
144unsigned long __init prom_free_prom_memory(void)
145{
146 unsigned long freed = 0;
147 unsigned long addr;
148 int i;
149
150 if (prom_flags & PROM_FLAG_DONT_FREE_TEMP)
151 return 0;
152
153 for (i = 0; i < boot_mem_map.nr_map; i++) {
154 if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
155 continue;
156
157 addr = boot_mem_map.map[i].addr;
158 while (addr < boot_mem_map.map[i].addr
159 + boot_mem_map.map[i].size) {
160 ClearPageReserved(virt_to_page(__va(addr)));
161 set_page_count(virt_to_page(__va(addr)), 1);
162 free_page((unsigned long)__va(addr));
163 addr += PAGE_SIZE;
164 freed += PAGE_SIZE;
165 }
166 }
167 printk(KERN_INFO "Freeing prom memory: %ldkb freed\n", freed >> 10);
168
169 return freed;
170}
diff --git a/arch/mips/arc/misc.c b/arch/mips/arc/misc.c
new file mode 100644
index 000000000000..84867de22028
--- /dev/null
+++ b/arch/mips/arc/misc.c
@@ -0,0 +1,108 @@
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 * Miscellaneous ARCS PROM routines.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 * Copyright (C) 1999 Silicon Graphics, Inc.
11 */
12#include <linux/config.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15
16#include <asm/bcache.h>
17
18#include <asm/arc/types.h>
19#include <asm/sgialib.h>
20#include <asm/bootinfo.h>
21#include <asm/system.h>
22
23extern void *sgiwd93_host;
24extern void reset_wd33c93(void *instance);
25
26VOID
27ArcHalt(VOID)
28{
29 bc_disable();
30 local_irq_disable();
31#ifdef CONFIG_SCSI_SGIWD93
32 reset_wd33c93(sgiwd93_host);
33#endif
34 ARC_CALL0(halt);
35never: goto never;
36}
37
38VOID
39ArcPowerDown(VOID)
40{
41 bc_disable();
42 local_irq_disable();
43#ifdef CONFIG_SCSI_SGIWD93
44 reset_wd33c93(sgiwd93_host);
45#endif
46 ARC_CALL0(pdown);
47never: goto never;
48}
49
50/* XXX is this a soft reset basically? XXX */
51VOID
52ArcRestart(VOID)
53{
54 bc_disable();
55 local_irq_disable();
56#ifdef CONFIG_SCSI_SGIWD93
57 reset_wd33c93(sgiwd93_host);
58#endif
59 ARC_CALL0(restart);
60never: goto never;
61}
62
63VOID
64ArcReboot(VOID)
65{
66 bc_disable();
67 local_irq_disable();
68#ifdef CONFIG_SCSI_SGIWD93
69 reset_wd33c93(sgiwd93_host);
70#endif
71 ARC_CALL0(reboot);
72never: goto never;
73}
74
75VOID
76ArcEnterInteractiveMode(VOID)
77{
78 bc_disable();
79 local_irq_disable();
80#ifdef CONFIG_SCSI_SGIWD93
81 reset_wd33c93(sgiwd93_host);
82#endif
83 ARC_CALL0(imode);
84never: goto never;
85}
86
87LONG
88ArcSaveConfiguration(VOID)
89{
90 return ARC_CALL0(cfg_save);
91}
92
93struct linux_sysid *
94ArcGetSystemId(VOID)
95{
96 return (struct linux_sysid *) ARC_CALL0(get_sysid);
97}
98
99VOID __init
100ArcFlushAllCaches(VOID)
101{
102 ARC_CALL0(cache_flush);
103}
104
105DISPLAY_STATUS * __init ArcGetDisplayStatus(ULONG FileID)
106{
107 return (DISPLAY_STATUS *) ARC_CALL1(GetDisplayStatus, FileID);
108}
diff --git a/arch/mips/arc/promlib.c b/arch/mips/arc/promlib.c
new file mode 100644
index 000000000000..c508c00dbb64
--- /dev/null
+++ b/arch/mips/arc/promlib.c
@@ -0,0 +1,43 @@
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) 1996 David S. Miller (dm@sgi.com)
7 * Compability with board caches, Ulf Carlsson
8 */
9#include <linux/kernel.h>
10#include <asm/sgialib.h>
11#include <asm/bcache.h>
12
13/*
14 * IP22 boardcache is not compatible with board caches. Thus we disable it
15 * during romvec action. Since r4xx0.c is always compiled and linked with your
16 * kernel, this shouldn't cause any harm regardless what MIPS processor you
17 * have.
18 *
19 * The ARC write and read functions seem to interfere with the serial lines
20 * in some way. You should be careful with them.
21 */
22
23void prom_putchar(char c)
24{
25 ULONG cnt;
26 CHAR it = c;
27
28 bc_disable();
29 ArcWrite(1, &it, 1, &cnt);
30 bc_enable();
31}
32
33char prom_getchar(void)
34{
35 ULONG cnt;
36 CHAR c;
37
38 bc_disable();
39 ArcRead(0, &c, 1, &cnt);
40 bc_enable();
41
42 return c;
43}
diff --git a/arch/mips/arc/salone.c b/arch/mips/arc/salone.c
new file mode 100644
index 000000000000..e6afb64723d0
--- /dev/null
+++ b/arch/mips/arc/salone.c
@@ -0,0 +1,24 @@
1/*
2 * Routines to load into memory and execute stand-along program images using
3 * ARCS PROM firmware.
4 *
5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 */
7#include <linux/init.h>
8#include <asm/sgialib.h>
9
10LONG __init ArcLoad(CHAR *Path, ULONG TopAddr, ULONG *ExecAddr, ULONG *LowAddr)
11{
12 return ARC_CALL4(load, Path, TopAddr, ExecAddr, LowAddr);
13}
14
15LONG __init ArcInvoke(ULONG ExecAddr, ULONG StackAddr, ULONG Argc, CHAR *Argv[],
16 CHAR *Envp[])
17{
18 return ARC_CALL5(invoke, ExecAddr, StackAddr, Argc, Argv, Envp);
19}
20
21LONG __init ArcExecute(CHAR *Path, LONG Argc, CHAR *Argv[], CHAR *Envp[])
22{
23 return ARC_CALL4(exec, Path, Argc, Argv, Envp);
24}
diff --git a/arch/mips/arc/time.c b/arch/mips/arc/time.c
new file mode 100644
index 000000000000..299ff2c5c0b5
--- /dev/null
+++ b/arch/mips/arc/time.c
@@ -0,0 +1,25 @@
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 * Extracting time information from ARCS prom.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 */
10#include <linux/init.h>
11
12#include <asm/arc/types.h>
13#include <asm/sgialib.h>
14
15struct linux_tinfo * __init
16ArcGetTime(VOID)
17{
18 return (struct linux_tinfo *) ARC_CALL0(get_tinfo);
19}
20
21ULONG __init
22ArcGetRelativeTime(VOID)
23{
24 return ARC_CALL0(get_rtime);
25}
diff --git a/arch/mips/arc/tree.c b/arch/mips/arc/tree.c
new file mode 100644
index 000000000000..2aedd4f52839
--- /dev/null
+++ b/arch/mips/arc/tree.c
@@ -0,0 +1,127 @@
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 * PROM component device tree code.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 * Copyright (C) 1999 Silicon Graphics, Inc.
11 */
12#include <linux/init.h>
13#include <asm/arc/types.h>
14#include <asm/sgialib.h>
15
16#undef DEBUG_PROM_TREE
17
18pcomponent * __init
19ArcGetPeer(pcomponent *Current)
20{
21 if (Current == PROM_NULL_COMPONENT)
22 return PROM_NULL_COMPONENT;
23
24 return (pcomponent *) ARC_CALL1(next_component, Current);
25}
26
27pcomponent * __init
28ArcGetChild(pcomponent *Current)
29{
30 return (pcomponent *) ARC_CALL1(child_component, Current);
31}
32
33pcomponent * __init
34ArcGetParent(pcomponent *Current)
35{
36 if (Current == PROM_NULL_COMPONENT)
37 return PROM_NULL_COMPONENT;
38
39 return (pcomponent *) ARC_CALL1(parent_component, Current);
40}
41
42LONG __init
43ArcGetConfigurationData(VOID *Buffer, pcomponent *Current)
44{
45 return ARC_CALL2(component_data, Buffer, Current);
46}
47
48pcomponent * __init
49ArcAddChild(pcomponent *Current, pcomponent *Template, VOID *ConfigurationData)
50{
51 return (pcomponent *)
52 ARC_CALL3(child_add, Current, Template, ConfigurationData);
53}
54
55LONG __init
56ArcDeleteComponent(pcomponent *ComponentToDelete)
57{
58 return ARC_CALL1(comp_del, ComponentToDelete);
59}
60
61pcomponent * __init
62ArcGetComponent(CHAR *Path)
63{
64 return (pcomponent *)ARC_CALL1(component_by_path, Path);
65}
66
67#ifdef DEBUG_PROM_TREE
68
69static char *classes[] = {
70 "system", "processor", "cache", "adapter", "controller", "peripheral",
71 "memory"
72};
73
74static char *types[] = {
75 "arc", "cpu", "fpu", "picache", "pdcache", "sicache", "sdcache",
76 "sccache", "memdev", "eisa adapter", "tc adapter", "scsi adapter",
77 "dti adapter", "multi-func adapter", "disk controller",
78 "tp controller", "cdrom controller", "worm controller",
79 "serial controller", "net controller", "display controller",
80 "parallel controller", "pointer controller", "keyboard controller",
81 "audio controller", "misc controller", "disk peripheral",
82 "floppy peripheral", "tp peripheral", "modem peripheral",
83 "monitor peripheral", "printer peripheral", "pointer peripheral",
84 "keyboard peripheral", "terminal peripheral", "line peripheral",
85 "net peripheral", "misc peripheral", "anonymous"
86};
87
88static char *iflags[] = {
89 "bogus", "read only", "removable", "console in", "console out",
90 "input", "output"
91};
92
93static void __init
94dump_component(pcomponent *p)
95{
96 prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
97 p, classes[p->class], types[p->type],
98 iflags[p->iflags], p->vers, p->rev);
99 prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
100 p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
101}
102
103static void __init
104traverse(pcomponent *p, int op)
105{
106 dump_component(p);
107 if(ArcGetChild(p))
108 traverse(ArcGetChild(p), 1);
109 if(ArcGetPeer(p) && op)
110 traverse(ArcGetPeer(p), 1);
111}
112
113void __init
114prom_testtree(void)
115{
116 pcomponent *p;
117
118 p = ArcGetChild(PROM_NULL_COMPONENT);
119 dump_component(p);
120 p = ArcGetChild(p);
121 while(p) {
122 dump_component(p);
123 p = ArcGetPeer(p);
124 }
125}
126
127#endif /* DEBUG_PROM_TREE */
diff --git a/arch/mips/au1000/common/Makefile b/arch/mips/au1000/common/Makefile
new file mode 100644
index 000000000000..594b75e5e080
--- /dev/null
+++ b/arch/mips/au1000/common/Makefile
@@ -0,0 +1,15 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Alchemy Au1000 CPU, generic files.
7#
8
9obj-y += prom.o int-handler.o irq.o puts.o time.o reset.o \
10 au1xxx_irqmap.o clocks.o platform.o power.o setup.o \
11 sleeper.o cputable.o dma.o dbdma.o
12
13obj-$(CONFIG_AU1X00_USB_DEVICE) += usbdev.o
14obj-$(CONFIG_KGDB) += dbg_io.o
15obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/mips/au1000/common/au1xxx_irqmap.c b/arch/mips/au1000/common/au1xxx_irqmap.c
new file mode 100644
index 000000000000..8a0f39f67c59
--- /dev/null
+++ b/arch/mips/au1000/common/au1xxx_irqmap.c
@@ -0,0 +1,224 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx processor specific IRQ tables
4 *
5 * Copyright 2004 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/config.h>
29#include <linux/errno.h>
30#include <linux/init.h>
31#include <linux/irq.h>
32#include <linux/kernel_stat.h>
33#include <linux/module.h>
34#include <linux/signal.h>
35#include <linux/sched.h>
36#include <linux/types.h>
37#include <linux/interrupt.h>
38#include <linux/ioport.h>
39#include <linux/timex.h>
40#include <linux/slab.h>
41#include <linux/random.h>
42#include <linux/delay.h>
43#include <linux/bitops.h>
44
45#include <asm/bootinfo.h>
46#include <asm/io.h>
47#include <asm/mipsregs.h>
48#include <asm/system.h>
49#include <asm/mach-au1x00/au1000.h>
50
51/* The IC0 interrupt table. This is processor, rather than
52 * board dependent, so no reason to keep this info in the board
53 * dependent files.
54 *
55 * Careful if you change match 2 request!
56 * The interrupt handler is called directly from the low level dispatch code.
57 */
58au1xxx_irq_map_t au1xxx_ic0_map[] = {
59
60#if defined(CONFIG_SOC_AU1000)
61 { AU1000_UART0_INT, INTC_INT_HIGH_LEVEL, 0},
62 { AU1000_UART1_INT, INTC_INT_HIGH_LEVEL, 0},
63 { AU1000_UART2_INT, INTC_INT_HIGH_LEVEL, 0},
64 { AU1000_UART3_INT, INTC_INT_HIGH_LEVEL, 0},
65 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0},
66 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0},
67 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0},
68 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0},
69 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0},
70 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0},
71 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0},
72 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0},
73 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0},
74 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0},
75 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
76 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
77 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
78 { AU1000_TOY_MATCH2_INT, INTC_INT_RISE_EDGE, 1 },
79 { AU1000_RTC_INT, INTC_INT_RISE_EDGE, 0 },
80 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
81 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
82 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
83 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0},
84 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0},
85 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
86 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
87 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
88 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
89 { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0},
90 { AU1000_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0},
91 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
92
93#elif defined(CONFIG_SOC_AU1500)
94
95 { AU1500_UART0_INT, INTC_INT_HIGH_LEVEL, 0},
96 { AU1000_PCI_INTA, INTC_INT_LOW_LEVEL, 0 },
97 { AU1000_PCI_INTB, INTC_INT_LOW_LEVEL, 0 },
98 { AU1500_UART3_INT, INTC_INT_HIGH_LEVEL, 0},
99 { AU1000_PCI_INTC, INTC_INT_LOW_LEVEL, 0 },
100 { AU1000_PCI_INTD, INTC_INT_LOW_LEVEL, 0 },
101 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0},
102 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0},
103 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0},
104 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0},
105 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0},
106 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0},
107 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0},
108 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0},
109 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
110 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
111 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
112 { AU1000_TOY_MATCH2_INT, INTC_INT_RISE_EDGE, 1 },
113 { AU1000_RTC_INT, INTC_INT_RISE_EDGE, 0 },
114 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
115 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
116 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
117 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
118 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
119 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
120 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
121 { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0},
122 { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0},
123 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
124
125#elif defined(CONFIG_SOC_AU1100)
126
127 { AU1100_UART0_INT, INTC_INT_HIGH_LEVEL, 0},
128 { AU1100_UART1_INT, INTC_INT_HIGH_LEVEL, 0},
129 { AU1100_SD_INT, INTC_INT_HIGH_LEVEL, 0},
130 { AU1100_UART3_INT, INTC_INT_HIGH_LEVEL, 0},
131 { AU1000_SSI0_INT, INTC_INT_HIGH_LEVEL, 0},
132 { AU1000_SSI1_INT, INTC_INT_HIGH_LEVEL, 0},
133 { AU1000_DMA_INT_BASE, INTC_INT_HIGH_LEVEL, 0},
134 { AU1000_DMA_INT_BASE+1, INTC_INT_HIGH_LEVEL, 0},
135 { AU1000_DMA_INT_BASE+2, INTC_INT_HIGH_LEVEL, 0},
136 { AU1000_DMA_INT_BASE+3, INTC_INT_HIGH_LEVEL, 0},
137 { AU1000_DMA_INT_BASE+4, INTC_INT_HIGH_LEVEL, 0},
138 { AU1000_DMA_INT_BASE+5, INTC_INT_HIGH_LEVEL, 0},
139 { AU1000_DMA_INT_BASE+6, INTC_INT_HIGH_LEVEL, 0},
140 { AU1000_DMA_INT_BASE+7, INTC_INT_HIGH_LEVEL, 0},
141 { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 },
142 { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
143 { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
144 { AU1000_TOY_MATCH2_INT, INTC_INT_RISE_EDGE, 1 },
145 { AU1000_RTC_INT, INTC_INT_RISE_EDGE, 0 },
146 { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
147 { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
148 { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
149 { AU1000_IRDA_TX_INT, INTC_INT_HIGH_LEVEL, 0},
150 { AU1000_IRDA_RX_INT, INTC_INT_HIGH_LEVEL, 0},
151 { AU1000_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
152 { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
153 { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
154 { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 },
155 { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0},
156 /*{ AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0},*/
157 { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0},
158 { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 },
159
160#elif defined(CONFIG_SOC_AU1550)
161
162 { AU1550_UART0_INT, INTC_INT_HIGH_LEVEL, 0},
163 { AU1550_PCI_INTA, INTC_INT_LOW_LEVEL, 0 },
164 { AU1550_PCI_INTB, INTC_INT_LOW_LEVEL, 0 },
165 { AU1550_DDMA_INT, INTC_INT_HIGH_LEVEL, 0},
166 { AU1550_CRYPTO_INT, INTC_INT_HIGH_LEVEL, 0},
167 { AU1550_PCI_INTC, INTC_INT_LOW_LEVEL, 0 },
168 { AU1550_PCI_INTD, INTC_INT_LOW_LEVEL, 0 },
169 { AU1550_PCI_RST_INT, INTC_INT_LOW_LEVEL, 0 },
170 { AU1550_UART1_INT, INTC_INT_HIGH_LEVEL, 0},
171 { AU1550_UART3_INT, INTC_INT_HIGH_LEVEL, 0},
172 { AU1550_PSC0_INT, INTC_INT_HIGH_LEVEL, 0},
173 { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0},
174 { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0},
175 { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0},
176 { AU1550_TOY_INT, INTC_INT_RISE_EDGE, 0 },
177 { AU1550_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
178 { AU1550_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
179 { AU1550_TOY_MATCH2_INT, INTC_INT_RISE_EDGE, 1 },
180 { AU1550_RTC_INT, INTC_INT_RISE_EDGE, 0 },
181 { AU1550_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
182 { AU1550_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
183 { AU1550_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
184 { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0},
185 { AU1550_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 },
186 { AU1550_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 },
187 { AU1550_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 },
188 { AU1550_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0},
189 { AU1550_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0},
190
191#elif defined(CONFIG_SOC_AU1200)
192
193 { AU1200_UART0_INT, INTC_INT_HIGH_LEVEL, 0},
194 { AU1200_SWT_INT, INTC_INT_RISE_EDGE, 0 },
195 { AU1200_SD_INT, INTC_INT_HIGH_LEVEL, 0},
196 { AU1200_DDMA_INT, INTC_INT_HIGH_LEVEL, 0},
197 { AU1200_MAE_BE_INT, INTC_INT_HIGH_LEVEL, 0 },
198 { AU1200_UART1_INT, INTC_INT_HIGH_LEVEL, 0},
199 { AU1200_MAE_FE_INT, INTC_INT_HIGH_LEVEL, 0 },
200 { AU1200_PSC0_INT, INTC_INT_HIGH_LEVEL, 0},
201 { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0},
202 { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0},
203 { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0},
204 { AU1200_TOY_INT, INTC_INT_RISE_EDGE, 0 },
205 { AU1200_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
206 { AU1200_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
207 { AU1200_TOY_MATCH2_INT, INTC_INT_RISE_EDGE, 1 },
208 { AU1200_RTC_INT, INTC_INT_RISE_EDGE, 0 },
209 { AU1200_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 },
210 { AU1200_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 },
211 { AU1200_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 },
212 { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0},
213 { AU1200_USB_INT, INTC_INT_HIGH_LEVEL, 0 },
214 { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0},
215 { AU1200_MAE_BOTH_INT, INTC_INT_HIGH_LEVEL, 0},
216
217#else
218#error "Error: Unknown Alchemy SOC"
219#endif
220
221};
222
223int au1xxx_ic0_nr_irqs = sizeof(au1xxx_ic0_map)/sizeof(au1xxx_irq_map_t);
224
diff --git a/arch/mips/au1000/common/clocks.c b/arch/mips/au1000/common/clocks.c
new file mode 100644
index 000000000000..3ce6cace0eb0
--- /dev/null
+++ b/arch/mips/au1000/common/clocks.c
@@ -0,0 +1,96 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Simple Au1000 clocks routines.
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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/module.h>
31#include <asm/mach-au1x00/au1000.h>
32
33static unsigned int au1x00_clock; // Hz
34static unsigned int lcd_clock; // KHz
35static unsigned long uart_baud_base;
36
37/*
38 * Set the au1000_clock
39 */
40void set_au1x00_speed(unsigned int new_freq)
41{
42 au1x00_clock = new_freq;
43}
44
45unsigned int get_au1x00_speed(void)
46{
47 return au1x00_clock;
48}
49
50
51
52/*
53 * The UART baud base is not known at compile time ... if
54 * we want to be able to use the same code on different
55 * speed CPUs.
56 */
57unsigned long get_au1x00_uart_baud_base(void)
58{
59 return uart_baud_base;
60}
61
62void set_au1x00_uart_baud_base(unsigned long new_baud_base)
63{
64 uart_baud_base = new_baud_base;
65}
66
67/*
68 * Calculate the Au1x00's LCD clock based on the current
69 * cpu clock and the system bus clock, and try to keep it
70 * below 40 MHz (the Pb1000 board can lock-up if the LCD
71 * clock is over 40 MHz).
72 */
73void set_au1x00_lcd_clock(void)
74{
75 unsigned int static_cfg0;
76 unsigned int sys_busclk =
77 (get_au1x00_speed()/1000) /
78 ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2);
79
80 static_cfg0 = au_readl(MEM_STCFG0);
81
82 if (static_cfg0 & (1<<11))
83 lcd_clock = sys_busclk / 5; /* note: BCLK switching fails with D5 */
84 else
85 lcd_clock = sys_busclk / 4;
86
87 if (lcd_clock > 50000) /* Epson MAX */
88 printk("warning: LCD clock too high (%d KHz)\n", lcd_clock);
89}
90
91unsigned int get_au1x00_lcd_clock(void)
92{
93 return lcd_clock;
94}
95
96EXPORT_SYMBOL(get_au1x00_lcd_clock);
diff --git a/arch/mips/au1000/common/cputable.c b/arch/mips/au1000/common/cputable.c
new file mode 100644
index 000000000000..f5521dfccfd6
--- /dev/null
+++ b/arch/mips/au1000/common/cputable.c
@@ -0,0 +1,55 @@
1/*
2 * arch/mips/au1000/common/cputable.c
3 *
4 * Copyright (C) 2004 Dan Malek (dan@embeddededge.com)
5 * Copied from PowerPC and updated for Alchemy Au1xxx processors.
6 *
7 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14#include <linux/string.h>
15#include <linux/sched.h>
16#include <linux/threads.h>
17#include <linux/init.h>
18#include <asm/mach-au1x00/au1000.h>
19
20struct cpu_spec* cur_cpu_spec[NR_CPUS];
21
22/* With some thought, we can probably use the mask to reduce the
23 * size of the table.
24 */
25struct cpu_spec cpu_specs[] = {
26 { 0xffffffff, 0x00030100, "Au1000 DA", 1, 0 },
27 { 0xffffffff, 0x00030201, "Au1000 HA", 1, 0 },
28 { 0xffffffff, 0x00030202, "Au1000 HB", 1, 0 },
29 { 0xffffffff, 0x00030203, "Au1000 HC", 1, 1 },
30 { 0xffffffff, 0x00030204, "Au1000 HD", 1, 1 },
31 { 0xffffffff, 0x01030200, "Au1500 AB", 1, 1 },
32 { 0xffffffff, 0x01030201, "Au1500 AC", 0, 1 },
33 { 0xffffffff, 0x01030202, "Au1500 AD", 0, 1 },
34 { 0xffffffff, 0x02030200, "Au1100 AB", 1, 1 },
35 { 0xffffffff, 0x02030201, "Au1100 BA", 1, 1 },
36 { 0xffffffff, 0x02030202, "Au1100 BC", 1, 1 },
37 { 0xffffffff, 0x02030203, "Au1100 BD", 0, 1 },
38 { 0xffffffff, 0x02030204, "Au1100 BE", 0, 1 },
39 { 0xffffffff, 0x03030200, "Au1550 AA", 0, 1 },
40 { 0xffffffff, 0x04030200, "Au1200 AA", 0, 1 },
41 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0 },
42};
43
44void
45set_cpuspec(void)
46{
47 struct cpu_spec *sp;
48 u32 prid;
49
50 prid = read_c0_prid();
51 sp = cpu_specs;
52 while ((prid & sp->prid_mask) != sp->prid_value)
53 sp++;
54 cur_cpu_spec[0] = sp;
55}
diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
new file mode 100644
index 000000000000..adfc3172aace
--- /dev/null
+++ b/arch/mips/au1000/common/dbdma.c
@@ -0,0 +1,836 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * The Descriptor Based DMA channel manager that first appeared
5 * on the Au1550. I started with dma.c, but I think all that is
6 * left is this initial comment :-)
7 *
8 * Copyright 2004 Embedded Edge, LLC
9 * dan@embeddededge.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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 *
31 */
32#include <linux/config.h>
33#include <linux/kernel.h>
34#include <linux/errno.h>
35#include <linux/sched.h>
36#include <linux/slab.h>
37#include <linux/spinlock.h>
38#include <linux/string.h>
39#include <linux/delay.h>
40#include <linux/interrupt.h>
41#include <asm/mach-au1x00/au1000.h>
42#include <asm/mach-au1x00/au1xxx_dbdma.h>
43#include <asm/system.h>
44
45#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
46
47/*
48 * The Descriptor Based DMA supports up to 16 channels.
49 *
50 * There are 32 devices defined. We keep an internal structure
51 * of devices using these channels, along with additional
52 * information.
53 *
54 * We allocate the descriptors and allow access to them through various
55 * functions. The drivers allocate the data buffers and assign them
56 * to the descriptors.
57 */
58static DEFINE_SPINLOCK(au1xxx_dbdma_spin_lock);
59
60/* I couldn't find a macro that did this......
61*/
62#define ALIGN_ADDR(x, a) ((((u32)(x)) + (a-1)) & ~(a-1))
63
64static volatile dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE;
65static int dbdma_initialized;
66static void au1xxx_dbdma_init(void);
67
68typedef struct dbdma_device_table {
69 u32 dev_id;
70 u32 dev_flags;
71 u32 dev_tsize;
72 u32 dev_devwidth;
73 u32 dev_physaddr; /* If FIFO */
74 u32 dev_intlevel;
75 u32 dev_intpolarity;
76} dbdev_tab_t;
77
78typedef struct dbdma_chan_config {
79 u32 chan_flags;
80 u32 chan_index;
81 dbdev_tab_t *chan_src;
82 dbdev_tab_t *chan_dest;
83 au1x_dma_chan_t *chan_ptr;
84 au1x_ddma_desc_t *chan_desc_base;
85 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr;
86 void *chan_callparam;
87 void (*chan_callback)(int, void *, struct pt_regs *);
88} chan_tab_t;
89
90#define DEV_FLAGS_INUSE (1 << 0)
91#define DEV_FLAGS_ANYUSE (1 << 1)
92#define DEV_FLAGS_OUT (1 << 2)
93#define DEV_FLAGS_IN (1 << 3)
94
95static dbdev_tab_t dbdev_tab[] = {
96#ifdef CONFIG_SOC_AU1550
97 /* UARTS */
98 { DSCR_CMD0_UART0_TX, DEV_FLAGS_OUT, 0, 8, 0x11100004, 0, 0 },
99 { DSCR_CMD0_UART0_RX, DEV_FLAGS_IN, 0, 8, 0x11100000, 0, 0 },
100 { DSCR_CMD0_UART3_TX, DEV_FLAGS_OUT, 0, 8, 0x11400004, 0, 0 },
101 { DSCR_CMD0_UART3_RX, DEV_FLAGS_IN, 0, 8, 0x11400000, 0, 0 },
102
103 /* EXT DMA */
104 { DSCR_CMD0_DMA_REQ0, 0, 0, 0, 0x00000000, 0, 0 },
105 { DSCR_CMD0_DMA_REQ1, 0, 0, 0, 0x00000000, 0, 0 },
106 { DSCR_CMD0_DMA_REQ2, 0, 0, 0, 0x00000000, 0, 0 },
107 { DSCR_CMD0_DMA_REQ3, 0, 0, 0, 0x00000000, 0, 0 },
108
109 /* USB DEV */
110 { DSCR_CMD0_USBDEV_RX0, DEV_FLAGS_IN, 4, 8, 0x10200000, 0, 0 },
111 { DSCR_CMD0_USBDEV_TX0, DEV_FLAGS_OUT, 4, 8, 0x10200004, 0, 0 },
112 { DSCR_CMD0_USBDEV_TX1, DEV_FLAGS_OUT, 4, 8, 0x10200008, 0, 0 },
113 { DSCR_CMD0_USBDEV_TX2, DEV_FLAGS_OUT, 4, 8, 0x1020000c, 0, 0 },
114 { DSCR_CMD0_USBDEV_RX3, DEV_FLAGS_IN, 4, 8, 0x10200010, 0, 0 },
115 { DSCR_CMD0_USBDEV_RX4, DEV_FLAGS_IN, 4, 8, 0x10200014, 0, 0 },
116
117 /* PSC 0 */
118 { DSCR_CMD0_PSC0_TX, DEV_FLAGS_OUT, 0, 0, 0x11a0001c, 0, 0 },
119 { DSCR_CMD0_PSC0_RX, DEV_FLAGS_IN, 0, 0, 0x11a0001c, 0, 0 },
120
121 /* PSC 1 */
122 { DSCR_CMD0_PSC1_TX, DEV_FLAGS_OUT, 0, 0, 0x11b0001c, 0, 0 },
123 { DSCR_CMD0_PSC1_RX, DEV_FLAGS_IN, 0, 0, 0x11b0001c, 0, 0 },
124
125 /* PSC 2 */
126 { DSCR_CMD0_PSC2_TX, DEV_FLAGS_OUT, 0, 0, 0x10a0001c, 0, 0 },
127 { DSCR_CMD0_PSC2_RX, DEV_FLAGS_IN, 0, 0, 0x10a0001c, 0, 0 },
128
129 /* PSC 3 */
130 { DSCR_CMD0_PSC3_TX, DEV_FLAGS_OUT, 0, 0, 0x10b0001c, 0, 0 },
131 { DSCR_CMD0_PSC3_RX, DEV_FLAGS_IN, 0, 0, 0x10b0001c, 0, 0 },
132
133 { DSCR_CMD0_PCI_WRITE, 0, 0, 0, 0x00000000, 0, 0 }, /* PCI */
134 { DSCR_CMD0_NAND_FLASH, 0, 0, 0, 0x00000000, 0, 0 }, /* NAND */
135
136 /* MAC 0 */
137 { DSCR_CMD0_MAC0_RX, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
138 { DSCR_CMD0_MAC0_TX, DEV_FLAGS_OUT, 0, 0, 0x00000000, 0, 0 },
139
140 /* MAC 1 */
141 { DSCR_CMD0_MAC1_RX, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
142 { DSCR_CMD0_MAC1_TX, DEV_FLAGS_OUT, 0, 0, 0x00000000, 0, 0 },
143
144#endif /* CONFIG_SOC_AU1550 */
145
146#ifdef CONFIG_SOC_AU1200
147 { DSCR_CMD0_UART0_TX, DEV_FLAGS_OUT, 0, 8, 0x11100004, 0, 0 },
148 { DSCR_CMD0_UART0_RX, DEV_FLAGS_IN, 0, 8, 0x11100000, 0, 0 },
149 { DSCR_CMD0_UART1_TX, DEV_FLAGS_OUT, 0, 8, 0x11200004, 0, 0 },
150 { DSCR_CMD0_UART1_RX, DEV_FLAGS_IN, 0, 8, 0x11200000, 0, 0 },
151
152 { DSCR_CMD0_DMA_REQ0, 0, 0, 0, 0x00000000, 0, 0 },
153 { DSCR_CMD0_DMA_REQ1, 0, 0, 0, 0x00000000, 0, 0 },
154
155 { DSCR_CMD0_MAE_BE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
156 { DSCR_CMD0_MAE_FE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
157 { DSCR_CMD0_MAE_BOTH, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
158 { DSCR_CMD0_LCD, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
159
160 { DSCR_CMD0_SDMS_TX0, DEV_FLAGS_OUT, 0, 0, 0x00000000, 0, 0 },
161 { DSCR_CMD0_SDMS_RX0, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
162 { DSCR_CMD0_SDMS_TX1, DEV_FLAGS_OUT, 0, 0, 0x00000000, 0, 0 },
163 { DSCR_CMD0_SDMS_RX1, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
164
165 { DSCR_CMD0_AES_TX, DEV_FLAGS_OUT, 0, 0, 0x00000000, 0, 0 },
166 { DSCR_CMD0_AES_RX, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
167
168 { DSCR_CMD0_PSC0_TX, DEV_FLAGS_OUT, 0, 0, 0x11a0001c, 0, 0 },
169 { DSCR_CMD0_PSC0_RX, DEV_FLAGS_IN, 0, 0, 0x11a0001c, 0, 0 },
170 { DSCR_CMD0_PSC0_SYNC, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
171
172 { DSCR_CMD0_PSC1_TX, DEV_FLAGS_OUT, 0, 0, 0x11b0001c, 0, 0 },
173 { DSCR_CMD0_PSC1_RX, DEV_FLAGS_IN, 0, 0, 0x11b0001c, 0, 0 },
174 { DSCR_CMD0_PSC1_SYNC, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
175
176 { DSCR_CMD0_CIM_RXA, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
177 { DSCR_CMD0_CIM_RXB, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
178 { DSCR_CMD0_CIM_RXC, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
179 { DSCR_CMD0_CIM_SYNC, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
180
181 { DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 },
182
183#endif // CONFIG_SOC_AU1200
184
185 { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
186 { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
187};
188
189#define DBDEV_TAB_SIZE (sizeof(dbdev_tab) / sizeof(dbdev_tab_t))
190
191static chan_tab_t *chan_tab_ptr[NUM_DBDMA_CHANS];
192
193static dbdev_tab_t *
194find_dbdev_id (u32 id)
195{
196 int i;
197 dbdev_tab_t *p;
198 for (i = 0; i < DBDEV_TAB_SIZE; ++i) {
199 p = &dbdev_tab[i];
200 if (p->dev_id == id)
201 return p;
202 }
203 return NULL;
204}
205
206/* Allocate a channel and return a non-zero descriptor if successful.
207*/
208u32
209au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
210 void (*callback)(int, void *, struct pt_regs *), void *callparam)
211{
212 unsigned long flags;
213 u32 used, chan, rv;
214 u32 dcp;
215 int i;
216 dbdev_tab_t *stp, *dtp;
217 chan_tab_t *ctp;
218 volatile au1x_dma_chan_t *cp;
219
220 /* We do the intialization on the first channel allocation.
221 * We have to wait because of the interrupt handler initialization
222 * which can't be done successfully during board set up.
223 */
224 if (!dbdma_initialized)
225 au1xxx_dbdma_init();
226 dbdma_initialized = 1;
227
228 if ((srcid > DSCR_NDEV_IDS) || (destid > DSCR_NDEV_IDS))
229 return 0;
230
231 if ((stp = find_dbdev_id(srcid)) == NULL) return 0;
232 if ((dtp = find_dbdev_id(destid)) == NULL) return 0;
233
234 used = 0;
235 rv = 0;
236
237 /* Check to see if we can get both channels.
238 */
239 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
240 if (!(stp->dev_flags & DEV_FLAGS_INUSE) ||
241 (stp->dev_flags & DEV_FLAGS_ANYUSE)) {
242 /* Got source */
243 stp->dev_flags |= DEV_FLAGS_INUSE;
244 if (!(dtp->dev_flags & DEV_FLAGS_INUSE) ||
245 (dtp->dev_flags & DEV_FLAGS_ANYUSE)) {
246 /* Got destination */
247 dtp->dev_flags |= DEV_FLAGS_INUSE;
248 }
249 else {
250 /* Can't get dest. Release src.
251 */
252 stp->dev_flags &= ~DEV_FLAGS_INUSE;
253 used++;
254 }
255 }
256 else {
257 used++;
258 }
259 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
260
261 if (!used) {
262 /* Let's see if we can allocate a channel for it.
263 */
264 ctp = NULL;
265 chan = 0;
266 spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
267 for (i=0; i<NUM_DBDMA_CHANS; i++) {
268 if (chan_tab_ptr[i] == NULL) {
269 /* If kmalloc fails, it is caught below same
270 * as a channel not available.
271 */
272 ctp = kmalloc(sizeof(chan_tab_t), GFP_KERNEL);
273 chan_tab_ptr[i] = ctp;
274 ctp->chan_index = chan = i;
275 break;
276 }
277 }
278 spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
279
280 if (ctp != NULL) {
281 memset(ctp, 0, sizeof(chan_tab_t));
282 dcp = DDMA_CHANNEL_BASE;
283 dcp += (0x0100 * chan);
284 ctp->chan_ptr = (au1x_dma_chan_t *)dcp;
285 cp = (volatile au1x_dma_chan_t *)dcp;
286 ctp->chan_src = stp;
287 ctp->chan_dest = dtp;
288 ctp->chan_callback = callback;
289 ctp->chan_callparam = callparam;
290
291 /* Initialize channel configuration.
292 */
293 i = 0;
294 if (stp->dev_intlevel)
295 i |= DDMA_CFG_SED;
296 if (stp->dev_intpolarity)
297 i |= DDMA_CFG_SP;
298 if (dtp->dev_intlevel)
299 i |= DDMA_CFG_DED;
300 if (dtp->dev_intpolarity)
301 i |= DDMA_CFG_DP;
302 cp->ddma_cfg = i;
303 au_sync();
304
305 /* Return a non-zero value that can be used to
306 * find the channel information in subsequent
307 * operations.
308 */
309 rv = (u32)(&chan_tab_ptr[chan]);
310 }
311 else {
312 /* Release devices.
313 */
314 stp->dev_flags &= ~DEV_FLAGS_INUSE;
315 dtp->dev_flags &= ~DEV_FLAGS_INUSE;
316 }
317 }
318 return rv;
319}
320
321/* Set the device width if source or destination is a FIFO.
322 * Should be 8, 16, or 32 bits.
323 */
324u32
325au1xxx_dbdma_set_devwidth(u32 chanid, int bits)
326{
327 u32 rv;
328 chan_tab_t *ctp;
329 dbdev_tab_t *stp, *dtp;
330
331 ctp = *((chan_tab_t **)chanid);
332 stp = ctp->chan_src;
333 dtp = ctp->chan_dest;
334 rv = 0;
335
336 if (stp->dev_flags & DEV_FLAGS_IN) { /* Source in fifo */
337 rv = stp->dev_devwidth;
338 stp->dev_devwidth = bits;
339 }
340 if (dtp->dev_flags & DEV_FLAGS_OUT) { /* Destination out fifo */
341 rv = dtp->dev_devwidth;
342 dtp->dev_devwidth = bits;
343 }
344
345 return rv;
346}
347
348/* Allocate a descriptor ring, initializing as much as possible.
349*/
350u32
351au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
352{
353 int i;
354 u32 desc_base, srcid, destid;
355 u32 cmd0, cmd1, src1, dest1;
356 u32 src0, dest0;
357 chan_tab_t *ctp;
358 dbdev_tab_t *stp, *dtp;
359 au1x_ddma_desc_t *dp;
360
361 /* I guess we could check this to be within the
362 * range of the table......
363 */
364 ctp = *((chan_tab_t **)chanid);
365 stp = ctp->chan_src;
366 dtp = ctp->chan_dest;
367
368 /* The descriptors must be 32-byte aligned. There is a
369 * possibility the allocation will give us such an address,
370 * and if we try that first we are likely to not waste larger
371 * slabs of memory.
372 */
373 desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t), GFP_KERNEL);
374 if (desc_base == 0)
375 return 0;
376
377 if (desc_base & 0x1f) {
378 /* Lost....do it again, allocate extra, and round
379 * the address base.
380 */
381 kfree((const void *)desc_base);
382 i = entries * sizeof(au1x_ddma_desc_t);
383 i += (sizeof(au1x_ddma_desc_t) - 1);
384 if ((desc_base = (u32)kmalloc(i, GFP_KERNEL)) == 0)
385 return 0;
386
387 desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t));
388 }
389 dp = (au1x_ddma_desc_t *)desc_base;
390
391 /* Keep track of the base descriptor.
392 */
393 ctp->chan_desc_base = dp;
394
395 /* Initialize the rings with as much information as we know.
396 */
397 srcid = stp->dev_id;
398 destid = dtp->dev_id;
399
400 cmd0 = cmd1 = src1 = dest1 = 0;
401 src0 = dest0 = 0;
402
403 cmd0 |= DSCR_CMD0_SID(srcid);
404 cmd0 |= DSCR_CMD0_DID(destid);
405 cmd0 |= DSCR_CMD0_IE | DSCR_CMD0_CV;
406 cmd0 |= DSCR_CMD0_ST(DSCR_CMD0_ST_CURRENT);
407
408 switch (stp->dev_devwidth) {
409 case 8:
410 cmd0 |= DSCR_CMD0_SW(DSCR_CMD0_BYTE);
411 break;
412 case 16:
413 cmd0 |= DSCR_CMD0_SW(DSCR_CMD0_HALFWORD);
414 break;
415 case 32:
416 default:
417 cmd0 |= DSCR_CMD0_SW(DSCR_CMD0_WORD);
418 break;
419 }
420
421 switch (dtp->dev_devwidth) {
422 case 8:
423 cmd0 |= DSCR_CMD0_DW(DSCR_CMD0_BYTE);
424 break;
425 case 16:
426 cmd0 |= DSCR_CMD0_DW(DSCR_CMD0_HALFWORD);
427 break;
428 case 32:
429 default:
430 cmd0 |= DSCR_CMD0_DW(DSCR_CMD0_WORD);
431 break;
432 }
433
434 /* If the device is marked as an in/out FIFO, ensure it is
435 * set non-coherent.
436 */
437 if (stp->dev_flags & DEV_FLAGS_IN)
438 cmd0 |= DSCR_CMD0_SN; /* Source in fifo */
439 if (dtp->dev_flags & DEV_FLAGS_OUT)
440 cmd0 |= DSCR_CMD0_DN; /* Destination out fifo */
441
442 /* Set up source1. For now, assume no stride and increment.
443 * A channel attribute update can change this later.
444 */
445 switch (stp->dev_tsize) {
446 case 1:
447 src1 |= DSCR_SRC1_STS(DSCR_xTS_SIZE1);
448 break;
449 case 2:
450 src1 |= DSCR_SRC1_STS(DSCR_xTS_SIZE2);
451 break;
452 case 4:
453 src1 |= DSCR_SRC1_STS(DSCR_xTS_SIZE4);
454 break;
455 case 8:
456 default:
457 src1 |= DSCR_SRC1_STS(DSCR_xTS_SIZE8);
458 break;
459 }
460
461 /* If source input is fifo, set static address.
462 */
463 if (stp->dev_flags & DEV_FLAGS_IN) {
464 src0 = stp->dev_physaddr;
465 src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC);
466 }
467
468 /* Set up dest1. For now, assume no stride and increment.
469 * A channel attribute update can change this later.
470 */
471 switch (dtp->dev_tsize) {
472 case 1:
473 dest1 |= DSCR_DEST1_DTS(DSCR_xTS_SIZE1);
474 break;
475 case 2:
476 dest1 |= DSCR_DEST1_DTS(DSCR_xTS_SIZE2);
477 break;
478 case 4:
479 dest1 |= DSCR_DEST1_DTS(DSCR_xTS_SIZE4);
480 break;
481 case 8:
482 default:
483 dest1 |= DSCR_DEST1_DTS(DSCR_xTS_SIZE8);
484 break;
485 }
486
487 /* If destination output is fifo, set static address.
488 */
489 if (dtp->dev_flags & DEV_FLAGS_OUT) {
490 dest0 = dtp->dev_physaddr;
491 dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC);
492 }
493
494 for (i=0; i<entries; i++) {
495 dp->dscr_cmd0 = cmd0;
496 dp->dscr_cmd1 = cmd1;
497 dp->dscr_source0 = src0;
498 dp->dscr_source1 = src1;
499 dp->dscr_dest0 = dest0;
500 dp->dscr_dest1 = dest1;
501 dp->dscr_stat = 0;
502 dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(dp + 1));
503 dp++;
504 }
505
506 /* Make last descrptor point to the first.
507 */
508 dp--;
509 dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(ctp->chan_desc_base));
510 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base;
511
512 return (u32)(ctp->chan_desc_base);
513}
514
515/* Put a source buffer into the DMA ring.
516 * This updates the source pointer and byte count. Normally used
517 * for memory to fifo transfers.
518 */
519u32
520au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes)
521{
522 chan_tab_t *ctp;
523 au1x_ddma_desc_t *dp;
524
525 /* I guess we could check this to be within the
526 * range of the table......
527 */
528 ctp = *((chan_tab_t **)chanid);
529
530 /* We should have multiple callers for a particular channel,
531 * an interrupt doesn't affect this pointer nor the descriptor,
532 * so no locking should be needed.
533 */
534 dp = ctp->put_ptr;
535
536 /* If the descriptor is valid, we are way ahead of the DMA
537 * engine, so just return an error condition.
538 */
539 if (dp->dscr_cmd0 & DSCR_CMD0_V) {
540 return 0;
541 }
542
543 /* Load up buffer address and byte count.
544 */
545 dp->dscr_source0 = virt_to_phys(buf);
546 dp->dscr_cmd1 = nbytes;
547 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
548 ctp->chan_ptr->ddma_dbell = 0xffffffff; /* Make it go */
549
550 /* Get next descriptor pointer.
551 */
552 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
553
554 /* return something not zero.
555 */
556 return nbytes;
557}
558
559/* Put a destination buffer into the DMA ring.
560 * This updates the destination pointer and byte count. Normally used
561 * to place an empty buffer into the ring for fifo to memory transfers.
562 */
563u32
564au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes)
565{
566 chan_tab_t *ctp;
567 au1x_ddma_desc_t *dp;
568
569 /* I guess we could check this to be within the
570 * range of the table......
571 */
572 ctp = *((chan_tab_t **)chanid);
573
574 /* We should have multiple callers for a particular channel,
575 * an interrupt doesn't affect this pointer nor the descriptor,
576 * so no locking should be needed.
577 */
578 dp = ctp->put_ptr;
579
580 /* If the descriptor is valid, we are way ahead of the DMA
581 * engine, so just return an error condition.
582 */
583 if (dp->dscr_cmd0 & DSCR_CMD0_V)
584 return 0;
585
586 /* Load up buffer address and byte count.
587 */
588 dp->dscr_dest0 = virt_to_phys(buf);
589 dp->dscr_cmd1 = nbytes;
590 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
591
592 /* Get next descriptor pointer.
593 */
594 ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
595
596 /* return something not zero.
597 */
598 return nbytes;
599}
600
601/* Get a destination buffer into the DMA ring.
602 * Normally used to get a full buffer from the ring during fifo
603 * to memory transfers. This does not set the valid bit, you will
604 * have to put another destination buffer to keep the DMA going.
605 */
606u32
607au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes)
608{
609 chan_tab_t *ctp;
610 au1x_ddma_desc_t *dp;
611 u32 rv;
612
613 /* I guess we could check this to be within the
614 * range of the table......
615 */
616 ctp = *((chan_tab_t **)chanid);
617
618 /* We should have multiple callers for a particular channel,
619 * an interrupt doesn't affect this pointer nor the descriptor,
620 * so no locking should be needed.
621 */
622 dp = ctp->get_ptr;
623
624 /* If the descriptor is valid, we are way ahead of the DMA
625 * engine, so just return an error condition.
626 */
627 if (dp->dscr_cmd0 & DSCR_CMD0_V)
628 return 0;
629
630 /* Return buffer address and byte count.
631 */
632 *buf = (void *)(phys_to_virt(dp->dscr_dest0));
633 *nbytes = dp->dscr_cmd1;
634 rv = dp->dscr_stat;
635
636 /* Get next descriptor pointer.
637 */
638 ctp->get_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
639
640 /* return something not zero.
641 */
642 return rv;
643}
644
645void
646au1xxx_dbdma_stop(u32 chanid)
647{
648 chan_tab_t *ctp;
649 volatile au1x_dma_chan_t *cp;
650 int halt_timeout = 0;
651
652 ctp = *((chan_tab_t **)chanid);
653
654 cp = ctp->chan_ptr;
655 cp->ddma_cfg &= ~DDMA_CFG_EN; /* Disable channel */
656 au_sync();
657 while (!(cp->ddma_stat & DDMA_STAT_H)) {
658 udelay(1);
659 halt_timeout++;
660 if (halt_timeout > 100) {
661 printk("warning: DMA channel won't halt\n");
662 break;
663 }
664 }
665 /* clear current desc valid and doorbell */
666 cp->ddma_stat |= (DDMA_STAT_DB | DDMA_STAT_V);
667 au_sync();
668}
669
670/* Start using the current descriptor pointer. If the dbdma encounters
671 * a not valid descriptor, it will stop. In this case, we can just
672 * continue by adding a buffer to the list and starting again.
673 */
674void
675au1xxx_dbdma_start(u32 chanid)
676{
677 chan_tab_t *ctp;
678 volatile au1x_dma_chan_t *cp;
679
680 ctp = *((chan_tab_t **)chanid);
681
682 cp = ctp->chan_ptr;
683 cp->ddma_desptr = virt_to_phys(ctp->cur_ptr);
684 cp->ddma_cfg |= DDMA_CFG_EN; /* Enable channel */
685 au_sync();
686 cp->ddma_dbell = 0xffffffff; /* Make it go */
687 au_sync();
688}
689
690void
691au1xxx_dbdma_reset(u32 chanid)
692{
693 chan_tab_t *ctp;
694 au1x_ddma_desc_t *dp;
695
696 au1xxx_dbdma_stop(chanid);
697
698 ctp = *((chan_tab_t **)chanid);
699 ctp->get_ptr = ctp->put_ptr = ctp->cur_ptr = ctp->chan_desc_base;
700
701 /* Run through the descriptors and reset the valid indicator.
702 */
703 dp = ctp->chan_desc_base;
704
705 do {
706 dp->dscr_cmd0 &= ~DSCR_CMD0_V;
707 dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
708 } while (dp != ctp->chan_desc_base);
709}
710
711u32
712au1xxx_get_dma_residue(u32 chanid)
713{
714 chan_tab_t *ctp;
715 volatile au1x_dma_chan_t *cp;
716 u32 rv;
717
718 ctp = *((chan_tab_t **)chanid);
719 cp = ctp->chan_ptr;
720
721 /* This is only valid if the channel is stopped.
722 */
723 rv = cp->ddma_bytecnt;
724 au_sync();
725
726 return rv;
727}
728
729void
730au1xxx_dbdma_chan_free(u32 chanid)
731{
732 chan_tab_t *ctp;
733 dbdev_tab_t *stp, *dtp;
734
735 ctp = *((chan_tab_t **)chanid);
736 stp = ctp->chan_src;
737 dtp = ctp->chan_dest;
738
739 au1xxx_dbdma_stop(chanid);
740
741 if (ctp->chan_desc_base != NULL)
742 kfree(ctp->chan_desc_base);
743
744 stp->dev_flags &= ~DEV_FLAGS_INUSE;
745 dtp->dev_flags &= ~DEV_FLAGS_INUSE;
746 chan_tab_ptr[ctp->chan_index] = NULL;
747
748 kfree(ctp);
749}
750
751static irqreturn_t
752dbdma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
753{
754 u32 intstat;
755 u32 chan_index;
756 chan_tab_t *ctp;
757 au1x_ddma_desc_t *dp;
758 volatile au1x_dma_chan_t *cp;
759
760 intstat = dbdma_gptr->ddma_intstat;
761 au_sync();
762 chan_index = au_ffs(intstat) - 1;
763
764 ctp = chan_tab_ptr[chan_index];
765 cp = ctp->chan_ptr;
766 dp = ctp->cur_ptr;
767
768 /* Reset interrupt.
769 */
770 cp->ddma_irq = 0;
771 au_sync();
772
773 if (ctp->chan_callback)
774 (ctp->chan_callback)(irq, ctp->chan_callparam, regs);
775
776 ctp->cur_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
777
778 return IRQ_HANDLED;
779}
780
781static void
782au1xxx_dbdma_init(void)
783{
784 dbdma_gptr->ddma_config = 0;
785 dbdma_gptr->ddma_throttle = 0;
786 dbdma_gptr->ddma_inten = 0xffff;
787 au_sync();
788
789 if (request_irq(AU1550_DDMA_INT, dbdma_interrupt, SA_INTERRUPT,
790 "Au1xxx dbdma", (void *)dbdma_gptr))
791 printk("Can't get 1550 dbdma irq");
792}
793
794void
795au1xxx_dbdma_dump(u32 chanid)
796{
797 chan_tab_t *ctp;
798 au1x_ddma_desc_t *dp;
799 dbdev_tab_t *stp, *dtp;
800 volatile au1x_dma_chan_t *cp;
801
802 ctp = *((chan_tab_t **)chanid);
803 stp = ctp->chan_src;
804 dtp = ctp->chan_dest;
805 cp = ctp->chan_ptr;
806
807 printk("Chan %x, stp %x (dev %d) dtp %x (dev %d) \n",
808 (u32)ctp, (u32)stp, stp - dbdev_tab, (u32)dtp, dtp - dbdev_tab);
809 printk("desc base %x, get %x, put %x, cur %x\n",
810 (u32)(ctp->chan_desc_base), (u32)(ctp->get_ptr),
811 (u32)(ctp->put_ptr), (u32)(ctp->cur_ptr));
812
813 printk("dbdma chan %x\n", (u32)cp);
814 printk("cfg %08x, desptr %08x, statptr %08x\n",
815 cp->ddma_cfg, cp->ddma_desptr, cp->ddma_statptr);
816 printk("dbell %08x, irq %08x, stat %08x, bytecnt %08x\n",
817 cp->ddma_dbell, cp->ddma_irq, cp->ddma_stat, cp->ddma_bytecnt);
818
819
820 /* Run through the descriptors
821 */
822 dp = ctp->chan_desc_base;
823
824 do {
825 printk("dp %08x, cmd0 %08x, cmd1 %08x\n",
826 (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1);
827 printk("src0 %08x, src1 %08x, dest0 %08x\n",
828 dp->dscr_source0, dp->dscr_source1, dp->dscr_dest0);
829 printk("dest1 %08x, stat %08x, nxtptr %08x\n",
830 dp->dscr_dest1, dp->dscr_stat, dp->dscr_nxtptr);
831 dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
832 } while (dp != ctp->chan_desc_base);
833}
834
835#endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */
836
diff --git a/arch/mips/au1000/common/dbg_io.c b/arch/mips/au1000/common/dbg_io.c
new file mode 100644
index 000000000000..7bc768e558db
--- /dev/null
+++ b/arch/mips/au1000/common/dbg_io.c
@@ -0,0 +1,122 @@
1
2#include <linux/config.h>
3#include <asm/io.h>
4#include <asm/mach-au1x00/au1000.h>
5
6#ifdef CONFIG_KGDB
7
8/*
9 * FIXME the user should be able to select the
10 * uart to be used for debugging.
11 */
12#define DEBUG_BASE UART_DEBUG_BASE
13/**/
14
15/* we need uint32 uint8 */
16/* #include "types.h" */
17typedef unsigned char uint8;
18typedef unsigned int uint32;
19
20#define UART16550_BAUD_2400 2400
21#define UART16550_BAUD_4800 4800
22#define UART16550_BAUD_9600 9600
23#define UART16550_BAUD_19200 19200
24#define UART16550_BAUD_38400 38400
25#define UART16550_BAUD_57600 57600
26#define UART16550_BAUD_115200 115200
27
28#define UART16550_PARITY_NONE 0
29#define UART16550_PARITY_ODD 0x08
30#define UART16550_PARITY_EVEN 0x18
31#define UART16550_PARITY_MARK 0x28
32#define UART16550_PARITY_SPACE 0x38
33
34#define UART16550_DATA_5BIT 0x0
35#define UART16550_DATA_6BIT 0x1
36#define UART16550_DATA_7BIT 0x2
37#define UART16550_DATA_8BIT 0x3
38
39#define UART16550_STOP_1BIT 0x0
40#define UART16550_STOP_2BIT 0x4
41
42
43#define UART_RX 0 /* Receive buffer */
44#define UART_TX 4 /* Transmit buffer */
45#define UART_IER 8 /* Interrupt Enable Register */
46#define UART_IIR 0xC /* Interrupt ID Register */
47#define UART_FCR 0x10 /* FIFO Control Register */
48#define UART_LCR 0x14 /* Line Control Register */
49#define UART_MCR 0x18 /* Modem Control Register */
50#define UART_LSR 0x1C /* Line Status Register */
51#define UART_MSR 0x20 /* Modem Status Register */
52#define UART_CLK 0x28 /* Baud Rat4e Clock Divider */
53#define UART_MOD_CNTRL 0x100 /* Module Control */
54
55/* memory-mapped read/write of the port */
56#define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff)
57#define UART16550_WRITE(y,z) (au_writel(z&0xff, DEBUG_BASE + y))
58
59extern unsigned long get_au1x00_uart_baud_base(void);
60extern unsigned long cal_r4koff(void);
61
62void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
63{
64
65 if (UART16550_READ(UART_MOD_CNTRL) != 0x3) {
66 UART16550_WRITE(UART_MOD_CNTRL, 3);
67 }
68 cal_r4koff();
69
70 /* disable interrupts */
71 UART16550_WRITE(UART_IER, 0);
72
73 /* set up baud rate */
74 {
75 uint32 divisor;
76
77 /* set divisor */
78 divisor = get_au1x00_uart_baud_base() / baud;
79 UART16550_WRITE(UART_CLK, divisor & 0xffff);
80 }
81
82 /* set data format */
83 UART16550_WRITE(UART_LCR, (data | parity | stop));
84}
85
86static int remoteDebugInitialized = 0;
87
88uint8 getDebugChar(void)
89{
90 if (!remoteDebugInitialized) {
91 remoteDebugInitialized = 1;
92 debugInit(UART16550_BAUD_115200,
93 UART16550_DATA_8BIT,
94 UART16550_PARITY_NONE,
95 UART16550_STOP_1BIT);
96 }
97
98 while((UART16550_READ(UART_LSR) & 0x1) == 0);
99 return UART16550_READ(UART_RX);
100}
101
102
103int putDebugChar(uint8 byte)
104{
105// int i;
106
107 if (!remoteDebugInitialized) {
108 remoteDebugInitialized = 1;
109 debugInit(UART16550_BAUD_115200,
110 UART16550_DATA_8BIT,
111 UART16550_PARITY_NONE,
112 UART16550_STOP_1BIT);
113 }
114
115 while ((UART16550_READ(UART_LSR)&0x40) == 0);
116 UART16550_WRITE(UART_TX, byte);
117 //for (i=0;i<0xfff;i++);
118
119 return 1;
120}
121
122#endif
diff --git a/arch/mips/au1000/common/dma.c b/arch/mips/au1000/common/dma.c
new file mode 100644
index 000000000000..372c33f1353d
--- /dev/null
+++ b/arch/mips/au1000/common/dma.c
@@ -0,0 +1,243 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * A DMA channel allocator for Au1000. API is modeled loosely off of
5 * linux/kernel/dma.c.
6 *
7 * Copyright 2000 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc.
9 * stevel@mvista.com or source@mvista.com
10 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 *
32 */
33#include <linux/config.h>
34#include <linux/module.h>
35#include <linux/kernel.h>
36#include <linux/errno.h>
37#include <linux/sched.h>
38#include <linux/spinlock.h>
39#include <linux/string.h>
40#include <linux/delay.h>
41#include <linux/interrupt.h>
42#include <linux/module.h>
43#include <asm/system.h>
44#include <asm/mach-au1x00/au1000.h>
45#include <asm/mach-au1x00/au1000_dma.h>
46
47#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100)
48/*
49 * A note on resource allocation:
50 *
51 * All drivers needing DMA channels, should allocate and release them
52 * through the public routines `request_dma()' and `free_dma()'.
53 *
54 * In order to avoid problems, all processes should allocate resources in
55 * the same sequence and release them in the reverse order.
56 *
57 * So, when allocating DMAs and IRQs, first allocate the DMA, then the IRQ.
58 * When releasing them, first release the IRQ, then release the DMA. The
59 * main reason for this order is that, if you are requesting the DMA buffer
60 * done interrupt, you won't know the irq number until the DMA channel is
61 * returned from request_dma.
62 */
63
64
65DEFINE_SPINLOCK(au1000_dma_spin_lock);
66
67struct dma_chan au1000_dma_table[NUM_AU1000_DMA_CHANNELS] = {
68 {.dev_id = -1,},
69 {.dev_id = -1,},
70 {.dev_id = -1,},
71 {.dev_id = -1,},
72 {.dev_id = -1,},
73 {.dev_id = -1,},
74 {.dev_id = -1,},
75 {.dev_id = -1,}
76};
77EXPORT_SYMBOL(au1000_dma_table);
78
79// Device FIFO addresses and default DMA modes
80static const struct dma_dev {
81 unsigned int fifo_addr;
82 unsigned int dma_mode;
83} dma_dev_table[DMA_NUM_DEV] = {
84 {UART0_ADDR + UART_TX, 0},
85 {UART0_ADDR + UART_RX, 0},
86 {0, 0},
87 {0, 0},
88 {AC97C_DATA, DMA_DW16 }, // coherent
89 {AC97C_DATA, DMA_DR | DMA_DW16 }, // coherent
90 {UART3_ADDR + UART_TX, DMA_DW8 | DMA_NC},
91 {UART3_ADDR + UART_RX, DMA_DR | DMA_DW8 | DMA_NC},
92 {USBD_EP0RD, DMA_DR | DMA_DW8 | DMA_NC},
93 {USBD_EP0WR, DMA_DW8 | DMA_NC},
94 {USBD_EP2WR, DMA_DW8 | DMA_NC},
95 {USBD_EP3WR, DMA_DW8 | DMA_NC},
96 {USBD_EP4RD, DMA_DR | DMA_DW8 | DMA_NC},
97 {USBD_EP5RD, DMA_DR | DMA_DW8 | DMA_NC},
98 {I2S_DATA, DMA_DW32 | DMA_NC},
99 {I2S_DATA, DMA_DR | DMA_DW32 | DMA_NC}
100};
101
102int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
103 int length, int *eof, void *data)
104{
105 int i, len = 0;
106 struct dma_chan *chan;
107
108 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) {
109 if ((chan = get_dma_chan(i)) != NULL) {
110 len += sprintf(buf + len, "%2d: %s\n",
111 i, chan->dev_str);
112 }
113 }
114
115 if (fpos >= len) {
116 *start = buf;
117 *eof = 1;
118 return 0;
119 }
120 *start = buf + fpos;
121 if ((len -= fpos) > length)
122 return length;
123 *eof = 1;
124 return len;
125}
126
127// Device FIFO addresses and default DMA modes - 2nd bank
128static const struct dma_dev dma_dev_table_bank2[DMA_NUM_DEV_BANK2] = {
129 {SD0_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent
130 {SD0_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8}, // coherent
131 {SD1_XMIT_FIFO, DMA_DS | DMA_DW8}, // coherent
132 {SD1_RECV_FIFO, DMA_DS | DMA_DR | DMA_DW8} // coherent
133};
134
135void dump_au1000_dma_channel(unsigned int dmanr)
136{
137 struct dma_chan *chan;
138
139 if (dmanr >= NUM_AU1000_DMA_CHANNELS)
140 return;
141 chan = &au1000_dma_table[dmanr];
142
143 printk(KERN_INFO "Au1000 DMA%d Register Dump:\n", dmanr);
144 printk(KERN_INFO " mode = 0x%08x\n",
145 au_readl(chan->io + DMA_MODE_SET));
146 printk(KERN_INFO " addr = 0x%08x\n",
147 au_readl(chan->io + DMA_PERIPHERAL_ADDR));
148 printk(KERN_INFO " start0 = 0x%08x\n",
149 au_readl(chan->io + DMA_BUFFER0_START));
150 printk(KERN_INFO " start1 = 0x%08x\n",
151 au_readl(chan->io + DMA_BUFFER1_START));
152 printk(KERN_INFO " count0 = 0x%08x\n",
153 au_readl(chan->io + DMA_BUFFER0_COUNT));
154 printk(KERN_INFO " count1 = 0x%08x\n",
155 au_readl(chan->io + DMA_BUFFER1_COUNT));
156}
157
158
159/*
160 * Finds a free channel, and binds the requested device to it.
161 * Returns the allocated channel number, or negative on error.
162 * Requests the DMA done IRQ if irqhandler != NULL.
163 */
164int request_au1000_dma(int dev_id, const char *dev_str,
165 irqreturn_t (*irqhandler)(int, void *, struct pt_regs *),
166 unsigned long irqflags,
167 void *irq_dev_id)
168{
169 struct dma_chan *chan;
170 const struct dma_dev *dev;
171 int i, ret;
172
173#if defined(CONFIG_SOC_AU1100)
174 if (dev_id < 0 || dev_id >= (DMA_NUM_DEV + DMA_NUM_DEV_BANK2))
175 return -EINVAL;
176#else
177 if (dev_id < 0 || dev_id >= DMA_NUM_DEV)
178 return -EINVAL;
179#endif
180
181 for (i = 0; i < NUM_AU1000_DMA_CHANNELS; i++) {
182 if (au1000_dma_table[i].dev_id < 0)
183 break;
184 }
185 if (i == NUM_AU1000_DMA_CHANNELS)
186 return -ENODEV;
187
188 chan = &au1000_dma_table[i];
189
190 if (dev_id >= DMA_NUM_DEV) {
191 dev_id -= DMA_NUM_DEV;
192 dev = &dma_dev_table_bank2[dev_id];
193 } else {
194 dev = &dma_dev_table[dev_id];
195 }
196
197 if (irqhandler) {
198 chan->irq = AU1000_DMA_INT_BASE + i;
199 chan->irq_dev = irq_dev_id;
200 if ((ret = request_irq(chan->irq, irqhandler, irqflags,
201 dev_str, chan->irq_dev))) {
202 chan->irq = 0;
203 chan->irq_dev = NULL;
204 return ret;
205 }
206 } else {
207 chan->irq = 0;
208 chan->irq_dev = NULL;
209 }
210
211 // fill it in
212 chan->io = DMA_CHANNEL_BASE + i * DMA_CHANNEL_LEN;
213 chan->dev_id = dev_id;
214 chan->dev_str = dev_str;
215 chan->fifo_addr = dev->fifo_addr;
216 chan->mode = dev->dma_mode;
217
218 /* initialize the channel before returning */
219 init_dma(i);
220
221 return i;
222}
223EXPORT_SYMBOL(request_au1000_dma);
224
225void free_au1000_dma(unsigned int dmanr)
226{
227 struct dma_chan *chan = get_dma_chan(dmanr);
228 if (!chan) {
229 printk("Trying to free DMA%d\n", dmanr);
230 return;
231 }
232
233 disable_dma(dmanr);
234 if (chan->irq)
235 free_irq(chan->irq, chan->irq_dev);
236
237 chan->irq = 0;
238 chan->irq_dev = NULL;
239 chan->dev_id = -1;
240}
241EXPORT_SYMBOL(free_au1000_dma);
242
243#endif // AU1000 AU1500 AU1100
diff --git a/arch/mips/au1000/common/int-handler.S b/arch/mips/au1000/common/int-handler.S
new file mode 100644
index 000000000000..1c4ca883321e
--- /dev/null
+++ b/arch/mips/au1000/common/int-handler.S
@@ -0,0 +1,68 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: ppopov@mvista.com
4 *
5 * Interrupt dispatcher for Au1000 boards.
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#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17
18 .text
19 .set macro
20 .set noat
21 .align 5
22
23NESTED(au1000_IRQ, PT_SIZE, sp)
24 SAVE_ALL
25 CLI # Important: mark KERNEL mode !
26
27 mfc0 t0,CP0_CAUSE # get pending interrupts
28 mfc0 t1,CP0_STATUS # get enabled interrupts
29 and t0,t1 # isolate allowed ones
30
31 andi t0,0xff00 # isolate pending bits
32 beqz t0, 3f # spurious interrupt
33
34 andi a0, t0, CAUSEF_IP7
35 beq a0, zero, 1f
36 move a0, sp
37 jal mips_timer_interrupt
38 j ret_from_irq
39
401:
41 andi a0, t0, CAUSEF_IP2 # Interrupt Controller 0, Request 0
42 beq a0, zero, 2f
43 move a0,sp
44 jal intc0_req0_irqdispatch
45 j ret_from_irq
462:
47 andi a0, t0, CAUSEF_IP3 # Interrupt Controller 0, Request 1
48 beq a0, zero, 3f
49 move a0,sp
50 jal intc0_req1_irqdispatch
51 j ret_from_irq
523:
53 andi a0, t0, CAUSEF_IP4 # Interrupt Controller 1, Request 0
54 beq a0, zero, 4f
55 move a0,sp
56 jal intc1_req0_irqdispatch
57 j ret_from_irq
584:
59 andi a0, t0, CAUSEF_IP5 # Interrupt Controller 1, Request 1
60 beq a0, zero, 5f
61 move a0, sp
62 jal intc1_req1_irqdispatch
63 j ret_from_irq
64
655:
66 move a0, sp
67 j spurious_interrupt
68END(au1000_IRQ)
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
new file mode 100644
index 000000000000..d1eb5a4a9a19
--- /dev/null
+++ b/arch/mips/au1000/common/irq.c
@@ -0,0 +1,654 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1000 interrupt routines.
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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#include <linux/config.h>
30#include <linux/errno.h>
31#include <linux/init.h>
32#include <linux/irq.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/delay.h>
44#include <linux/bitops.h>
45
46#include <asm/bootinfo.h>
47#include <asm/io.h>
48#include <asm/mipsregs.h>
49#include <asm/system.h>
50#include <asm/mach-au1x00/au1000.h>
51#ifdef CONFIG_MIPS_PB1000
52#include <asm/mach-pb1x00/pb1000.h>
53#endif
54
55#undef DEBUG_IRQ
56#ifdef DEBUG_IRQ
57/* note: prints function name for you */
58#define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
59#else
60#define DPRINTK(fmt, args...)
61#endif
62
63#define EXT_INTC0_REQ0 2 /* IP 2 */
64#define EXT_INTC0_REQ1 3 /* IP 3 */
65#define EXT_INTC1_REQ0 4 /* IP 4 */
66#define EXT_INTC1_REQ1 5 /* IP 5 */
67#define MIPS_TIMER_IP 7 /* IP 7 */
68
69extern asmlinkage void au1000_IRQ(void);
70extern void set_debug_traps(void);
71extern irq_cpustat_t irq_stat [NR_CPUS];
72
73static void setup_local_irq(unsigned int irq, int type, int int_req);
74static unsigned int startup_irq(unsigned int irq);
75static void end_irq(unsigned int irq_nr);
76static inline void mask_and_ack_level_irq(unsigned int irq_nr);
77static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr);
78static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr);
79static inline void mask_and_ack_either_edge_irq(unsigned int irq_nr);
80inline void local_enable_irq(unsigned int irq_nr);
81inline void local_disable_irq(unsigned int irq_nr);
82
83void (*board_init_irq)(void);
84
85#ifdef CONFIG_PM
86extern void counter0_irq(int irq, void *dev_id, struct pt_regs *regs);
87#endif
88
89static DEFINE_SPINLOCK(irq_lock);
90
91
92static unsigned int startup_irq(unsigned int irq_nr)
93{
94 local_enable_irq(irq_nr);
95 return 0;
96}
97
98
99static void shutdown_irq(unsigned int irq_nr)
100{
101 local_disable_irq(irq_nr);
102 return;
103}
104
105
106inline void local_enable_irq(unsigned int irq_nr)
107{
108 if (irq_nr > AU1000_LAST_INTC0_INT) {
109 au_writel(1<<(irq_nr-32), IC1_MASKSET);
110 au_writel(1<<(irq_nr-32), IC1_WAKESET);
111 }
112 else {
113 au_writel(1<<irq_nr, IC0_MASKSET);
114 au_writel(1<<irq_nr, IC0_WAKESET);
115 }
116 au_sync();
117}
118
119
120inline void local_disable_irq(unsigned int irq_nr)
121{
122 if (irq_nr > AU1000_LAST_INTC0_INT) {
123 au_writel(1<<(irq_nr-32), IC1_MASKCLR);
124 au_writel(1<<(irq_nr-32), IC1_WAKECLR);
125 }
126 else {
127 au_writel(1<<irq_nr, IC0_MASKCLR);
128 au_writel(1<<irq_nr, IC0_WAKECLR);
129 }
130 au_sync();
131}
132
133
134static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr)
135{
136 if (irq_nr > AU1000_LAST_INTC0_INT) {
137 au_writel(1<<(irq_nr-32), IC1_RISINGCLR);
138 au_writel(1<<(irq_nr-32), IC1_MASKCLR);
139 }
140 else {
141 au_writel(1<<irq_nr, IC0_RISINGCLR);
142 au_writel(1<<irq_nr, IC0_MASKCLR);
143 }
144 au_sync();
145}
146
147
148static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr)
149{
150 if (irq_nr > AU1000_LAST_INTC0_INT) {
151 au_writel(1<<(irq_nr-32), IC1_FALLINGCLR);
152 au_writel(1<<(irq_nr-32), IC1_MASKCLR);
153 }
154 else {
155 au_writel(1<<irq_nr, IC0_FALLINGCLR);
156 au_writel(1<<irq_nr, IC0_MASKCLR);
157 }
158 au_sync();
159}
160
161
162static inline void mask_and_ack_either_edge_irq(unsigned int irq_nr)
163{
164 /* This may assume that we don't get interrupts from
165 * both edges at once, or if we do, that we don't care.
166 */
167 if (irq_nr > AU1000_LAST_INTC0_INT) {
168 au_writel(1<<(irq_nr-32), IC1_FALLINGCLR);
169 au_writel(1<<(irq_nr-32), IC1_RISINGCLR);
170 au_writel(1<<(irq_nr-32), IC1_MASKCLR);
171 }
172 else {
173 au_writel(1<<irq_nr, IC0_FALLINGCLR);
174 au_writel(1<<irq_nr, IC0_RISINGCLR);
175 au_writel(1<<irq_nr, IC0_MASKCLR);
176 }
177 au_sync();
178}
179
180
181static inline void mask_and_ack_level_irq(unsigned int irq_nr)
182{
183
184 local_disable_irq(irq_nr);
185 au_sync();
186#if defined(CONFIG_MIPS_PB1000)
187 if (irq_nr == AU1000_GPIO_15) {
188 au_writel(0x8000, PB1000_MDR); /* ack int */
189 au_sync();
190 }
191#endif
192 return;
193}
194
195
196static void end_irq(unsigned int irq_nr)
197{
198 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) {
199 local_enable_irq(irq_nr);
200 }
201#if defined(CONFIG_MIPS_PB1000)
202 if (irq_nr == AU1000_GPIO_15) {
203 au_writel(0x4000, PB1000_MDR); /* enable int */
204 au_sync();
205 }
206#endif
207}
208
209unsigned long save_local_and_disable(int controller)
210{
211 int i;
212 unsigned long flags, mask;
213
214 spin_lock_irqsave(&irq_lock, flags);
215 if (controller) {
216 mask = au_readl(IC1_MASKSET);
217 for (i=32; i<64; i++) {
218 local_disable_irq(i);
219 }
220 }
221 else {
222 mask = au_readl(IC0_MASKSET);
223 for (i=0; i<32; i++) {
224 local_disable_irq(i);
225 }
226 }
227 spin_unlock_irqrestore(&irq_lock, flags);
228
229 return mask;
230}
231
232void restore_local_and_enable(int controller, unsigned long mask)
233{
234 int i;
235 unsigned long flags, new_mask;
236
237 spin_lock_irqsave(&irq_lock, flags);
238 for (i=0; i<32; i++) {
239 if (mask & (1<<i)) {
240 if (controller)
241 local_enable_irq(i+32);
242 else
243 local_enable_irq(i);
244 }
245 }
246 if (controller)
247 new_mask = au_readl(IC1_MASKSET);
248 else
249 new_mask = au_readl(IC0_MASKSET);
250
251 spin_unlock_irqrestore(&irq_lock, flags);
252}
253
254
255static struct hw_interrupt_type rise_edge_irq_type = {
256 "Au1000 Rise Edge",
257 startup_irq,
258 shutdown_irq,
259 local_enable_irq,
260 local_disable_irq,
261 mask_and_ack_rise_edge_irq,
262 end_irq,
263 NULL
264};
265
266static struct hw_interrupt_type fall_edge_irq_type = {
267 "Au1000 Fall Edge",
268 startup_irq,
269 shutdown_irq,
270 local_enable_irq,
271 local_disable_irq,
272 mask_and_ack_fall_edge_irq,
273 end_irq,
274 NULL
275};
276
277static struct hw_interrupt_type either_edge_irq_type = {
278 "Au1000 Rise or Fall Edge",
279 startup_irq,
280 shutdown_irq,
281 local_enable_irq,
282 local_disable_irq,
283 mask_and_ack_either_edge_irq,
284 end_irq,
285 NULL
286};
287
288static struct hw_interrupt_type level_irq_type = {
289 "Au1000 Level",
290 startup_irq,
291 shutdown_irq,
292 local_enable_irq,
293 local_disable_irq,
294 mask_and_ack_level_irq,
295 end_irq,
296 NULL
297};
298
299#ifdef CONFIG_PM
300void startup_match20_interrupt(void)
301{
302 local_enable_irq(AU1000_TOY_MATCH2_INT);
303}
304#endif
305
306static void setup_local_irq(unsigned int irq_nr, int type, int int_req)
307{
308 if (irq_nr > AU1000_MAX_INTR) return;
309 /* Config2[n], Config1[n], Config0[n] */
310 if (irq_nr > AU1000_LAST_INTC0_INT) {
311 switch (type) {
312 case INTC_INT_RISE_EDGE: /* 0:0:1 */
313 au_writel(1<<(irq_nr-32), IC1_CFG2CLR);
314 au_writel(1<<(irq_nr-32), IC1_CFG1CLR);
315 au_writel(1<<(irq_nr-32), IC1_CFG0SET);
316 irq_desc[irq_nr].handler = &rise_edge_irq_type;
317 break;
318 case INTC_INT_FALL_EDGE: /* 0:1:0 */
319 au_writel(1<<(irq_nr-32), IC1_CFG2CLR);
320 au_writel(1<<(irq_nr-32), IC1_CFG1SET);
321 au_writel(1<<(irq_nr-32), IC1_CFG0CLR);
322 irq_desc[irq_nr].handler = &fall_edge_irq_type;
323 break;
324 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
325 au_writel(1<<(irq_nr-32), IC1_CFG2CLR);
326 au_writel(1<<(irq_nr-32), IC1_CFG1SET);
327 au_writel(1<<(irq_nr-32), IC1_CFG0SET);
328 irq_desc[irq_nr].handler = &either_edge_irq_type;
329 break;
330 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
331 au_writel(1<<(irq_nr-32), IC1_CFG2SET);
332 au_writel(1<<(irq_nr-32), IC1_CFG1CLR);
333 au_writel(1<<(irq_nr-32), IC1_CFG0SET);
334 irq_desc[irq_nr].handler = &level_irq_type;
335 break;
336 case INTC_INT_LOW_LEVEL: /* 1:1:0 */
337 au_writel(1<<(irq_nr-32), IC1_CFG2SET);
338 au_writel(1<<(irq_nr-32), IC1_CFG1SET);
339 au_writel(1<<(irq_nr-32), IC1_CFG0CLR);
340 irq_desc[irq_nr].handler = &level_irq_type;
341 break;
342 case INTC_INT_DISABLED: /* 0:0:0 */
343 au_writel(1<<(irq_nr-32), IC1_CFG0CLR);
344 au_writel(1<<(irq_nr-32), IC1_CFG1CLR);
345 au_writel(1<<(irq_nr-32), IC1_CFG2CLR);
346 break;
347 default: /* disable the interrupt */
348 printk("unexpected int type %d (irq %d)\n", type, irq_nr);
349 au_writel(1<<(irq_nr-32), IC1_CFG0CLR);
350 au_writel(1<<(irq_nr-32), IC1_CFG1CLR);
351 au_writel(1<<(irq_nr-32), IC1_CFG2CLR);
352 return;
353 }
354 if (int_req) /* assign to interrupt request 1 */
355 au_writel(1<<(irq_nr-32), IC1_ASSIGNCLR);
356 else /* assign to interrupt request 0 */
357 au_writel(1<<(irq_nr-32), IC1_ASSIGNSET);
358 au_writel(1<<(irq_nr-32), IC1_SRCSET);
359 au_writel(1<<(irq_nr-32), IC1_MASKCLR);
360 au_writel(1<<(irq_nr-32), IC1_WAKECLR);
361 }
362 else {
363 switch (type) {
364 case INTC_INT_RISE_EDGE: /* 0:0:1 */
365 au_writel(1<<irq_nr, IC0_CFG2CLR);
366 au_writel(1<<irq_nr, IC0_CFG1CLR);
367 au_writel(1<<irq_nr, IC0_CFG0SET);
368 irq_desc[irq_nr].handler = &rise_edge_irq_type;
369 break;
370 case INTC_INT_FALL_EDGE: /* 0:1:0 */
371 au_writel(1<<irq_nr, IC0_CFG2CLR);
372 au_writel(1<<irq_nr, IC0_CFG1SET);
373 au_writel(1<<irq_nr, IC0_CFG0CLR);
374 irq_desc[irq_nr].handler = &fall_edge_irq_type;
375 break;
376 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
377 au_writel(1<<irq_nr, IC0_CFG2CLR);
378 au_writel(1<<irq_nr, IC0_CFG1SET);
379 au_writel(1<<irq_nr, IC0_CFG0SET);
380 irq_desc[irq_nr].handler = &either_edge_irq_type;
381 break;
382 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
383 au_writel(1<<irq_nr, IC0_CFG2SET);
384 au_writel(1<<irq_nr, IC0_CFG1CLR);
385 au_writel(1<<irq_nr, IC0_CFG0SET);
386 irq_desc[irq_nr].handler = &level_irq_type;
387 break;
388 case INTC_INT_LOW_LEVEL: /* 1:1:0 */
389 au_writel(1<<irq_nr, IC0_CFG2SET);
390 au_writel(1<<irq_nr, IC0_CFG1SET);
391 au_writel(1<<irq_nr, IC0_CFG0CLR);
392 irq_desc[irq_nr].handler = &level_irq_type;
393 break;
394 case INTC_INT_DISABLED: /* 0:0:0 */
395 au_writel(1<<irq_nr, IC0_CFG0CLR);
396 au_writel(1<<irq_nr, IC0_CFG1CLR);
397 au_writel(1<<irq_nr, IC0_CFG2CLR);
398 break;
399 default: /* disable the interrupt */
400 printk("unexpected int type %d (irq %d)\n", type, irq_nr);
401 au_writel(1<<irq_nr, IC0_CFG0CLR);
402 au_writel(1<<irq_nr, IC0_CFG1CLR);
403 au_writel(1<<irq_nr, IC0_CFG2CLR);
404 return;
405 }
406 if (int_req) /* assign to interrupt request 1 */
407 au_writel(1<<irq_nr, IC0_ASSIGNCLR);
408 else /* assign to interrupt request 0 */
409 au_writel(1<<irq_nr, IC0_ASSIGNSET);
410 au_writel(1<<irq_nr, IC0_SRCSET);
411 au_writel(1<<irq_nr, IC0_MASKCLR);
412 au_writel(1<<irq_nr, IC0_WAKECLR);
413 }
414 au_sync();
415}
416
417
418void __init arch_init_irq(void)
419{
420 int i;
421 unsigned long cp0_status;
422 au1xxx_irq_map_t *imp;
423 extern au1xxx_irq_map_t au1xxx_irq_map[];
424 extern au1xxx_irq_map_t au1xxx_ic0_map[];
425 extern int au1xxx_nr_irqs;
426 extern int au1xxx_ic0_nr_irqs;
427
428 cp0_status = read_c0_status();
429 memset(irq_desc, 0, sizeof(irq_desc));
430 set_except_vector(0, au1000_IRQ);
431
432 /* Initialize interrupt controllers to a safe state.
433 */
434 au_writel(0xffffffff, IC0_CFG0CLR);
435 au_writel(0xffffffff, IC0_CFG1CLR);
436 au_writel(0xffffffff, IC0_CFG2CLR);
437 au_writel(0xffffffff, IC0_MASKCLR);
438 au_writel(0xffffffff, IC0_ASSIGNSET);
439 au_writel(0xffffffff, IC0_WAKECLR);
440 au_writel(0xffffffff, IC0_SRCSET);
441 au_writel(0xffffffff, IC0_FALLINGCLR);
442 au_writel(0xffffffff, IC0_RISINGCLR);
443 au_writel(0x00000000, IC0_TESTBIT);
444
445 au_writel(0xffffffff, IC1_CFG0CLR);
446 au_writel(0xffffffff, IC1_CFG1CLR);
447 au_writel(0xffffffff, IC1_CFG2CLR);
448 au_writel(0xffffffff, IC1_MASKCLR);
449 au_writel(0xffffffff, IC1_ASSIGNSET);
450 au_writel(0xffffffff, IC1_WAKECLR);
451 au_writel(0xffffffff, IC1_SRCSET);
452 au_writel(0xffffffff, IC1_FALLINGCLR);
453 au_writel(0xffffffff, IC1_RISINGCLR);
454 au_writel(0x00000000, IC1_TESTBIT);
455
456 /* Initialize IC0, which is fixed per processor.
457 */
458 imp = au1xxx_ic0_map;
459 for (i=0; i<au1xxx_ic0_nr_irqs; i++) {
460 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
461 imp++;
462 }
463
464 /* Now set up the irq mapping for the board.
465 */
466 imp = au1xxx_irq_map;
467 for (i=0; i<au1xxx_nr_irqs; i++) {
468 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
469 imp++;
470 }
471
472 set_c0_status(ALLINTS);
473
474 /* Board specific IRQ initialization.
475 */
476 if (board_init_irq)
477 (*board_init_irq)();
478}
479
480
481/*
482 * Interrupts are nested. Even if an interrupt handler is registered
483 * as "fast", we might get another interrupt before we return from
484 * intcX_reqX_irqdispatch().
485 */
486
487void intc0_req0_irqdispatch(struct pt_regs *regs)
488{
489 int irq = 0;
490 static unsigned long intc0_req0 = 0;
491
492 intc0_req0 |= au_readl(IC0_REQ0INT);
493
494 if (!intc0_req0) return;
495
496 /*
497 * Because of the tight timing of SETUP token to reply
498 * transactions, the USB devices-side packet complete
499 * interrupt needs the highest priority.
500 */
501 if ((intc0_req0 & (1<<AU1000_USB_DEV_REQ_INT))) {
502 intc0_req0 &= ~(1<<AU1000_USB_DEV_REQ_INT);
503 do_IRQ(AU1000_USB_DEV_REQ_INT, regs);
504 return;
505 }
506
507 irq = au_ffs(intc0_req0) - 1;
508 intc0_req0 &= ~(1<<irq);
509 do_IRQ(irq, regs);
510}
511
512
513void intc0_req1_irqdispatch(struct pt_regs *regs)
514{
515 int irq = 0;
516 static unsigned long intc0_req1 = 0;
517
518 intc0_req1 |= au_readl(IC0_REQ1INT);
519
520 if (!intc0_req1) return;
521
522 irq = au_ffs(intc0_req1) - 1;
523 intc0_req1 &= ~(1<<irq);
524#ifdef CONFIG_PM
525 if (irq == AU1000_TOY_MATCH2_INT) {
526 mask_and_ack_rise_edge_irq(irq);
527 counter0_irq(irq, NULL, regs);
528 local_enable_irq(irq);
529 }
530 else
531#endif
532 {
533 do_IRQ(irq, regs);
534 }
535}
536
537
538/*
539 * Interrupt Controller 1:
540 * interrupts 32 - 63
541 */
542void intc1_req0_irqdispatch(struct pt_regs *regs)
543{
544 int irq = 0;
545 static unsigned long intc1_req0 = 0;
546
547 intc1_req0 |= au_readl(IC1_REQ0INT);
548
549 if (!intc1_req0) return;
550
551 irq = au_ffs(intc1_req0) - 1;
552 intc1_req0 &= ~(1<<irq);
553 irq += 32;
554 do_IRQ(irq, regs);
555}
556
557
558void intc1_req1_irqdispatch(struct pt_regs *regs)
559{
560 int irq = 0;
561 static unsigned long intc1_req1 = 0;
562
563 intc1_req1 |= au_readl(IC1_REQ1INT);
564
565 if (!intc1_req1) return;
566
567 irq = au_ffs(intc1_req1) - 1;
568 intc1_req1 &= ~(1<<irq);
569 irq += 32;
570 do_IRQ(irq, regs);
571}
572
573#ifdef CONFIG_PM
574
575/* Save/restore the interrupt controller state.
576 * Called from the save/restore core registers as part of the
577 * au_sleep function in power.c.....maybe I should just pm_register()
578 * them instead?
579 */
580static uint sleep_intctl_config0[2];
581static uint sleep_intctl_config1[2];
582static uint sleep_intctl_config2[2];
583static uint sleep_intctl_src[2];
584static uint sleep_intctl_assign[2];
585static uint sleep_intctl_wake[2];
586static uint sleep_intctl_mask[2];
587
588void
589save_au1xxx_intctl(void)
590{
591 sleep_intctl_config0[0] = au_readl(IC0_CFG0RD);
592 sleep_intctl_config1[0] = au_readl(IC0_CFG1RD);
593 sleep_intctl_config2[0] = au_readl(IC0_CFG2RD);
594 sleep_intctl_src[0] = au_readl(IC0_SRCRD);
595 sleep_intctl_assign[0] = au_readl(IC0_ASSIGNRD);
596 sleep_intctl_wake[0] = au_readl(IC0_WAKERD);
597 sleep_intctl_mask[0] = au_readl(IC0_MASKRD);
598
599 sleep_intctl_config0[1] = au_readl(IC1_CFG0RD);
600 sleep_intctl_config1[1] = au_readl(IC1_CFG1RD);
601 sleep_intctl_config2[1] = au_readl(IC1_CFG2RD);
602 sleep_intctl_src[1] = au_readl(IC1_SRCRD);
603 sleep_intctl_assign[1] = au_readl(IC1_ASSIGNRD);
604 sleep_intctl_wake[1] = au_readl(IC1_WAKERD);
605 sleep_intctl_mask[1] = au_readl(IC1_MASKRD);
606}
607
608/* For most restore operations, we clear the entire register and
609 * then set the bits we found during the save.
610 */
611void
612restore_au1xxx_intctl(void)
613{
614 au_writel(0xffffffff, IC0_MASKCLR); au_sync();
615
616 au_writel(0xffffffff, IC0_CFG0CLR); au_sync();
617 au_writel(sleep_intctl_config0[0], IC0_CFG0SET); au_sync();
618 au_writel(0xffffffff, IC0_CFG1CLR); au_sync();
619 au_writel(sleep_intctl_config1[0], IC0_CFG1SET); au_sync();
620 au_writel(0xffffffff, IC0_CFG2CLR); au_sync();
621 au_writel(sleep_intctl_config2[0], IC0_CFG2SET); au_sync();
622 au_writel(0xffffffff, IC0_SRCCLR); au_sync();
623 au_writel(sleep_intctl_src[0], IC0_SRCSET); au_sync();
624 au_writel(0xffffffff, IC0_ASSIGNCLR); au_sync();
625 au_writel(sleep_intctl_assign[0], IC0_ASSIGNSET); au_sync();
626 au_writel(0xffffffff, IC0_WAKECLR); au_sync();
627 au_writel(sleep_intctl_wake[0], IC0_WAKESET); au_sync();
628 au_writel(0xffffffff, IC0_RISINGCLR); au_sync();
629 au_writel(0xffffffff, IC0_FALLINGCLR); au_sync();
630 au_writel(0x00000000, IC0_TESTBIT); au_sync();
631
632 au_writel(0xffffffff, IC1_MASKCLR); au_sync();
633
634 au_writel(0xffffffff, IC1_CFG0CLR); au_sync();
635 au_writel(sleep_intctl_config0[1], IC1_CFG0SET); au_sync();
636 au_writel(0xffffffff, IC1_CFG1CLR); au_sync();
637 au_writel(sleep_intctl_config1[1], IC1_CFG1SET); au_sync();
638 au_writel(0xffffffff, IC1_CFG2CLR); au_sync();
639 au_writel(sleep_intctl_config2[1], IC1_CFG2SET); au_sync();
640 au_writel(0xffffffff, IC1_SRCCLR); au_sync();
641 au_writel(sleep_intctl_src[1], IC1_SRCSET); au_sync();
642 au_writel(0xffffffff, IC1_ASSIGNCLR); au_sync();
643 au_writel(sleep_intctl_assign[1], IC1_ASSIGNSET); au_sync();
644 au_writel(0xffffffff, IC1_WAKECLR); au_sync();
645 au_writel(sleep_intctl_wake[1], IC1_WAKESET); au_sync();
646 au_writel(0xffffffff, IC1_RISINGCLR); au_sync();
647 au_writel(0xffffffff, IC1_FALLINGCLR); au_sync();
648 au_writel(0x00000000, IC1_TESTBIT); au_sync();
649
650 au_writel(sleep_intctl_mask[1], IC1_MASKSET); au_sync();
651
652 au_writel(sleep_intctl_mask[0], IC0_MASKSET); au_sync();
653}
654#endif /* CONFIG_PM */
diff --git a/arch/mips/au1000/common/pci.c b/arch/mips/au1000/common/pci.c
new file mode 100644
index 000000000000..533721eef6ae
--- /dev/null
+++ b/arch/mips/au1000/common/pci.c
@@ -0,0 +1,97 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 pci support.
4 *
5 * Copyright 2001,2002,2003 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
10 *
11 * Support for all devices (greater than 16) added by David Gathright.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */
33#include <linux/config.h>
34#include <linux/types.h>
35#include <linux/pci.h>
36#include <linux/kernel.h>
37#include <linux/init.h>
38
39#include <asm/mach-au1x00/au1000.h>
40
41/* TBD */
42static struct resource pci_io_resource = {
43 "pci IO space",
44 (u32)PCI_IO_START,
45 (u32)PCI_IO_END,
46 IORESOURCE_IO
47};
48
49static struct resource pci_mem_resource = {
50 "pci memory space",
51 (u32)PCI_MEM_START,
52 (u32)PCI_MEM_END,
53 IORESOURCE_MEM
54};
55
56extern struct pci_ops au1x_pci_ops;
57
58static struct pci_controller au1x_controller = {
59 .pci_ops = &au1x_pci_ops,
60 .io_resource = &pci_io_resource,
61 .mem_resource = &pci_mem_resource,
62};
63
64#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
65static unsigned long virt_io_addr;
66#endif
67
68static int __init au1x_pci_setup(void)
69{
70#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
71 virt_io_addr = (unsigned long)ioremap(Au1500_PCI_IO_START,
72 Au1500_PCI_IO_END - Au1500_PCI_IO_START + 1);
73
74 if (!virt_io_addr) {
75 printk(KERN_ERR "Unable to ioremap pci space\n");
76 return 1;
77 }
78
79#ifdef CONFIG_DMA_NONCOHERENT
80 /*
81 * Set the NC bit in controller for Au1500 pre-AC silicon
82 */
83 u32 prid = read_c0_prid();
84 if ( (prid & 0xFF000000) == 0x01000000 && prid < 0x01030202) {
85 au_writel( 1<<16 | au_readl(Au1500_PCI_CFG), Au1500_PCI_CFG);
86 printk("Non-coherent PCI accesses enabled\n");
87 }
88#endif
89
90 set_io_port_base(virt_io_addr);
91#endif
92
93 register_pci_controller(&au1x_controller);
94 return 0;
95}
96
97arch_initcall(au1x_pci_setup);
diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
new file mode 100644
index 000000000000..0776b2db5641
--- /dev/null
+++ b/arch/mips/au1000/common/platform.c
@@ -0,0 +1,53 @@
1/*
2 * Platform device support for Au1x00 SoCs.
3 *
4 * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <linux/device.h>
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/resource.h>
14
15#include <asm/mach-au1x00/au1000.h>
16
17static struct resource au1xxx_usb_ohci_resources[] = {
18 [0] = {
19 .start = USB_OHCI_BASE,
20 .end = USB_OHCI_BASE + USB_OHCI_LEN,
21 .flags = IORESOURCE_MEM,
22 },
23 [1] = {
24 .start = AU1000_USB_HOST_INT,
25 .end = AU1000_USB_HOST_INT,
26 .flags = IORESOURCE_IRQ,
27 },
28};
29
30/* The dmamask must be set for OHCI to work */
31static u64 ohci_dmamask = ~(u32)0;
32
33static struct platform_device au1xxx_usb_ohci_device = {
34 .name = "au1xxx-ohci",
35 .id = 0,
36 .dev = {
37 .dma_mask = &ohci_dmamask,
38 .coherent_dma_mask = 0xffffffff,
39 },
40 .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources),
41 .resource = au1xxx_usb_ohci_resources,
42};
43
44static struct platform_device *au1xxx_platform_devices[] __initdata = {
45 &au1xxx_usb_ohci_device,
46};
47
48int au1xxx_platform_init(void)
49{
50 return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
51}
52
53arch_initcall(au1xxx_platform_init);
diff --git a/arch/mips/au1000/common/power.c b/arch/mips/au1000/common/power.c
new file mode 100644
index 000000000000..c40daccbb5b1
--- /dev/null
+++ b/arch/mips/au1000/common/power.c
@@ -0,0 +1,493 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1000 Power Management routines.
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * Some of the routines are right out of init/main.c, whose
10 * copyrights apply here.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32#include <linux/config.h>
33#include <linux/init.h>
34#include <linux/pm.h>
35#include <linux/slab.h>
36#include <linux/sysctl.h>
37
38#include <asm/string.h>
39#include <asm/uaccess.h>
40#include <asm/io.h>
41#include <asm/system.h>
42#include <asm/mach-au1x00/au1000.h>
43
44#ifdef CONFIG_PM
45
46#define DEBUG 1
47#ifdef DEBUG
48# define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
49#else
50# define DPRINTK(fmt, args...)
51#endif
52
53static void calibrate_delay(void);
54
55extern void set_au1x00_speed(unsigned int new_freq);
56extern unsigned int get_au1x00_speed(void);
57extern unsigned long get_au1x00_uart_baud_base(void);
58extern void set_au1x00_uart_baud_base(unsigned long new_baud_base);
59extern unsigned long save_local_and_disable(int controller);
60extern void restore_local_and_enable(int controller, unsigned long mask);
61extern void local_enable_irq(unsigned int irq_nr);
62
63/* Quick acpi hack. This will have to change! */
64#define CTL_ACPI 9999
65#define ACPI_S1_SLP_TYP 19
66#define ACPI_SLEEP 21
67
68
69static DEFINE_SPINLOCK(pm_lock);
70
71/* We need to save/restore a bunch of core registers that are
72 * either volatile or reset to some state across a processor sleep.
73 * If reading a register doesn't provide a proper result for a
74 * later restore, we have to provide a function for loading that
75 * register and save a copy.
76 *
77 * We only have to save/restore registers that aren't otherwise
78 * done as part of a driver pm_* function.
79 */
80static uint sleep_aux_pll_cntrl;
81static uint sleep_cpu_pll_cntrl;
82static uint sleep_pin_function;
83static uint sleep_uart0_inten;
84static uint sleep_uart0_fifoctl;
85static uint sleep_uart0_linectl;
86static uint sleep_uart0_clkdiv;
87static uint sleep_uart0_enable;
88static uint sleep_usbhost_enable;
89static uint sleep_usbdev_enable;
90static uint sleep_static_memctlr[4][3];
91
92/* Define this to cause the value you write to /proc/sys/pm/sleep to
93 * set the TOY timer for the amount of time you want to sleep.
94 * This is done mainly for testing, but may be useful in other cases.
95 * The value is number of 32KHz ticks to sleep.
96 */
97#define SLEEP_TEST_TIMEOUT 1
98#ifdef SLEEP_TEST_TIMEOUT
99static int sleep_ticks;
100void wakeup_counter0_set(int ticks);
101#endif
102
103static void
104save_core_regs(void)
105{
106 extern void save_au1xxx_intctl(void);
107 extern void pm_eth0_shutdown(void);
108
109 /* Do the serial ports.....these really should be a pm_*
110 * registered function by the driver......but of course the
111 * standard serial driver doesn't understand our Au1xxx
112 * unique registers.
113 */
114 sleep_uart0_inten = au_readl(UART0_ADDR + UART_IER);
115 sleep_uart0_fifoctl = au_readl(UART0_ADDR + UART_FCR);
116 sleep_uart0_linectl = au_readl(UART0_ADDR + UART_LCR);
117 sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK);
118 sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL);
119
120 /* Shutdown USB host/device.
121 */
122 sleep_usbhost_enable = au_readl(USB_HOST_CONFIG);
123
124 /* There appears to be some undocumented reset register....
125 */
126 au_writel(0, 0xb0100004); au_sync();
127 au_writel(0, USB_HOST_CONFIG); au_sync();
128
129 sleep_usbdev_enable = au_readl(USBD_ENABLE);
130 au_writel(0, USBD_ENABLE); au_sync();
131
132 /* Save interrupt controller state.
133 */
134 save_au1xxx_intctl();
135
136 /* Clocks and PLLs.
137 */
138 sleep_aux_pll_cntrl = au_readl(SYS_AUXPLL);
139
140 /* We don't really need to do this one, but unless we
141 * write it again it won't have a valid value if we
142 * happen to read it.
143 */
144 sleep_cpu_pll_cntrl = au_readl(SYS_CPUPLL);
145
146 sleep_pin_function = au_readl(SYS_PINFUNC);
147
148 /* Save the static memory controller configuration.
149 */
150 sleep_static_memctlr[0][0] = au_readl(MEM_STCFG0);
151 sleep_static_memctlr[0][1] = au_readl(MEM_STTIME0);
152 sleep_static_memctlr[0][2] = au_readl(MEM_STADDR0);
153 sleep_static_memctlr[1][0] = au_readl(MEM_STCFG1);
154 sleep_static_memctlr[1][1] = au_readl(MEM_STTIME1);
155 sleep_static_memctlr[1][2] = au_readl(MEM_STADDR1);
156 sleep_static_memctlr[2][0] = au_readl(MEM_STCFG2);
157 sleep_static_memctlr[2][1] = au_readl(MEM_STTIME2);
158 sleep_static_memctlr[2][2] = au_readl(MEM_STADDR2);
159 sleep_static_memctlr[3][0] = au_readl(MEM_STCFG3);
160 sleep_static_memctlr[3][1] = au_readl(MEM_STTIME3);
161 sleep_static_memctlr[3][2] = au_readl(MEM_STADDR3);
162}
163
164static void
165restore_core_regs(void)
166{
167 extern void restore_au1xxx_intctl(void);
168 extern void wakeup_counter0_adjust(void);
169
170 au_writel(sleep_aux_pll_cntrl, SYS_AUXPLL); au_sync();
171 au_writel(sleep_cpu_pll_cntrl, SYS_CPUPLL); au_sync();
172 au_writel(sleep_pin_function, SYS_PINFUNC); au_sync();
173
174 /* Restore the static memory controller configuration.
175 */
176 au_writel(sleep_static_memctlr[0][0], MEM_STCFG0);
177 au_writel(sleep_static_memctlr[0][1], MEM_STTIME0);
178 au_writel(sleep_static_memctlr[0][2], MEM_STADDR0);
179 au_writel(sleep_static_memctlr[1][0], MEM_STCFG1);
180 au_writel(sleep_static_memctlr[1][1], MEM_STTIME1);
181 au_writel(sleep_static_memctlr[1][2], MEM_STADDR1);
182 au_writel(sleep_static_memctlr[2][0], MEM_STCFG2);
183 au_writel(sleep_static_memctlr[2][1], MEM_STTIME2);
184 au_writel(sleep_static_memctlr[2][2], MEM_STADDR2);
185 au_writel(sleep_static_memctlr[3][0], MEM_STCFG3);
186 au_writel(sleep_static_memctlr[3][1], MEM_STTIME3);
187 au_writel(sleep_static_memctlr[3][2], MEM_STADDR3);
188
189 /* Enable the UART if it was enabled before sleep.
190 * I guess I should define module control bits........
191 */
192 if (sleep_uart0_enable & 0x02) {
193 au_writel(0, UART0_ADDR + UART_MOD_CNTRL); au_sync();
194 au_writel(1, UART0_ADDR + UART_MOD_CNTRL); au_sync();
195 au_writel(3, UART0_ADDR + UART_MOD_CNTRL); au_sync();
196 au_writel(sleep_uart0_inten, UART0_ADDR + UART_IER); au_sync();
197 au_writel(sleep_uart0_fifoctl, UART0_ADDR + UART_FCR); au_sync();
198 au_writel(sleep_uart0_linectl, UART0_ADDR + UART_LCR); au_sync();
199 au_writel(sleep_uart0_clkdiv, UART0_ADDR + UART_CLK); au_sync();
200 }
201
202 restore_au1xxx_intctl();
203 wakeup_counter0_adjust();
204}
205
206unsigned long suspend_mode;
207
208void wakeup_from_suspend(void)
209{
210 suspend_mode = 0;
211}
212
213int au_sleep(void)
214{
215 unsigned long wakeup, flags;
216 extern void save_and_sleep(void);
217
218 spin_lock_irqsave(&pm_lock,flags);
219
220 save_core_regs();
221
222 flush_cache_all();
223
224 /** The code below is all system dependent and we should probably
225 ** have a function call out of here to set this up. You need
226 ** to configure the GPIO or timer interrupts that will bring
227 ** you out of sleep.
228 ** For testing, the TOY counter wakeup is useful.
229 **/
230
231#if 0
232 au_writel(au_readl(SYS_PINSTATERD) & ~(1 << 11), SYS_PINSTATERD);
233
234 /* gpio 6 can cause a wake up event */
235 wakeup = au_readl(SYS_WAKEMSK);
236 wakeup &= ~(1 << 8); /* turn off match20 wakeup */
237 wakeup |= 1 << 6; /* turn on gpio 6 wakeup */
238#else
239 /* For testing, allow match20 to wake us up.
240 */
241#ifdef SLEEP_TEST_TIMEOUT
242 wakeup_counter0_set(sleep_ticks);
243#endif
244 wakeup = 1 << 8; /* turn on match20 wakeup */
245 wakeup = 0;
246#endif
247 au_writel(1, SYS_WAKESRC); /* clear cause */
248 au_sync();
249 au_writel(wakeup, SYS_WAKEMSK);
250 au_sync();
251
252 save_and_sleep();
253
254 /* after a wakeup, the cpu vectors back to 0x1fc00000 so
255 * it's up to the boot code to get us back here.
256 */
257 restore_core_regs();
258 spin_unlock_irqrestore(&pm_lock, flags);
259 return 0;
260}
261
262static int pm_do_sleep(ctl_table * ctl, int write, struct file *file,
263 void *buffer, size_t * len)
264{
265 int retval = 0;
266#ifdef SLEEP_TEST_TIMEOUT
267#define TMPBUFLEN2 16
268 char buf[TMPBUFLEN2], *p;
269#endif
270
271 if (!write) {
272 *len = 0;
273 } else {
274#ifdef SLEEP_TEST_TIMEOUT
275 if (*len > TMPBUFLEN2 - 1) {
276 return -EFAULT;
277 }
278 if (copy_from_user(buf, buffer, *len)) {
279 return -EFAULT;
280 }
281 buf[*len] = 0;
282 p = buf;
283 sleep_ticks = simple_strtoul(p, &p, 0);
284#endif
285 retval = pm_send_all(PM_SUSPEND, (void *) 2);
286
287 if (retval)
288 return retval;
289
290 au_sleep();
291 retval = pm_send_all(PM_RESUME, (void *) 0);
292 }
293 return retval;
294}
295
296static int pm_do_suspend(ctl_table * ctl, int write, struct file *file,
297 void *buffer, size_t * len)
298{
299 int retval = 0;
300 void au1k_wait(void);
301
302 if (!write) {
303 *len = 0;
304 } else {
305 retval = pm_send_all(PM_SUSPEND, (void *) 2);
306 if (retval)
307 return retval;
308 suspend_mode = 1;
309 au1k_wait();
310 retval = pm_send_all(PM_RESUME, (void *) 0);
311 }
312 return retval;
313}
314
315
316static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
317 void *buffer, size_t * len)
318{
319 int retval = 0, i;
320 unsigned long val, pll;
321#define TMPBUFLEN 64
322#define MAX_CPU_FREQ 396
323 char buf[TMPBUFLEN], *p;
324 unsigned long flags, intc0_mask, intc1_mask;
325 unsigned long old_baud_base, old_cpu_freq, baud_rate, old_clk,
326 old_refresh;
327 unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh;
328
329 spin_lock_irqsave(&pm_lock, flags);
330 if (!write) {
331 *len = 0;
332 } else {
333 /* Parse the new frequency */
334 if (*len > TMPBUFLEN - 1) {
335 spin_unlock_irqrestore(&pm_lock, flags);
336 return -EFAULT;
337 }
338 if (copy_from_user(buf, buffer, *len)) {
339 spin_unlock_irqrestore(&pm_lock, flags);
340 return -EFAULT;
341 }
342 buf[*len] = 0;
343 p = buf;
344 val = simple_strtoul(p, &p, 0);
345 if (val > MAX_CPU_FREQ) {
346 spin_unlock_irqrestore(&pm_lock, flags);
347 return -EFAULT;
348 }
349
350 pll = val / 12;
351 if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */
352 /* revisit this for higher speed cpus */
353 spin_unlock_irqrestore(&pm_lock, flags);
354 return -EFAULT;
355 }
356
357 old_baud_base = get_au1x00_uart_baud_base();
358 old_cpu_freq = get_au1x00_speed();
359
360 new_cpu_freq = pll * 12 * 1000000;
361 new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16));
362 set_au1x00_speed(new_cpu_freq);
363 set_au1x00_uart_baud_base(new_baud_base);
364
365 old_refresh = au_readl(MEM_SDREFCFG) & 0x1ffffff;
366 new_refresh =
367 ((old_refresh * new_cpu_freq) /
368 old_cpu_freq) | (au_readl(MEM_SDREFCFG) & ~0x1ffffff);
369
370 au_writel(pll, SYS_CPUPLL);
371 au_sync_delay(1);
372 au_writel(new_refresh, MEM_SDREFCFG);
373 au_sync_delay(1);
374
375 for (i = 0; i < 4; i++) {
376 if (au_readl
377 (UART_BASE + UART_MOD_CNTRL +
378 i * 0x00100000) == 3) {
379 old_clk =
380 au_readl(UART_BASE + UART_CLK +
381 i * 0x00100000);
382 // baud_rate = baud_base/clk
383 baud_rate = old_baud_base / old_clk;
384 /* we won't get an exact baud rate and the error
385 * could be significant enough that our new
386 * calculation will result in a clock that will
387 * give us a baud rate that's too far off from
388 * what we really want.
389 */
390 if (baud_rate > 100000)
391 baud_rate = 115200;
392 else if (baud_rate > 50000)
393 baud_rate = 57600;
394 else if (baud_rate > 30000)
395 baud_rate = 38400;
396 else if (baud_rate > 17000)
397 baud_rate = 19200;
398 else
399 (baud_rate = 9600);
400 // new_clk = new_baud_base/baud_rate
401 new_clk = new_baud_base / baud_rate;
402 au_writel(new_clk,
403 UART_BASE + UART_CLK +
404 i * 0x00100000);
405 au_sync_delay(10);
406 }
407 }
408 }
409
410
411 /* We don't want _any_ interrupts other than
412 * match20. Otherwise our calibrate_delay()
413 * calculation will be off, potentially a lot.
414 */
415 intc0_mask = save_local_and_disable(0);
416 intc1_mask = save_local_and_disable(1);
417 local_enable_irq(AU1000_TOY_MATCH2_INT);
418 spin_unlock_irqrestore(&pm_lock, flags);
419 calibrate_delay();
420 restore_local_and_enable(0, intc0_mask);
421 restore_local_and_enable(1, intc1_mask);
422 return retval;
423}
424
425
426static struct ctl_table pm_table[] = {
427 {ACPI_S1_SLP_TYP, "suspend", NULL, 0, 0600, NULL, &pm_do_suspend},
428 {ACPI_SLEEP, "sleep", NULL, 0, 0600, NULL, &pm_do_sleep},
429 {CTL_ACPI, "freq", NULL, 0, 0600, NULL, &pm_do_freq},
430 {0}
431};
432
433static struct ctl_table pm_dir_table[] = {
434 {CTL_ACPI, "pm", NULL, 0, 0555, pm_table},
435 {0}
436};
437
438/*
439 * Initialize power interface
440 */
441static int __init pm_init(void)
442{
443 register_sysctl_table(pm_dir_table, 1);
444 return 0;
445}
446
447__initcall(pm_init);
448
449
450/*
451 * This is right out of init/main.c
452 */
453
454/* This is the number of bits of precision for the loops_per_jiffy. Each
455 bit takes on average 1.5/HZ seconds. This (like the original) is a little
456 better than 1% */
457#define LPS_PREC 8
458
459static void calibrate_delay(void)
460{
461 unsigned long ticks, loopbit;
462 int lps_precision = LPS_PREC;
463
464 loops_per_jiffy = (1 << 12);
465
466 while (loops_per_jiffy <<= 1) {
467 /* wait for "start of" clock tick */
468 ticks = jiffies;
469 while (ticks == jiffies)
470 /* nothing */ ;
471 /* Go .. */
472 ticks = jiffies;
473 __delay(loops_per_jiffy);
474 ticks = jiffies - ticks;
475 if (ticks)
476 break;
477 }
478
479/* Do a binary approximation to get loops_per_jiffy set to equal one clock
480 (up to lps_precision bits) */
481 loops_per_jiffy >>= 1;
482 loopbit = loops_per_jiffy;
483 while (lps_precision-- && (loopbit >>= 1)) {
484 loops_per_jiffy |= loopbit;
485 ticks = jiffies;
486 while (ticks == jiffies);
487 ticks = jiffies;
488 __delay(loops_per_jiffy);
489 if (jiffies != ticks) /* longer than 1 tick */
490 loops_per_jiffy &= ~loopbit;
491 }
492}
493#endif /* CONFIG_PM */
diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c
new file mode 100644
index 000000000000..22e5a85af4d5
--- /dev/null
+++ b/arch/mips/au1000/common/prom.c
@@ -0,0 +1,162 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PROM library initialisation code, assuming a version of
5 * pmon is the boot code.
6 *
7 * Copyright 2000,2001 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc.
9 * ppopov@mvista.com or source@mvista.com
10 *
11 * This file was derived from Carsten Langgaard's
12 * arch/mips/mips-boards/xx files.
13 *
14 * Carsten Langgaard, carstenl@mips.com
15 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
16 *
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2 of the License, or (at your
20 * option) any later version.
21 *
22 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
25 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 * You should have received a copy of the GNU General Public License along
34 * with this program; if not, write to the Free Software Foundation, Inc.,
35 * 675 Mass Ave, Cambridge, MA 02139, USA.
36 */
37
38#include <linux/module.h>
39#include <linux/kernel.h>
40#include <linux/init.h>
41#include <linux/string.h>
42
43#include <asm/bootinfo.h>
44
45/* #define DEBUG_CMDLINE */
46
47extern int prom_argc;
48extern char **prom_argv, **prom_envp;
49
50typedef struct
51{
52 char *name;
53/* char *val; */
54}t_env_var;
55
56
57char * prom_getcmdline(void)
58{
59 return &(arcs_cmdline[0]);
60}
61
62void prom_init_cmdline(void)
63{
64 char *cp;
65 int actr;
66
67 actr = 1; /* Always ignore argv[0] */
68
69 cp = &(arcs_cmdline[0]);
70 while(actr < prom_argc) {
71 strcpy(cp, prom_argv[actr]);
72 cp += strlen(prom_argv[actr]);
73 *cp++ = ' ';
74 actr++;
75 }
76 if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
77 --cp;
78 *cp = '\0';
79
80}
81
82
83char *prom_getenv(char *envname)
84{
85 /*
86 * Return a pointer to the given environment variable.
87 * Environment variables are stored in the form of "memsize=64".
88 */
89
90 t_env_var *env = (t_env_var *)prom_envp;
91 int i;
92
93 i = strlen(envname);
94
95 while(env->name) {
96 if(strncmp(envname, env->name, i) == 0) {
97 return(env->name + strlen(envname) + 1);
98 }
99 env++;
100 }
101 return(NULL);
102}
103
104inline unsigned char str2hexnum(unsigned char c)
105{
106 if(c >= '0' && c <= '9')
107 return c - '0';
108 if(c >= 'a' && c <= 'f')
109 return c - 'a' + 10;
110 if(c >= 'A' && c <= 'F')
111 return c - 'A' + 10;
112 return 0; /* foo */
113}
114
115inline void str2eaddr(unsigned char *ea, unsigned char *str)
116{
117 int i;
118
119 for(i = 0; i < 6; i++) {
120 unsigned char num;
121
122 if((*str == '.') || (*str == ':'))
123 str++;
124 num = str2hexnum(*str++) << 4;
125 num |= (str2hexnum(*str++));
126 ea[i] = num;
127 }
128}
129
130int get_ethernet_addr(char *ethernet_addr)
131{
132 char *ethaddr_str;
133
134 ethaddr_str = prom_getenv("ethaddr");
135 if (!ethaddr_str) {
136 printk("ethaddr not set in boot prom\n");
137 return -1;
138 }
139 str2eaddr(ethernet_addr, ethaddr_str);
140
141#if 0
142 {
143 int i;
144
145 printk("get_ethernet_addr: ");
146 for (i=0; i<5; i++)
147 printk("%02x:", (unsigned char)*(ethernet_addr+i));
148 printk("%02x\n", *(ethernet_addr+i));
149 }
150#endif
151
152 return 0;
153}
154
155unsigned long __init prom_free_prom_memory(void)
156{
157 return 0;
158}
159
160EXPORT_SYMBOL(prom_getcmdline);
161EXPORT_SYMBOL(get_ethernet_addr);
162EXPORT_SYMBOL(str2eaddr);
diff --git a/arch/mips/au1000/common/puts.c b/arch/mips/au1000/common/puts.c
new file mode 100644
index 000000000000..c2ae4624b77b
--- /dev/null
+++ b/arch/mips/au1000/common/puts.c
@@ -0,0 +1,145 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Low level uart routines to directly access a 16550 uart.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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/types.h>
32#include <asm/mach-au1x00/au1000.h>
33
34#define SERIAL_BASE UART_BASE
35#define SER_CMD 0x7
36#define SER_DATA 0x1
37#define TX_BUSY 0x20
38
39#define TIMEOUT 0xffffff
40#define SLOW_DOWN
41
42static const char digits[16] = "0123456789abcdef";
43static volatile unsigned long * const com1 = (unsigned long *)SERIAL_BASE;
44
45
46#ifdef SLOW_DOWN
47static inline void slow_down(void)
48{
49 int k;
50 for (k=0; k<10000; k++);
51}
52#else
53#define slow_down()
54#endif
55
56void
57putch(const unsigned char c)
58{
59 unsigned char ch;
60 int i = 0;
61
62 do {
63 ch = com1[SER_CMD];
64 slow_down();
65 i++;
66 if (i>TIMEOUT) {
67 break;
68 }
69 } while (0 == (ch & TX_BUSY));
70 com1[SER_DATA] = c;
71}
72
73void
74puts(unsigned char *cp)
75{
76 unsigned char ch;
77 int i = 0;
78
79 while (*cp) {
80 do {
81 ch = com1[SER_CMD];
82 slow_down();
83 i++;
84 if (i>TIMEOUT) {
85 break;
86 }
87 } while (0 == (ch & TX_BUSY));
88 com1[SER_DATA] = *cp++;
89 }
90 putch('\r');
91 putch('\n');
92}
93
94void
95fputs(const char *cp)
96{
97 unsigned char ch;
98 int i = 0;
99
100 while (*cp) {
101
102 do {
103 ch = com1[SER_CMD];
104 slow_down();
105 i++;
106 if (i>TIMEOUT) {
107 break;
108 }
109 } while (0 == (ch & TX_BUSY));
110 com1[SER_DATA] = *cp++;
111 }
112}
113
114
115void
116put64(uint64_t ul)
117{
118 int cnt;
119 unsigned ch;
120
121 cnt = 16; /* 16 nibbles in a 64 bit long */
122 putch('0');
123 putch('x');
124 do {
125 cnt--;
126 ch = (unsigned char)(ul >> cnt * 4) & 0x0F;
127 putch(digits[ch]);
128 } while (cnt > 0);
129}
130
131void
132put32(unsigned u)
133{
134 int cnt;
135 unsigned ch;
136
137 cnt = 8; /* 8 nibbles in a 32 bit long */
138 putch('0');
139 putch('x');
140 do {
141 cnt--;
142 ch = (unsigned char)(u >> cnt * 4) & 0x0F;
143 putch(digits[ch]);
144 } while (cnt > 0);
145}
diff --git a/arch/mips/au1000/common/reset.c b/arch/mips/au1000/common/reset.c
new file mode 100644
index 000000000000..65b84db800e4
--- /dev/null
+++ b/arch/mips/au1000/common/reset.c
@@ -0,0 +1,195 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Au1000 reset routines.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/config.h>
31#include <linux/sched.h>
32#include <linux/mm.h>
33#include <asm/io.h>
34#include <asm/pgtable.h>
35#include <asm/processor.h>
36#include <asm/reboot.h>
37#include <asm/system.h>
38#include <asm/mach-au1x00/au1000.h>
39
40extern int au_sleep(void);
41extern void (*flush_cache_all)(void);
42
43void au1000_restart(char *command)
44{
45 /* Set all integrated peripherals to disabled states */
46 extern void board_reset (void);
47 u32 prid = read_c0_prid();
48
49 printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n");
50 switch (prid & 0xFF000000)
51 {
52 case 0x00000000: /* Au1000 */
53 au_writel(0x02, 0xb0000010); /* ac97_enable */
54 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
55 asm("sync");
56 au_writel(0x00, 0xb017fffc); /* usbh_enable */
57 au_writel(0x00, 0xb0200058); /* usbd_enable */
58 au_writel(0x00, 0xb0300040); /* ir_enable */
59 au_writel(0x00, 0xb4004104); /* mac dma */
60 au_writel(0x00, 0xb4004114); /* mac dma */
61 au_writel(0x00, 0xb4004124); /* mac dma */
62 au_writel(0x00, 0xb4004134); /* mac dma */
63 au_writel(0x00, 0xb0520000); /* macen0 */
64 au_writel(0x00, 0xb0520004); /* macen1 */
65 au_writel(0x00, 0xb1000008); /* i2s_enable */
66 au_writel(0x00, 0xb1100100); /* uart0_enable */
67 au_writel(0x00, 0xb1200100); /* uart1_enable */
68 au_writel(0x00, 0xb1300100); /* uart2_enable */
69 au_writel(0x00, 0xb1400100); /* uart3_enable */
70 au_writel(0x02, 0xb1600100); /* ssi0_enable */
71 au_writel(0x02, 0xb1680100); /* ssi1_enable */
72 au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
73 au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
74 au_writel(0x00, 0xb1900028); /* sys_clksrc */
75 au_writel(0x10, 0xb1900060); /* sys_cpupll */
76 au_writel(0x00, 0xb1900064); /* sys_auxpll */
77 au_writel(0x00, 0xb1900100); /* sys_pininputen */
78 break;
79 case 0x01000000: /* Au1500 */
80 au_writel(0x02, 0xb0000010); /* ac97_enable */
81 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
82 asm("sync");
83 au_writel(0x00, 0xb017fffc); /* usbh_enable */
84 au_writel(0x00, 0xb0200058); /* usbd_enable */
85 au_writel(0x00, 0xb4004104); /* mac dma */
86 au_writel(0x00, 0xb4004114); /* mac dma */
87 au_writel(0x00, 0xb4004124); /* mac dma */
88 au_writel(0x00, 0xb4004134); /* mac dma */
89 au_writel(0x00, 0xb1520000); /* macen0 */
90 au_writel(0x00, 0xb1520004); /* macen1 */
91 au_writel(0x00, 0xb1100100); /* uart0_enable */
92 au_writel(0x00, 0xb1400100); /* uart3_enable */
93 au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
94 au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
95 au_writel(0x00, 0xb1900028); /* sys_clksrc */
96 au_writel(0x10, 0xb1900060); /* sys_cpupll */
97 au_writel(0x00, 0xb1900064); /* sys_auxpll */
98 au_writel(0x00, 0xb1900100); /* sys_pininputen */
99 break;
100 case 0x02000000: /* Au1100 */
101 au_writel(0x02, 0xb0000010); /* ac97_enable */
102 au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */
103 asm("sync");
104 au_writel(0x00, 0xb017fffc); /* usbh_enable */
105 au_writel(0x00, 0xb0200058); /* usbd_enable */
106 au_writel(0x00, 0xb0300040); /* ir_enable */
107 au_writel(0x00, 0xb4004104); /* mac dma */
108 au_writel(0x00, 0xb4004114); /* mac dma */
109 au_writel(0x00, 0xb4004124); /* mac dma */
110 au_writel(0x00, 0xb4004134); /* mac dma */
111 au_writel(0x00, 0xb0520000); /* macen0 */
112 au_writel(0x00, 0xb1000008); /* i2s_enable */
113 au_writel(0x00, 0xb1100100); /* uart0_enable */
114 au_writel(0x00, 0xb1200100); /* uart1_enable */
115 au_writel(0x00, 0xb1400100); /* uart3_enable */
116 au_writel(0x02, 0xb1600100); /* ssi0_enable */
117 au_writel(0x02, 0xb1680100); /* ssi1_enable */
118 au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
119 au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
120 au_writel(0x00, 0xb1900028); /* sys_clksrc */
121 au_writel(0x10, 0xb1900060); /* sys_cpupll */
122 au_writel(0x00, 0xb1900064); /* sys_auxpll */
123 au_writel(0x00, 0xb1900100); /* sys_pininputen */
124 break;
125 case 0x03000000: /* Au1550 */
126 au_writel(0x00, 0xb1a00004); /* psc 0 */
127 au_writel(0x00, 0xb1b00004); /* psc 1 */
128 au_writel(0x00, 0xb0a00004); /* psc 2 */
129 au_writel(0x00, 0xb0b00004); /* psc 3 */
130 au_writel(0x00, 0xb017fffc); /* usbh_enable */
131 au_writel(0x00, 0xb0200058); /* usbd_enable */
132 au_writel(0x00, 0xb4004104); /* mac dma */
133 au_writel(0x00, 0xb4004114); /* mac dma */
134 au_writel(0x00, 0xb4004124); /* mac dma */
135 au_writel(0x00, 0xb4004134); /* mac dma */
136 au_writel(0x00, 0xb1520000); /* macen0 */
137 au_writel(0x00, 0xb1520004); /* macen1 */
138 au_writel(0x00, 0xb1100100); /* uart0_enable */
139 au_writel(0x00, 0xb1200100); /* uart1_enable */
140 au_writel(0x00, 0xb1400100); /* uart3_enable */
141 au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */
142 au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */
143 au_writel(0x00, 0xb1900028); /* sys_clksrc */
144 au_writel(0x10, 0xb1900060); /* sys_cpupll */
145 au_writel(0x00, 0xb1900064); /* sys_auxpll */
146 au_writel(0x00, 0xb1900100); /* sys_pininputen */
147 break;
148
149 default:
150 break;
151 }
152
153 set_c0_status(ST0_BEV | ST0_ERL);
154 set_c0_config(CONF_CM_UNCACHED);
155 flush_cache_all();
156 write_c0_wired(0);
157
158 /* Give board a chance to do a hardware reset */
159 board_reset();
160
161 /* Jump to the beggining in case board_reset() is empty */
162 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
163}
164
165void au1000_halt(void)
166{
167#if defined(CONFIG_MIPS_PB1550)
168 /* power off system */
169 printk("\n** Powering off Pb1550\n");
170 au_writew(au_readw(0xAF00001C) | (3<<14), 0xAF00001C);
171 au_sync();
172 while(1); /* should not get here */
173#endif
174 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
175#ifdef CONFIG_MIPS_MIRAGE
176 au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT);
177#endif
178#ifdef CONFIG_PM
179 au_sleep();
180
181 /* should not get here */
182 printk(KERN_ERR "Unable to put cpu in sleep mode\n");
183 while(1);
184#else
185 while (1)
186 __asm__(".set\tmips3\n\t"
187 "wait\n\t"
188 ".set\tmips0");
189#endif
190}
191
192void au1000_power_off(void)
193{
194 au1000_halt();
195}
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
new file mode 100644
index 000000000000..dbc8b1bda963
--- /dev/null
+++ b/arch/mips/au1000/common/setup.c
@@ -0,0 +1,195 @@
1/*
2 * Copyright 2000 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ppopov@mvista.com or source@mvista.com
5 *
6 * Updates to 2.6, Pete Popov, Embedded Alley Solutions, Inc.
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/config.h>
29#include <linux/init.h>
30#include <linux/sched.h>
31#include <linux/ioport.h>
32#include <linux/mm.h>
33#include <linux/delay.h>
34#include <linux/interrupt.h>
35
36#include <asm/cpu.h>
37#include <asm/bootinfo.h>
38#include <asm/irq.h>
39#include <asm/mipsregs.h>
40#include <asm/reboot.h>
41#include <asm/pgtable.h>
42#include <asm/mach-au1x00/au1000.h>
43#include <asm/time.h>
44
45extern char * __init prom_getcmdline(void);
46extern void __init board_setup(void);
47extern void au1000_restart(char *);
48extern void au1000_halt(void);
49extern void au1000_power_off(void);
50extern struct resource ioport_resource;
51extern struct resource iomem_resource;
52extern void (*board_time_init)(void);
53extern void au1x_time_init(void);
54extern void (*board_timer_setup)(struct irqaction *irq);
55extern void au1x_timer_setup(struct irqaction *irq);
56extern void au1xxx_time_init(void);
57extern void au1xxx_timer_setup(struct irqaction *irq);
58extern void set_cpuspec(void);
59
60static int __init au1x00_setup(void)
61{
62 struct cpu_spec *sp;
63 char *argptr;
64 unsigned long prid, cpupll, bclk = 1;
65
66 set_cpuspec();
67 sp = cur_cpu_spec[0];
68
69 board_setup(); /* board specific setup */
70
71 prid = read_c0_prid();
72 cpupll = (au_readl(0xB1900060) & 0x3F) * 12;
73 printk("(PRId %08lx) @ %ldMHZ\n", prid, cpupll);
74
75 bclk = sp->cpu_bclk;
76 if (bclk)
77 {
78 /* Enable BCLK switching */
79 bclk = au_readl(0xB190003C);
80 au_writel(bclk | 0x60, 0xB190003C);
81 printk("BCLK switching enabled!\n");
82 }
83
84 if (sp->cpu_od) {
85 /* Various early Au1000 Errata corrected by this */
86 set_c0_config(1<<19); /* Set Config[OD] */
87 }
88 else {
89 /* Clear to obtain best system bus performance */
90 clear_c0_config(1<<19); /* Clear Config[OD] */
91 }
92
93 argptr = prom_getcmdline();
94
95#ifdef CONFIG_SERIAL_AU1X00_CONSOLE
96 if ((argptr = strstr(argptr, "console=")) == NULL) {
97 argptr = prom_getcmdline();
98 strcat(argptr, " console=ttyS0,115200");
99 }
100#endif
101
102#ifdef CONFIG_FB_AU1100
103 if ((argptr = strstr(argptr, "video=")) == NULL) {
104 argptr = prom_getcmdline();
105 /* default panel */
106 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/
107#ifdef CONFIG_MIPS_HYDROGEN3
108 strcat(argptr, " video=au1100fb:panel:Hydrogen_3_NEC_panel_320x240,nohwcursor");
109#else
110 strcat(argptr, " video=au1100fb:panel:s10,nohwcursor");
111#endif
112 }
113#endif
114
115#ifdef CONFIG_FB_E1356
116 if ((argptr = strstr(argptr, "video=")) == NULL) {
117 argptr = prom_getcmdline();
118#ifdef CONFIG_MIPS_PB1000
119 strcat(argptr, " video=e1356fb:system:pb1000,mmunalign:1");
120#else
121 strcat(argptr, " video=e1356fb:system:pb1500");
122#endif
123 }
124#endif
125
126#ifdef CONFIG_FB_XPERT98
127 if ((argptr = strstr(argptr, "video=")) == NULL) {
128 argptr = prom_getcmdline();
129 strcat(argptr, " video=atyfb:1024x768-8@70");
130 }
131#endif
132
133#if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000)
134 /* au1000 does not support vra, au1500 and au1100 do */
135 strcat(argptr, " au1000_audio=vra");
136 argptr = prom_getcmdline();
137#endif
138 _machine_restart = au1000_restart;
139 _machine_halt = au1000_halt;
140 _machine_power_off = au1000_power_off;
141 board_time_init = au1xxx_time_init;
142 board_timer_setup = au1xxx_timer_setup;
143
144 /* IO/MEM resources. */
145 set_io_port_base(0);
146 ioport_resource.start = IOPORT_RESOURCE_START;
147 ioport_resource.end = IOPORT_RESOURCE_END;
148 iomem_resource.start = IOMEM_RESOURCE_START;
149 iomem_resource.end = IOMEM_RESOURCE_END;
150
151 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_E0S);
152 au_writel(SYS_CNTRL_E0 | SYS_CNTRL_EN0, SYS_COUNTER_CNTRL);
153 au_sync();
154 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T0S);
155 au_writel(0, SYS_TOYTRIM);
156
157 return 0;
158}
159
160early_initcall(au1x00_setup);
161
162#if defined(CONFIG_64BIT_PHYS_ADDR)
163/* This routine should be valid for all Au1x based boards */
164phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
165{
166 u32 start, end;
167
168 /* Don't fixup 36 bit addresses */
169 if ((phys_addr >> 32) != 0) return phys_addr;
170
171#ifdef CONFIG_PCI
172 start = (u32)Au1500_PCI_MEM_START;
173 end = (u32)Au1500_PCI_MEM_END;
174 /* check for pci memory window */
175 if ((phys_addr >= start) && ((phys_addr + size) < end)) {
176 return (phys_t)((phys_addr - start) + Au1500_PCI_MEM_START);
177 }
178#endif
179
180 /* All Au1x SOCs have a pcmcia controller */
181 /* We setup our 32 bit pseudo addresses to be equal to the
182 * 36 bit addr >> 4, to make it easier to check the address
183 * and fix it.
184 * The Au1x socket 0 phys attribute address is 0xF 4000 0000.
185 * The pseudo address we use is 0xF400 0000. Any address over
186 * 0xF400 0000 is a pcmcia pseudo address.
187 */
188 if ((phys_addr >= 0xF4000000) && (phys_addr < 0xFFFFFFFF)) {
189 return (phys_t)(phys_addr << 4);
190 }
191
192 /* default nop */
193 return phys_addr;
194}
195#endif
diff --git a/arch/mips/au1000/common/sleeper.S b/arch/mips/au1000/common/sleeper.S
new file mode 100644
index 000000000000..44dac3b0df3b
--- /dev/null
+++ b/arch/mips/au1000/common/sleeper.S
@@ -0,0 +1,149 @@
1/*
2 * Copyright 2002 Embedded Edge, LLC
3 * Author: dan@embeddededge.com
4 *
5 * Sleep helper for Au1xxx sleep mode.
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#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17
18 .text
19 .set macro
20 .set noat
21 .align 5
22
23/* Save all of the processor general registers and go to sleep.
24 * A wakeup condition will get us back here to restore the registers.
25 */
26LEAF(save_and_sleep)
27
28 subu sp, PT_SIZE
29 sw $1, PT_R1(sp)
30 sw $2, PT_R2(sp)
31 sw $3, PT_R3(sp)
32 sw $4, PT_R4(sp)
33 sw $5, PT_R5(sp)
34 sw $6, PT_R6(sp)
35 sw $7, PT_R7(sp)
36 sw $8, PT_R8(sp)
37 sw $9, PT_R9(sp)
38 sw $10, PT_R10(sp)
39 sw $11, PT_R11(sp)
40 sw $12, PT_R12(sp)
41 sw $13, PT_R13(sp)
42 sw $14, PT_R14(sp)
43 sw $15, PT_R15(sp)
44 sw $16, PT_R16(sp)
45 sw $17, PT_R17(sp)
46 sw $18, PT_R18(sp)
47 sw $19, PT_R19(sp)
48 sw $20, PT_R20(sp)
49 sw $21, PT_R21(sp)
50 sw $22, PT_R22(sp)
51 sw $23, PT_R23(sp)
52 sw $24, PT_R24(sp)
53 sw $25, PT_R25(sp)
54 sw $26, PT_R26(sp)
55 sw $27, PT_R27(sp)
56 sw $28, PT_R28(sp)
57 sw $29, PT_R29(sp)
58 sw $30, PT_R30(sp)
59 sw $31, PT_R31(sp)
60 mfc0 k0, CP0_STATUS
61 sw k0, 0x20(sp)
62 mfc0 k0, CP0_CONTEXT
63 sw k0, 0x1c(sp)
64 mfc0 k0, CP0_PAGEMASK
65 sw k0, 0x18(sp)
66 mfc0 k0, CP0_CONFIG
67 sw k0, 0x14(sp)
68
69 /* Now set up the scratch registers so the boot rom will
70 * return to this point upon wakeup.
71 */
72 la k0, 1f
73 lui k1, 0xb190
74 ori k1, 0x18
75 sw sp, 0(k1)
76 ori k1, 0x1c
77 sw k0, 0(k1)
78
79/* Put SDRAM into self refresh. Preload instructions into cache,
80 * issue a precharge, then auto refresh, then sleep commands to it.
81 */
82 la t0, sdsleep
83 .set mips3
84 cache 0x14, 0(t0)
85 cache 0x14, 32(t0)
86 cache 0x14, 64(t0)
87 cache 0x14, 96(t0)
88 .set mips0
89
90sdsleep:
91 lui k0, 0xb400
92 sw zero, 0x001c(k0) /* Precharge */
93 sw zero, 0x0020(k0) /* Auto refresh */
94 sw zero, 0x0030(k0) /* SDRAM sleep */
95 sync
96
97 lui k1, 0xb190
98 sw zero, 0x0078(k1) /* get ready to sleep */
99 sync
100 sw zero, 0x007c(k1) /* Put processor to sleep */
101 sync
102
103 /* This is where we return upon wakeup.
104 * Reload all of the registers and return.
105 */
1061: nop
107 lw k0, 0x20(sp)
108 mtc0 k0, CP0_STATUS
109 lw k0, 0x1c(sp)
110 mtc0 k0, CP0_CONTEXT
111 lw k0, 0x18(sp)
112 mtc0 k0, CP0_PAGEMASK
113 lw k0, 0x14(sp)
114 mtc0 k0, CP0_CONFIG
115 lw $1, PT_R1(sp)
116 lw $2, PT_R2(sp)
117 lw $3, PT_R3(sp)
118 lw $4, PT_R4(sp)
119 lw $5, PT_R5(sp)
120 lw $6, PT_R6(sp)
121 lw $7, PT_R7(sp)
122 lw $8, PT_R8(sp)
123 lw $9, PT_R9(sp)
124 lw $10, PT_R10(sp)
125 lw $11, PT_R11(sp)
126 lw $12, PT_R12(sp)
127 lw $13, PT_R13(sp)
128 lw $14, PT_R14(sp)
129 lw $15, PT_R15(sp)
130 lw $16, PT_R16(sp)
131 lw $17, PT_R17(sp)
132 lw $18, PT_R18(sp)
133 lw $19, PT_R19(sp)
134 lw $20, PT_R20(sp)
135 lw $21, PT_R21(sp)
136 lw $22, PT_R22(sp)
137 lw $23, PT_R23(sp)
138 lw $24, PT_R24(sp)
139 lw $25, PT_R25(sp)
140 lw $26, PT_R26(sp)
141 lw $27, PT_R27(sp)
142 lw $28, PT_R28(sp)
143 lw $29, PT_R29(sp)
144 lw $30, PT_R30(sp)
145 lw $31, PT_R31(sp)
146 addiu sp, PT_SIZE
147
148 jr ra
149END(save_and_sleep)
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c
new file mode 100644
index 000000000000..fe418f1620c3
--- /dev/null
+++ b/arch/mips/au1000/common/time.c
@@ -0,0 +1,469 @@
1/*
2 *
3 * Copyright (C) 2001 MontaVista Software, ppopov@mvista.com
4 * Copied and modified Carsten Langgaard's time.c
5 *
6 * Carsten Langgaard, carstenl@mips.com
7 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 *
26 * Setting up the clock on the MIPS boards.
27 *
28 * Update. Always configure the kernel with CONFIG_NEW_TIME_C. This
29 * will use the user interface gettimeofday() functions from the
30 * arch/mips/kernel/time.c, and we provide the clock interrupt processing
31 * and the timer offset compute functions. If CONFIG_PM is selected,
32 * we also ensure the 32KHz timer is available. -- Dan
33 */
34
35#include <linux/types.h>
36#include <linux/config.h>
37#include <linux/init.h>
38#include <linux/kernel_stat.h>
39#include <linux/sched.h>
40#include <linux/spinlock.h>
41#include <linux/hardirq.h>
42
43#include <asm/compiler.h>
44#include <asm/mipsregs.h>
45#include <asm/ptrace.h>
46#include <asm/time.h>
47#include <asm/div64.h>
48#include <asm/mach-au1x00/au1000.h>
49
50#include <linux/mc146818rtc.h>
51#include <linux/timex.h>
52
53extern void startup_match20_interrupt(void);
54extern void do_softirq(void);
55extern volatile unsigned long wall_jiffies;
56unsigned long missed_heart_beats = 0;
57
58static unsigned long r4k_offset; /* Amount to increment compare reg each time */
59static unsigned long r4k_cur; /* What counter should be at next timer irq */
60int no_au1xxx_32khz;
61void (*au1k_wait_ptr)(void);
62
63/* Cycle counter value at the previous timer interrupt.. */
64static unsigned int timerhi = 0, timerlo = 0;
65
66#ifdef CONFIG_PM
67#define MATCH20_INC 328
68extern void startup_match20_interrupt(void);
69static unsigned long last_pc0, last_match20;
70#endif
71
72static DEFINE_SPINLOCK(time_lock);
73
74static inline void ack_r4ktimer(unsigned long newval)
75{
76 write_c0_compare(newval);
77}
78
79/*
80 * There are a lot of conceptually broken versions of the MIPS timer interrupt
81 * handler floating around. This one is rather different, but the algorithm
82 * is provably more robust.
83 */
84unsigned long wtimer;
85void mips_timer_interrupt(struct pt_regs *regs)
86{
87 int irq = 63;
88 unsigned long count;
89
90 irq_enter();
91 kstat_this_cpu.irqs[irq]++;
92
93 if (r4k_offset == 0)
94 goto null;
95
96 do {
97 count = read_c0_count();
98 timerhi += (count < timerlo); /* Wrap around */
99 timerlo = count;
100
101 kstat_this_cpu.irqs[irq]++;
102 do_timer(regs);
103#ifndef CONFIG_SMP
104 update_process_times(user_mode(regs));
105#endif
106 r4k_cur += r4k_offset;
107 ack_r4ktimer(r4k_cur);
108
109 } while (((unsigned long)read_c0_count()
110 - r4k_cur) < 0x7fffffff);
111
112 irq_exit();
113 return;
114
115null:
116 ack_r4ktimer(0);
117}
118
119#ifdef CONFIG_PM
120void counter0_irq(int irq, void *dev_id, struct pt_regs *regs)
121{
122 unsigned long pc0;
123 int time_elapsed;
124 static int jiffie_drift = 0;
125
126 kstat.irqs[0][irq]++;
127 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) {
128 /* should never happen! */
129 printk(KERN_WARNING "counter 0 w status eror\n");
130 return;
131 }
132
133 pc0 = au_readl(SYS_TOYREAD);
134 if (pc0 < last_match20) {
135 /* counter overflowed */
136 time_elapsed = (0xffffffff - last_match20) + pc0;
137 }
138 else {
139 time_elapsed = pc0 - last_match20;
140 }
141
142 while (time_elapsed > 0) {
143 do_timer(regs);
144#ifndef CONFIG_SMP
145 update_process_times(user_mode(regs));
146#endif
147 time_elapsed -= MATCH20_INC;
148 last_match20 += MATCH20_INC;
149 jiffie_drift++;
150 }
151
152 last_pc0 = pc0;
153 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
154 au_sync();
155
156 /* our counter ticks at 10.009765625 ms/tick, we we're running
157 * almost 10uS too slow per tick.
158 */
159
160 if (jiffie_drift >= 999) {
161 jiffie_drift -= 999;
162 do_timer(regs); /* increment jiffies by one */
163#ifndef CONFIG_SMP
164 update_process_times(user_mode(regs));
165#endif
166 }
167}
168
169/* When we wakeup from sleep, we have to "catch up" on all of the
170 * timer ticks we have missed.
171 */
172void
173wakeup_counter0_adjust(void)
174{
175 unsigned long pc0;
176 int time_elapsed;
177
178 pc0 = au_readl(SYS_TOYREAD);
179 if (pc0 < last_match20) {
180 /* counter overflowed */
181 time_elapsed = (0xffffffff - last_match20) + pc0;
182 }
183 else {
184 time_elapsed = pc0 - last_match20;
185 }
186
187 while (time_elapsed > 0) {
188 time_elapsed -= MATCH20_INC;
189 last_match20 += MATCH20_INC;
190 }
191
192 last_pc0 = pc0;
193 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
194 au_sync();
195
196}
197
198/* This is just for debugging to set the timer for a sleep delay.
199*/
200void
201wakeup_counter0_set(int ticks)
202{
203 unsigned long pc0;
204
205 pc0 = au_readl(SYS_TOYREAD);
206 last_pc0 = pc0;
207 au_writel(last_match20 + (MATCH20_INC * ticks), SYS_TOYMATCH2);
208 au_sync();
209}
210#endif
211
212/* I haven't found anyone that doesn't use a 12 MHz source clock,
213 * but just in case.....
214 */
215#ifdef CONFIG_AU1000_SRC_CLK
216#define AU1000_SRC_CLK CONFIG_AU1000_SRC_CLK
217#else
218#define AU1000_SRC_CLK 12000000
219#endif
220
221/*
222 * We read the real processor speed from the PLL. This is important
223 * because it is more accurate than computing it from the 32KHz
224 * counter, if it exists. If we don't have an accurate processor
225 * speed, all of the peripherals that derive their clocks based on
226 * this advertised speed will introduce error and sometimes not work
227 * properly. This function is futher convoluted to still allow configurations
228 * to do that in case they have really, really old silicon with a
229 * write-only PLL register, that we need the 32KHz when power management
230 * "wait" is enabled, and we need to detect if the 32KHz isn't present
231 * but requested......got it? :-) -- Dan
232 */
233unsigned long cal_r4koff(void)
234{
235 unsigned long count;
236 unsigned long cpu_speed;
237 unsigned long flags;
238 unsigned long counter;
239
240 spin_lock_irqsave(&time_lock, flags);
241
242 /* Power management cares if we don't have a 32KHz counter.
243 */
244 no_au1xxx_32khz = 0;
245 counter = au_readl(SYS_COUNTER_CNTRL);
246 if (counter & SYS_CNTRL_E0) {
247 int trim_divide = 16;
248
249 au_writel(counter | SYS_CNTRL_EN1, SYS_COUNTER_CNTRL);
250
251 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S);
252 /* RTC now ticks at 32.768/16 kHz */
253 au_writel(trim_divide-1, SYS_RTCTRIM);
254 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S);
255
256 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S);
257 au_writel (0, SYS_TOYWRITE);
258 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S);
259
260#if defined(CONFIG_AU1000_USE32K)
261 {
262 unsigned long start, end;
263
264 start = au_readl(SYS_RTCREAD);
265 start += 2;
266 /* wait for the beginning of a new tick
267 */
268 while (au_readl(SYS_RTCREAD) < start);
269
270 /* Start r4k counter.
271 */
272 write_c0_count(0);
273
274 /* Wait 0.5 seconds.
275 */
276 end = start + (32768 / trim_divide)/2;
277
278 while (end > au_readl(SYS_RTCREAD));
279
280 count = read_c0_count();
281 cpu_speed = count * 2;
282 }
283#else
284 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) *
285 AU1000_SRC_CLK;
286 count = cpu_speed / 2;
287#endif
288 }
289 else {
290 /* The 32KHz oscillator isn't running, so assume there
291 * isn't one and grab the processor speed from the PLL.
292 * NOTE: some old silicon doesn't allow reading the PLL.
293 */
294 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK;
295 count = cpu_speed / 2;
296 no_au1xxx_32khz = 1;
297 }
298 mips_hpt_frequency = count;
299 // Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16)
300 set_au1x00_uart_baud_base(cpu_speed / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16));
301 spin_unlock_irqrestore(&time_lock, flags);
302 return (cpu_speed / HZ);
303}
304
305/* This is for machines which generate the exact clock. */
306#define USECS_PER_JIFFY (1000000/HZ)
307#define USECS_PER_JIFFY_FRAC (0x100000000LL*1000000/HZ&0xffffffff)
308
309static unsigned long
310div64_32(unsigned long v1, unsigned long v2, unsigned long v3)
311{
312 unsigned long r0;
313 do_div64_32(r0, v1, v2, v3);
314 return r0;
315}
316
317static unsigned long do_fast_cp0_gettimeoffset(void)
318{
319 u32 count;
320 unsigned long res, tmp;
321 unsigned long r0;
322
323 /* Last jiffy when do_fast_gettimeoffset() was called. */
324 static unsigned long last_jiffies=0;
325 unsigned long quotient;
326
327 /*
328 * Cached "1/(clocks per usec)*2^32" value.
329 * It has to be recalculated once each jiffy.
330 */
331 static unsigned long cached_quotient=0;
332
333 tmp = jiffies;
334
335 quotient = cached_quotient;
336
337 if (tmp && last_jiffies != tmp) {
338 last_jiffies = tmp;
339 if (last_jiffies != 0) {
340 r0 = div64_32(timerhi, timerlo, tmp);
341 quotient = div64_32(USECS_PER_JIFFY, USECS_PER_JIFFY_FRAC, r0);
342 cached_quotient = quotient;
343 }
344 }
345
346 /* Get last timer tick in absolute kernel time */
347 count = read_c0_count();
348
349 /* .. relative to previous jiffy (32 bits is enough) */
350 count -= timerlo;
351
352 __asm__("multu\t%1,%2\n\t"
353 "mfhi\t%0"
354 : "=r" (res)
355 : "r" (count), "r" (quotient)
356 : "hi", "lo", GCC_REG_ACCUM);
357
358 /*
359 * Due to possible jiffies inconsistencies, we need to check
360 * the result so that we'll get a timer that is monotonic.
361 */
362 if (res >= USECS_PER_JIFFY)
363 res = USECS_PER_JIFFY-1;
364
365 return res;
366}
367
368#ifdef CONFIG_PM
369static unsigned long do_fast_pm_gettimeoffset(void)
370{
371 unsigned long pc0;
372 unsigned long offset;
373
374 pc0 = au_readl(SYS_TOYREAD);
375 au_sync();
376 offset = pc0 - last_pc0;
377 if (offset > 2*MATCH20_INC) {
378 printk("huge offset %x, last_pc0 %x last_match20 %x pc0 %x\n",
379 (unsigned)offset, (unsigned)last_pc0,
380 (unsigned)last_match20, (unsigned)pc0);
381 }
382 offset = (unsigned long)((offset * 305) / 10);
383 return offset;
384}
385#endif
386
387void au1xxx_timer_setup(struct irqaction *irq)
388{
389 unsigned int est_freq;
390 extern unsigned long (*do_gettimeoffset)(void);
391 extern void au1k_wait(void);
392
393 printk("calculating r4koff... ");
394 r4k_offset = cal_r4koff();
395 printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);
396
397 //est_freq = 2*r4k_offset*HZ;
398 est_freq = r4k_offset*HZ;
399 est_freq += 5000; /* round */
400 est_freq -= est_freq%10000;
401 printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
402 (est_freq%1000000)*100/1000000);
403 set_au1x00_speed(est_freq);
404 set_au1x00_lcd_clock(); // program the LCD clock
405
406 r4k_cur = (read_c0_count() + r4k_offset);
407 write_c0_compare(r4k_cur);
408
409#ifdef CONFIG_PM
410 /*
411 * setup counter 0, since it keeps ticking after a
412 * 'wait' instruction has been executed. The CP0 timer and
413 * counter 1 do NOT continue running after 'wait'
414 *
415 * It's too early to call request_irq() here, so we handle
416 * counter 0 interrupt as a special irq and it doesn't show
417 * up under /proc/interrupts.
418 *
419 * Check to ensure we really have a 32KHz oscillator before
420 * we do this.
421 */
422 if (no_au1xxx_32khz) {
423 unsigned int c0_status;
424
425 printk("WARNING: no 32KHz clock found.\n");
426 do_gettimeoffset = do_fast_cp0_gettimeoffset;
427
428 /* Ensure we get CPO_COUNTER interrupts.
429 */
430 c0_status = read_c0_status();
431 c0_status |= IE_IRQ5;
432 write_c0_status(c0_status);
433 }
434 else {
435 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);
436 au_writel(0, SYS_TOYWRITE);
437 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S);
438
439 au_writel(au_readl(SYS_WAKEMSK) | (1<<8), SYS_WAKEMSK);
440 au_writel(~0, SYS_WAKESRC);
441 au_sync();
442 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
443
444 /* setup match20 to interrupt once every 10ms */
445 last_pc0 = last_match20 = au_readl(SYS_TOYREAD);
446 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
447 au_sync();
448 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
449 startup_match20_interrupt();
450
451 do_gettimeoffset = do_fast_pm_gettimeoffset;
452
453 /* We can use the real 'wait' instruction.
454 */
455 au1k_wait_ptr = au1k_wait;
456 }
457
458#else
459 /* We have to do this here instead of in timer_init because
460 * the generic code in arch/mips/kernel/time.c will write
461 * over our function pointer.
462 */
463 do_gettimeoffset = do_fast_cp0_gettimeoffset;
464#endif
465}
466
467void __init au1xxx_time_init(void)
468{
469}
diff --git a/arch/mips/au1000/common/usbdev.c b/arch/mips/au1000/common/usbdev.c
new file mode 100644
index 000000000000..447a9a4612a8
--- /dev/null
+++ b/arch/mips/au1000/common/usbdev.c
@@ -0,0 +1,1557 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1000 USB Device-Side (device layer)
4 *
5 * Copyright 2001-2002 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * stevel@mvista.com or source@mvista.com
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#include <linux/kernel.h>
30#include <linux/ioport.h>
31#include <linux/sched.h>
32#include <linux/signal.h>
33#include <linux/errno.h>
34#include <linux/poll.h>
35#include <linux/init.h>
36#include <linux/slab.h>
37#include <linux/fcntl.h>
38#include <linux/module.h>
39#include <linux/spinlock.h>
40#include <linux/list.h>
41#include <linux/smp_lock.h>
42#define DEBUG
43#include <linux/usb.h>
44
45#include <asm/io.h>
46#include <asm/uaccess.h>
47#include <asm/irq.h>
48#include <asm/mipsregs.h>
49#include <asm/au1000.h>
50#include <asm/au1000_dma.h>
51#include <asm/au1000_usbdev.h>
52
53#ifdef DEBUG
54#undef VDEBUG
55#ifdef VDEBUG
56#define vdbg(fmt, arg...) printk(KERN_DEBUG __FILE__ ": " fmt "\n" , ## arg)
57#else
58#define vdbg(fmt, arg...) do {} while (0)
59#endif
60#else
61#define vdbg(fmt, arg...) do {} while (0)
62#endif
63
64#define ALLOC_FLAGS (in_interrupt () ? GFP_ATOMIC : GFP_KERNEL)
65
66#define EP_FIFO_DEPTH 8
67
68typedef enum {
69 SETUP_STAGE = 0,
70 DATA_STAGE,
71 STATUS_STAGE
72} ep0_stage_t;
73
74typedef struct {
75 int read_fifo;
76 int write_fifo;
77 int ctrl_stat;
78 int read_fifo_status;
79 int write_fifo_status;
80} endpoint_reg_t;
81
82typedef struct {
83 usbdev_pkt_t *head;
84 usbdev_pkt_t *tail;
85 int count;
86} pkt_list_t;
87
88typedef struct {
89 int active;
90 struct usb_endpoint_descriptor *desc;
91 endpoint_reg_t *reg;
92 /* Only one of these are used, unless this is the control ep */
93 pkt_list_t inlist;
94 pkt_list_t outlist;
95 unsigned int indma, outdma; /* DMA channel numbers for IN, OUT */
96 /* following are extracted from endpoint descriptor for easy access */
97 int max_pkt_size;
98 int type;
99 int direction;
100 /* WE assign endpoint addresses! */
101 int address;
102 spinlock_t lock;
103} endpoint_t;
104
105
106static struct usb_dev {
107 endpoint_t ep[6];
108 ep0_stage_t ep0_stage;
109
110 struct usb_device_descriptor * dev_desc;
111 struct usb_interface_descriptor* if_desc;
112 struct usb_config_descriptor * conf_desc;
113 u8 * full_conf_desc;
114 struct usb_string_descriptor * str_desc[6];
115
116 /* callback to function layer */
117 void (*func_cb)(usbdev_cb_type_t type, unsigned long arg,
118 void *cb_data);
119 void* cb_data;
120
121 usbdev_state_t state; // device state
122 int suspended; // suspended flag
123 int address; // device address
124 int interface;
125 int num_ep;
126 u8 alternate_setting;
127 u8 configuration; // configuration value
128 int remote_wakeup_en;
129} usbdev;
130
131
132static endpoint_reg_t ep_reg[] = {
133 // FIFO's 0 and 1 are EP0 default control
134 {USBD_EP0RD, USBD_EP0WR, USBD_EP0CS, USBD_EP0RDSTAT, USBD_EP0WRSTAT },
135 {0},
136 // FIFO 2 is EP2, IN
137 { -1, USBD_EP2WR, USBD_EP2CS, -1, USBD_EP2WRSTAT },
138 // FIFO 3 is EP3, IN
139 { -1, USBD_EP3WR, USBD_EP3CS, -1, USBD_EP3WRSTAT },
140 // FIFO 4 is EP4, OUT
141 {USBD_EP4RD, -1, USBD_EP4CS, USBD_EP4RDSTAT, -1 },
142 // FIFO 5 is EP5, OUT
143 {USBD_EP5RD, -1, USBD_EP5CS, USBD_EP5RDSTAT, -1 }
144};
145
146static struct {
147 unsigned int id;
148 const char *str;
149} ep_dma_id[] = {
150 { DMA_ID_USBDEV_EP0_TX, "USBDev EP0 IN" },
151 { DMA_ID_USBDEV_EP0_RX, "USBDev EP0 OUT" },
152 { DMA_ID_USBDEV_EP2_TX, "USBDev EP2 IN" },
153 { DMA_ID_USBDEV_EP3_TX, "USBDev EP3 IN" },
154 { DMA_ID_USBDEV_EP4_RX, "USBDev EP4 OUT" },
155 { DMA_ID_USBDEV_EP5_RX, "USBDev EP5 OUT" }
156};
157
158#define DIR_OUT 0
159#define DIR_IN (1<<3)
160
161#define CONTROL_EP USB_ENDPOINT_XFER_CONTROL
162#define BULK_EP USB_ENDPOINT_XFER_BULK
163
164static inline endpoint_t *
165epaddr_to_ep(struct usb_dev* dev, int ep_addr)
166{
167 if (ep_addr >= 0 && ep_addr < 2)
168 return &dev->ep[0];
169 if (ep_addr < 6)
170 return &dev->ep[ep_addr];
171 return NULL;
172}
173
174static const char* std_req_name[] = {
175 "GET_STATUS",
176 "CLEAR_FEATURE",
177 "RESERVED",
178 "SET_FEATURE",
179 "RESERVED",
180 "SET_ADDRESS",
181 "GET_DESCRIPTOR",
182 "SET_DESCRIPTOR",
183 "GET_CONFIGURATION",
184 "SET_CONFIGURATION",
185 "GET_INTERFACE",
186 "SET_INTERFACE",
187 "SYNCH_FRAME"
188};
189
190static inline const char*
191get_std_req_name(int req)
192{
193 return (req >= 0 && req <= 12) ? std_req_name[req] : "UNKNOWN";
194}
195
196#if 0
197static void
198dump_setup(struct usb_ctrlrequest* s)
199{
200 dbg("%s: requesttype=%d", __FUNCTION__, s->requesttype);
201 dbg("%s: request=%d %s", __FUNCTION__, s->request,
202 get_std_req_name(s->request));
203 dbg("%s: value=0x%04x", __FUNCTION__, s->wValue);
204 dbg("%s: index=%d", __FUNCTION__, s->index);
205 dbg("%s: length=%d", __FUNCTION__, s->length);
206}
207#endif
208
209static inline usbdev_pkt_t *
210alloc_packet(endpoint_t * ep, int data_size, void* data)
211{
212 usbdev_pkt_t* pkt = kmalloc(sizeof(usbdev_pkt_t) + data_size,
213 ALLOC_FLAGS);
214 if (!pkt)
215 return NULL;
216 pkt->ep_addr = ep->address;
217 pkt->size = data_size;
218 pkt->status = 0;
219 pkt->next = NULL;
220 if (data)
221 memcpy(pkt->payload, data, data_size);
222
223 return pkt;
224}
225
226
227/*
228 * Link a packet to the tail of the enpoint's packet list.
229 * EP spinlock must be held when calling.
230 */
231static void
232link_tail(endpoint_t * ep, pkt_list_t * list, usbdev_pkt_t * pkt)
233{
234 if (!list->tail) {
235 list->head = list->tail = pkt;
236 list->count = 1;
237 } else {
238 list->tail->next = pkt;
239 list->tail = pkt;
240 list->count++;
241 }
242}
243
244/*
245 * Unlink and return a packet from the head of the given packet
246 * list. It is the responsibility of the caller to free the packet.
247 * EP spinlock must be held when calling.
248 */
249static usbdev_pkt_t *
250unlink_head(pkt_list_t * list)
251{
252 usbdev_pkt_t *pkt;
253
254 pkt = list->head;
255 if (!pkt || !list->count) {
256 return NULL;
257 }
258
259 list->head = pkt->next;
260 if (!list->head) {
261 list->head = list->tail = NULL;
262 list->count = 0;
263 } else
264 list->count--;
265
266 return pkt;
267}
268
269/*
270 * Create and attach a new packet to the tail of the enpoint's
271 * packet list. EP spinlock must be held when calling.
272 */
273static usbdev_pkt_t *
274add_packet(endpoint_t * ep, pkt_list_t * list, int size)
275{
276 usbdev_pkt_t *pkt = alloc_packet(ep, size, NULL);
277 if (!pkt)
278 return NULL;
279
280 link_tail(ep, list, pkt);
281 return pkt;
282}
283
284
285/*
286 * Unlink and free a packet from the head of the enpoint's
287 * packet list. EP spinlock must be held when calling.
288 */
289static inline void
290free_packet(pkt_list_t * list)
291{
292 kfree(unlink_head(list));
293}
294
295/* EP spinlock must be held when calling. */
296static inline void
297flush_pkt_list(pkt_list_t * list)
298{
299 while (list->count)
300 free_packet(list);
301}
302
303/* EP spinlock must be held when calling */
304static inline void
305flush_write_fifo(endpoint_t * ep)
306{
307 if (ep->reg->write_fifo_status >= 0) {
308 au_writel(USBDEV_FSTAT_FLUSH | USBDEV_FSTAT_UF |
309 USBDEV_FSTAT_OF,
310 ep->reg->write_fifo_status);
311 //udelay(100);
312 //au_writel(USBDEV_FSTAT_UF | USBDEV_FSTAT_OF,
313 // ep->reg->write_fifo_status);
314 }
315}
316
317/* EP spinlock must be held when calling */
318static inline void
319flush_read_fifo(endpoint_t * ep)
320{
321 if (ep->reg->read_fifo_status >= 0) {
322 au_writel(USBDEV_FSTAT_FLUSH | USBDEV_FSTAT_UF |
323 USBDEV_FSTAT_OF,
324 ep->reg->read_fifo_status);
325 //udelay(100);
326 //au_writel(USBDEV_FSTAT_UF | USBDEV_FSTAT_OF,
327 // ep->reg->read_fifo_status);
328 }
329}
330
331
332/* EP spinlock must be held when calling. */
333static void
334endpoint_flush(endpoint_t * ep)
335{
336 // First, flush all packets
337 flush_pkt_list(&ep->inlist);
338 flush_pkt_list(&ep->outlist);
339
340 // Now flush the endpoint's h/w FIFO(s)
341 flush_write_fifo(ep);
342 flush_read_fifo(ep);
343}
344
345/* EP spinlock must be held when calling. */
346static void
347endpoint_stall(endpoint_t * ep)
348{
349 u32 cs;
350
351 warn(__FUNCTION__);
352
353 cs = au_readl(ep->reg->ctrl_stat) | USBDEV_CS_STALL;
354 au_writel(cs, ep->reg->ctrl_stat);
355}
356
357/* EP spinlock must be held when calling. */
358static void
359endpoint_unstall(endpoint_t * ep)
360{
361 u32 cs;
362
363 warn(__FUNCTION__);
364
365 cs = au_readl(ep->reg->ctrl_stat) & ~USBDEV_CS_STALL;
366 au_writel(cs, ep->reg->ctrl_stat);
367}
368
369static void
370endpoint_reset_datatoggle(endpoint_t * ep)
371{
372 // FIXME: is this possible?
373}
374
375
376/* EP spinlock must be held when calling. */
377static int
378endpoint_fifo_read(endpoint_t * ep)
379{
380 int read_count = 0;
381 u8 *bufptr;
382 usbdev_pkt_t *pkt = ep->outlist.tail;
383
384 if (!pkt)
385 return -EINVAL;
386
387 bufptr = &pkt->payload[pkt->size];
388 while (au_readl(ep->reg->read_fifo_status) & USBDEV_FSTAT_FCNT_MASK) {
389 *bufptr++ = au_readl(ep->reg->read_fifo) & 0xff;
390 read_count++;
391 pkt->size++;
392 }
393
394 return read_count;
395}
396
397#if 0
398/* EP spinlock must be held when calling. */
399static int
400endpoint_fifo_write(endpoint_t * ep, int index)
401{
402 int write_count = 0;
403 u8 *bufptr;
404 usbdev_pkt_t *pkt = ep->inlist.head;
405
406 if (!pkt)
407 return -EINVAL;
408
409 bufptr = &pkt->payload[index];
410 while ((au_readl(ep->reg->write_fifo_status) &
411 USBDEV_FSTAT_FCNT_MASK) < EP_FIFO_DEPTH) {
412 if (bufptr < pkt->payload + pkt->size) {
413 au_writel(*bufptr++, ep->reg->write_fifo);
414 write_count++;
415 } else {
416 break;
417 }
418 }
419
420 return write_count;
421}
422#endif
423
424/*
425 * This routine is called to restart transmission of a packet.
426 * The endpoint's TSIZE must be set to the new packet's size,
427 * and DMA to the write FIFO needs to be restarted.
428 * EP spinlock must be held when calling.
429 */
430static void
431kickstart_send_packet(endpoint_t * ep)
432{
433 u32 cs;
434 usbdev_pkt_t *pkt = ep->inlist.head;
435
436 vdbg("%s: ep%d, pkt=%p", __FUNCTION__, ep->address, pkt);
437
438 if (!pkt) {
439 err("%s: head=NULL! list->count=%d", __FUNCTION__,
440 ep->inlist.count);
441 return;
442 }
443
444 dma_cache_wback_inv((unsigned long)pkt->payload, pkt->size);
445
446 /*
447 * make sure FIFO is empty
448 */
449 flush_write_fifo(ep);
450
451 cs = au_readl(ep->reg->ctrl_stat) & USBDEV_CS_STALL;
452 cs |= (pkt->size << USBDEV_CS_TSIZE_BIT);
453 au_writel(cs, ep->reg->ctrl_stat);
454
455 if (get_dma_active_buffer(ep->indma) == 1) {
456 set_dma_count1(ep->indma, pkt->size);
457 set_dma_addr1(ep->indma, virt_to_phys(pkt->payload));
458 enable_dma_buffer1(ep->indma); // reenable
459 } else {
460 set_dma_count0(ep->indma, pkt->size);
461 set_dma_addr0(ep->indma, virt_to_phys(pkt->payload));
462 enable_dma_buffer0(ep->indma); // reenable
463 }
464 if (dma_halted(ep->indma))
465 start_dma(ep->indma);
466}
467
468
469/*
470 * This routine is called when a packet in the inlist has been
471 * completed. Frees the completed packet and starts sending the
472 * next. EP spinlock must be held when calling.
473 */
474static usbdev_pkt_t *
475send_packet_complete(endpoint_t * ep)
476{
477 usbdev_pkt_t *pkt = unlink_head(&ep->inlist);
478
479 if (pkt) {
480 pkt->status =
481 (au_readl(ep->reg->ctrl_stat) & USBDEV_CS_NAK) ?
482 PKT_STATUS_NAK : PKT_STATUS_ACK;
483
484 vdbg("%s: ep%d, %s pkt=%p, list count=%d", __FUNCTION__,
485 ep->address, (pkt->status & PKT_STATUS_NAK) ?
486 "NAK" : "ACK", pkt, ep->inlist.count);
487 }
488
489 /*
490 * The write fifo should already be drained if things are
491 * working right, but flush it anyway just in case.
492 */
493 flush_write_fifo(ep);
494
495 // begin transmitting next packet in the inlist
496 if (ep->inlist.count) {
497 kickstart_send_packet(ep);
498 }
499
500 return pkt;
501}
502
503/*
504 * Add a new packet to the tail of the given ep's packet
505 * inlist. The transmit complete interrupt frees packets from
506 * the head of this list. EP spinlock must be held when calling.
507 */
508static int
509send_packet(struct usb_dev* dev, usbdev_pkt_t *pkt, int async)
510{
511 pkt_list_t *list;
512 endpoint_t* ep;
513
514 if (!pkt || !(ep = epaddr_to_ep(dev, pkt->ep_addr)))
515 return -EINVAL;
516
517 if (!pkt->size)
518 return 0;
519
520 list = &ep->inlist;
521
522 if (!async && list->count) {
523 halt_dma(ep->indma);
524 flush_pkt_list(list);
525 }
526
527 link_tail(ep, list, pkt);
528
529 vdbg("%s: ep%d, pkt=%p, size=%d, list count=%d", __FUNCTION__,
530 ep->address, pkt, pkt->size, list->count);
531
532 if (list->count == 1) {
533 /*
534 * if the packet count is one, it means the list was empty,
535 * and no more data will go out this ep until we kick-start
536 * it again.
537 */
538 kickstart_send_packet(ep);
539 }
540
541 return pkt->size;
542}
543
544/*
545 * This routine is called to restart reception of a packet.
546 * EP spinlock must be held when calling.
547 */
548static void
549kickstart_receive_packet(endpoint_t * ep)
550{
551 usbdev_pkt_t *pkt;
552
553 // get and link a new packet for next reception
554 if (!(pkt = add_packet(ep, &ep->outlist, ep->max_pkt_size))) {
555 err("%s: could not alloc new packet", __FUNCTION__);
556 return;
557 }
558
559 if (get_dma_active_buffer(ep->outdma) == 1) {
560 clear_dma_done1(ep->outdma);
561 set_dma_count1(ep->outdma, ep->max_pkt_size);
562 set_dma_count0(ep->outdma, 0);
563 set_dma_addr1(ep->outdma, virt_to_phys(pkt->payload));
564 enable_dma_buffer1(ep->outdma); // reenable
565 } else {
566 clear_dma_done0(ep->outdma);
567 set_dma_count0(ep->outdma, ep->max_pkt_size);
568 set_dma_count1(ep->outdma, 0);
569 set_dma_addr0(ep->outdma, virt_to_phys(pkt->payload));
570 enable_dma_buffer0(ep->outdma); // reenable
571 }
572 if (dma_halted(ep->outdma))
573 start_dma(ep->outdma);
574}
575
576
577/*
578 * This routine is called when a packet in the outlist has been
579 * completed (received) and we need to prepare for a new packet
580 * to be received. Halts DMA and computes the packet size from the
581 * remaining DMA counter. Then prepares a new packet for reception
582 * and restarts DMA. FIXME: what if another packet comes in
583 * on top of the completed packet? Counter would be wrong.
584 * EP spinlock must be held when calling.
585 */
586static usbdev_pkt_t *
587receive_packet_complete(endpoint_t * ep)
588{
589 usbdev_pkt_t *pkt = ep->outlist.tail;
590 u32 cs;
591
592 halt_dma(ep->outdma);
593
594 cs = au_readl(ep->reg->ctrl_stat);
595
596 if (!pkt)
597 return NULL;
598
599 pkt->size = ep->max_pkt_size - get_dma_residue(ep->outdma);
600 if (pkt->size)
601 dma_cache_inv((unsigned long)pkt->payload, pkt->size);
602 /*
603 * need to pull out any remaining bytes in the FIFO.
604 */
605 endpoint_fifo_read(ep);
606 /*
607 * should be drained now, but flush anyway just in case.
608 */
609 flush_read_fifo(ep);
610
611 pkt->status = (cs & USBDEV_CS_NAK) ? PKT_STATUS_NAK : PKT_STATUS_ACK;
612 if (ep->address == 0 && (cs & USBDEV_CS_SU))
613 pkt->status |= PKT_STATUS_SU;
614
615 vdbg("%s: ep%d, %s pkt=%p, size=%d", __FUNCTION__,
616 ep->address, (pkt->status & PKT_STATUS_NAK) ?
617 "NAK" : "ACK", pkt, pkt->size);
618
619 kickstart_receive_packet(ep);
620
621 return pkt;
622}
623
624
625/*
626 ****************************************************************************
627 * Here starts the standard device request handlers. They are
628 * all called by do_setup() via a table of function pointers.
629 ****************************************************************************
630 */
631
632static ep0_stage_t
633do_get_status(struct usb_dev* dev, struct usb_ctrlrequest* setup)
634{
635 switch (setup->bRequestType) {
636 case 0x80: // Device
637 // FIXME: send device status
638 break;
639 case 0x81: // Interface
640 // FIXME: send interface status
641 break;
642 case 0x82: // End Point
643 // FIXME: send endpoint status
644 break;
645 default:
646 // Invalid Command
647 endpoint_stall(&dev->ep[0]); // Stall End Point 0
648 break;
649 }
650
651 return STATUS_STAGE;
652}
653
654static ep0_stage_t
655do_clear_feature(struct usb_dev* dev, struct usb_ctrlrequest* setup)
656{
657 switch (setup->bRequestType) {
658 case 0x00: // Device
659 if ((le16_to_cpu(setup->wValue) & 0xff) == 1)
660 dev->remote_wakeup_en = 0;
661 else
662 endpoint_stall(&dev->ep[0]);
663 break;
664 case 0x02: // End Point
665 if ((le16_to_cpu(setup->wValue) & 0xff) == 0) {
666 endpoint_t *ep =
667 epaddr_to_ep(dev,
668 le16_to_cpu(setup->wIndex) & 0xff);
669
670 endpoint_unstall(ep);
671 endpoint_reset_datatoggle(ep);
672 } else
673 endpoint_stall(&dev->ep[0]);
674 break;
675 }
676
677 return SETUP_STAGE;
678}
679
680static ep0_stage_t
681do_reserved(struct usb_dev* dev, struct usb_ctrlrequest* setup)
682{
683 // Invalid request, stall End Point 0
684 endpoint_stall(&dev->ep[0]);
685 return SETUP_STAGE;
686}
687
688static ep0_stage_t
689do_set_feature(struct usb_dev* dev, struct usb_ctrlrequest* setup)
690{
691 switch (setup->bRequestType) {
692 case 0x00: // Device
693 if ((le16_to_cpu(setup->wValue) & 0xff) == 1)
694 dev->remote_wakeup_en = 1;
695 else
696 endpoint_stall(&dev->ep[0]);
697 break;
698 case 0x02: // End Point
699 if ((le16_to_cpu(setup->wValue) & 0xff) == 0) {
700 endpoint_t *ep =
701 epaddr_to_ep(dev,
702 le16_to_cpu(setup->wIndex) & 0xff);
703
704 endpoint_stall(ep);
705 } else
706 endpoint_stall(&dev->ep[0]);
707 break;
708 }
709
710 return SETUP_STAGE;
711}
712
713static ep0_stage_t
714do_set_address(struct usb_dev* dev, struct usb_ctrlrequest* setup)
715{
716 int new_state = dev->state;
717 int new_addr = le16_to_cpu(setup->wValue);
718
719 dbg("%s: our address=%d", __FUNCTION__, new_addr);
720
721 if (new_addr > 127) {
722 // usb spec doesn't tell us what to do, so just go to
723 // default state
724 new_state = DEFAULT;
725 dev->address = 0;
726 } else if (dev->address != new_addr) {
727 dev->address = new_addr;
728 new_state = ADDRESS;
729 }
730
731 if (dev->state != new_state) {
732 dev->state = new_state;
733 /* inform function layer of usbdev state change */
734 dev->func_cb(CB_NEW_STATE, dev->state, dev->cb_data);
735 }
736
737 return SETUP_STAGE;
738}
739
740static ep0_stage_t
741do_get_descriptor(struct usb_dev* dev, struct usb_ctrlrequest* setup)
742{
743 int strnum, desc_len = le16_to_cpu(setup->wLength);
744
745 switch (le16_to_cpu(setup->wValue) >> 8) {
746 case USB_DT_DEVICE:
747 // send device descriptor!
748 desc_len = desc_len > dev->dev_desc->bLength ?
749 dev->dev_desc->bLength : desc_len;
750 dbg("sending device desc, size=%d", desc_len);
751 send_packet(dev, alloc_packet(&dev->ep[0], desc_len,
752 dev->dev_desc), 0);
753 break;
754 case USB_DT_CONFIG:
755 // If the config descr index in low-byte of
756 // setup->wValue is valid, send config descr,
757 // otherwise stall ep0.
758 if ((le16_to_cpu(setup->wValue) & 0xff) == 0) {
759 // send config descriptor!
760 if (desc_len <= USB_DT_CONFIG_SIZE) {
761 dbg("sending partial config desc, size=%d",
762 desc_len);
763 send_packet(dev,
764 alloc_packet(&dev->ep[0],
765 desc_len,
766 dev->conf_desc),
767 0);
768 } else {
769 int len = le16_to_cpu(dev->conf_desc->wTotalLength);
770 dbg("sending whole config desc,"
771 " size=%d, our size=%d", desc_len, len);
772 desc_len = desc_len > len ? len : desc_len;
773 send_packet(dev,
774 alloc_packet(&dev->ep[0],
775 desc_len,
776 dev->full_conf_desc),
777 0);
778 }
779 } else
780 endpoint_stall(&dev->ep[0]);
781 break;
782 case USB_DT_STRING:
783 // If the string descr index in low-byte of setup->wValue
784 // is valid, send string descr, otherwise stall ep0.
785 strnum = le16_to_cpu(setup->wValue) & 0xff;
786 if (strnum >= 0 && strnum < 6) {
787 struct usb_string_descriptor *desc =
788 dev->str_desc[strnum];
789 desc_len = desc_len > desc->bLength ?
790 desc->bLength : desc_len;
791 dbg("sending string desc %d", strnum);
792 send_packet(dev,
793 alloc_packet(&dev->ep[0], desc_len,
794 desc), 0);
795 } else
796 endpoint_stall(&dev->ep[0]);
797 break;
798 default:
799 // Invalid request
800 err("invalid get desc=%d, stalled",
801 le16_to_cpu(setup->wValue) >> 8);
802 endpoint_stall(&dev->ep[0]); // Stall endpoint 0
803 break;
804 }
805
806 return STATUS_STAGE;
807}
808
809static ep0_stage_t
810do_set_descriptor(struct usb_dev* dev, struct usb_ctrlrequest* setup)
811{
812 // TODO: implement
813 // there will be an OUT data stage (the descriptor to set)
814 return DATA_STAGE;
815}
816
817static ep0_stage_t
818do_get_configuration(struct usb_dev* dev, struct usb_ctrlrequest* setup)
819{
820 // send dev->configuration
821 dbg("sending config");
822 send_packet(dev, alloc_packet(&dev->ep[0], 1, &dev->configuration),
823 0);
824 return STATUS_STAGE;
825}
826
827static ep0_stage_t
828do_set_configuration(struct usb_dev* dev, struct usb_ctrlrequest* setup)
829{
830 // set active config to low-byte of setup->wValue
831 dev->configuration = le16_to_cpu(setup->wValue) & 0xff;
832 dbg("set config, config=%d", dev->configuration);
833 if (!dev->configuration && dev->state > DEFAULT) {
834 dev->state = ADDRESS;
835 /* inform function layer of usbdev state change */
836 dev->func_cb(CB_NEW_STATE, dev->state, dev->cb_data);
837 } else if (dev->configuration == 1) {
838 dev->state = CONFIGURED;
839 /* inform function layer of usbdev state change */
840 dev->func_cb(CB_NEW_STATE, dev->state, dev->cb_data);
841 } else {
842 // FIXME: "respond with request error" - how?
843 }
844
845 return SETUP_STAGE;
846}
847
848static ep0_stage_t
849do_get_interface(struct usb_dev* dev, struct usb_ctrlrequest* setup)
850{
851 // interface must be zero.
852 if ((le16_to_cpu(setup->wIndex) & 0xff) || dev->state == ADDRESS) {
853 // FIXME: respond with "request error". how?
854 } else if (dev->state == CONFIGURED) {
855 // send dev->alternate_setting
856 dbg("sending alt setting");
857 send_packet(dev, alloc_packet(&dev->ep[0], 1,
858 &dev->alternate_setting), 0);
859 }
860
861 return STATUS_STAGE;
862
863}
864
865static ep0_stage_t
866do_set_interface(struct usb_dev* dev, struct usb_ctrlrequest* setup)
867{
868 if (dev->state == ADDRESS) {
869 // FIXME: respond with "request error". how?
870 } else if (dev->state == CONFIGURED) {
871 dev->interface = le16_to_cpu(setup->wIndex) & 0xff;
872 dev->alternate_setting =
873 le16_to_cpu(setup->wValue) & 0xff;
874 // interface and alternate_setting must be zero
875 if (dev->interface || dev->alternate_setting) {
876 // FIXME: respond with "request error". how?
877 }
878 }
879
880 return SETUP_STAGE;
881}
882
883static ep0_stage_t
884do_synch_frame(struct usb_dev* dev, struct usb_ctrlrequest* setup)
885{
886 // TODO
887 return SETUP_STAGE;
888}
889
890typedef ep0_stage_t (*req_method_t)(struct usb_dev* dev,
891 struct usb_ctrlrequest* setup);
892
893
894/* Table of the standard device request handlers */
895static const req_method_t req_method[] = {
896 do_get_status,
897 do_clear_feature,
898 do_reserved,
899 do_set_feature,
900 do_reserved,
901 do_set_address,
902 do_get_descriptor,
903 do_set_descriptor,
904 do_get_configuration,
905 do_set_configuration,
906 do_get_interface,
907 do_set_interface,
908 do_synch_frame
909};
910
911
912// SETUP packet request dispatcher
913static void
914do_setup (struct usb_dev* dev, struct usb_ctrlrequest* setup)
915{
916 req_method_t m;
917
918 dbg("%s: req %d %s", __FUNCTION__, setup->bRequestType,
919 get_std_req_name(setup->bRequestType));
920
921 if ((setup->bRequestType & USB_TYPE_MASK) != USB_TYPE_STANDARD ||
922 (setup->bRequestType & USB_RECIP_MASK) != USB_RECIP_DEVICE) {
923 err("%s: invalid requesttype 0x%02x", __FUNCTION__,
924 setup->bRequestType);
925 return;
926 }
927
928 if ((setup->bRequestType & 0x80) == USB_DIR_OUT && setup->wLength)
929 dbg("%s: OUT phase! length=%d", __FUNCTION__, setup->wLength);
930
931 if (setup->bRequestType < sizeof(req_method)/sizeof(req_method_t))
932 m = req_method[setup->bRequestType];
933 else
934 m = do_reserved;
935
936 dev->ep0_stage = (*m)(dev, setup);
937}
938
939/*
940 * A SETUP, DATA0, or DATA1 packet has been received
941 * on the default control endpoint's fifo.
942 */
943static void
944process_ep0_receive (struct usb_dev* dev)
945{
946 endpoint_t *ep0 = &dev->ep[0];
947 usbdev_pkt_t *pkt;
948
949 spin_lock(&ep0->lock);
950
951 // complete packet and prepare a new packet
952 pkt = receive_packet_complete(ep0);
953 if (!pkt) {
954 // FIXME: should put a warn/err here.
955 spin_unlock(&ep0->lock);
956 return;
957 }
958
959 // unlink immediately from endpoint.
960 unlink_head(&ep0->outlist);
961
962 // override current stage if h/w says it's a setup packet
963 if (pkt->status & PKT_STATUS_SU)
964 dev->ep0_stage = SETUP_STAGE;
965
966 switch (dev->ep0_stage) {
967 case SETUP_STAGE:
968 vdbg("SU bit is %s in setup stage",
969 (pkt->status & PKT_STATUS_SU) ? "set" : "not set");
970
971 if (pkt->size == sizeof(struct usb_ctrlrequest)) {
972#ifdef VDEBUG
973 if (pkt->status & PKT_STATUS_ACK)
974 vdbg("received SETUP");
975 else
976 vdbg("received NAK SETUP");
977#endif
978 do_setup(dev, (struct usb_ctrlrequest*)pkt->payload);
979 } else
980 err("%s: wrong size SETUP received", __FUNCTION__);
981 break;
982 case DATA_STAGE:
983 /*
984 * this setup has an OUT data stage. Of the standard
985 * device requests, only set_descriptor has this stage,
986 * so this packet is that descriptor. TODO: drop it for
987 * now, set_descriptor not implemented.
988 *
989 * Need to place a byte in the write FIFO here, to prepare
990 * to send a zero-length DATA ack packet to the host in the
991 * STATUS stage.
992 */
993 au_writel(0, ep0->reg->write_fifo);
994 dbg("received OUT stage DATAx on EP0, size=%d", pkt->size);
995 dev->ep0_stage = SETUP_STAGE;
996 break;
997 case STATUS_STAGE:
998 // this setup had an IN data stage, and host is ACK'ing
999 // the packet we sent during that stage.
1000 if (pkt->size != 0)
1001 warn("received non-zero ACK on EP0??");
1002#ifdef VDEBUG
1003 else
1004 vdbg("received ACK on EP0");
1005#endif
1006 dev->ep0_stage = SETUP_STAGE;
1007 break;
1008 }
1009
1010 spin_unlock(&ep0->lock);
1011 // we're done processing the packet, free it
1012 kfree(pkt);
1013}
1014
1015
1016/*
1017 * A DATA0/1 packet has been received on one of the OUT endpoints (4 or 5)
1018 */
1019static void
1020process_ep_receive (struct usb_dev* dev, endpoint_t *ep)
1021{
1022 usbdev_pkt_t *pkt;
1023
1024 spin_lock(&ep->lock);
1025 pkt = receive_packet_complete(ep);
1026 spin_unlock(&ep->lock);
1027
1028 dev->func_cb(CB_PKT_COMPLETE, (unsigned long)pkt, dev->cb_data);
1029}
1030
1031
1032
1033/* This ISR handles the receive complete and suspend events */
1034static void
1035req_sus_intr (int irq, void *dev_id, struct pt_regs *regs)
1036{
1037 struct usb_dev *dev = (struct usb_dev *) dev_id;
1038 u32 status;
1039
1040 status = au_readl(USBD_INTSTAT);
1041 au_writel(status, USBD_INTSTAT); // ack'em
1042
1043 if (status & (1<<0))
1044 process_ep0_receive(dev);
1045 if (status & (1<<4))
1046 process_ep_receive(dev, &dev->ep[4]);
1047 if (status & (1<<5))
1048 process_ep_receive(dev, &dev->ep[5]);
1049}
1050
1051
1052/* This ISR handles the DMA done events on EP0 */
1053static void
1054dma_done_ep0_intr(int irq, void *dev_id, struct pt_regs *regs)
1055{
1056 struct usb_dev *dev = (struct usb_dev *) dev_id;
1057 usbdev_pkt_t* pkt;
1058 endpoint_t *ep0 = &dev->ep[0];
1059 u32 cs0, buff_done;
1060
1061 spin_lock(&ep0->lock);
1062 cs0 = au_readl(ep0->reg->ctrl_stat);
1063
1064 // first check packet transmit done
1065 if ((buff_done = get_dma_buffer_done(ep0->indma)) != 0) {
1066 // transmitted a DATAx packet during DATA stage
1067 // on control endpoint 0
1068 // clear DMA done bit
1069 if (buff_done & DMA_D0)
1070 clear_dma_done0(ep0->indma);
1071 if (buff_done & DMA_D1)
1072 clear_dma_done1(ep0->indma);
1073
1074 pkt = send_packet_complete(ep0);
1075 if (pkt)
1076 kfree(pkt);
1077 }
1078
1079 /*
1080 * Now check packet receive done. Shouldn't get these,
1081 * the receive packet complete intr should happen
1082 * before the DMA done intr occurs.
1083 */
1084 if ((buff_done = get_dma_buffer_done(ep0->outdma)) != 0) {
1085 // clear DMA done bit
1086 if (buff_done & DMA_D0)
1087 clear_dma_done0(ep0->outdma);
1088 if (buff_done & DMA_D1)
1089 clear_dma_done1(ep0->outdma);
1090
1091 //process_ep0_receive(dev);
1092 }
1093
1094 spin_unlock(&ep0->lock);
1095}
1096
1097/* This ISR handles the DMA done events on endpoints 2,3,4,5 */
1098static void
1099dma_done_ep_intr(int irq, void *dev_id, struct pt_regs *regs)
1100{
1101 struct usb_dev *dev = (struct usb_dev *) dev_id;
1102 int i;
1103
1104 for (i = 2; i < 6; i++) {
1105 u32 buff_done;
1106 usbdev_pkt_t* pkt;
1107 endpoint_t *ep = &dev->ep[i];
1108
1109 if (!ep->active) continue;
1110
1111 spin_lock(&ep->lock);
1112
1113 if (ep->direction == USB_DIR_IN) {
1114 buff_done = get_dma_buffer_done(ep->indma);
1115 if (buff_done != 0) {
1116 // transmitted a DATAx pkt on the IN ep
1117 // clear DMA done bit
1118 if (buff_done & DMA_D0)
1119 clear_dma_done0(ep->indma);
1120 if (buff_done & DMA_D1)
1121 clear_dma_done1(ep->indma);
1122
1123 pkt = send_packet_complete(ep);
1124
1125 spin_unlock(&ep->lock);
1126 dev->func_cb(CB_PKT_COMPLETE,
1127 (unsigned long)pkt,
1128 dev->cb_data);
1129 spin_lock(&ep->lock);
1130 }
1131 } else {
1132 /*
1133 * Check packet receive done (OUT ep). Shouldn't get
1134 * these, the rx packet complete intr should happen
1135 * before the DMA done intr occurs.
1136 */
1137 buff_done = get_dma_buffer_done(ep->outdma);
1138 if (buff_done != 0) {
1139 // received a DATAx pkt on the OUT ep
1140 // clear DMA done bit
1141 if (buff_done & DMA_D0)
1142 clear_dma_done0(ep->outdma);
1143 if (buff_done & DMA_D1)
1144 clear_dma_done1(ep->outdma);
1145
1146 //process_ep_receive(dev, ep);
1147 }
1148 }
1149
1150 spin_unlock(&ep->lock);
1151 }
1152}
1153
1154
1155/***************************************************************************
1156 * Here begins the external interface functions
1157 ***************************************************************************
1158 */
1159
1160/*
1161 * allocate a new packet
1162 */
1163int
1164usbdev_alloc_packet(int ep_addr, int data_size, usbdev_pkt_t** pkt)
1165{
1166 endpoint_t * ep = epaddr_to_ep(&usbdev, ep_addr);
1167 usbdev_pkt_t* lpkt = NULL;
1168
1169 if (!ep || !ep->active || ep->address < 2)
1170 return -ENODEV;
1171 if (data_size > ep->max_pkt_size)
1172 return -EINVAL;
1173
1174 lpkt = *pkt = alloc_packet(ep, data_size, NULL);
1175 if (!lpkt)
1176 return -ENOMEM;
1177 return 0;
1178}
1179
1180
1181/*
1182 * packet send
1183 */
1184int
1185usbdev_send_packet(int ep_addr, usbdev_pkt_t * pkt)
1186{
1187 unsigned long flags;
1188 int count;
1189 endpoint_t * ep;
1190
1191 if (!pkt || !(ep = epaddr_to_ep(&usbdev, pkt->ep_addr)) ||
1192 !ep->active || ep->address < 2)
1193 return -ENODEV;
1194 if (ep->direction != USB_DIR_IN)
1195 return -EINVAL;
1196
1197 spin_lock_irqsave(&ep->lock, flags);
1198 count = send_packet(&usbdev, pkt, 1);
1199 spin_unlock_irqrestore(&ep->lock, flags);
1200
1201 return count;
1202}
1203
1204/*
1205 * packet receive
1206 */
1207int
1208usbdev_receive_packet(int ep_addr, usbdev_pkt_t** pkt)
1209{
1210 unsigned long flags;
1211 usbdev_pkt_t* lpkt = NULL;
1212 endpoint_t *ep = epaddr_to_ep(&usbdev, ep_addr);
1213
1214 if (!ep || !ep->active || ep->address < 2)
1215 return -ENODEV;
1216 if (ep->direction != USB_DIR_OUT)
1217 return -EINVAL;
1218
1219 spin_lock_irqsave(&ep->lock, flags);
1220 if (ep->outlist.count > 1)
1221 lpkt = unlink_head(&ep->outlist);
1222 spin_unlock_irqrestore(&ep->lock, flags);
1223
1224 if (!lpkt) {
1225 /* no packet available */
1226 *pkt = NULL;
1227 return -ENODATA;
1228 }
1229
1230 *pkt = lpkt;
1231
1232 return lpkt->size;
1233}
1234
1235
1236/*
1237 * return total queued byte count on the endpoint.
1238 */
1239int
1240usbdev_get_byte_count(int ep_addr)
1241{
1242 unsigned long flags;
1243 pkt_list_t *list;
1244 usbdev_pkt_t *scan;
1245 int count = 0;
1246 endpoint_t * ep = epaddr_to_ep(&usbdev, ep_addr);
1247
1248 if (!ep || !ep->active || ep->address < 2)
1249 return -ENODEV;
1250
1251 if (ep->direction == USB_DIR_IN) {
1252 list = &ep->inlist;
1253
1254 spin_lock_irqsave(&ep->lock, flags);
1255 for (scan = list->head; scan; scan = scan->next)
1256 count += scan->size;
1257 spin_unlock_irqrestore(&ep->lock, flags);
1258 } else {
1259 list = &ep->outlist;
1260
1261 spin_lock_irqsave(&ep->lock, flags);
1262 if (list->count > 1) {
1263 for (scan = list->head; scan != list->tail;
1264 scan = scan->next)
1265 count += scan->size;
1266 }
1267 spin_unlock_irqrestore(&ep->lock, flags);
1268 }
1269
1270 return count;
1271}
1272
1273
1274void
1275usbdev_exit(void)
1276{
1277 endpoint_t *ep;
1278 int i;
1279
1280 au_writel(0, USBD_INTEN); // disable usb dev ints
1281 au_writel(0, USBD_ENABLE); // disable usb dev
1282
1283 free_irq(AU1000_USB_DEV_REQ_INT, &usbdev);
1284 free_irq(AU1000_USB_DEV_SUS_INT, &usbdev);
1285
1286 // free all control endpoint resources
1287 ep = &usbdev.ep[0];
1288 free_au1000_dma(ep->indma);
1289 free_au1000_dma(ep->outdma);
1290 endpoint_flush(ep);
1291
1292 // free ep resources
1293 for (i = 2; i < 6; i++) {
1294 ep = &usbdev.ep[i];
1295 if (!ep->active) continue;
1296
1297 if (ep->direction == USB_DIR_IN) {
1298 free_au1000_dma(ep->indma);
1299 } else {
1300 free_au1000_dma(ep->outdma);
1301 }
1302 endpoint_flush(ep);
1303 }
1304
1305 if (usbdev.full_conf_desc)
1306 kfree(usbdev.full_conf_desc);
1307}
1308
1309int
1310usbdev_init(struct usb_device_descriptor* dev_desc,
1311 struct usb_config_descriptor* config_desc,
1312 struct usb_interface_descriptor* if_desc,
1313 struct usb_endpoint_descriptor* ep_desc,
1314 struct usb_string_descriptor* str_desc[],
1315 void (*cb)(usbdev_cb_type_t, unsigned long, void *),
1316 void* cb_data)
1317{
1318 endpoint_t *ep0;
1319 int i, ret=0;
1320 u8* fcd;
1321
1322 if (dev_desc->bNumConfigurations > 1 ||
1323 config_desc->bNumInterfaces > 1 ||
1324 if_desc->bNumEndpoints > 4) {
1325 err("Only one config, one i/f, and no more "
1326 "than 4 ep's allowed");
1327 ret = -EINVAL;
1328 goto out;
1329 }
1330
1331 if (!cb) {
1332 err("Function-layer callback required");
1333 ret = -EINVAL;
1334 goto out;
1335 }
1336
1337 if (dev_desc->bMaxPacketSize0 != USBDEV_EP0_MAX_PACKET_SIZE) {
1338 warn("EP0 Max Packet size must be %d",
1339 USBDEV_EP0_MAX_PACKET_SIZE);
1340 dev_desc->bMaxPacketSize0 = USBDEV_EP0_MAX_PACKET_SIZE;
1341 }
1342
1343 memset(&usbdev, 0, sizeof(struct usb_dev));
1344
1345 usbdev.state = DEFAULT;
1346 usbdev.dev_desc = dev_desc;
1347 usbdev.if_desc = if_desc;
1348 usbdev.conf_desc = config_desc;
1349 for (i=0; i<6; i++)
1350 usbdev.str_desc[i] = str_desc[i];
1351 usbdev.func_cb = cb;
1352 usbdev.cb_data = cb_data;
1353
1354 /* Initialize default control endpoint */
1355 ep0 = &usbdev.ep[0];
1356 ep0->active = 1;
1357 ep0->type = CONTROL_EP;
1358 ep0->max_pkt_size = USBDEV_EP0_MAX_PACKET_SIZE;
1359 spin_lock_init(&ep0->lock);
1360 ep0->desc = NULL; // ep0 has no descriptor
1361 ep0->address = 0;
1362 ep0->direction = 0;
1363 ep0->reg = &ep_reg[0];
1364
1365 /* Initialize the other requested endpoints */
1366 for (i = 0; i < if_desc->bNumEndpoints; i++) {
1367 struct usb_endpoint_descriptor* epd = &ep_desc[i];
1368 endpoint_t *ep;
1369
1370 if ((epd->bEndpointAddress & 0x80) == USB_DIR_IN) {
1371 ep = &usbdev.ep[2];
1372 ep->address = 2;
1373 if (ep->active) {
1374 ep = &usbdev.ep[3];
1375 ep->address = 3;
1376 if (ep->active) {
1377 err("too many IN ep's requested");
1378 ret = -ENODEV;
1379 goto out;
1380 }
1381 }
1382 } else {
1383 ep = &usbdev.ep[4];
1384 ep->address = 4;
1385 if (ep->active) {
1386 ep = &usbdev.ep[5];
1387 ep->address = 5;
1388 if (ep->active) {
1389 err("too many OUT ep's requested");
1390 ret = -ENODEV;
1391 goto out;
1392 }
1393 }
1394 }
1395
1396 ep->active = 1;
1397 epd->bEndpointAddress &= ~0x0f;
1398 epd->bEndpointAddress |= (u8)ep->address;
1399 ep->direction = epd->bEndpointAddress & 0x80;
1400 ep->type = epd->bmAttributes & 0x03;
1401 ep->max_pkt_size = le16_to_cpu(epd->wMaxPacketSize);
1402 spin_lock_init(&ep->lock);
1403 ep->desc = epd;
1404 ep->reg = &ep_reg[ep->address];
1405 }
1406
1407 /*
1408 * initialize the full config descriptor
1409 */
1410 usbdev.full_conf_desc = fcd = kmalloc(le16_to_cpu(config_desc->wTotalLength),
1411 ALLOC_FLAGS);
1412 if (!fcd) {
1413 err("failed to alloc full config descriptor");
1414 ret = -ENOMEM;
1415 goto out;
1416 }
1417
1418 memcpy(fcd, config_desc, USB_DT_CONFIG_SIZE);
1419 fcd += USB_DT_CONFIG_SIZE;
1420 memcpy(fcd, if_desc, USB_DT_INTERFACE_SIZE);
1421 fcd += USB_DT_INTERFACE_SIZE;
1422 for (i = 0; i < if_desc->bNumEndpoints; i++) {
1423 memcpy(fcd, &ep_desc[i], USB_DT_ENDPOINT_SIZE);
1424 fcd += USB_DT_ENDPOINT_SIZE;
1425 }
1426
1427 /* Now we're ready to enable the controller */
1428 au_writel(0x0002, USBD_ENABLE);
1429 udelay(100);
1430 au_writel(0x0003, USBD_ENABLE);
1431 udelay(100);
1432
1433 /* build and send config table based on ep descriptors */
1434 for (i = 0; i < 6; i++) {
1435 endpoint_t *ep;
1436 if (i == 1)
1437 continue; // skip dummy ep
1438 ep = &usbdev.ep[i];
1439 if (ep->active) {
1440 au_writel((ep->address << 4) | 0x04, USBD_CONFIG);
1441 au_writel(((ep->max_pkt_size & 0x380) >> 7) |
1442 (ep->direction >> 4) | (ep->type << 4),
1443 USBD_CONFIG);
1444 au_writel((ep->max_pkt_size & 0x7f) << 1, USBD_CONFIG);
1445 au_writel(0x00, USBD_CONFIG);
1446 au_writel(ep->address, USBD_CONFIG);
1447 } else {
1448 u8 dir = (i==2 || i==3) ? DIR_IN : DIR_OUT;
1449 au_writel((i << 4) | 0x04, USBD_CONFIG);
1450 au_writel(((16 & 0x380) >> 7) | dir |
1451 (BULK_EP << 4), USBD_CONFIG);
1452 au_writel((16 & 0x7f) << 1, USBD_CONFIG);
1453 au_writel(0x00, USBD_CONFIG);
1454 au_writel(i, USBD_CONFIG);
1455 }
1456 }
1457
1458 /*
1459 * Enable Receive FIFO Complete interrupts only. Transmit
1460 * complete is being handled by the DMA done interrupts.
1461 */
1462 au_writel(0x31, USBD_INTEN);
1463
1464 /*
1465 * Controller is now enabled, request DMA and IRQ
1466 * resources.
1467 */
1468
1469 /* request the USB device transfer complete interrupt */
1470 if (request_irq(AU1000_USB_DEV_REQ_INT, req_sus_intr, SA_INTERRUPT,
1471 "USBdev req", &usbdev)) {
1472 err("Can't get device request intr");
1473 ret = -ENXIO;
1474 goto out;
1475 }
1476 /* request the USB device suspend interrupt */
1477 if (request_irq(AU1000_USB_DEV_SUS_INT, req_sus_intr, SA_INTERRUPT,
1478 "USBdev sus", &usbdev)) {
1479 err("Can't get device suspend intr");
1480 ret = -ENXIO;
1481 goto out;
1482 }
1483
1484 /* Request EP0 DMA and IRQ */
1485 if ((ep0->indma = request_au1000_dma(ep_dma_id[0].id,
1486 ep_dma_id[0].str,
1487 dma_done_ep0_intr,
1488 SA_INTERRUPT,
1489 &usbdev)) < 0) {
1490 err("Can't get %s DMA", ep_dma_id[0].str);
1491 ret = -ENXIO;
1492 goto out;
1493 }
1494 if ((ep0->outdma = request_au1000_dma(ep_dma_id[1].id,
1495 ep_dma_id[1].str,
1496 NULL, 0, NULL)) < 0) {
1497 err("Can't get %s DMA", ep_dma_id[1].str);
1498 ret = -ENXIO;
1499 goto out;
1500 }
1501
1502 // Flush the ep0 buffers and FIFOs
1503 endpoint_flush(ep0);
1504 // start packet reception on ep0
1505 kickstart_receive_packet(ep0);
1506
1507 /* Request DMA and IRQ for the other endpoints */
1508 for (i = 2; i < 6; i++) {
1509 endpoint_t *ep = &usbdev.ep[i];
1510 if (!ep->active)
1511 continue;
1512
1513 // Flush the endpoint buffers and FIFOs
1514 endpoint_flush(ep);
1515
1516 if (ep->direction == USB_DIR_IN) {
1517 ep->indma =
1518 request_au1000_dma(ep_dma_id[ep->address].id,
1519 ep_dma_id[ep->address].str,
1520 dma_done_ep_intr,
1521 SA_INTERRUPT,
1522 &usbdev);
1523 if (ep->indma < 0) {
1524 err("Can't get %s DMA",
1525 ep_dma_id[ep->address].str);
1526 ret = -ENXIO;
1527 goto out;
1528 }
1529 } else {
1530 ep->outdma =
1531 request_au1000_dma(ep_dma_id[ep->address].id,
1532 ep_dma_id[ep->address].str,
1533 NULL, 0, NULL);
1534 if (ep->outdma < 0) {
1535 err("Can't get %s DMA",
1536 ep_dma_id[ep->address].str);
1537 ret = -ENXIO;
1538 goto out;
1539 }
1540
1541 // start packet reception on OUT endpoint
1542 kickstart_receive_packet(ep);
1543 }
1544 }
1545
1546 out:
1547 if (ret)
1548 usbdev_exit();
1549 return ret;
1550}
1551
1552EXPORT_SYMBOL(usbdev_init);
1553EXPORT_SYMBOL(usbdev_exit);
1554EXPORT_SYMBOL(usbdev_alloc_packet);
1555EXPORT_SYMBOL(usbdev_receive_packet);
1556EXPORT_SYMBOL(usbdev_send_packet);
1557EXPORT_SYMBOL(usbdev_get_byte_count);
diff --git a/arch/mips/au1000/csb250/Makefile b/arch/mips/au1000/csb250/Makefile
new file mode 100644
index 000000000000..c0c4dcdccae8
--- /dev/null
+++ b/arch/mips/au1000/csb250/Makefile
@@ -0,0 +1,8 @@
1#
2# Copyright 2002 Cogent Computer Systems
3# dan@embeddededge.com
4#
5# Makefile for the Cogent CSB250 Au1500 board. Copied from Pb1500.
6#
7
8obj-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/csb250/board_setup.c b/arch/mips/au1000/csb250/board_setup.c
new file mode 100644
index 000000000000..90426eaffb23
--- /dev/null
+++ b/arch/mips/au1000/csb250/board_setup.c
@@ -0,0 +1,239 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Cogent CSB250 board setup.
5 *
6 * Copyright 2002 Cogent Computer Systems, Inc.
7 * dan@embeddededge.com
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#include <linux/config.h>
30#include <linux/init.h>
31#include <linux/sched.h>
32#include <linux/ioport.h>
33#include <linux/mm.h>
34#include <linux/console.h>
35#include <linux/mc146818rtc.h>
36#include <linux/delay.h>
37
38#include <asm/cpu.h>
39#include <asm/bootinfo.h>
40#include <asm/irq.h>
41#include <asm/keyboard.h>
42#include <asm/mipsregs.h>
43#include <asm/reboot.h>
44#include <asm/pgtable.h>
45#include <asm/au1000.h>
46#include <asm/csb250.h>
47
48extern int (*board_pci_idsel)(unsigned int devsel, int assert);
49int csb250_pci_idsel(unsigned int devsel, int assert);
50
51void __init board_setup(void)
52{
53 u32 pin_func, pin_val;
54 u32 sys_freqctrl, sys_clksrc;
55
56
57 // set AUX clock to 12MHz * 8 = 96 MHz
58 au_writel(8, SYS_AUXPLL);
59 au_writel(0, SYS_PINSTATERD);
60 udelay(100);
61
62#if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
63
64 /* GPIO201 is input for PCMCIA card detect */
65 /* GPIO203 is input for PCMCIA interrupt request */
66 au_writel(au_readl(GPIO2_DIR) & (u32)(~((1<<1)|(1<<3))), GPIO2_DIR);
67
68 /* zero and disable FREQ2 */
69 sys_freqctrl = au_readl(SYS_FREQCTRL0);
70 sys_freqctrl &= ~0xFFF00000;
71 au_writel(sys_freqctrl, SYS_FREQCTRL0);
72
73 /* zero and disable USBH/USBD clocks */
74 sys_clksrc = au_readl(SYS_CLKSRC);
75 sys_clksrc &= ~0x00007FE0;
76 au_writel(sys_clksrc, SYS_CLKSRC);
77
78 sys_freqctrl = au_readl(SYS_FREQCTRL0);
79 sys_freqctrl &= ~0xFFF00000;
80
81 sys_clksrc = au_readl(SYS_CLKSRC);
82 sys_clksrc &= ~0x00007FE0;
83
84 // FREQ2 = aux/2 = 48 MHz
85 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20));
86 au_writel(sys_freqctrl, SYS_FREQCTRL0);
87
88 /*
89 * Route 48MHz FREQ2 into USB Host and/or Device
90 */
91#ifdef CONFIG_USB_OHCI
92 sys_clksrc |= ((4<<12) | (0<<11) | (0<<10));
93#endif
94#ifdef CONFIG_AU1X00_USB_DEVICE
95 sys_clksrc |= ((4<<7) | (0<<6) | (0<<5));
96#endif
97 au_writel(sys_clksrc, SYS_CLKSRC);
98
99
100 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000);
101#ifndef CONFIG_AU1X00_USB_DEVICE
102 // 2nd USB port is USB host
103 pin_func |= 0x8000;
104#endif
105 au_writel(pin_func, SYS_PINFUNC);
106#endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
107
108 /* Configure GPIO2....it's used by PCI among other things.
109 */
110
111 /* Make everything but GP200 (PCI RST) an input until we get
112 * the pins set correctly.
113 */
114 au_writel(0x00000001, GPIO2_DIR);
115
116 /* Set the pins used for output.
117 * A zero bit will leave PCI reset, LEDs off, power up USB,
118 * IDSEL disabled.
119 */
120 pin_val = ((3 << 30) | (7 << 19) | (1 << 17) | (1 << 16));
121 au_writel(pin_val, GPIO2_OUTPUT);
122
123 /* Set the output direction.
124 */
125 pin_val = ((3 << 14) | (7 << 3) | (1 << 1) | (1 << 0));
126 au_writel(pin_val, GPIO2_DIR);
127
128#ifdef CONFIG_PCI
129 /* Use FREQ1 for the PCI output clock. We use the
130 * CPU clock of 384 MHz divided by 12 to get 32 MHz PCI.
131 * If Michael changes the CPU speed, we need to adjust
132 * that here as well :-).
133 */
134
135 /* zero and disable FREQ1
136 */
137 sys_freqctrl = au_readl(SYS_FREQCTRL0);
138 sys_freqctrl &= ~0x000ffc00;
139 au_writel(sys_freqctrl, SYS_FREQCTRL0);
140
141 /* zero and disable PCI clock
142 */
143 sys_clksrc = au_readl(SYS_CLKSRC);
144 sys_clksrc &= ~0x000f8000;
145 au_writel(sys_clksrc, SYS_CLKSRC);
146
147 /* Get current values (which really should match above).
148 */
149 sys_freqctrl = au_readl(SYS_FREQCTRL0);
150 sys_freqctrl &= ~0x000ffc00;
151
152 sys_clksrc = au_readl(SYS_CLKSRC);
153 sys_clksrc &= ~0x000f8000;
154
155 /* FREQ1 = cpu/12 = 32 MHz
156 */
157 sys_freqctrl |= ((5<<12) | (1<<11) | (0<<10));
158 au_writel(sys_freqctrl, SYS_FREQCTRL0);
159
160 /* Just connect the clock without further dividing.
161 */
162 sys_clksrc |= ((3<<17) | (0<<16) | (0<<15));
163 au_writel(sys_clksrc, SYS_CLKSRC);
164
165 udelay(1);
166
167 /* Now that clocks should be running, take PCI out of reset.
168 */
169 pin_val = au_readl(GPIO2_OUTPUT);
170 pin_val |= ((1 << 16) | 1);
171 au_writel(pin_val, GPIO2_OUTPUT);
172
173 // Setup PCI bus controller
174 au_writel(0, Au1500_PCI_CMEM);
175 au_writel(0x00003fff, Au1500_CFG_BASE);
176
177 /* We run big endian without any of the software byte swapping,
178 * so configure the PCI bridge to help us out.
179 */
180 au_writel(0xf | (2<<6) | (1<<5) | (1<<4), Au1500_PCI_CFG);
181
182 au_writel(0xf0000000, Au1500_PCI_MWMASK_DEV);
183 au_writel(0, Au1500_PCI_MWBASE_REV_CCL);
184 au_writel(0x02a00356, Au1500_PCI_STATCMD);
185 au_writel(0x00003c04, Au1500_PCI_HDRTYPE);
186 au_writel(0x00000008, Au1500_PCI_MBAR);
187 au_sync();
188
189 board_pci_idsel = csb250_pci_idsel;
190#endif
191
192 /* Enable sys bus clock divider when IDLE state or no bus activity. */
193 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
194
195#ifdef CONFIG_RTC
196 // Enable the RTC if not already enabled
197 if (!(au_readl(0xac000028) & 0x20)) {
198 printk("enabling clock ...\n");
199 au_writel((au_readl(0xac000028) | 0x20), 0xac000028);
200 }
201 // Put the clock in BCD mode
202 if (readl(0xac00002C) & 0x4) { /* reg B */
203 au_writel(au_readl(0xac00002c) & ~0x4, 0xac00002c);
204 au_sync();
205 }
206#endif
207}
208
209/* The IDSEL is selected in the GPIO2 register. We will make device
210 * 12 appear in slot 0 and device 13 appear in slot 1.
211 */
212int
213csb250_pci_idsel(unsigned int devsel, int assert)
214{
215 int retval;
216 unsigned int gpio2_pins;
217
218 retval = 1;
219
220 /* First, disable both selects, then assert the one requested.
221 */
222 au_writel(0xc000c000, GPIO2_OUTPUT);
223 au_sync();
224
225 if (assert) {
226 if (devsel == 12)
227 gpio2_pins = 0x40000000;
228 else if (devsel == 13)
229 gpio2_pins = 0x80000000;
230 else {
231 gpio2_pins = 0xc000c000;
232 retval = 0;
233 }
234 au_writel(gpio2_pins, GPIO2_OUTPUT);
235 }
236 au_sync();
237
238 return retval;
239}
diff --git a/arch/mips/au1000/csb250/init.c b/arch/mips/au1000/csb250/init.c
new file mode 100644
index 000000000000..4320057fc439
--- /dev/null
+++ b/arch/mips/au1000/csb250/init.c
@@ -0,0 +1,95 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Cogent CSB250 board setup
5 *
6 * Copyright 2002 Cogent Computer Systems, Inc.
7 * dan@embeddededge.com
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/init.h>
31#include <linux/mm.h>
32#include <linux/sched.h>
33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h>
37#include <linux/kernel.h>
38#include <linux/sched.h>
39
40int prom_argc;
41char **prom_argv, **prom_envp;
42extern void __init prom_init_cmdline(void);
43extern char *prom_getenv(char *envname);
44
45/* When we get initrd working someday.........
46*/
47int my_initrd_start, my_initrd_size;
48
49/* Start arguments and environment.
50*/
51static char *csb_env[2];
52static char *csb_arg[4];
53static char *arg1 = "console=ttyS3,38400";
54static char *arg2 = "root=/dev/nfs rw ip=any";
55static char *env1 = "ethaddr=00:30:23:50:00:00";
56
57const char *get_system_type(void)
58{
59 return "Cogent CSB250";
60}
61
62int __init prom_init(int argc, char **argv, char **envp, int *prom_vec)
63{
64 unsigned char *memsize_str;
65 unsigned long memsize;
66
67 /* We use a0 and a1 to pass initrd start and size.
68 */
69 if (((uint) argc > 0) && ((uint)argv > 0)) {
70 my_initrd_start = (uint)argc;
71 my_initrd_size = (uint)argv;
72 }
73
74 /* First argv is ignored.
75 */
76 prom_argc = 3;
77 prom_argv = csb_arg;
78 prom_envp = csb_env;
79 csb_arg[1] = arg1;
80 csb_arg[2] = arg2;
81 csb_env[0] = env1;
82
83 mips_machgroup = MACH_GROUP_ALCHEMY;
84 mips_machtype = MACH_CSB250;
85
86 prom_init_cmdline();
87 memsize_str = prom_getenv("memsize");
88 if (!memsize_str) {
89 memsize = 0x02000000;
90 } else {
91 memsize = simple_strtol(memsize_str, NULL, 0);
92 }
93 add_memory_region(0, memsize, BOOT_MEM_RAM);
94 return 0;
95}
diff --git a/arch/mips/au1000/csb250/irqmap.c b/arch/mips/au1000/csb250/irqmap.c
new file mode 100644
index 000000000000..5cb1166be35c
--- /dev/null
+++ b/arch/mips/au1000/csb250/irqmap.c
@@ -0,0 +1,60 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table
4 *
5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/irq.h>
31#include <linux/kernel_stat.h>
32#include <linux/module.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/ioport.h>
38#include <linux/timex.h>
39#include <linux/slab.h>
40#include <linux/random.h>
41#include <linux/delay.h>
42#include <linux/bitops.h>
43
44#include <asm/bootinfo.h>
45#include <asm/io.h>
46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/au1000.h>
49
50au1xxx_irq_map_t au1xxx_irq_map[] = {
51
52 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
53 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
54 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
55 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
56 { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 },
57 { AU1500_GPIO_207, INTC_INT_LOW_LEVEL, 0 },
58};
59
60int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t);
diff --git a/arch/mips/au1000/db1x00/Makefile b/arch/mips/au1000/db1x00/Makefile
new file mode 100644
index 000000000000..4c7d763f2113
--- /dev/null
+++ b/arch/mips/au1000/db1x00/Makefile
@@ -0,0 +1,9 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Alchemy Semiconductor Db1x00 board.
7
8lib-y := init.o board_setup.o irqmap.o
9obj-$(CONFIG_WM97XX_COMODULE) += mirage_ts.o
diff --git a/arch/mips/au1000/db1x00/board_setup.c b/arch/mips/au1000/db1x00/board_setup.c
new file mode 100644
index 000000000000..ac05ba0ff63f
--- /dev/null
+++ b/arch/mips/au1000/db1x00/board_setup.c
@@ -0,0 +1,127 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Db1x00 board setup.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/config.h>
31#include <linux/init.h>
32#include <linux/sched.h>
33#include <linux/ioport.h>
34#include <linux/mm.h>
35#include <linux/console.h>
36#include <linux/mc146818rtc.h>
37#include <linux/delay.h>
38
39#include <asm/cpu.h>
40#include <asm/bootinfo.h>
41#include <asm/irq.h>
42#include <asm/mipsregs.h>
43#include <asm/reboot.h>
44#include <asm/pgtable.h>
45#include <asm/mach-au1x00/au1000.h>
46#include <asm/mach-db1x00/db1x00.h>
47
48/* not correct for db1550 */
49static BCSR * const bcsr = (BCSR *)0xAE000000;
50
51void board_reset (void)
52{
53 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
54 au_writel(0x00000000, 0xAE00001C);
55}
56
57void __init board_setup(void)
58{
59 u32 pin_func;
60
61 pin_func = 0;
62 /* not valid for 1550 */
63#ifdef CONFIG_AU1X00_USB_DEVICE
64 // 2nd USB port is USB device
65 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000);
66 au_writel(pin_func, SYS_PINFUNC);
67#endif
68
69#if defined(CONFIG_IRDA) && (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100))
70 /* set IRFIRSEL instead of GPIO15 */
71 pin_func = au_readl(SYS_PINFUNC) | (u32)((1<<8));
72 au_writel(pin_func, SYS_PINFUNC);
73 /* power off until the driver is in use */
74 bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK;
75 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF;
76 au_sync();
77#endif
78 au_writel(0, 0xAE000010); /* turn off pcmcia power */
79
80#ifdef CONFIG_MIPS_MIRAGE
81 /* enable GPIO[31:0] inputs */
82 au_writel(0, SYS_PININPUTEN);
83
84 /* GPIO[20] is output, tristate the other input primary GPIO's */
85 au_writel((u32)(~(1<<20)), SYS_TRIOUTCLR);
86
87 /* set GPIO[210:208] instead of SSI_0 */
88 pin_func = au_readl(SYS_PINFUNC) | (u32)(1);
89
90 /* set GPIO[215:211] for LED's */
91 pin_func |= (u32)((5<<2));
92
93 /* set GPIO[214:213] for more LED's */
94 pin_func |= (u32)((5<<12));
95
96 /* set GPIO[207:200] instead of PCMCIA/LCD */
97 pin_func |= (u32)((3<<17));
98 au_writel(pin_func, SYS_PINFUNC);
99
100 /* Enable speaker amplifier. This should
101 * be part of the audio driver.
102 */
103 au_writel(au_readl(GPIO2_DIR) | 0x200, GPIO2_DIR);
104 au_writel(0x02000200, GPIO2_OUTPUT);
105#endif
106
107 au_sync();
108
109#ifdef CONFIG_MIPS_DB1000
110 printk("AMD Alchemy Au1000/Db1000 Board\n");
111#endif
112#ifdef CONFIG_MIPS_DB1500
113 printk("AMD Alchemy Au1500/Db1500 Board\n");
114#endif
115#ifdef CONFIG_MIPS_DB1100
116 printk("AMD Alchemy Au1100/Db1100 Board\n");
117#endif
118#ifdef CONFIG_MIPS_BOSPORUS
119 printk("AMD Alchemy Bosporus Board\n");
120#endif
121#ifdef CONFIG_MIPS_MIRAGE
122 printk("AMD Alchemy Mirage Board\n");
123#endif
124#ifdef CONFIG_MIPS_DB1550
125 printk("AMD Alchemy Au1550/Db1550 Board\n");
126#endif
127}
diff --git a/arch/mips/au1000/db1x00/init.c b/arch/mips/au1000/db1x00/init.c
new file mode 100644
index 000000000000..51eee94a5e82
--- /dev/null
+++ b/arch/mips/au1000/db1x00/init.c
@@ -0,0 +1,74 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * PB1000 board setup
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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/init.h>
31#include <linux/mm.h>
32#include <linux/sched.h>
33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/config.h>
37#include <linux/string.h>
38#include <linux/kernel.h>
39
40int prom_argc;
41char **prom_argv, **prom_envp;
42extern void __init prom_init_cmdline(void);
43extern char *prom_getenv(char *envname);
44
45const char *get_system_type(void)
46{
47#ifdef CONFIG_MIPS_BOSPORUS
48 return "Alchemy Bosporus Gateway Reference";
49#else
50 return "Alchemy Db1x00";
51#endif
52}
53
54void __init prom_init(void)
55{
56 unsigned char *memsize_str;
57 unsigned long memsize;
58
59 prom_argc = fw_arg0;
60 prom_argv = (char **) fw_arg1;
61 prom_envp = (char **) fw_arg2;
62
63 mips_machgroup = MACH_GROUP_ALCHEMY;
64 mips_machtype = MACH_DB1000; /* set the platform # */
65
66 prom_init_cmdline();
67
68 memsize_str = prom_getenv("memsize");
69 if (!memsize_str)
70 memsize = 0x04000000;
71 else
72 memsize = simple_strtol(memsize_str, NULL, 0);
73 add_memory_region(0, memsize, BOOT_MEM_RAM);
74}
diff --git a/arch/mips/au1000/db1x00/irqmap.c b/arch/mips/au1000/db1x00/irqmap.c
new file mode 100644
index 000000000000..8f6ef0dbe1f8
--- /dev/null
+++ b/arch/mips/au1000/db1x00/irqmap.c
@@ -0,0 +1,72 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table
4 *
5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/config.h>
29#include <linux/errno.h>
30#include <linux/init.h>
31#include <linux/irq.h>
32#include <linux/kernel_stat.h>
33#include <linux/module.h>
34#include <linux/signal.h>
35#include <linux/sched.h>
36#include <linux/types.h>
37#include <linux/interrupt.h>
38#include <linux/ioport.h>
39#include <linux/timex.h>
40#include <linux/slab.h>
41#include <linux/random.h>
42#include <linux/delay.h>
43#include <linux/bitops.h>
44
45#include <asm/bootinfo.h>
46#include <asm/io.h>
47#include <asm/mipsregs.h>
48#include <asm/system.h>
49#include <asm/mach-au1x00/au1000.h>
50
51au1xxx_irq_map_t au1xxx_irq_map[] = {
52
53#ifndef CONFIG_MIPS_MIRAGE
54#ifdef CONFIG_MIPS_DB1550
55 { AU1000_GPIO_3, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card 0 IRQ# */
56 { AU1000_GPIO_5, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card 1 IRQ# */
57#else
58 { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card 0 Fully_Interted# */
59 { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card 0 STSCHG# */
60 { AU1000_GPIO_2, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card 0 IRQ# */
61
62 { AU1000_GPIO_3, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card 1 Fully_Interted# */
63 { AU1000_GPIO_4, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card 1 STSCHG# */
64 { AU1000_GPIO_5, INTC_INT_LOW_LEVEL, 0 }, /* PCMCIA Card 1 IRQ# */
65#endif
66#else
67 { AU1000_GPIO_7, INTC_INT_RISE_EDGE, 0 }, /* touchscreen pen down */
68#endif
69
70};
71
72int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t);
diff --git a/arch/mips/au1000/db1x00/mirage_ts.c b/arch/mips/au1000/db1x00/mirage_ts.c
new file mode 100644
index 000000000000..ade35e432004
--- /dev/null
+++ b/arch/mips/au1000/db1x00/mirage_ts.c
@@ -0,0 +1,261 @@
1/*
2 * linux/arch/mips/au1000/db1x00/mirage_ts.c
3 *
4 * BRIEF MODULE DESCRIPTION
5 * Glue between Mirage board-specific touchscreen pieces
6 * and generic Wolfson Codec touchscreen support.
7 *
8 * Based on pb1100_ts.c used in Hydrogen II.
9 *
10 * Copyright (c) 2003 Embedded Edge, LLC
11 * dan@embeddededge.com
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */
33
34#include <linux/config.h>
35#include <linux/types.h>
36#include <linux/module.h>
37#include <linux/sched.h>
38#include <linux/kernel.h>
39#include <linux/init.h>
40#include <linux/fs.h>
41#include <linux/poll.h>
42#include <linux/proc_fs.h>
43#include <linux/smp.h>
44#include <linux/smp_lock.h>
45#include <linux/wait.h>
46
47#include <asm/segment.h>
48#include <asm/irq.h>
49#include <asm/uaccess.h>
50#include <asm/delay.h>
51#include <asm/au1000.h>
52
53/*
54 * Imported interface to Wolfson Codec driver.
55 */
56extern void *wm97xx_ts_get_handle(int which);
57extern int wm97xx_ts_ready(void* ts_handle);
58extern void wm97xx_ts_set_cal(void* ts_handle, int xscale, int xtrans, int yscale, int ytrans);
59extern u16 wm97xx_ts_get_ac97(void* ts_handle, u8 reg);
60extern void wm97xx_ts_set_ac97(void* ts_handle, u8 reg, u16 val);
61extern int wm97xx_ts_read_data(void* ts_handle, long* x, long* y, long* pressure);
62extern void wm97xx_ts_send_data(void* ts_handle, long x, long y, long z);
63
64int wm97xx_comodule_present = 1;
65
66
67#define TS_NAME "mirage_ts"
68
69#define err(format, arg...) printk(KERN_ERR TS_NAME ": " format "\n" , ## arg)
70#define info(format, arg...) printk(KERN_INFO TS_NAME ": " format "\n" , ## arg)
71#define warn(format, arg...) printk(KERN_WARNING TS_NAME ": " format "\n" , ## arg)
72#define DPRINTK(format, arg...) printk("%s: " format "\n", __FUNCTION__ , ## arg)
73
74
75#define PEN_DOWN_IRQ AU1000_GPIO_7
76
77static struct task_struct *ts_task = 0;
78static DECLARE_COMPLETION(ts_complete);
79static DECLARE_WAIT_QUEUE_HEAD(pendown_wait);
80
81#ifdef CONFIG_WM97XX_FIVEWIRETS
82static int release_pressure = 1;
83#else
84static int release_pressure = 50;
85#endif
86
87typedef struct {
88 long x;
89 long y;
90} DOWN_EVENT;
91
92#define SAMPLE_RATE 50 /* samples per second */
93#define PEN_DEBOUNCE 5 /* samples for settling - fn of SAMPLE_RATE */
94#define PEN_UP_TIMEOUT 10 /* in seconds */
95#define PEN_UP_SETTLE 5 /* samples per second */
96
97static struct {
98 int xscale;
99 int xtrans;
100 int yscale;
101 int ytrans;
102} mirage_ts_cal =
103{
104#if 0
105 xscale: 84,
106 xtrans: -157,
107 yscale: 66,
108 ytrans: -150,
109#else
110 xscale: 84,
111 xtrans: -150,
112 yscale: 66,
113 ytrans: -146,
114#endif
115};
116
117
118static void pendown_irq(int irqnr, void *devid, struct pt_regs *regs)
119{
120//DPRINTK("got one 0x%x", au_readl(SYS_PINSTATERD));
121 wake_up(&pendown_wait);
122}
123
124static int ts_thread(void *id)
125{
126 static int pen_was_down = 0;
127 static DOWN_EVENT pen_xy;
128 long x, y, z;
129 void *ts; /* handle */
130 struct task_struct *tsk = current;
131 int timeout = HZ / SAMPLE_RATE;
132
133 ts_task = tsk;
134
135 daemonize();
136 tsk->tty = NULL;
137 tsk->policy = SCHED_FIFO;
138 tsk->rt_priority = 1;
139 strcpy(tsk->comm, "touchscreen");
140
141 /* only want to receive SIGKILL */
142 spin_lock_irq(&tsk->sigmask_lock);
143 siginitsetinv(&tsk->blocked, sigmask(SIGKILL));
144 recalc_sigpending(tsk);
145 spin_unlock_irq(&tsk->sigmask_lock);
146
147 /* get handle for codec */
148 ts = wm97xx_ts_get_handle(0);
149
150 /* proceed only after everybody is ready */
151 wait_event_timeout(pendown_wait, wm97xx_ts_ready(ts), HZ/4);
152
153 /* board-specific calibration */
154 wm97xx_ts_set_cal(ts,
155 mirage_ts_cal.xscale,
156 mirage_ts_cal.xtrans,
157 mirage_ts_cal.yscale,
158 mirage_ts_cal.ytrans);
159
160 /* route Wolfson pendown interrupts to our GPIO */
161 au_sync();
162 wm97xx_ts_set_ac97(ts, 0x4c, wm97xx_ts_get_ac97(ts, 0x4c) & ~0x0008);
163 au_sync();
164 wm97xx_ts_set_ac97(ts, 0x56, wm97xx_ts_get_ac97(ts, 0x56) & ~0x0008);
165 au_sync();
166 wm97xx_ts_set_ac97(ts, 0x52, wm97xx_ts_get_ac97(ts, 0x52) | 0x2008);
167 au_sync();
168
169 for (;;) {
170 interruptible_sleep_on_timeout(&pendown_wait, timeout);
171 disable_irq(PEN_DOWN_IRQ);
172 if (signal_pending(tsk)) {
173 break;
174 }
175
176 /* read codec */
177 if (!wm97xx_ts_read_data(ts, &x, &y, &z))
178 z = 0; /* treat no-data and pen-up the same */
179
180 if (signal_pending(tsk)) {
181 break;
182 }
183
184 if (z >= release_pressure) {
185 y = ~y; /* top to bottom */
186 if (pen_was_down > 1 /*&& pen_was_down < PEN_DEBOUNCE*/) {//THXXX
187 /* bounce ? */
188 x = pen_xy.x;
189 y = pen_xy.y;
190 --pen_was_down;
191 } else if (pen_was_down <= 1) {
192 pen_xy.x = x;
193 pen_xy.y = y;
194 if (pen_was_down)
195 wm97xx_ts_send_data(ts, x, y, z);
196 pen_was_down = PEN_DEBOUNCE;
197 }
198 //wm97xx_ts_send_data(ts, x, y, z);
199 timeout = HZ / SAMPLE_RATE;
200 } else {
201 if (pen_was_down) {
202 if (--pen_was_down)
203 z = release_pressure;
204 else //THXXX
205 wm97xx_ts_send_data(ts, pen_xy.x, pen_xy.y, z);
206 }
207 /* The pendown signal takes some time to settle after
208 * reading the pen pressure so wait a little
209 * before enabling the pen.
210 */
211 if (! pen_was_down) {
212// interruptible_sleep_on_timeout(&pendown_wait, HZ / PEN_UP_SETTLE);
213 timeout = HZ * PEN_UP_TIMEOUT;
214 }
215 }
216 enable_irq(PEN_DOWN_IRQ);
217 }
218 enable_irq(PEN_DOWN_IRQ);
219 ts_task = NULL;
220 complete(&ts_complete);
221 return 0;
222}
223
224static int __init ts_mirage_init(void)
225{
226 int ret;
227
228 /* pen down signal is connected to GPIO 7 */
229
230 ret = request_irq(PEN_DOWN_IRQ, pendown_irq, 0, "ts-pendown", NULL);
231 if (ret) {
232 err("unable to get pendown irq%d: [%d]", PEN_DOWN_IRQ, ret);
233 return ret;
234 }
235
236 lock_kernel();
237 ret = kernel_thread(ts_thread, NULL, CLONE_FS | CLONE_FILES);
238 if (ret < 0) {
239 unlock_kernel();
240 return ret;
241 }
242 unlock_kernel();
243
244 info("Mirage touchscreen IRQ initialized.");
245
246 return 0;
247}
248
249static void __exit ts_mirage_exit(void)
250{
251 if (ts_task) {
252 send_sig(SIGKILL, ts_task, 1);
253 wait_for_completion(&ts_complete);
254 }
255
256 free_irq(PEN_DOWN_IRQ, NULL);
257}
258
259module_init(ts_mirage_init);
260module_exit(ts_mirage_exit);
261
diff --git a/arch/mips/au1000/hydrogen3/Makefile b/arch/mips/au1000/hydrogen3/Makefile
new file mode 100644
index 000000000000..974f79256bb3
--- /dev/null
+++ b/arch/mips/au1000/hydrogen3/Makefile
@@ -0,0 +1,9 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Alchemy Semiconductor PB1000 board.
7#
8
9obj-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/hydrogen3/board_setup.c b/arch/mips/au1000/hydrogen3/board_setup.c
new file mode 100644
index 000000000000..2efae1064647
--- /dev/null
+++ b/arch/mips/au1000/hydrogen3/board_setup.c
@@ -0,0 +1,70 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Db1x00 board setup.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/config.h>
31#include <linux/init.h>
32#include <linux/sched.h>
33#include <linux/ioport.h>
34#include <linux/mm.h>
35#include <linux/console.h>
36#include <linux/mc146818rtc.h>
37#include <linux/delay.h>
38
39#include <asm/cpu.h>
40#include <asm/bootinfo.h>
41#include <asm/irq.h>
42#include <asm/keyboard.h>
43#include <asm/mipsregs.h>
44#include <asm/reboot.h>
45#include <asm/pgtable.h>
46#include <asm/au1000.h>
47
48void board_reset (void)
49{
50}
51
52void __init board_setup(void)
53{
54 u32 pin_func;
55
56#ifdef CONFIG_AU1X00_USB_DEVICE
57 // 2nd USB port is USB device
58 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000);
59 au_writel(pin_func, SYS_PINFUNC);
60#endif
61
62#if defined(CONFIG_IRDA) && (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100))
63 /* set IRFIRSEL instead of GPIO15 */
64 pin_func = au_readl(SYS_PINFUNC) | (u32)((1<<8));
65 au_writel(pin_func, SYS_PINFUNC);
66 au_sync();
67#endif
68
69 printk("AMD Alchemy Hydrogen3 Board\n");
70}
diff --git a/arch/mips/au1000/hydrogen3/init.c b/arch/mips/au1000/hydrogen3/init.c
new file mode 100644
index 000000000000..eee4adf98711
--- /dev/null
+++ b/arch/mips/au1000/hydrogen3/init.c
@@ -0,0 +1,77 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PB1000 board setup
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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/init.h>
32#include <linux/mm.h>
33#include <linux/sched.h>
34#include <linux/bootmem.h>
35#include <asm/addrspace.h>
36#include <asm/bootinfo.h>
37#include <linux/config.h>
38#include <linux/string.h>
39#include <linux/kernel.h>
40#include <linux/sched.h>
41
42int prom_argc;
43char **prom_argv, **prom_envp;
44extern void __init prom_init_cmdline(void);
45extern char *prom_getenv(char *envname);
46
47const char *get_system_type(void)
48{
49#ifdef CONFIG_MIPS_BOSPORUS
50 return "Alchemy Bosporus Gateway Reference";
51#else
52 return "Alchemy Db1x00";
53#endif
54}
55
56int __init prom_init(int argc, char **argv, char **envp, int *prom_vec)
57{
58 unsigned char *memsize_str;
59 unsigned long memsize;
60
61 prom_argc = argc;
62 prom_argv = argv;
63 prom_envp = envp;
64
65 mips_machgroup = MACH_GROUP_ALCHEMY;
66 mips_machtype = MACH_DB1000; /* set the platform # */
67 prom_init_cmdline();
68
69 memsize_str = prom_getenv("memsize");
70 if (!memsize_str) {
71 memsize = 0x04000000;
72 } else {
73 memsize = simple_strtol(memsize_str, NULL, 0);
74 }
75 add_memory_region(0, memsize, BOOT_MEM_RAM);
76 return 0;
77}
diff --git a/arch/mips/au1000/hydrogen3/irqmap.c b/arch/mips/au1000/hydrogen3/irqmap.c
new file mode 100644
index 000000000000..6eacaa0daa49
--- /dev/null
+++ b/arch/mips/au1000/hydrogen3/irqmap.c
@@ -0,0 +1,56 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table
4 *
5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/irq.h>
31#include <linux/kernel_stat.h>
32#include <linux/module.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/ioport.h>
38#include <linux/timex.h>
39#include <linux/slab.h>
40#include <linux/random.h>
41#include <linux/delay.h>
42#include <linux/bitops.h>
43
44#include <asm/bootinfo.h>
45#include <asm/io.h>
46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/au1000.h>
49
50au1xxx_irq_map_t au1xxx_irq_map[] = {
51
52 /* { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 }, */
53 { AU1000_GPIO_21, INTC_INT_LOW_LEVEL, 0 },
54};
55
56int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t);
diff --git a/arch/mips/au1000/mtx-1/Makefile b/arch/mips/au1000/mtx-1/Makefile
new file mode 100644
index 000000000000..764bf9f7e281
--- /dev/null
+++ b/arch/mips/au1000/mtx-1/Makefile
@@ -0,0 +1,10 @@
1#
2# Copyright 2003 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5# Bruno Randolf <bruno.randolf@4g-systems.biz>
6#
7# Makefile for 4G Systems MTX-1 board.
8#
9
10lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/mtx-1/board_setup.c b/arch/mips/au1000/mtx-1/board_setup.c
new file mode 100644
index 000000000000..638de7bb43f0
--- /dev/null
+++ b/arch/mips/au1000/mtx-1/board_setup.c
@@ -0,0 +1,89 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * 4G Systems MTX-1 board setup.
5 *
6 * Copyright 2003 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 * Bruno Randolf <bruno.randolf@4g-systems.biz>
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31#include <linux/config.h>
32#include <linux/init.h>
33#include <linux/sched.h>
34#include <linux/ioport.h>
35#include <linux/mm.h>
36#include <linux/console.h>
37#include <linux/delay.h>
38
39#include <asm/cpu.h>
40#include <asm/bootinfo.h>
41#include <asm/irq.h>
42#include <asm/mipsregs.h>
43#include <asm/reboot.h>
44#include <asm/pgtable.h>
45#include <asm/mach-au1x00/au1000.h>
46
47void board_reset (void)
48{
49 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
50 au_writel(0x00000000, 0xAE00001C);
51}
52
53void __init board_setup(void)
54{
55#if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
56#ifdef CONFIG_AU1X00_USB_DEVICE
57 // 2nd USB port is USB device
58 au_writel(au_readl(SYS_PINFUNC) & (u32)(~0x8000), SYS_PINFUNC);
59#endif
60 // enable USB power switch
61 au_writel( au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR );
62 au_writel( 0x100000, GPIO2_OUTPUT );
63#endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
64
65#ifdef CONFIG_PCI
66#if defined(__MIPSEB__)
67 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG);
68#else
69 au_writel(0xf, Au1500_PCI_CFG);
70#endif
71#endif
72
73 // initialize sys_pinfunc:
74 // disable second ethernet port (SYS_PF_NI2)
75 // set U3/GPIO23 to GPIO23 (SYS_PF_U3)
76 au_writel( SYS_PF_NI2 | SYS_PF_U3, SYS_PINFUNC );
77
78 // initialize GPIO
79 au_writel( 0xFFFFFFFF, SYS_TRIOUTCLR );
80 au_writel( 0x00000001, SYS_OUTPUTCLR ); // set M66EN (PCI 66MHz) to OFF
81 au_writel( 0x00000008, SYS_OUTPUTSET ); // set PCI CLKRUN# to OFF
82 au_writel( 0x00000020, SYS_OUTPUTCLR ); // set eth PHY TX_ER to OFF
83
84 // enable LED and set it to green
85 au_writel( au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR );
86 au_writel( 0x18000800, GPIO2_OUTPUT );
87
88 printk("4G Systems MTX-1 Board\n");
89}
diff --git a/arch/mips/au1000/mtx-1/init.c b/arch/mips/au1000/mtx-1/init.c
new file mode 100644
index 000000000000..02e7dbcff727
--- /dev/null
+++ b/arch/mips/au1000/mtx-1/init.c
@@ -0,0 +1,71 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * 4G Systems MTX-1 board setup
5 *
6 * Copyright 2003 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 * Bruno Randolf <bruno.randolf@4g-systems.biz>
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31#include <linux/string.h>
32#include <linux/kernel.h>
33#include <linux/sched.h>
34#include <linux/init.h>
35#include <linux/mm.h>
36#include <linux/sched.h>
37#include <linux/bootmem.h>
38#include <asm/addrspace.h>
39#include <asm/bootinfo.h>
40
41int prom_argc;
42char **prom_argv, **prom_envp;
43extern void __init prom_init_cmdline(void);
44extern char *prom_getenv(char *envname);
45
46const char *get_system_type(void)
47{
48 return "MTX-1";
49}
50
51void __init prom_init(void)
52{
53 unsigned char *memsize_str;
54 unsigned long memsize;
55
56 prom_argc = fw_arg0;
57 prom_argv = (char **) fw_arg1;
58 prom_envp = (char **) fw_arg2;
59
60 mips_machgroup = MACH_GROUP_ALCHEMY;
61 mips_machtype = MACH_MTX1; /* set the platform # */
62
63 prom_init_cmdline();
64
65 memsize_str = prom_getenv("memsize");
66 if (!memsize_str)
67 memsize = 0x04000000;
68 else
69 memsize = simple_strtol(memsize_str, NULL, 0);
70 add_memory_region(0, memsize, BOOT_MEM_RAM);
71}
diff --git a/arch/mips/au1000/mtx-1/irqmap.c b/arch/mips/au1000/mtx-1/irqmap.c
new file mode 100644
index 000000000000..ddcb9d089dc1
--- /dev/null
+++ b/arch/mips/au1000/mtx-1/irqmap.c
@@ -0,0 +1,58 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table
4 *
5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/irq.h>
31#include <linux/kernel_stat.h>
32#include <linux/module.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/ioport.h>
38#include <linux/timex.h>
39#include <linux/slab.h>
40#include <linux/random.h>
41#include <linux/delay.h>
42#include <linux/bitops.h>
43
44#include <asm/bootinfo.h>
45#include <asm/io.h>
46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h>
49
50au1xxx_irq_map_t au1xxx_irq_map[] = {
51 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
52 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
53 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
54 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
55 { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 },
56};
57
58int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t);
diff --git a/arch/mips/au1000/pb1000/Makefile b/arch/mips/au1000/pb1000/Makefile
new file mode 100644
index 000000000000..daa1a507e72f
--- /dev/null
+++ b/arch/mips/au1000/pb1000/Makefile
@@ -0,0 +1,8 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Alchemy Semiconductor PB1000 board.
7
8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1000/board_setup.c b/arch/mips/au1000/pb1000/board_setup.c
new file mode 100644
index 000000000000..2fa211b69329
--- /dev/null
+++ b/arch/mips/au1000/pb1000/board_setup.c
@@ -0,0 +1,182 @@
1/*
2 * Copyright 2000 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ppopov@mvista.com or source@mvista.com
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#include <linux/config.h>
27#include <linux/init.h>
28#include <linux/sched.h>
29#include <linux/ioport.h>
30#include <linux/mm.h>
31#include <linux/console.h>
32#include <linux/delay.h>
33
34#include <asm/cpu.h>
35#include <asm/bootinfo.h>
36#include <asm/irq.h>
37#include <asm/mipsregs.h>
38#include <asm/reboot.h>
39#include <asm/pgtable.h>
40#include <asm/mach-au1x00/au1000.h>
41#include <asm/mach-pb1x00/pb1000.h>
42
43void board_reset (void)
44{
45}
46
47void __init board_setup(void)
48{
49 u32 pin_func, static_cfg0;
50 u32 sys_freqctrl, sys_clksrc;
51 u32 prid = read_c0_prid();
52
53 // set AUX clock to 12MHz * 8 = 96 MHz
54 au_writel(8, SYS_AUXPLL);
55 au_writel(0, SYS_PINSTATERD);
56 udelay(100);
57
58#if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
59 /* zero and disable FREQ2 */
60 sys_freqctrl = au_readl(SYS_FREQCTRL0);
61 sys_freqctrl &= ~0xFFF00000;
62 au_writel(sys_freqctrl, SYS_FREQCTRL0);
63
64 /* zero and disable USBH/USBD clocks */
65 sys_clksrc = au_readl(SYS_CLKSRC);
66 sys_clksrc &= ~0x00007FE0;
67 au_writel(sys_clksrc, SYS_CLKSRC);
68
69 sys_freqctrl = au_readl(SYS_FREQCTRL0);
70 sys_freqctrl &= ~0xFFF00000;
71
72 sys_clksrc = au_readl(SYS_CLKSRC);
73 sys_clksrc &= ~0x00007FE0;
74
75 switch (prid & 0x000000FF)
76 {
77 case 0x00: /* DA */
78 case 0x01: /* HA */
79 case 0x02: /* HB */
80 /* CPU core freq to 48MHz to slow it way down... */
81 au_writel(4, SYS_CPUPLL);
82
83 /*
84 * Setup 48MHz FREQ2 from CPUPLL for USB Host
85 */
86 /* FRDIV2=3 -> div by 8 of 384MHz -> 48MHz */
87 sys_freqctrl |= ((3<<22) | (1<<21) | (0<<20));
88 au_writel(sys_freqctrl, SYS_FREQCTRL0);
89
90 /* CPU core freq to 384MHz */
91 au_writel(0x20, SYS_CPUPLL);
92
93 printk("Au1000: 48MHz OHCI workaround enabled\n");
94 break;
95
96 default: /* HC and newer */
97 // FREQ2 = aux/2 = 48 MHz
98 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20));
99 au_writel(sys_freqctrl, SYS_FREQCTRL0);
100 break;
101 }
102
103 /*
104 * Route 48MHz FREQ2 into USB Host and/or Device
105 */
106#ifdef CONFIG_USB_OHCI
107 sys_clksrc |= ((4<<12) | (0<<11) | (0<<10));
108#endif
109#ifdef CONFIG_AU1X00_USB_DEVICE
110 sys_clksrc |= ((4<<7) | (0<<6) | (0<<5));
111#endif
112 au_writel(sys_clksrc, SYS_CLKSRC);
113
114 // configure pins GPIO[14:9] as GPIO
115 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8080);
116
117#ifndef CONFIG_AU1X00_USB_DEVICE
118 // 2nd USB port is USB host
119 pin_func |= 0x8000;
120#endif
121 au_writel(pin_func, SYS_PINFUNC);
122 au_writel(0x2800, SYS_TRIOUTCLR);
123 au_writel(0x0030, SYS_OUTPUTCLR);
124#endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
125
126 // make gpio 15 an input (for interrupt line)
127 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x100);
128 // we don't need I2S, so make it available for GPIO[31:29]
129 pin_func |= (1<<5);
130 au_writel(pin_func, SYS_PINFUNC);
131
132 au_writel(0x8000, SYS_TRIOUTCLR);
133
134 static_cfg0 = au_readl(MEM_STCFG0) & (u32)(~0xc00);
135 au_writel(static_cfg0, MEM_STCFG0);
136
137 // configure RCE2* for LCD
138 au_writel(0x00000004, MEM_STCFG2);
139
140 // MEM_STTIME2
141 au_writel(0x09000000, MEM_STTIME2);
142
143 // Set 32-bit base address decoding for RCE2*
144 au_writel(0x10003ff0, MEM_STADDR2);
145
146 // PCI CPLD setup
147 // expand CE0 to cover PCI
148 au_writel(0x11803e40, MEM_STADDR1);
149
150 // burst visibility on
151 au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0);
152
153 au_writel(0x83, MEM_STCFG1); // ewait enabled, flash timing
154 au_writel(0x33030a10, MEM_STTIME1); // slower timing for FPGA
155
156 /* setup the static bus controller */
157 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */
158 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
159 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
160
161#ifdef CONFIG_PCI
162 au_writel(0, PCI_BRIDGE_CONFIG); // set extend byte to 0
163 au_writel(0, SDRAM_MBAR); // set mbar to 0
164 au_writel(0x2, SDRAM_CMD); // enable memory accesses
165 au_sync_delay(1);
166#endif
167
168 /* Enable Au1000 BCLK switching - note: sed1356 must not use
169 * its BCLK (Au1000 LCLK) for any timings */
170 switch (prid & 0x000000FF)
171 {
172 case 0x00: /* DA */
173 case 0x01: /* HA */
174 case 0x02: /* HB */
175 break;
176 default: /* HC and newer */
177 /* Enable sys bus clock divider when IDLE state or no bus
178 activity. */
179 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
180 break;
181 }
182}
diff --git a/arch/mips/au1000/pb1000/init.c b/arch/mips/au1000/pb1000/init.c
new file mode 100644
index 000000000000..34713c5df0d7
--- /dev/null
+++ b/arch/mips/au1000/pb1000/init.c
@@ -0,0 +1,69 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * PB1000 board setup
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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#include <linux/init.h>
30#include <linux/mm.h>
31#include <linux/sched.h>
32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h>
36#include <linux/kernel.h>
37
38int prom_argc;
39char **prom_argv, **prom_envp;
40extern void __init prom_init_cmdline(void);
41extern char *prom_getenv(char *envname);
42
43const char *get_system_type(void)
44{
45 return "Alchemy Pb1000";
46}
47
48void __init prom_init(void)
49{
50 unsigned char *memsize_str;
51 unsigned long memsize;
52
53 prom_argc = (int) fw_arg0;
54 prom_argv = (char **) fw_arg1;
55 prom_envp = (char **) fw_arg2;
56
57 mips_machgroup = MACH_GROUP_ALCHEMY;
58 mips_machtype = MACH_PB1000;
59
60 prom_init_cmdline();
61 memsize_str = prom_getenv("memsize");
62 if (!memsize_str) {
63 memsize = 0x04000000;
64 } else {
65 memsize = simple_strtol(memsize_str, NULL, 0);
66 }
67 add_memory_region(0, memsize, BOOT_MEM_RAM);
68 return 0;
69}
diff --git a/arch/mips/au1000/pb1000/irqmap.c b/arch/mips/au1000/pb1000/irqmap.c
new file mode 100644
index 000000000000..a3c460e3c23e
--- /dev/null
+++ b/arch/mips/au1000/pb1000/irqmap.c
@@ -0,0 +1,54 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table
4 *
5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/irq.h>
31#include <linux/kernel_stat.h>
32#include <linux/module.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/ioport.h>
38#include <linux/timex.h>
39#include <linux/slab.h>
40#include <linux/random.h>
41#include <linux/delay.h>
42#include <linux/bitops.h>
43
44#include <asm/bootinfo.h>
45#include <asm/io.h>
46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h>
49
50au1xxx_irq_map_t au1xxx_irq_map[] = {
51 { AU1000_GPIO_15, INTC_INT_LOW_LEVEL, 0 },
52};
53
54int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t);
diff --git a/arch/mips/au1000/pb1100/Makefile b/arch/mips/au1000/pb1100/Makefile
new file mode 100644
index 000000000000..996236df6375
--- /dev/null
+++ b/arch/mips/au1000/pb1100/Makefile
@@ -0,0 +1,8 @@
1#
2# Copyright 2000,2001 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Alchemy Semiconductor Pb1100 board.
7
8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1100/board_setup.c b/arch/mips/au1000/pb1100/board_setup.c
new file mode 100644
index 000000000000..13c2f6ca7e33
--- /dev/null
+++ b/arch/mips/au1000/pb1100/board_setup.c
@@ -0,0 +1,116 @@
1/*
2 * Copyright 2002 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ppopov@mvista.com or source@mvista.com
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#include <linux/config.h>
27#include <linux/init.h>
28#include <linux/sched.h>
29#include <linux/ioport.h>
30#include <linux/mm.h>
31#include <linux/console.h>
32#include <linux/delay.h>
33
34#include <asm/cpu.h>
35#include <asm/bootinfo.h>
36#include <asm/irq.h>
37#include <asm/mipsregs.h>
38#include <asm/reboot.h>
39#include <asm/pgtable.h>
40#include <asm/mach-au1x00/au1000.h>
41#include <asm/mach-pb1x00/pb1100.h>
42
43void board_reset (void)
44{
45 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
46 au_writel(0x00000000, 0xAE00001C);
47}
48
49void __init board_setup(void)
50{
51 u32 pin_func;
52 u32 sys_freqctrl, sys_clksrc;
53
54 // set AUX clock to 12MHz * 8 = 96 MHz
55 au_writel(8, SYS_AUXPLL);
56 au_writel(0, SYS_PININPUTEN);
57 udelay(100);
58
59#if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
60 // configure pins GPIO[14:9] as GPIO
61 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80);
62
63 /* zero and disable FREQ2 */
64 sys_freqctrl = au_readl(SYS_FREQCTRL0);
65 sys_freqctrl &= ~0xFFF00000;
66 au_writel(sys_freqctrl, SYS_FREQCTRL0);
67
68 /* zero and disable USBH/USBD/IrDA clock */
69 sys_clksrc = au_readl(SYS_CLKSRC);
70 sys_clksrc &= ~0x0000001F;
71 au_writel(sys_clksrc, SYS_CLKSRC);
72
73 sys_freqctrl = au_readl(SYS_FREQCTRL0);
74 sys_freqctrl &= ~0xFFF00000;
75
76 sys_clksrc = au_readl(SYS_CLKSRC);
77 sys_clksrc &= ~0x0000001F;
78
79 // FREQ2 = aux/2 = 48 MHz
80 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20));
81 au_writel(sys_freqctrl, SYS_FREQCTRL0);
82
83 /*
84 * Route 48MHz FREQ2 into USBH/USBD/IrDA
85 */
86 sys_clksrc |= ((4<<2) | (0<<1) | 0 );
87 au_writel(sys_clksrc, SYS_CLKSRC);
88
89 /* setup the static bus controller */
90 au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */
91 au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */
92 au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */
93
94 // get USB Functionality pin state (device vs host drive pins)
95 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000);
96#ifndef CONFIG_AU1X00_USB_DEVICE
97 // 2nd USB port is USB host
98 pin_func |= 0x8000;
99#endif
100 au_writel(pin_func, SYS_PINFUNC);
101#endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
102
103 /* Enable sys bus clock divider when IDLE state or no bus activity. */
104 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
105
106 // Enable the RTC if not already enabled
107 if (!(readb(0xac000028) & 0x20)) {
108 writeb(readb(0xac000028) | 0x20, 0xac000028);
109 au_sync();
110 }
111 // Put the clock in BCD mode
112 if (readb(0xac00002C) & 0x4) { /* reg B */
113 writeb(readb(0xac00002c) & ~0x4, 0xac00002c);
114 au_sync();
115 }
116}
diff --git a/arch/mips/au1000/pb1100/init.c b/arch/mips/au1000/pb1100/init.c
new file mode 100644
index 000000000000..1fae39a608cf
--- /dev/null
+++ b/arch/mips/au1000/pb1100/init.c
@@ -0,0 +1,70 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Pb1100 board setup
5 *
6 * Copyright 2002 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/init.h>
31#include <linux/mm.h>
32#include <linux/sched.h>
33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h>
37#include <linux/kernel.h>
38
39int prom_argc;
40char **prom_argv, **prom_envp;
41extern void __init prom_init_cmdline(void);
42extern char *prom_getenv(char *envname);
43
44const char *get_system_type(void)
45{
46 return "Alchemy Pb1100";
47}
48
49void __init prom_init(void)
50{
51 unsigned char *memsize_str;
52 unsigned long memsize;
53
54 prom_argc = fw_arg0;
55 prom_argv = (char **) fw_arg1;
56 prom_envp = (int *) fw_arg3;
57
58 mips_machgroup = MACH_GROUP_ALCHEMY;
59 mips_machtype = MACH_PB1100;
60
61 prom_init_cmdline();
62
63 memsize_str = prom_getenv("memsize");
64 if (!memsize_str)
65 memsize = 0x04000000;
66 else
67 memsize = simple_strtol(memsize_str, NULL, 0);
68
69 add_memory_region(0, memsize, BOOT_MEM_RAM);
70}
diff --git a/arch/mips/au1000/pb1100/irqmap.c b/arch/mips/au1000/pb1100/irqmap.c
new file mode 100644
index 000000000000..43be7158b9ab
--- /dev/null
+++ b/arch/mips/au1000/pb1100/irqmap.c
@@ -0,0 +1,57 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table
4 *
5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/irq.h>
31#include <linux/kernel_stat.h>
32#include <linux/module.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/ioport.h>
38#include <linux/timex.h>
39#include <linux/slab.h>
40#include <linux/random.h>
41#include <linux/delay.h>
42#include <linux/bitops.h>
43
44#include <asm/bootinfo.h>
45#include <asm/io.h>
46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h>
49
50au1xxx_irq_map_t au1xxx_irq_map[] = {
51 { AU1000_GPIO_9, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card Fully_Interted#
52 { AU1000_GPIO_10, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card STSCHG#
53 { AU1000_GPIO_11, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card IRQ#
54 { AU1000_GPIO_13, INTC_INT_LOW_LEVEL, 0 }, // DC_IRQ#
55};
56
57int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t);
diff --git a/arch/mips/au1000/pb1500/Makefile b/arch/mips/au1000/pb1500/Makefile
new file mode 100644
index 000000000000..97a730813cd3
--- /dev/null
+++ b/arch/mips/au1000/pb1500/Makefile
@@ -0,0 +1,8 @@
1#
2# Copyright 2000,2001 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Alchemy Semiconductor Pb1500 board.
7
8lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1500/board_setup.c b/arch/mips/au1000/pb1500/board_setup.c
new file mode 100644
index 000000000000..30bb87282b1f
--- /dev/null
+++ b/arch/mips/au1000/pb1500/board_setup.c
@@ -0,0 +1,138 @@
1/*
2 * Copyright 2000 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ppopov@mvista.com or source@mvista.com
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#include <linux/config.h>
27#include <linux/init.h>
28#include <linux/sched.h>
29#include <linux/ioport.h>
30#include <linux/mm.h>
31#include <linux/console.h>
32#include <linux/delay.h>
33
34#include <asm/cpu.h>
35#include <asm/bootinfo.h>
36#include <asm/irq.h>
37#include <asm/mipsregs.h>
38#include <asm/reboot.h>
39#include <asm/pgtable.h>
40#include <asm/mach-au1x00/au1000.h>
41#include <asm/mach-pb1x00/pb1500.h>
42
43void board_reset (void)
44{
45 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
46 au_writel(0x00000000, 0xAE00001C);
47}
48
49void __init board_setup(void)
50{
51 u32 pin_func;
52 u32 sys_freqctrl, sys_clksrc;
53
54 sys_clksrc = sys_freqctrl = pin_func = 0;
55 // set AUX clock to 12MHz * 8 = 96 MHz
56 au_writel(8, SYS_AUXPLL);
57 au_writel(0, SYS_PINSTATERD);
58 udelay(100);
59
60#if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
61
62 /* GPIO201 is input for PCMCIA card detect */
63 /* GPIO203 is input for PCMCIA interrupt request */
64 au_writel(au_readl(GPIO2_DIR) & (u32)(~((1<<1)|(1<<3))), GPIO2_DIR);
65
66 /* zero and disable FREQ2 */
67 sys_freqctrl = au_readl(SYS_FREQCTRL0);
68 sys_freqctrl &= ~0xFFF00000;
69 au_writel(sys_freqctrl, SYS_FREQCTRL0);
70
71 /* zero and disable USBH/USBD clocks */
72 sys_clksrc = au_readl(SYS_CLKSRC);
73 sys_clksrc &= ~0x00007FE0;
74 au_writel(sys_clksrc, SYS_CLKSRC);
75
76 sys_freqctrl = au_readl(SYS_FREQCTRL0);
77 sys_freqctrl &= ~0xFFF00000;
78
79 sys_clksrc = au_readl(SYS_CLKSRC);
80 sys_clksrc &= ~0x00007FE0;
81
82 // FREQ2 = aux/2 = 48 MHz
83 sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20));
84 au_writel(sys_freqctrl, SYS_FREQCTRL0);
85
86 /*
87 * Route 48MHz FREQ2 into USB Host and/or Device
88 */
89#ifdef CONFIG_USB_OHCI
90 sys_clksrc |= ((4<<12) | (0<<11) | (0<<10));
91#endif
92#ifdef CONFIG_AU1X00_USB_DEVICE
93 sys_clksrc |= ((4<<7) | (0<<6) | (0<<5));
94#endif
95 au_writel(sys_clksrc, SYS_CLKSRC);
96
97
98 pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000);
99#ifndef CONFIG_AU1X00_USB_DEVICE
100 // 2nd USB port is USB host
101 pin_func |= 0x8000;
102#endif
103 au_writel(pin_func, SYS_PINFUNC);
104#endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
105
106
107
108#ifdef CONFIG_PCI
109 // Setup PCI bus controller
110 au_writel(0, Au1500_PCI_CMEM);
111 au_writel(0x00003fff, Au1500_CFG_BASE);
112#if defined(__MIPSEB__)
113 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG);
114#else
115 au_writel(0xf, Au1500_PCI_CFG);
116#endif
117 au_writel(0xf0000000, Au1500_PCI_MWMASK_DEV);
118 au_writel(0, Au1500_PCI_MWBASE_REV_CCL);
119 au_writel(0x02a00356, Au1500_PCI_STATCMD);
120 au_writel(0x00003c04, Au1500_PCI_HDRTYPE);
121 au_writel(0x00000008, Au1500_PCI_MBAR);
122 au_sync();
123#endif
124
125 /* Enable sys bus clock divider when IDLE state or no bus activity. */
126 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
127
128 /* Enable the RTC if not already enabled */
129 if (!(au_readl(0xac000028) & 0x20)) {
130 printk("enabling clock ...\n");
131 au_writel((au_readl(0xac000028) | 0x20), 0xac000028);
132 }
133 /* Put the clock in BCD mode */
134 if (readl(0xac00002C) & 0x4) { /* reg B */
135 au_writel(au_readl(0xac00002c) & ~0x4, 0xac00002c);
136 au_sync();
137 }
138}
diff --git a/arch/mips/au1000/pb1500/init.c b/arch/mips/au1000/pb1500/init.c
new file mode 100644
index 000000000000..733d2e469db2
--- /dev/null
+++ b/arch/mips/au1000/pb1500/init.c
@@ -0,0 +1,69 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PB1500 board setup
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/init.h>
31#include <linux/mm.h>
32#include <linux/sched.h>
33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h>
37#include <linux/kernel.h>
38
39int prom_argc;
40char **prom_argv, **prom_envp;
41extern void __init prom_init_cmdline(void);
42extern char *prom_getenv(char *envname);
43
44const char *get_system_type(void)
45{
46 return "Alchemy Pb1500";
47}
48
49void __init prom_init(void)
50{
51 unsigned char *memsize_str;
52 unsigned long memsize;
53
54 prom_argc = (int) fw_arg0;
55 prom_argv = (char **) fw_arg1;
56 prom_envp = (char **) fw_arg2;
57
58 mips_machgroup = MACH_GROUP_ALCHEMY;
59 mips_machtype = MACH_PB1500;
60
61 prom_init_cmdline();
62 memsize_str = prom_getenv("memsize");
63 if (!memsize_str) {
64 memsize = 0x04000000;
65 } else {
66 memsize = simple_strtol(memsize_str, NULL, 0);
67 }
68 add_memory_region(0, memsize, BOOT_MEM_RAM);
69}
diff --git a/arch/mips/au1000/pb1500/irqmap.c b/arch/mips/au1000/pb1500/irqmap.c
new file mode 100644
index 000000000000..476e25001681
--- /dev/null
+++ b/arch/mips/au1000/pb1500/irqmap.c
@@ -0,0 +1,58 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table
4 *
5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/irq.h>
31#include <linux/kernel_stat.h>
32#include <linux/module.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/ioport.h>
38#include <linux/timex.h>
39#include <linux/slab.h>
40#include <linux/random.h>
41#include <linux/delay.h>
42#include <linux/bitops.h>
43
44#include <asm/bootinfo.h>
45#include <asm/io.h>
46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h>
49
50au1xxx_irq_map_t au1xxx_irq_map[] = {
51 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
52 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
53 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
54 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
55 { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 },
56};
57
58int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t);
diff --git a/arch/mips/au1000/pb1550/Makefile b/arch/mips/au1000/pb1550/Makefile
new file mode 100644
index 000000000000..aa35bc6cb8cf
--- /dev/null
+++ b/arch/mips/au1000/pb1550/Makefile
@@ -0,0 +1,9 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Alchemy Semiconductor PB1000 board.
7#
8
9lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/pb1550/board_setup.c b/arch/mips/au1000/pb1550/board_setup.c
new file mode 100644
index 000000000000..05fd27dc24e6
--- /dev/null
+++ b/arch/mips/au1000/pb1550/board_setup.c
@@ -0,0 +1,69 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Pb1550 board setup.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/init.h>
31#include <linux/sched.h>
32#include <linux/ioport.h>
33#include <linux/mm.h>
34#include <linux/console.h>
35#include <linux/mc146818rtc.h>
36#include <linux/delay.h>
37
38#include <asm/cpu.h>
39#include <asm/bootinfo.h>
40#include <asm/irq.h>
41#include <asm/mipsregs.h>
42#include <asm/reboot.h>
43#include <asm/pgtable.h>
44#include <asm/mach-au1x00/au1000.h>
45#include <asm/mach-pb1x00/pb1550.h>
46
47void board_reset (void)
48{
49 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
50 au_writew(au_readw(0xAF00001C) & ~(1<<15), 0xAF00001C);
51}
52
53void __init board_setup(void)
54{
55 u32 pin_func;
56
57 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver,
58 * but it is board specific code, so put it here.
59 */
60 pin_func = au_readl(SYS_PINFUNC);
61 au_sync();
62 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
63 au_writel(pin_func, SYS_PINFUNC);
64
65 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */
66 au_sync();
67
68 printk("AMD Alchemy Pb1550 Board\n");
69}
diff --git a/arch/mips/au1000/pb1550/init.c b/arch/mips/au1000/pb1550/init.c
new file mode 100644
index 000000000000..41daa3371be3
--- /dev/null
+++ b/arch/mips/au1000/pb1550/init.c
@@ -0,0 +1,69 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PB1550 board setup
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/init.h>
31#include <linux/mm.h>
32#include <linux/sched.h>
33#include <linux/bootmem.h>
34#include <asm/addrspace.h>
35#include <asm/bootinfo.h>
36#include <linux/string.h>
37#include <linux/kernel.h>
38
39int prom_argc;
40char **prom_argv, **prom_envp;
41extern void __init prom_init_cmdline(void);
42extern char *prom_getenv(char *envname);
43
44const char *get_system_type(void)
45{
46 return "Alchemy Pb1550";
47}
48
49void __init prom_init(void)
50{
51 unsigned char *memsize_str;
52 unsigned long memsize;
53
54 prom_argc = (int) fw_arg0;
55 prom_argv = (char **) fw_arg1;
56 prom_envp = (char **) fw_arg2;
57
58 mips_machgroup = MACH_GROUP_ALCHEMY;
59 mips_machtype = MACH_PB1550;
60
61 prom_init_cmdline();
62 memsize_str = prom_getenv("memsize");
63 if (!memsize_str) {
64 memsize = 0x08000000;
65 } else {
66 memsize = simple_strtol(memsize_str, NULL, 0);
67 }
68 add_memory_region(0, memsize, BOOT_MEM_RAM);
69}
diff --git a/arch/mips/au1000/pb1550/irqmap.c b/arch/mips/au1000/pb1550/irqmap.c
new file mode 100644
index 000000000000..889d4949ee76
--- /dev/null
+++ b/arch/mips/au1000/pb1550/irqmap.c
@@ -0,0 +1,55 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table
4 *
5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/irq.h>
31#include <linux/kernel_stat.h>
32#include <linux/module.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/ioport.h>
38#include <linux/timex.h>
39#include <linux/slab.h>
40#include <linux/random.h>
41#include <linux/delay.h>
42#include <linux/bitops.h>
43
44#include <asm/bootinfo.h>
45#include <asm/io.h>
46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/mach-au1x00/au1000.h>
49
50au1xxx_irq_map_t au1xxx_irq_map[] = {
51 { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 },
52 { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 },
53};
54
55int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t);
diff --git a/arch/mips/au1000/xxs1500/Makefile b/arch/mips/au1000/xxs1500/Makefile
new file mode 100644
index 000000000000..44d7f7056ae7
--- /dev/null
+++ b/arch/mips/au1000/xxs1500/Makefile
@@ -0,0 +1,9 @@
1#
2# Copyright 2003 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for MyCable XXS1500 board.
7#
8
9lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/au1000/xxs1500/board_setup.c b/arch/mips/au1000/xxs1500/board_setup.c
new file mode 100644
index 000000000000..9dadc82536f4
--- /dev/null
+++ b/arch/mips/au1000/xxs1500/board_setup.c
@@ -0,0 +1,91 @@
1/*
2 * Copyright 2000-2003 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ppopov@mvista.com or source@mvista.com
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#include <linux/config.h>
27#include <linux/init.h>
28#include <linux/sched.h>
29#include <linux/ioport.h>
30#include <linux/mm.h>
31#include <linux/console.h>
32#include <linux/delay.h>
33
34#include <asm/cpu.h>
35#include <asm/bootinfo.h>
36#include <asm/irq.h>
37#include <asm/keyboard.h>
38#include <asm/mipsregs.h>
39#include <asm/reboot.h>
40#include <asm/pgtable.h>
41#include <asm/au1000.h>
42
43void board_reset (void)
44{
45 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
46 au_writel(0x00000000, 0xAE00001C);
47}
48
49void __init board_setup(void)
50{
51 u32 pin_func;
52
53 // set multiple use pins (UART3/GPIO) to UART (it's used as UART too)
54 pin_func = au_readl(SYS_PINFUNC) & (u32)(~SYS_PF_UR3);
55 pin_func |= SYS_PF_UR3;
56 au_writel(pin_func, SYS_PINFUNC);
57
58 // enable UART
59 au_writel(0x01, UART3_ADDR+UART_MOD_CNTRL); // clock enable (CE)
60 mdelay(10);
61 au_writel(0x03, UART3_ADDR+UART_MOD_CNTRL); // CE and "enable"
62 mdelay(10);
63
64 // enable DTR = USB power up
65 au_writel(0x01, UART3_ADDR+UART_MCR); //? UART_MCR_DTR is 0x01???
66
67#ifdef CONFIG_PCMCIA_XXS1500
68 /* setup pcmcia signals */
69 au_writel(0, SYS_PININPUTEN);
70
71 /* gpio 0, 1, and 4 are inputs */
72 au_writel(1 | (1<<1) | (1<<4), SYS_TRIOUTCLR);
73
74 /* enable GPIO2 if not already enabled */
75 au_writel(1, GPIO2_ENABLE);
76 /* gpio2 208/9/10/11 are inputs */
77 au_writel((1<<8) | (1<<9) | (1<<10) | (1<<11), GPIO2_DIR);
78
79 /* turn off power */
80 au_writel((au_readl(GPIO2_PINSTATE) & ~(1<<14))|(1<<30), GPIO2_OUTPUT);
81#endif
82
83
84#ifdef CONFIG_PCI
85#if defined(__MIPSEB__)
86 au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG);
87#else
88 au_writel(0xf, Au1500_PCI_CFG);
89#endif
90#endif
91}
diff --git a/arch/mips/au1000/xxs1500/init.c b/arch/mips/au1000/xxs1500/init.c
new file mode 100644
index 000000000000..03f755291b51
--- /dev/null
+++ b/arch/mips/au1000/xxs1500/init.c
@@ -0,0 +1,68 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * XXS1500 board setup
4 *
5 * Copyright 2003 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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#include <linux/init.h>
30#include <linux/mm.h>
31#include <linux/sched.h>
32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h>
36#include <linux/kernel.h>
37
38int prom_argc;
39char **prom_argv, **prom_envp;
40extern void __init prom_init_cmdline(void);
41extern char *prom_getenv(char *envname);
42
43const char *get_system_type(void)
44{
45 return "XXS1500";
46}
47
48void __init prom_init(void)
49{
50 unsigned char *memsize_str;
51 unsigned long memsize;
52
53 prom_argc = fw_arg0;
54 prom_argv = (char **) fw_arg1;
55 prom_envp = (char **) fw_arg2;
56
57 mips_machgroup = MACH_GROUP_ALCHEMY;
58 mips_machtype = MACH_XXS1500; /* set the platform # */
59
60 prom_init_cmdline();
61
62 memsize_str = prom_getenv("memsize");
63 if (!memsize_str)
64 memsize = 0x04000000;
65 else
66 memsize = simple_strtol(memsize_str, NULL, 0);
67 add_memory_region(0, memsize, BOOT_MEM_RAM);
68}
diff --git a/arch/mips/au1000/xxs1500/irqmap.c b/arch/mips/au1000/xxs1500/irqmap.c
new file mode 100644
index 000000000000..954800a0ab52
--- /dev/null
+++ b/arch/mips/au1000/xxs1500/irqmap.c
@@ -0,0 +1,66 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Au1xxx irq map table
4 *
5 * Copyright 2003 Embedded Edge, LLC
6 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/irq.h>
31#include <linux/kernel_stat.h>
32#include <linux/module.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/ioport.h>
38#include <linux/timex.h>
39#include <linux/slab.h>
40#include <linux/random.h>
41#include <linux/delay.h>
42#include <linux/bitops.h>
43
44#include <asm/bootinfo.h>
45#include <asm/io.h>
46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/au1000.h>
49
50au1xxx_irq_map_t au1xxx_irq_map[] = {
51 { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0},
52 { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 },
53 { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 },
54 { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 },
55 { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 },
56 { AU1500_GPIO_207, INTC_INT_LOW_LEVEL, 0 },
57
58 { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 },
59 { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 },
60 { AU1000_GPIO_2, INTC_INT_LOW_LEVEL, 0 },
61 { AU1000_GPIO_3, INTC_INT_LOW_LEVEL, 0 },
62 { AU1000_GPIO_4, INTC_INT_LOW_LEVEL, 0 }, /* CF interrupt */
63 { AU1000_GPIO_5, INTC_INT_LOW_LEVEL, 0 },
64};
65
66int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t);
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
new file mode 100644
index 000000000000..efbeac326815
--- /dev/null
+++ b/arch/mips/boot/Makefile
@@ -0,0 +1,49 @@
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) 1995, 1998, 2001, 2002 by Ralf Baechle
7# Copyright (C) 2004 Maciej W. Rozycki
8#
9
10#
11# Some DECstations need all possible sections of an ECOFF executable
12#
13ifdef CONFIG_MACH_DECSTATION
14 E2EFLAGS = -a
15else
16 E2EFLAGS =
17endif
18
19#
20# Drop some uninteresting sections in the kernel.
21# This is only relevant for ELF kernels but doesn't hurt a.out
22#
23drop-sections = .reginfo .mdebug .comment .note .pdr .options .MIPS.options
24strip-flags = $(addprefix --remove-section=,$(drop-sections))
25
26VMLINUX = vmlinux
27
28all: vmlinux.ecoff vmlinux.srec addinitrd
29
30vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX)
31 $(obj)/elf2ecoff $(VMLINUX) vmlinux.ecoff $(E2EFLAGS)
32
33$(obj)/elf2ecoff: $(obj)/elf2ecoff.c
34 $(HOSTCC) -o $@ $^
35
36vmlinux.srec: $(VMLINUX)
37 $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $(obj)/vmlinux.srec
38
39$(obj)/addinitrd: $(obj)/addinitrd.c
40 $(HOSTCC) -o $@ $^
41
42archhelp:
43 @echo '* vmlinux.ecoff - ECOFF boot image'
44 @echo '* vmlinux.srec - SREC boot image'
45
46clean-files += addinitrd \
47 elf2ecoff \
48 vmlinux.ecoff \
49 vmlinux.srec
diff --git a/arch/mips/boot/addinitrd.c b/arch/mips/boot/addinitrd.c
new file mode 100644
index 000000000000..8b3033304770
--- /dev/null
+++ b/arch/mips/boot/addinitrd.c
@@ -0,0 +1,131 @@
1/*
2 * addinitrd - program to add a initrd image to an ecoff kernel
3 *
4 * (C) 1999 Thomas Bogendoerfer
5 * minor modifications, cleanup: Guido Guenther <agx@sigxcpu.org>
6 * further cleanup: Maciej W. Rozycki
7 */
8
9#include <sys/types.h>
10#include <sys/stat.h>
11#include <fcntl.h>
12#include <unistd.h>
13#include <stdio.h>
14#include <netinet/in.h>
15
16#include "ecoff.h"
17
18#define MIPS_PAGE_SIZE 4096
19#define MIPS_PAGE_MASK (MIPS_PAGE_SIZE-1)
20
21#define swab16(x) \
22 ((unsigned short)( \
23 (((unsigned short)(x) & (unsigned short)0x00ffU) << 8) | \
24 (((unsigned short)(x) & (unsigned short)0xff00U) >> 8) ))
25
26#define swab32(x) \
27 ((unsigned int)( \
28 (((unsigned int)(x) & (unsigned int)0x000000ffUL) << 24) | \
29 (((unsigned int)(x) & (unsigned int)0x0000ff00UL) << 8) | \
30 (((unsigned int)(x) & (unsigned int)0x00ff0000UL) >> 8) | \
31 (((unsigned int)(x) & (unsigned int)0xff000000UL) >> 24) ))
32
33#define SWAB(a) (swab ? swab32(a) : (a))
34
35void die (char *s)
36{
37 perror (s);
38 exit (1);
39}
40
41int main (int argc, char *argv[])
42{
43 int fd_vmlinux,fd_initrd,fd_outfile;
44 FILHDR efile;
45 AOUTHDR eaout;
46 SCNHDR esecs[3];
47 struct stat st;
48 char buf[1024];
49 unsigned long loadaddr;
50 unsigned long initrd_header[2];
51 int i,cnt;
52 int swab = 0;
53
54 if (argc != 4) {
55 printf ("Usage: %s <vmlinux> <initrd> <outfile>\n",argv[0]);
56 exit (1);
57 }
58
59 if ((fd_vmlinux = open (argv[1],O_RDONLY)) < 0)
60 die ("open vmlinux");
61 if (read (fd_vmlinux, &efile, sizeof efile) != sizeof efile)
62 die ("read file header");
63 if (read (fd_vmlinux, &eaout, sizeof eaout) != sizeof eaout)
64 die ("read aout header");
65 if (read (fd_vmlinux, esecs, sizeof esecs) != sizeof esecs)
66 die ("read section headers");
67 /*
68 * check whether the file is good for us
69 */
70 /* TBD */
71
72 /*
73 * check, if we have to swab words
74 */
75 if (ntohs(0xaa55) == 0xaa55) {
76 if (efile.f_magic == swab16(MIPSELMAGIC))
77 swab = 1;
78 } else {
79 if (efile.f_magic == swab16(MIPSEBMAGIC))
80 swab = 1;
81 }
82
83 /* make sure we have an empty data segment for the initrd */
84 if (eaout.dsize || esecs[1].s_size) {
85 fprintf (stderr, "Data segment not empty. Giving up!\n");
86 exit (1);
87 }
88 if ((fd_initrd = open (argv[2], O_RDONLY)) < 0)
89 die ("open initrd");
90 if (fstat (fd_initrd, &st) < 0)
91 die ("fstat initrd");
92 loadaddr = ((SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)
93 + MIPS_PAGE_SIZE-1) & ~MIPS_PAGE_MASK) - 8;
94 if (loadaddr < (SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)))
95 loadaddr += MIPS_PAGE_SIZE;
96 initrd_header[0] = SWAB(0x494E5244);
97 initrd_header[1] = SWAB(st.st_size);
98 eaout.dsize = esecs[1].s_size = initrd_header[1] = SWAB(st.st_size+8);
99 eaout.data_start = esecs[1].s_vaddr = esecs[1].s_paddr = SWAB(loadaddr);
100
101 if ((fd_outfile = open (argv[3], O_RDWR|O_CREAT|O_TRUNC,0666)) < 0)
102 die ("open outfile");
103 if (write (fd_outfile, &efile, sizeof efile) != sizeof efile)
104 die ("write file header");
105 if (write (fd_outfile, &eaout, sizeof eaout) != sizeof eaout)
106 die ("write aout header");
107 if (write (fd_outfile, esecs, sizeof esecs) != sizeof esecs)
108 die ("write section headers");
109 /* skip padding */
110 if(lseek(fd_vmlinux, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
111 die ("lseek vmlinux");
112 if(lseek(fd_outfile, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
113 die ("lseek outfile");
114 /* copy text segment */
115 cnt = SWAB(eaout.tsize);
116 while (cnt) {
117 if ((i = read (fd_vmlinux, buf, sizeof buf)) <= 0)
118 die ("read vmlinux");
119 if (write (fd_outfile, buf, i) != i)
120 die ("write vmlinux");
121 cnt -= i;
122 }
123 if (write (fd_outfile, initrd_header, sizeof initrd_header) != sizeof initrd_header)
124 die ("write initrd header");
125 while ((i = read (fd_initrd, buf, sizeof buf)) > 0)
126 if (write (fd_outfile, buf, i) != i)
127 die ("write initrd");
128 close (fd_vmlinux);
129 close (fd_initrd);
130 return 0;
131}
diff --git a/arch/mips/boot/ecoff.h b/arch/mips/boot/ecoff.h
new file mode 100644
index 000000000000..8c3eed2877f2
--- /dev/null
+++ b/arch/mips/boot/ecoff.h
@@ -0,0 +1,62 @@
1/*
2 * Some ECOFF definitions.
3 */
4typedef struct filehdr {
5 unsigned short f_magic; /* magic number */
6 unsigned short f_nscns; /* number of sections */
7 long f_timdat; /* time & date stamp */
8 long f_symptr; /* file pointer to symbolic header */
9 long f_nsyms; /* sizeof(symbolic hdr) */
10 unsigned short f_opthdr; /* sizeof(optional hdr) */
11 unsigned short f_flags; /* flags */
12} FILHDR;
13#define FILHSZ sizeof(FILHDR)
14
15#define OMAGIC 0407
16#define MIPSEBMAGIC 0x160
17#define MIPSELMAGIC 0x162
18
19typedef struct scnhdr {
20 char s_name[8]; /* section name */
21 long s_paddr; /* physical address, aliased s_nlib */
22 long s_vaddr; /* virtual address */
23 long s_size; /* section size */
24 long s_scnptr; /* file ptr to raw data for section */
25 long s_relptr; /* file ptr to relocation */
26 long s_lnnoptr; /* file ptr to gp histogram */
27 unsigned short s_nreloc; /* number of relocation entries */
28 unsigned short s_nlnno; /* number of gp histogram entries */
29 long s_flags; /* flags */
30} SCNHDR;
31#define SCNHSZ sizeof(SCNHDR)
32#define SCNROUND ((long)16)
33
34typedef struct aouthdr {
35 short magic; /* see above */
36 short vstamp; /* version stamp */
37 long tsize; /* text size in bytes, padded to DW bdry*/
38 long dsize; /* initialized data " " */
39 long bsize; /* uninitialized data " " */
40 long entry; /* entry pt. */
41 long text_start; /* base of text used for this file */
42 long data_start; /* base of data used for this file */
43 long bss_start; /* base of bss used for this file */
44 long gprmask; /* general purpose register mask */
45 long cprmask[4]; /* co-processor register masks */
46 long gp_value; /* the gp value used for this object */
47} AOUTHDR;
48#define AOUTHSZ sizeof(AOUTHDR)
49
50#define OMAGIC 0407
51#define NMAGIC 0410
52#define ZMAGIC 0413
53#define SMAGIC 0411
54#define LIBMAGIC 0443
55
56#define N_TXTOFF(f, a) \
57 ((a).magic == ZMAGIC || (a).magic == LIBMAGIC ? 0 : \
58 ((a).vstamp < 23 ? \
59 ((FILHSZ + AOUTHSZ + (f).f_nscns * SCNHSZ + 7) & 0xfffffff8) : \
60 ((FILHSZ + AOUTHSZ + (f).f_nscns * SCNHSZ + SCNROUND-1) & ~(SCNROUND-1)) ) )
61#define N_DATOFF(f, a) \
62 N_TXTOFF(f, a) + (a).tsize;
diff --git a/arch/mips/boot/elf2ecoff.c b/arch/mips/boot/elf2ecoff.c
new file mode 100644
index 000000000000..c3543d9eb266
--- /dev/null
+++ b/arch/mips/boot/elf2ecoff.c
@@ -0,0 +1,616 @@
1/*
2 * Copyright (c) 1995
3 * Ted Lemon (hereinafter referred to as the author)
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29/* elf2ecoff.c
30
31 This program converts an elf executable to an ECOFF executable.
32 No symbol table is retained. This is useful primarily in building
33 net-bootable kernels for machines (e.g., DECstation and Alpha) which
34 only support the ECOFF object file format. */
35
36#include <stdio.h>
37#include <string.h>
38#include <errno.h>
39#include <sys/types.h>
40#include <fcntl.h>
41#include <unistd.h>
42#include <elf.h>
43#include <limits.h>
44#include <netinet/in.h>
45#include <stdlib.h>
46
47#include "ecoff.h"
48
49/*
50 * Some extra ELF definitions
51 */
52#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
53
54/* -------------------------------------------------------------------- */
55
56struct sect {
57 unsigned long vaddr;
58 unsigned long len;
59};
60
61int *symTypeTable;
62int must_convert_endian = 0;
63int format_bigendian = 0;
64
65static void copy(int out, int in, off_t offset, off_t size)
66{
67 char ibuf[4096];
68 int remaining, cur, count;
69
70 /* Go to the start of the ELF symbol table... */
71 if (lseek(in, offset, SEEK_SET) < 0) {
72 perror("copy: lseek");
73 exit(1);
74 }
75
76 remaining = size;
77 while (remaining) {
78 cur = remaining;
79 if (cur > sizeof ibuf)
80 cur = sizeof ibuf;
81 remaining -= cur;
82 if ((count = read(in, ibuf, cur)) != cur) {
83 fprintf(stderr, "copy: read: %s\n",
84 count ? strerror(errno) :
85 "premature end of file");
86 exit(1);
87 }
88 if ((count = write(out, ibuf, cur)) != cur) {
89 perror("copy: write");
90 exit(1);
91 }
92 }
93}
94
95/*
96 * Combine two segments, which must be contiguous. If pad is true, it's
97 * okay for there to be padding between.
98 */
99static void combine(struct sect *base, struct sect *new, int pad)
100{
101 if (!base->len)
102 *base = *new;
103 else if (new->len) {
104 if (base->vaddr + base->len != new->vaddr) {
105 if (pad)
106 base->len = new->vaddr - base->vaddr;
107 else {
108 fprintf(stderr,
109 "Non-contiguous data can't be converted.\n");
110 exit(1);
111 }
112 }
113 base->len += new->len;
114 }
115}
116
117static int phcmp(const void *v1, const void *v2)
118{
119 const Elf32_Phdr *h1 = v1;
120 const Elf32_Phdr *h2 = v2;
121
122 if (h1->p_vaddr > h2->p_vaddr)
123 return 1;
124 else if (h1->p_vaddr < h2->p_vaddr)
125 return -1;
126 else
127 return 0;
128}
129
130static char *saveRead(int file, off_t offset, off_t len, char *name)
131{
132 char *tmp;
133 int count;
134 off_t off;
135 if ((off = lseek(file, offset, SEEK_SET)) < 0) {
136 fprintf(stderr, "%s: fseek: %s\n", name, strerror(errno));
137 exit(1);
138 }
139 if (!(tmp = (char *) malloc(len))) {
140 fprintf(stderr, "%s: Can't allocate %ld bytes.\n", name,
141 len);
142 exit(1);
143 }
144 count = read(file, tmp, len);
145 if (count != len) {
146 fprintf(stderr, "%s: read: %s.\n",
147 name,
148 count ? strerror(errno) : "End of file reached");
149 exit(1);
150 }
151 return tmp;
152}
153
154#define swab16(x) \
155 ((unsigned short)( \
156 (((unsigned short)(x) & (unsigned short)0x00ffU) << 8) | \
157 (((unsigned short)(x) & (unsigned short)0xff00U) >> 8) ))
158
159#define swab32(x) \
160 ((unsigned int)( \
161 (((unsigned int)(x) & (unsigned int)0x000000ffUL) << 24) | \
162 (((unsigned int)(x) & (unsigned int)0x0000ff00UL) << 8) | \
163 (((unsigned int)(x) & (unsigned int)0x00ff0000UL) >> 8) | \
164 (((unsigned int)(x) & (unsigned int)0xff000000UL) >> 24) ))
165
166static void convert_elf_hdr(Elf32_Ehdr * e)
167{
168 e->e_type = swab16(e->e_type);
169 e->e_machine = swab16(e->e_machine);
170 e->e_version = swab32(e->e_version);
171 e->e_entry = swab32(e->e_entry);
172 e->e_phoff = swab32(e->e_phoff);
173 e->e_shoff = swab32(e->e_shoff);
174 e->e_flags = swab32(e->e_flags);
175 e->e_ehsize = swab16(e->e_ehsize);
176 e->e_phentsize = swab16(e->e_phentsize);
177 e->e_phnum = swab16(e->e_phnum);
178 e->e_shentsize = swab16(e->e_shentsize);
179 e->e_shnum = swab16(e->e_shnum);
180 e->e_shstrndx = swab16(e->e_shstrndx);
181}
182
183static void convert_elf_phdrs(Elf32_Phdr * p, int num)
184{
185 int i;
186
187 for (i = 0; i < num; i++, p++) {
188 p->p_type = swab32(p->p_type);
189 p->p_offset = swab32(p->p_offset);
190 p->p_vaddr = swab32(p->p_vaddr);
191 p->p_paddr = swab32(p->p_paddr);
192 p->p_filesz = swab32(p->p_filesz);
193 p->p_memsz = swab32(p->p_memsz);
194 p->p_flags = swab32(p->p_flags);
195 p->p_align = swab32(p->p_align);
196 }
197
198}
199
200static void convert_elf_shdrs(Elf32_Shdr * s, int num)
201{
202 int i;
203
204 for (i = 0; i < num; i++, s++) {
205 s->sh_name = swab32(s->sh_name);
206 s->sh_type = swab32(s->sh_type);
207 s->sh_flags = swab32(s->sh_flags);
208 s->sh_addr = swab32(s->sh_addr);
209 s->sh_offset = swab32(s->sh_offset);
210 s->sh_size = swab32(s->sh_size);
211 s->sh_link = swab32(s->sh_link);
212 s->sh_info = swab32(s->sh_info);
213 s->sh_addralign = swab32(s->sh_addralign);
214 s->sh_entsize = swab32(s->sh_entsize);
215 }
216}
217
218static void convert_ecoff_filehdr(struct filehdr *f)
219{
220 f->f_magic = swab16(f->f_magic);
221 f->f_nscns = swab16(f->f_nscns);
222 f->f_timdat = swab32(f->f_timdat);
223 f->f_symptr = swab32(f->f_symptr);
224 f->f_nsyms = swab32(f->f_nsyms);
225 f->f_opthdr = swab16(f->f_opthdr);
226 f->f_flags = swab16(f->f_flags);
227}
228
229static void convert_ecoff_aouthdr(struct aouthdr *a)
230{
231 a->magic = swab16(a->magic);
232 a->vstamp = swab16(a->vstamp);
233 a->tsize = swab32(a->tsize);
234 a->dsize = swab32(a->dsize);
235 a->bsize = swab32(a->bsize);
236 a->entry = swab32(a->entry);
237 a->text_start = swab32(a->text_start);
238 a->data_start = swab32(a->data_start);
239 a->bss_start = swab32(a->bss_start);
240 a->gprmask = swab32(a->gprmask);
241 a->cprmask[0] = swab32(a->cprmask[0]);
242 a->cprmask[1] = swab32(a->cprmask[1]);
243 a->cprmask[2] = swab32(a->cprmask[2]);
244 a->cprmask[3] = swab32(a->cprmask[3]);
245 a->gp_value = swab32(a->gp_value);
246}
247
248static void convert_ecoff_esecs(struct scnhdr *s, int num)
249{
250 int i;
251
252 for (i = 0; i < num; i++, s++) {
253 s->s_paddr = swab32(s->s_paddr);
254 s->s_vaddr = swab32(s->s_vaddr);
255 s->s_size = swab32(s->s_size);
256 s->s_scnptr = swab32(s->s_scnptr);
257 s->s_relptr = swab32(s->s_relptr);
258 s->s_lnnoptr = swab32(s->s_lnnoptr);
259 s->s_nreloc = swab16(s->s_nreloc);
260 s->s_nlnno = swab16(s->s_nlnno);
261 s->s_flags = swab32(s->s_flags);
262 }
263}
264
265int main(int argc, char *argv[])
266{
267 Elf32_Ehdr ex;
268 Elf32_Phdr *ph;
269 Elf32_Shdr *sh;
270 char *shstrtab;
271 int i, pad;
272 struct sect text, data, bss;
273 struct filehdr efh;
274 struct aouthdr eah;
275 struct scnhdr esecs[6];
276 int infile, outfile;
277 unsigned long cur_vma = ULONG_MAX;
278 int addflag = 0;
279 int nosecs;
280
281 text.len = data.len = bss.len = 0;
282 text.vaddr = data.vaddr = bss.vaddr = 0;
283
284 /* Check args... */
285 if (argc < 3 || argc > 4) {
286 usage:
287 fprintf(stderr,
288 "usage: elf2ecoff <elf executable> <ecoff executable> [-a]\n");
289 exit(1);
290 }
291 if (argc == 4) {
292 if (strcmp(argv[3], "-a"))
293 goto usage;
294 addflag = 1;
295 }
296
297 /* Try the input file... */
298 if ((infile = open(argv[1], O_RDONLY)) < 0) {
299 fprintf(stderr, "Can't open %s for read: %s\n",
300 argv[1], strerror(errno));
301 exit(1);
302 }
303
304 /* Read the header, which is at the beginning of the file... */
305 i = read(infile, &ex, sizeof ex);
306 if (i != sizeof ex) {
307 fprintf(stderr, "ex: %s: %s.\n",
308 argv[1],
309 i ? strerror(errno) : "End of file reached");
310 exit(1);
311 }
312
313 if (ex.e_ident[EI_DATA] == ELFDATA2MSB)
314 format_bigendian = 1;
315
316 if (ntohs(0xaa55) == 0xaa55) {
317 if (!format_bigendian)
318 must_convert_endian = 1;
319 } else {
320 if (format_bigendian)
321 must_convert_endian = 1;
322 }
323 if (must_convert_endian)
324 convert_elf_hdr(&ex);
325
326 /* Read the program headers... */
327 ph = (Elf32_Phdr *) saveRead(infile, ex.e_phoff,
328 ex.e_phnum * sizeof(Elf32_Phdr),
329 "ph");
330 if (must_convert_endian)
331 convert_elf_phdrs(ph, ex.e_phnum);
332 /* Read the section headers... */
333 sh = (Elf32_Shdr *) saveRead(infile, ex.e_shoff,
334 ex.e_shnum * sizeof(Elf32_Shdr),
335 "sh");
336 if (must_convert_endian)
337 convert_elf_shdrs(sh, ex.e_shnum);
338 /* Read in the section string table. */
339 shstrtab = saveRead(infile, sh[ex.e_shstrndx].sh_offset,
340 sh[ex.e_shstrndx].sh_size, "shstrtab");
341
342 /* Figure out if we can cram the program header into an ECOFF
343 header... Basically, we can't handle anything but loadable
344 segments, but we can ignore some kinds of segments. We can't
345 handle holes in the address space. Segments may be out of order,
346 so we sort them first. */
347
348 qsort(ph, ex.e_phnum, sizeof(Elf32_Phdr), phcmp);
349
350 for (i = 0; i < ex.e_phnum; i++) {
351 /* Section types we can ignore... */
352 if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE ||
353 ph[i].p_type == PT_PHDR
354 || ph[i].p_type == PT_MIPS_REGINFO)
355 continue;
356 /* Section types we can't handle... */
357 else if (ph[i].p_type != PT_LOAD) {
358 fprintf(stderr,
359 "Program header %d type %d can't be converted.\n",
360 ex.e_phnum, ph[i].p_type);
361 exit(1);
362 }
363 /* Writable (data) segment? */
364 if (ph[i].p_flags & PF_W) {
365 struct sect ndata, nbss;
366
367 ndata.vaddr = ph[i].p_vaddr;
368 ndata.len = ph[i].p_filesz;
369 nbss.vaddr = ph[i].p_vaddr + ph[i].p_filesz;
370 nbss.len = ph[i].p_memsz - ph[i].p_filesz;
371
372 combine(&data, &ndata, 0);
373 combine(&bss, &nbss, 1);
374 } else {
375 struct sect ntxt;
376
377 ntxt.vaddr = ph[i].p_vaddr;
378 ntxt.len = ph[i].p_filesz;
379
380 combine(&text, &ntxt, 0);
381 }
382 /* Remember the lowest segment start address. */
383 if (ph[i].p_vaddr < cur_vma)
384 cur_vma = ph[i].p_vaddr;
385 }
386
387 /* Sections must be in order to be converted... */
388 if (text.vaddr > data.vaddr || data.vaddr > bss.vaddr ||
389 text.vaddr + text.len > data.vaddr
390 || data.vaddr + data.len > bss.vaddr) {
391 fprintf(stderr,
392 "Sections ordering prevents a.out conversion.\n");
393 exit(1);
394 }
395
396 /* If there's a data section but no text section, then the loader
397 combined everything into one section. That needs to be the
398 text section, so just make the data section zero length following
399 text. */
400 if (data.len && !text.len) {
401 text = data;
402 data.vaddr = text.vaddr + text.len;
403 data.len = 0;
404 }
405
406 /* If there is a gap between text and data, we'll fill it when we copy
407 the data, so update the length of the text segment as represented in
408 a.out to reflect that, since a.out doesn't allow gaps in the program
409 address space. */
410 if (text.vaddr + text.len < data.vaddr)
411 text.len = data.vaddr - text.vaddr;
412
413 /* We now have enough information to cons up an a.out header... */
414 eah.magic = OMAGIC;
415 eah.vstamp = 200;
416 eah.tsize = text.len;
417 eah.dsize = data.len;
418 eah.bsize = bss.len;
419 eah.entry = ex.e_entry;
420 eah.text_start = text.vaddr;
421 eah.data_start = data.vaddr;
422 eah.bss_start = bss.vaddr;
423 eah.gprmask = 0xf3fffffe;
424 memset(&eah.cprmask, '\0', sizeof eah.cprmask);
425 eah.gp_value = 0; /* unused. */
426
427 if (format_bigendian)
428 efh.f_magic = MIPSEBMAGIC;
429 else
430 efh.f_magic = MIPSELMAGIC;
431 if (addflag)
432 nosecs = 6;
433 else
434 nosecs = 3;
435 efh.f_nscns = nosecs;
436 efh.f_timdat = 0; /* bogus */
437 efh.f_symptr = 0;
438 efh.f_nsyms = 0;
439 efh.f_opthdr = sizeof eah;
440 efh.f_flags = 0x100f; /* Stripped, not sharable. */
441
442 memset(esecs, 0, sizeof esecs);
443 strcpy(esecs[0].s_name, ".text");
444 strcpy(esecs[1].s_name, ".data");
445 strcpy(esecs[2].s_name, ".bss");
446 if (addflag) {
447 strcpy(esecs[3].s_name, ".rdata");
448 strcpy(esecs[4].s_name, ".sdata");
449 strcpy(esecs[5].s_name, ".sbss");
450 }
451 esecs[0].s_paddr = esecs[0].s_vaddr = eah.text_start;
452 esecs[1].s_paddr = esecs[1].s_vaddr = eah.data_start;
453 esecs[2].s_paddr = esecs[2].s_vaddr = eah.bss_start;
454 if (addflag) {
455 esecs[3].s_paddr = esecs[3].s_vaddr = 0;
456 esecs[4].s_paddr = esecs[4].s_vaddr = 0;
457 esecs[5].s_paddr = esecs[5].s_vaddr = 0;
458 }
459 esecs[0].s_size = eah.tsize;
460 esecs[1].s_size = eah.dsize;
461 esecs[2].s_size = eah.bsize;
462 if (addflag) {
463 esecs[3].s_size = 0;
464 esecs[4].s_size = 0;
465 esecs[5].s_size = 0;
466 }
467 esecs[0].s_scnptr = N_TXTOFF(efh, eah);
468 esecs[1].s_scnptr = N_DATOFF(efh, eah);
469#define ECOFF_SEGMENT_ALIGNMENT(a) 0x10
470#define ECOFF_ROUND(s,a) (((s)+(a)-1)&~((a)-1))
471 esecs[2].s_scnptr = esecs[1].s_scnptr +
472 ECOFF_ROUND(esecs[1].s_size, ECOFF_SEGMENT_ALIGNMENT(&eah));
473 if (addflag) {
474 esecs[3].s_scnptr = 0;
475 esecs[4].s_scnptr = 0;
476 esecs[5].s_scnptr = 0;
477 }
478 esecs[0].s_relptr = esecs[1].s_relptr = esecs[2].s_relptr = 0;
479 esecs[0].s_lnnoptr = esecs[1].s_lnnoptr = esecs[2].s_lnnoptr = 0;
480 esecs[0].s_nreloc = esecs[1].s_nreloc = esecs[2].s_nreloc = 0;
481 esecs[0].s_nlnno = esecs[1].s_nlnno = esecs[2].s_nlnno = 0;
482 if (addflag) {
483 esecs[3].s_relptr = esecs[4].s_relptr
484 = esecs[5].s_relptr = 0;
485 esecs[3].s_lnnoptr = esecs[4].s_lnnoptr
486 = esecs[5].s_lnnoptr = 0;
487 esecs[3].s_nreloc = esecs[4].s_nreloc = esecs[5].s_nreloc =
488 0;
489 esecs[3].s_nlnno = esecs[4].s_nlnno = esecs[5].s_nlnno = 0;
490 }
491 esecs[0].s_flags = 0x20;
492 esecs[1].s_flags = 0x40;
493 esecs[2].s_flags = 0x82;
494 if (addflag) {
495 esecs[3].s_flags = 0x100;
496 esecs[4].s_flags = 0x200;
497 esecs[5].s_flags = 0x400;
498 }
499
500 /* Make the output file... */
501 if ((outfile = open(argv[2], O_WRONLY | O_CREAT, 0777)) < 0) {
502 fprintf(stderr, "Unable to create %s: %s\n", argv[2],
503 strerror(errno));
504 exit(1);
505 }
506
507 if (must_convert_endian)
508 convert_ecoff_filehdr(&efh);
509 /* Write the headers... */
510 i = write(outfile, &efh, sizeof efh);
511 if (i != sizeof efh) {
512 perror("efh: write");
513 exit(1);
514
515 for (i = 0; i < nosecs; i++) {
516 printf
517 ("Section %d: %s phys %lx size %lx file offset %lx\n",
518 i, esecs[i].s_name, esecs[i].s_paddr,
519 esecs[i].s_size, esecs[i].s_scnptr);
520 }
521 }
522 fprintf(stderr, "wrote %d byte file header.\n", i);
523
524 if (must_convert_endian)
525 convert_ecoff_aouthdr(&eah);
526 i = write(outfile, &eah, sizeof eah);
527 if (i != sizeof eah) {
528 perror("eah: write");
529 exit(1);
530 }
531 fprintf(stderr, "wrote %d byte a.out header.\n", i);
532
533 if (must_convert_endian)
534 convert_ecoff_esecs(&esecs[0], nosecs);
535 i = write(outfile, &esecs, nosecs * sizeof(struct scnhdr));
536 if (i != nosecs * sizeof(struct scnhdr)) {
537 perror("esecs: write");
538 exit(1);
539 }
540 fprintf(stderr, "wrote %d bytes of section headers.\n", i);
541
542 pad = (sizeof(efh) + sizeof(eah) + nosecs * sizeof(struct scnhdr)) & 15;
543 if (pad) {
544 pad = 16 - pad;
545 i = write(outfile, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0", pad);
546 if (i < 0) {
547 perror("ipad: write");
548 exit(1);
549 }
550 fprintf(stderr, "wrote %d byte pad.\n", i);
551 }
552
553 /*
554 * Copy the loadable sections. Zero-fill any gaps less than 64k;
555 * complain about any zero-filling, and die if we're asked to zero-fill
556 * more than 64k.
557 */
558 for (i = 0; i < ex.e_phnum; i++) {
559 /* Unprocessable sections were handled above, so just verify that
560 the section can be loaded before copying. */
561 if (ph[i].p_type == PT_LOAD && ph[i].p_filesz) {
562 if (cur_vma != ph[i].p_vaddr) {
563 unsigned long gap =
564 ph[i].p_vaddr - cur_vma;
565 char obuf[1024];
566 if (gap > 65536) {
567 fprintf(stderr,
568 "Intersegment gap (%ld bytes) too large.\n",
569 gap);
570 exit(1);
571 }
572 fprintf(stderr,
573 "Warning: %ld byte intersegment gap.\n",
574 gap);
575 memset(obuf, 0, sizeof obuf);
576 while (gap) {
577 int count =
578 write(outfile, obuf,
579 (gap >
580 sizeof obuf ? sizeof
581 obuf : gap));
582 if (count < 0) {
583 fprintf(stderr,
584 "Error writing gap: %s\n",
585 strerror(errno));
586 exit(1);
587 }
588 gap -= count;
589 }
590 }
591 fprintf(stderr, "writing %d bytes...\n",
592 ph[i].p_filesz);
593 copy(outfile, infile, ph[i].p_offset,
594 ph[i].p_filesz);
595 cur_vma = ph[i].p_vaddr + ph[i].p_filesz;
596 }
597 }
598
599 /*
600 * Write a page of padding for boot PROMS that read entire pages.
601 * Without this, they may attempt to read past the end of the
602 * data section, incur an error, and refuse to boot.
603 */
604 {
605 char obuf[4096];
606 memset(obuf, 0, sizeof obuf);
607 if (write(outfile, obuf, sizeof(obuf)) != sizeof(obuf)) {
608 fprintf(stderr, "Error writing PROM padding: %s\n",
609 strerror(errno));
610 exit(1);
611 }
612 }
613
614 /* Looks like we won... */
615 exit(0);
616}
diff --git a/arch/mips/cobalt/Makefile b/arch/mips/cobalt/Makefile
new file mode 100644
index 000000000000..a5e6554b2326
--- /dev/null
+++ b/arch/mips/cobalt/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for the Cobalt micro systems family specific parts of the kernel
3#
4
5obj-y := irq.o int-handler.o reset.o setup.o promcon.o
6
7EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/cobalt/int-handler.S b/arch/mips/cobalt/int-handler.S
new file mode 100644
index 000000000000..1a21dec1b3ca
--- /dev/null
+++ b/arch/mips/cobalt/int-handler.S
@@ -0,0 +1,25 @@
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) 1995, 1996, 1997, 2003 by Ralf Baechle
7 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
8 */
9#include <asm/asm.h>
10#include <asm/mipsregs.h>
11#include <asm/cobalt/cobalt.h>
12#include <asm/regdef.h>
13#include <asm/stackframe.h>
14
15 .text
16 .align 5
17 NESTED(cobalt_handle_int, PT_SIZE, sp)
18 SAVE_ALL
19 CLI
20
21 la ra, ret_from_irq
22 move a1, sp
23 j cobalt_irq
24
25 END(cobalt_handle_int)
diff --git a/arch/mips/cobalt/irq.c b/arch/mips/cobalt/irq.c
new file mode 100644
index 000000000000..6d2a81581397
--- /dev/null
+++ b/arch/mips/cobalt/irq.c
@@ -0,0 +1,102 @@
1/*
2 * IRQ vector handles
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995, 1996, 1997, 2003 by Ralf Baechle
9 */
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/irq.h>
13
14#include <asm/i8259.h>
15#include <asm/irq_cpu.h>
16#include <asm/gt64120.h>
17#include <asm/ptrace.h>
18
19#include <asm/cobalt/cobalt.h>
20
21extern void cobalt_handle_int(void);
22
23/*
24 * We have two types of interrupts that we handle, ones that come in through
25 * the CPU interrupt lines, and ones that come in on the via chip. The CPU
26 * mappings are:
27 *
28 * 16, - Software interrupt 0 (unused) IE_SW0
29 * 17 - Software interrupt 1 (unused) IE_SW0
30 * 18 - Galileo chip (timer) IE_IRQ0
31 * 19 - Tulip 0 + NCR SCSI IE_IRQ1
32 * 20 - Tulip 1 IE_IRQ2
33 * 21 - 16550 UART IE_IRQ3
34 * 22 - VIA southbridge PIC IE_IRQ4
35 * 23 - unused IE_IRQ5
36 *
37 * The VIA chip is a master/slave 8259 setup and has the following interrupts:
38 *
39 * 8 - RTC
40 * 9 - PCI
41 * 14 - IDE0
42 * 15 - IDE1
43 */
44
45asmlinkage void cobalt_irq(struct pt_regs *regs)
46{
47 unsigned int pending = read_c0_status() & read_c0_cause();
48
49 if (pending & CAUSEF_IP2) { /* int 18 */
50 unsigned long irq_src = GALILEO_INL(GT_INTRCAUSE_OFS);
51
52 /* Check for timer irq ... */
53 if (irq_src & GALILEO_T0EXP) {
54 /* Clear the int line */
55 GALILEO_OUTL(0, GT_INTRCAUSE_OFS);
56 do_IRQ(COBALT_TIMER_IRQ, regs);
57 }
58 return;
59 }
60
61 if (pending & CAUSEF_IP6) { /* int 22 */
62 int irq = i8259_irq();
63
64 if (irq >= 0)
65 do_IRQ(irq, regs);
66 return;
67 }
68
69 if (pending & CAUSEF_IP3) { /* int 19 */
70 do_IRQ(COBALT_ETH0_IRQ, regs);
71 return;
72 }
73
74 if (pending & CAUSEF_IP4) { /* int 20 */
75 do_IRQ(COBALT_ETH1_IRQ, regs);
76 return;
77 }
78
79 if (pending & CAUSEF_IP5) { /* int 21 */
80 do_IRQ(COBALT_SERIAL_IRQ, regs);
81 return;
82 }
83
84 if (pending & CAUSEF_IP7) { /* int 23 */
85 do_IRQ(COBALT_QUBE_SLOT_IRQ, regs);
86 return;
87 }
88}
89
90void __init arch_init_irq(void)
91{
92 set_except_vector(0, cobalt_handle_int);
93
94 init_i8259_irqs(); /* 0 ... 15 */
95 mips_cpu_irq_init(16); /* 16 ... 23 */
96
97 /*
98 * Mask all cpu interrupts
99 * (except IE4, we already masked those at VIA level)
100 */
101 change_c0_status(ST0_IM, IE_IRQ4);
102}
diff --git a/arch/mips/cobalt/promcon.c b/arch/mips/cobalt/promcon.c
new file mode 100644
index 000000000000..f03df761e9f1
--- /dev/null
+++ b/arch/mips/cobalt/promcon.c
@@ -0,0 +1,87 @@
1/*
2 * PROM console for Cobalt Raq2
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995, 1996, 1997 by Ralf Baechle
9 * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv)
10 *
11 */
12
13#include <linux/init.h>
14#include <linux/console.h>
15#include <linux/kdev_t.h>
16#include <linux/serial_reg.h>
17
18#include <asm/delay.h>
19#include <asm/serial.h>
20#include <asm/io.h>
21
22static unsigned long port = 0xc800000;
23
24static __inline__ void ns16550_cons_put_char(char ch, unsigned long ioaddr)
25{
26 char lsr;
27
28 do {
29 lsr = inb(ioaddr + UART_LSR);
30 } while ((lsr & (UART_LSR_TEMT | UART_LSR_THRE)) != (UART_LSR_TEMT | UART_LSR_THRE));
31 outb(ch, ioaddr + UART_TX);
32}
33
34static __inline__ char ns16550_cons_get_char(unsigned long ioaddr)
35{
36 while ((inb(ioaddr + UART_LSR) & UART_LSR_DR) == 0)
37 udelay(1);
38 return inb(ioaddr + UART_RX);
39}
40
41void ns16550_console_write(struct console *co, const char *s, unsigned count)
42{
43 char lsr, ier;
44 unsigned i;
45
46 ier = inb(port + UART_IER);
47 outb(0x00, port + UART_IER);
48 for (i=0; i < count; i++, s++) {
49
50 if(*s == '\n')
51 ns16550_cons_put_char('\r', port);
52 ns16550_cons_put_char(*s, port);
53 }
54
55 do {
56 lsr = inb(port + UART_LSR);
57 } while ((lsr & (UART_LSR_TEMT | UART_LSR_THRE)) != (UART_LSR_TEMT | UART_LSR_THRE));
58
59 outb(ier, port + UART_IER);
60}
61
62char getDebugChar(void)
63{
64 return ns16550_cons_get_char(port);
65}
66
67void putDebugChar(char kgdb_char)
68{
69 ns16550_cons_put_char(kgdb_char, port);
70}
71
72static struct console ns16550_console = {
73 .name = "prom",
74 .setup = NULL,
75 .write = ns16550_console_write,
76 .flags = CON_PRINTBUFFER,
77 .index = -1,
78};
79
80static int __init ns16550_setup_console(void)
81{
82 register_console(&ns16550_console);
83
84 return 0;
85}
86
87console_initcall(ns16550_setup_console);
diff --git a/arch/mips/cobalt/reset.c b/arch/mips/cobalt/reset.c
new file mode 100644
index 000000000000..084c8e59f42c
--- /dev/null
+++ b/arch/mips/cobalt/reset.c
@@ -0,0 +1,68 @@
1/*
2 * Cobalt Reset operations
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995, 1996, 1997 by Ralf Baechle
9 * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv)
10 */
11#include <linux/sched.h>
12#include <linux/mm.h>
13#include <asm/cacheflush.h>
14#include <asm/io.h>
15#include <asm/processor.h>
16#include <asm/reboot.h>
17#include <asm/system.h>
18#include <asm/mipsregs.h>
19
20void cobalt_machine_restart(char *command)
21{
22 *(volatile char *)0xbc000000 = 0x0f;
23
24 /*
25 * Ouch, we're still alive ... This time we take the silver bullet ...
26 * ... and find that we leave the hardware in a state in which the
27 * kernel in the flush locks up somewhen during of after the PCI
28 * detection stuff.
29 */
30 set_c0_status(ST0_BEV | ST0_ERL);
31 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
32 flush_cache_all();
33 write_c0_wired(0);
34 __asm__ __volatile__(
35 "jr\t%0"
36 :
37 : "r" (0xbfc00000));
38}
39
40extern int led_state;
41#define kLED 0xBC000000
42#define LEDSet(x) (*(volatile unsigned char *) kLED) = (( unsigned char)x)
43
44void cobalt_machine_halt(void)
45{
46 int mark;
47
48 /* Blink our cute? little LED (number 3)... */
49 while (1) {
50 led_state = led_state | ( 1 << 3 );
51 LEDSet(led_state);
52 mark = jiffies;
53 while (jiffies<(mark+HZ));
54 led_state = led_state & ~( 1 << 3 );
55 LEDSet(led_state);
56 mark = jiffies;
57 while (jiffies<(mark+HZ));
58 }
59}
60
61/*
62 * This triggers the luser mode device driver for the power switch ;-)
63 */
64void cobalt_machine_power_off(void)
65{
66 printk("You can switch the machine off now.\n");
67 cobalt_machine_halt();
68}
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
new file mode 100644
index 000000000000..6b4737e425ed
--- /dev/null
+++ b/arch/mips/cobalt/setup.c
@@ -0,0 +1,150 @@
1/*
2 * Setup pointers to hardware dependent routines.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
10 *
11 */
12#include <linux/config.h>
13#include <linux/interrupt.h>
14#include <linux/pci.h>
15#include <linux/init.h>
16
17#include <asm/bootinfo.h>
18#include <asm/time.h>
19#include <asm/io.h>
20#include <asm/irq.h>
21#include <asm/processor.h>
22#include <asm/reboot.h>
23#include <asm/gt64120.h>
24
25#include <asm/cobalt/cobalt.h>
26
27extern void cobalt_machine_restart(char *command);
28extern void cobalt_machine_halt(void);
29extern void cobalt_machine_power_off(void);
30
31int cobalt_board_id;
32
33static char my_cmdline[CL_SIZE] = {
34 "console=ttyS0,115200 "
35#ifdef CONFIG_IP_PNP
36 "ip=on "
37#endif
38#ifdef CONFIG_ROOT_NFS
39 "root=/dev/nfs "
40#else
41 "root=/dev/hda1 "
42#endif
43 };
44
45const char *get_system_type(void)
46{
47 return "MIPS Cobalt";
48}
49
50static void __init cobalt_timer_setup(struct irqaction *irq)
51{
52 /* Load timer value for 150 Hz */
53 GALILEO_OUTL(500000, GT_TC0_OFS);
54
55 /* Register our timer interrupt */
56 setup_irq(COBALT_TIMER_IRQ, irq);
57
58 /* Enable timer ints */
59 GALILEO_OUTL((GALILEO_ENTC0 | GALILEO_SELTC0), GT_TC_CONTROL_OFS);
60 /* Unmask timer int */
61 GALILEO_OUTL(0x100, GT_INTRMASK_OFS);
62}
63
64extern struct pci_ops gt64111_pci_ops;
65
66static struct resource cobalt_mem_resource = {
67 "GT64111 PCI MEM", GT64111_IO_BASE, 0xffffffffUL, IORESOURCE_MEM
68};
69
70static struct resource cobalt_io_resource = {
71 "GT64111 IO MEM", 0x00001000UL, 0x0fffffffUL, IORESOURCE_IO
72};
73
74static struct resource cobalt_io_resources[] = {
75 { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
76 { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
77 { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY },
78 { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
79 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
80};
81
82#define COBALT_IO_RESOURCES (sizeof(cobalt_io_resources)/sizeof(struct resource))
83
84static struct pci_controller cobalt_pci_controller = {
85 .pci_ops = &gt64111_pci_ops,
86 .mem_resource = &cobalt_mem_resource,
87 .mem_offset = 0,
88 .io_resource = &cobalt_io_resource,
89 .io_offset = 0x00001000UL - GT64111_IO_BASE
90};
91
92static void __init cobalt_setup(void)
93{
94 unsigned int devfn = PCI_DEVFN(COBALT_PCICONF_VIA, 0);
95 int i;
96
97 _machine_restart = cobalt_machine_restart;
98 _machine_halt = cobalt_machine_halt;
99 _machine_power_off = cobalt_machine_power_off;
100
101 board_timer_setup = cobalt_timer_setup;
102
103 set_io_port_base(KSEG1ADDR(GT64111_IO_BASE));
104
105 /*
106 * This is a prom style console. We just poke at the
107 * UART to make it talk.
108 * Only use this console if you really screw up and can't
109 * get to the stage of setting up a real serial console.
110 */
111 /*ns16550_setup_console();*/
112
113 /* request I/O space for devices used on all i[345]86 PCs */
114 for (i = 0; i < COBALT_IO_RESOURCES; i++)
115 request_resource(&ioport_resource, cobalt_io_resources + i);
116
117 /* Read the cobalt id register out of the PCI config space */
118 PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3));
119 cobalt_board_id = GALILEO_INL(GT_PCI0_CFGDATA_OFS);
120 cobalt_board_id >>= ((VIA_COBALT_BRD_ID_REG & 3) * 8);
121 cobalt_board_id = VIA_COBALT_BRD_REG_to_ID(cobalt_board_id);
122
123#ifdef CONFIG_PCI
124 register_pci_controller(&cobalt_pci_controller);
125#endif
126}
127
128early_initcall(cobalt_setup);
129
130/*
131 * Prom init. We read our one and only communication with the firmware.
132 * Grab the amount of installed memory
133 */
134
135void __init prom_init(void)
136{
137 int argc = fw_arg0;
138
139 strcpy(arcs_cmdline, my_cmdline);
140
141 mips_machgroup = MACH_GROUP_COBALT;
142
143 add_memory_region(0x0, argc & 0x7fffffff, BOOT_MEM_RAM);
144}
145
146unsigned long __init prom_free_prom_memory(void)
147{
148 /* Nothing to do! */
149 return 0;
150}
diff --git a/arch/mips/configs/atlas_defconfig b/arch/mips/configs/atlas_defconfig
new file mode 100644
index 000000000000..caad7ca27abd
--- /dev/null
+++ b/arch/mips/configs/atlas_defconfig
@@ -0,0 +1,1104 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:00 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69CONFIG_MIPS_ATLAS=y
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83# CONFIG_SOC_AU1X00 is not set
84# CONFIG_SIBYTE_SB1xxx_SOC is not set
85# CONFIG_SNI_RM200_PCI is not set
86# CONFIG_TOSHIBA_RBTX4927 is not set
87CONFIG_RWSEM_GENERIC_SPINLOCK=y
88CONFIG_GENERIC_CALIBRATE_DELAY=y
89CONFIG_HAVE_DEC_LOCK=y
90CONFIG_DMA_NONCOHERENT=y
91CONFIG_MIPS_BONITO64=y
92CONFIG_MIPS_MSC=y
93# CONFIG_CPU_LITTLE_ENDIAN is not set
94CONFIG_MIPS_BOARDS_GEN=y
95CONFIG_MIPS_GT64120=y
96CONFIG_SWAP_IO_SPACE=y
97CONFIG_BOOT_ELF32=y
98CONFIG_MIPS_L1_CACHE_SHIFT=5
99
100#
101# CPU selection
102#
103CONFIG_CPU_MIPS32=y
104# CONFIG_CPU_MIPS64 is not set
105# CONFIG_CPU_R3000 is not set
106# CONFIG_CPU_TX39XX is not set
107# CONFIG_CPU_VR41XX is not set
108# CONFIG_CPU_R4300 is not set
109# CONFIG_CPU_R4X00 is not set
110# CONFIG_CPU_TX49XX is not set
111# CONFIG_CPU_R5000 is not set
112# CONFIG_CPU_R5432 is not set
113# CONFIG_CPU_R6000 is not set
114# CONFIG_CPU_NEVADA is not set
115# CONFIG_CPU_R8000 is not set
116# CONFIG_CPU_R10000 is not set
117# CONFIG_CPU_RM7000 is not set
118# CONFIG_CPU_RM9000 is not set
119# CONFIG_CPU_SB1 is not set
120CONFIG_PAGE_SIZE_4KB=y
121# CONFIG_PAGE_SIZE_8KB is not set
122# CONFIG_PAGE_SIZE_16KB is not set
123# CONFIG_PAGE_SIZE_64KB is not set
124CONFIG_CPU_HAS_PREFETCH=y
125# CONFIG_64BIT_PHYS_ADDR is not set
126# CONFIG_CPU_ADVANCED is not set
127CONFIG_CPU_HAS_LLSC=y
128CONFIG_CPU_HAS_SYNC=y
129# CONFIG_PREEMPT is not set
130
131#
132# Bus options (PCI, PCMCIA, EISA, ISA, TC)
133#
134CONFIG_HW_HAS_PCI=y
135CONFIG_PCI=y
136CONFIG_PCI_LEGACY_PROC=y
137CONFIG_PCI_NAMES=y
138CONFIG_MMU=y
139
140#
141# PCCARD (PCMCIA/CardBus) support
142#
143# CONFIG_PCCARD is not set
144
145#
146# PC-card bridges
147#
148
149#
150# PCI Hotplug Support
151#
152# CONFIG_HOTPLUG_PCI is not set
153
154#
155# Executable file formats
156#
157CONFIG_BINFMT_ELF=y
158# CONFIG_BINFMT_MISC is not set
159CONFIG_TRAD_SIGNALS=y
160
161#
162# Device Drivers
163#
164
165#
166# Generic Driver Options
167#
168CONFIG_STANDALONE=y
169CONFIG_PREVENT_FIRMWARE_BUILD=y
170CONFIG_FW_LOADER=y
171
172#
173# Memory Technology Devices (MTD)
174#
175# CONFIG_MTD is not set
176
177#
178# Parallel port support
179#
180# CONFIG_PARPORT is not set
181
182#
183# Plug and Play support
184#
185
186#
187# Block devices
188#
189# CONFIG_BLK_DEV_FD is not set
190# CONFIG_BLK_CPQ_DA is not set
191# CONFIG_BLK_CPQ_CISS_DA is not set
192# CONFIG_BLK_DEV_DAC960 is not set
193CONFIG_BLK_DEV_UMEM=m
194# CONFIG_BLK_DEV_COW_COMMON is not set
195CONFIG_BLK_DEV_LOOP=m
196CONFIG_BLK_DEV_CRYPTOLOOP=m
197CONFIG_BLK_DEV_NBD=m
198# CONFIG_BLK_DEV_SX8 is not set
199CONFIG_BLK_DEV_RAM=y
200CONFIG_BLK_DEV_RAM_COUNT=16
201CONFIG_BLK_DEV_RAM_SIZE=4096
202# CONFIG_BLK_DEV_INITRD is not set
203CONFIG_INITRAMFS_SOURCE=""
204# CONFIG_LBD is not set
205CONFIG_CDROM_PKTCDVD=m
206CONFIG_CDROM_PKTCDVD_BUFFERS=8
207# CONFIG_CDROM_PKTCDVD_WCACHE is not set
208
209#
210# IO Schedulers
211#
212CONFIG_IOSCHED_NOOP=y
213CONFIG_IOSCHED_AS=y
214CONFIG_IOSCHED_DEADLINE=y
215CONFIG_IOSCHED_CFQ=y
216CONFIG_ATA_OVER_ETH=m
217
218#
219# ATA/ATAPI/MFM/RLL support
220#
221CONFIG_IDE=y
222CONFIG_BLK_DEV_IDE=y
223
224#
225# Please see Documentation/ide.txt for help/info on IDE drives
226#
227# CONFIG_BLK_DEV_IDE_SATA is not set
228CONFIG_BLK_DEV_IDEDISK=y
229# CONFIG_IDEDISK_MULTI_MODE is not set
230CONFIG_BLK_DEV_IDECD=y
231# CONFIG_BLK_DEV_IDETAPE is not set
232# CONFIG_BLK_DEV_IDEFLOPPY is not set
233# CONFIG_BLK_DEV_IDESCSI is not set
234# CONFIG_IDE_TASK_IOCTL is not set
235
236#
237# IDE chipset support/bugfixes
238#
239CONFIG_IDE_GENERIC=y
240# CONFIG_BLK_DEV_IDEPCI is not set
241# CONFIG_IDE_ARM is not set
242# CONFIG_BLK_DEV_IDEDMA is not set
243# CONFIG_IDEDMA_AUTO is not set
244# CONFIG_BLK_DEV_HD is not set
245
246#
247# SCSI device support
248#
249CONFIG_SCSI=y
250CONFIG_SCSI_PROC_FS=y
251
252#
253# SCSI support type (disk, tape, CD-ROM)
254#
255CONFIG_BLK_DEV_SD=y
256CONFIG_CHR_DEV_ST=m
257CONFIG_CHR_DEV_OSST=m
258CONFIG_BLK_DEV_SR=m
259CONFIG_BLK_DEV_SR_VENDOR=y
260CONFIG_CHR_DEV_SG=m
261
262#
263# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
264#
265CONFIG_SCSI_MULTI_LUN=y
266CONFIG_SCSI_CONSTANTS=y
267CONFIG_SCSI_LOGGING=y
268
269#
270# SCSI Transport Attributes
271#
272CONFIG_SCSI_SPI_ATTRS=y
273CONFIG_SCSI_FC_ATTRS=m
274CONFIG_SCSI_ISCSI_ATTRS=m
275
276#
277# SCSI low-level drivers
278#
279# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
280# CONFIG_SCSI_3W_9XXX is not set
281# CONFIG_SCSI_ACARD is not set
282# CONFIG_SCSI_AACRAID is not set
283# CONFIG_SCSI_AIC7XXX is not set
284# CONFIG_SCSI_AIC7XXX_OLD is not set
285# CONFIG_SCSI_AIC79XX is not set
286# CONFIG_SCSI_DPT_I2O is not set
287# CONFIG_MEGARAID_NEWGEN is not set
288# CONFIG_MEGARAID_LEGACY is not set
289# CONFIG_SCSI_SATA is not set
290# CONFIG_SCSI_BUSLOGIC is not set
291# CONFIG_SCSI_DMX3191D is not set
292# CONFIG_SCSI_EATA is not set
293# CONFIG_SCSI_EATA_PIO is not set
294# CONFIG_SCSI_FUTURE_DOMAIN is not set
295# CONFIG_SCSI_GDTH is not set
296# CONFIG_SCSI_IPS is not set
297# CONFIG_SCSI_INITIO is not set
298# CONFIG_SCSI_INIA100 is not set
299CONFIG_SCSI_SYM53C8XX_2=y
300CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
301CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
302CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
303# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
304# CONFIG_SCSI_IPR is not set
305# CONFIG_SCSI_QLOGIC_ISP is not set
306# CONFIG_SCSI_QLOGIC_FC is not set
307# CONFIG_SCSI_QLOGIC_1280 is not set
308CONFIG_SCSI_QLA2XXX=y
309# CONFIG_SCSI_QLA21XX is not set
310# CONFIG_SCSI_QLA22XX is not set
311# CONFIG_SCSI_QLA2300 is not set
312# CONFIG_SCSI_QLA2322 is not set
313# CONFIG_SCSI_QLA6312 is not set
314# CONFIG_SCSI_DC395x is not set
315# CONFIG_SCSI_DC390T is not set
316# CONFIG_SCSI_NSP32 is not set
317# CONFIG_SCSI_DEBUG is not set
318
319#
320# Multi-device support (RAID and LVM)
321#
322CONFIG_MD=y
323CONFIG_BLK_DEV_MD=m
324CONFIG_MD_LINEAR=m
325CONFIG_MD_RAID0=m
326CONFIG_MD_RAID1=m
327CONFIG_MD_RAID10=m
328CONFIG_MD_RAID5=m
329CONFIG_MD_RAID6=m
330CONFIG_MD_MULTIPATH=m
331CONFIG_MD_FAULTY=m
332CONFIG_BLK_DEV_DM=m
333CONFIG_DM_CRYPT=m
334CONFIG_DM_SNAPSHOT=m
335CONFIG_DM_MIRROR=m
336CONFIG_DM_ZERO=m
337
338#
339# Fusion MPT device support
340#
341# CONFIG_FUSION is not set
342
343#
344# IEEE 1394 (FireWire) support
345#
346# CONFIG_IEEE1394 is not set
347
348#
349# I2O device support
350#
351# CONFIG_I2O is not set
352
353#
354# Networking support
355#
356CONFIG_NET=y
357
358#
359# Networking options
360#
361CONFIG_PACKET=y
362CONFIG_PACKET_MMAP=y
363CONFIG_NETLINK_DEV=y
364CONFIG_UNIX=y
365CONFIG_NET_KEY=y
366CONFIG_INET=y
367CONFIG_IP_MULTICAST=y
368CONFIG_IP_ADVANCED_ROUTER=y
369CONFIG_IP_MULTIPLE_TABLES=y
370CONFIG_IP_ROUTE_FWMARK=y
371CONFIG_IP_ROUTE_MULTIPATH=y
372CONFIG_IP_ROUTE_VERBOSE=y
373CONFIG_IP_PNP=y
374CONFIG_IP_PNP_DHCP=y
375CONFIG_IP_PNP_BOOTP=y
376# CONFIG_IP_PNP_RARP is not set
377CONFIG_NET_IPIP=m
378CONFIG_NET_IPGRE=m
379CONFIG_NET_IPGRE_BROADCAST=y
380CONFIG_IP_MROUTE=y
381CONFIG_IP_PIMSM_V1=y
382CONFIG_IP_PIMSM_V2=y
383# CONFIG_ARPD is not set
384CONFIG_SYN_COOKIES=y
385CONFIG_INET_AH=m
386CONFIG_INET_ESP=m
387CONFIG_INET_IPCOMP=m
388CONFIG_INET_TUNNEL=m
389CONFIG_IP_TCPDIAG=m
390CONFIG_IP_TCPDIAG_IPV6=y
391
392#
393# IP: Virtual Server Configuration
394#
395CONFIG_IP_VS=m
396# CONFIG_IP_VS_DEBUG is not set
397CONFIG_IP_VS_TAB_BITS=12
398
399#
400# IPVS transport protocol load balancing support
401#
402CONFIG_IP_VS_PROTO_TCP=y
403CONFIG_IP_VS_PROTO_UDP=y
404CONFIG_IP_VS_PROTO_ESP=y
405CONFIG_IP_VS_PROTO_AH=y
406
407#
408# IPVS scheduler
409#
410CONFIG_IP_VS_RR=m
411CONFIG_IP_VS_WRR=m
412CONFIG_IP_VS_LC=m
413CONFIG_IP_VS_WLC=m
414CONFIG_IP_VS_LBLC=m
415CONFIG_IP_VS_LBLCR=m
416CONFIG_IP_VS_DH=m
417CONFIG_IP_VS_SH=m
418CONFIG_IP_VS_SED=m
419CONFIG_IP_VS_NQ=m
420
421#
422# IPVS application helper
423#
424CONFIG_IP_VS_FTP=m
425CONFIG_IPV6=m
426CONFIG_IPV6_PRIVACY=y
427CONFIG_INET6_AH=m
428CONFIG_INET6_ESP=m
429CONFIG_INET6_IPCOMP=m
430CONFIG_INET6_TUNNEL=m
431CONFIG_IPV6_TUNNEL=m
432CONFIG_NETFILTER=y
433# CONFIG_NETFILTER_DEBUG is not set
434CONFIG_BRIDGE_NETFILTER=y
435
436#
437# IP: Netfilter Configuration
438#
439CONFIG_IP_NF_CONNTRACK=m
440CONFIG_IP_NF_CT_ACCT=y
441CONFIG_IP_NF_CONNTRACK_MARK=y
442CONFIG_IP_NF_CT_PROTO_SCTP=m
443CONFIG_IP_NF_FTP=m
444CONFIG_IP_NF_IRC=m
445CONFIG_IP_NF_TFTP=m
446CONFIG_IP_NF_AMANDA=m
447CONFIG_IP_NF_QUEUE=m
448CONFIG_IP_NF_IPTABLES=m
449CONFIG_IP_NF_MATCH_LIMIT=m
450CONFIG_IP_NF_MATCH_IPRANGE=m
451CONFIG_IP_NF_MATCH_MAC=m
452CONFIG_IP_NF_MATCH_PKTTYPE=m
453CONFIG_IP_NF_MATCH_MARK=m
454CONFIG_IP_NF_MATCH_MULTIPORT=m
455CONFIG_IP_NF_MATCH_TOS=m
456CONFIG_IP_NF_MATCH_RECENT=m
457CONFIG_IP_NF_MATCH_ECN=m
458CONFIG_IP_NF_MATCH_DSCP=m
459CONFIG_IP_NF_MATCH_AH_ESP=m
460CONFIG_IP_NF_MATCH_LENGTH=m
461CONFIG_IP_NF_MATCH_TTL=m
462CONFIG_IP_NF_MATCH_TCPMSS=m
463CONFIG_IP_NF_MATCH_HELPER=m
464CONFIG_IP_NF_MATCH_STATE=m
465CONFIG_IP_NF_MATCH_CONNTRACK=m
466CONFIG_IP_NF_MATCH_OWNER=m
467CONFIG_IP_NF_MATCH_PHYSDEV=m
468CONFIG_IP_NF_MATCH_ADDRTYPE=m
469CONFIG_IP_NF_MATCH_REALM=m
470CONFIG_IP_NF_MATCH_SCTP=m
471CONFIG_IP_NF_MATCH_COMMENT=m
472CONFIG_IP_NF_MATCH_CONNMARK=m
473CONFIG_IP_NF_MATCH_HASHLIMIT=m
474CONFIG_IP_NF_FILTER=m
475CONFIG_IP_NF_TARGET_REJECT=m
476CONFIG_IP_NF_TARGET_LOG=m
477CONFIG_IP_NF_TARGET_ULOG=m
478CONFIG_IP_NF_TARGET_TCPMSS=m
479CONFIG_IP_NF_NAT=m
480CONFIG_IP_NF_NAT_NEEDED=y
481CONFIG_IP_NF_TARGET_MASQUERADE=m
482CONFIG_IP_NF_TARGET_REDIRECT=m
483CONFIG_IP_NF_TARGET_NETMAP=m
484CONFIG_IP_NF_TARGET_SAME=m
485CONFIG_IP_NF_NAT_SNMP_BASIC=m
486CONFIG_IP_NF_NAT_IRC=m
487CONFIG_IP_NF_NAT_FTP=m
488CONFIG_IP_NF_NAT_TFTP=m
489CONFIG_IP_NF_NAT_AMANDA=m
490CONFIG_IP_NF_MANGLE=m
491CONFIG_IP_NF_TARGET_TOS=m
492CONFIG_IP_NF_TARGET_ECN=m
493CONFIG_IP_NF_TARGET_DSCP=m
494CONFIG_IP_NF_TARGET_MARK=m
495CONFIG_IP_NF_TARGET_CLASSIFY=m
496CONFIG_IP_NF_TARGET_CONNMARK=m
497CONFIG_IP_NF_TARGET_CLUSTERIP=m
498CONFIG_IP_NF_RAW=m
499CONFIG_IP_NF_TARGET_NOTRACK=m
500CONFIG_IP_NF_ARPTABLES=m
501CONFIG_IP_NF_ARPFILTER=m
502CONFIG_IP_NF_ARP_MANGLE=m
503
504#
505# IPv6: Netfilter Configuration
506#
507CONFIG_IP6_NF_QUEUE=m
508CONFIG_IP6_NF_IPTABLES=m
509CONFIG_IP6_NF_MATCH_LIMIT=m
510CONFIG_IP6_NF_MATCH_MAC=m
511CONFIG_IP6_NF_MATCH_RT=m
512CONFIG_IP6_NF_MATCH_OPTS=m
513CONFIG_IP6_NF_MATCH_FRAG=m
514CONFIG_IP6_NF_MATCH_HL=m
515CONFIG_IP6_NF_MATCH_MULTIPORT=m
516CONFIG_IP6_NF_MATCH_OWNER=m
517CONFIG_IP6_NF_MATCH_MARK=m
518CONFIG_IP6_NF_MATCH_IPV6HEADER=m
519CONFIG_IP6_NF_MATCH_AHESP=m
520CONFIG_IP6_NF_MATCH_LENGTH=m
521CONFIG_IP6_NF_MATCH_EUI64=m
522CONFIG_IP6_NF_MATCH_PHYSDEV=m
523CONFIG_IP6_NF_FILTER=m
524CONFIG_IP6_NF_TARGET_LOG=m
525CONFIG_IP6_NF_MANGLE=m
526CONFIG_IP6_NF_TARGET_MARK=m
527CONFIG_IP6_NF_RAW=m
528
529#
530# Bridge: Netfilter Configuration
531#
532CONFIG_BRIDGE_NF_EBTABLES=m
533CONFIG_BRIDGE_EBT_BROUTE=m
534CONFIG_BRIDGE_EBT_T_FILTER=m
535CONFIG_BRIDGE_EBT_T_NAT=m
536CONFIG_BRIDGE_EBT_802_3=m
537CONFIG_BRIDGE_EBT_AMONG=m
538CONFIG_BRIDGE_EBT_ARP=m
539CONFIG_BRIDGE_EBT_IP=m
540CONFIG_BRIDGE_EBT_LIMIT=m
541CONFIG_BRIDGE_EBT_MARK=m
542CONFIG_BRIDGE_EBT_PKTTYPE=m
543CONFIG_BRIDGE_EBT_STP=m
544CONFIG_BRIDGE_EBT_VLAN=m
545CONFIG_BRIDGE_EBT_ARPREPLY=m
546CONFIG_BRIDGE_EBT_DNAT=m
547CONFIG_BRIDGE_EBT_MARK_T=m
548CONFIG_BRIDGE_EBT_REDIRECT=m
549CONFIG_BRIDGE_EBT_SNAT=m
550CONFIG_BRIDGE_EBT_LOG=m
551CONFIG_BRIDGE_EBT_ULOG=m
552CONFIG_XFRM=y
553CONFIG_XFRM_USER=m
554
555#
556# SCTP Configuration (EXPERIMENTAL)
557#
558CONFIG_IP_SCTP=m
559# CONFIG_SCTP_DBG_MSG is not set
560# CONFIG_SCTP_DBG_OBJCNT is not set
561# CONFIG_SCTP_HMAC_NONE is not set
562# CONFIG_SCTP_HMAC_SHA1 is not set
563CONFIG_SCTP_HMAC_MD5=y
564# CONFIG_ATM is not set
565CONFIG_BRIDGE=m
566CONFIG_VLAN_8021Q=m
567# CONFIG_DECNET is not set
568CONFIG_LLC=m
569# CONFIG_LLC2 is not set
570# CONFIG_IPX is not set
571CONFIG_ATALK=m
572CONFIG_DEV_APPLETALK=y
573CONFIG_IPDDP=m
574CONFIG_IPDDP_ENCAP=y
575CONFIG_IPDDP_DECAP=y
576# CONFIG_X25 is not set
577# CONFIG_LAPB is not set
578CONFIG_NET_DIVERT=y
579# CONFIG_ECONET is not set
580# CONFIG_WAN_ROUTER is not set
581
582#
583# QoS and/or fair queueing
584#
585CONFIG_NET_SCHED=y
586CONFIG_NET_SCH_CLK_JIFFIES=y
587# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
588# CONFIG_NET_SCH_CLK_CPU is not set
589CONFIG_NET_SCH_CBQ=m
590CONFIG_NET_SCH_HTB=m
591CONFIG_NET_SCH_HFSC=m
592CONFIG_NET_SCH_PRIO=m
593CONFIG_NET_SCH_RED=m
594CONFIG_NET_SCH_SFQ=m
595CONFIG_NET_SCH_TEQL=m
596CONFIG_NET_SCH_TBF=m
597CONFIG_NET_SCH_GRED=m
598CONFIG_NET_SCH_DSMARK=m
599CONFIG_NET_SCH_NETEM=m
600CONFIG_NET_SCH_INGRESS=m
601CONFIG_NET_QOS=y
602CONFIG_NET_ESTIMATOR=y
603CONFIG_NET_CLS=y
604CONFIG_NET_CLS_TCINDEX=m
605CONFIG_NET_CLS_ROUTE4=m
606CONFIG_NET_CLS_ROUTE=y
607CONFIG_NET_CLS_FW=m
608CONFIG_NET_CLS_U32=m
609# CONFIG_CLS_U32_PERF is not set
610CONFIG_NET_CLS_IND=y
611# CONFIG_CLS_U32_MARK is not set
612CONFIG_NET_CLS_RSVP=m
613CONFIG_NET_CLS_RSVP6=m
614# CONFIG_NET_CLS_ACT is not set
615CONFIG_NET_CLS_POLICE=y
616
617#
618# Network testing
619#
620# CONFIG_NET_PKTGEN is not set
621# CONFIG_NETPOLL is not set
622# CONFIG_NET_POLL_CONTROLLER is not set
623# CONFIG_HAMRADIO is not set
624# CONFIG_IRDA is not set
625# CONFIG_BT is not set
626CONFIG_NETDEVICES=y
627CONFIG_DUMMY=m
628CONFIG_BONDING=m
629CONFIG_EQUALIZER=m
630CONFIG_TUN=m
631# CONFIG_ETHERTAP is not set
632
633#
634# ARCnet devices
635#
636# CONFIG_ARCNET is not set
637
638#
639# Ethernet (10 or 100Mbit)
640#
641CONFIG_NET_ETHERNET=y
642CONFIG_MII=y
643# CONFIG_HAPPYMEAL is not set
644# CONFIG_SUNGEM is not set
645# CONFIG_NET_VENDOR_3COM is not set
646
647#
648# Tulip family network device support
649#
650# CONFIG_NET_TULIP is not set
651# CONFIG_HP100 is not set
652CONFIG_NET_PCI=y
653CONFIG_PCNET32=y
654# CONFIG_AMD8111_ETH is not set
655# CONFIG_ADAPTEC_STARFIRE is not set
656# CONFIG_B44 is not set
657# CONFIG_FORCEDETH is not set
658# CONFIG_DGRS is not set
659# CONFIG_EEPRO100 is not set
660# CONFIG_E100 is not set
661# CONFIG_FEALNX is not set
662# CONFIG_NATSEMI is not set
663# CONFIG_NE2K_PCI is not set
664# CONFIG_8139CP is not set
665# CONFIG_8139TOO is not set
666# CONFIG_SIS900 is not set
667# CONFIG_EPIC100 is not set
668# CONFIG_SUNDANCE is not set
669# CONFIG_TLAN is not set
670# CONFIG_VIA_RHINE is not set
671CONFIG_LAN_SAA9730=y
672
673#
674# Ethernet (1000 Mbit)
675#
676# CONFIG_ACENIC is not set
677# CONFIG_DL2K is not set
678# CONFIG_E1000 is not set
679# CONFIG_NS83820 is not set
680# CONFIG_HAMACHI is not set
681# CONFIG_YELLOWFIN is not set
682# CONFIG_R8169 is not set
683# CONFIG_SK98LIN is not set
684# CONFIG_VIA_VELOCITY is not set
685# CONFIG_TIGON3 is not set
686
687#
688# Ethernet (10000 Mbit)
689#
690# CONFIG_IXGB is not set
691# CONFIG_S2IO is not set
692
693#
694# Token Ring devices
695#
696# CONFIG_TR is not set
697
698#
699# Wireless LAN (non-hamradio)
700#
701# CONFIG_NET_RADIO is not set
702
703#
704# Wan interfaces
705#
706# CONFIG_WAN is not set
707# CONFIG_FDDI is not set
708# CONFIG_HIPPI is not set
709# CONFIG_PPP is not set
710# CONFIG_SLIP is not set
711# CONFIG_NET_FC is not set
712# CONFIG_SHAPER is not set
713# CONFIG_NETCONSOLE is not set
714
715#
716# ISDN subsystem
717#
718# CONFIG_ISDN is not set
719
720#
721# Telephony Support
722#
723# CONFIG_PHONE is not set
724
725#
726# Input device support
727#
728CONFIG_INPUT=y
729
730#
731# Userland interfaces
732#
733CONFIG_INPUT_MOUSEDEV=m
734CONFIG_INPUT_MOUSEDEV_PSAUX=y
735CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
736CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
737# CONFIG_INPUT_JOYDEV is not set
738# CONFIG_INPUT_TSDEV is not set
739# CONFIG_INPUT_EVDEV is not set
740# CONFIG_INPUT_EVBUG is not set
741
742#
743# Input I/O drivers
744#
745# CONFIG_GAMEPORT is not set
746CONFIG_SOUND_GAMEPORT=y
747CONFIG_SERIO=y
748# CONFIG_SERIO_I8042 is not set
749CONFIG_SERIO_SERPORT=y
750# CONFIG_SERIO_CT82C710 is not set
751# CONFIG_SERIO_PCIPS2 is not set
752CONFIG_SERIO_LIBPS2=y
753CONFIG_SERIO_RAW=y
754
755#
756# Input Device Drivers
757#
758# CONFIG_INPUT_KEYBOARD is not set
759CONFIG_INPUT_MOUSE=y
760# CONFIG_MOUSE_PS2 is not set
761CONFIG_MOUSE_SERIAL=m
762# CONFIG_MOUSE_VSXXXAA is not set
763# CONFIG_INPUT_JOYSTICK is not set
764# CONFIG_INPUT_TOUCHSCREEN is not set
765# CONFIG_INPUT_MISC is not set
766
767#
768# Character devices
769#
770CONFIG_VT=y
771CONFIG_VT_CONSOLE=y
772CONFIG_HW_CONSOLE=y
773# CONFIG_SERIAL_NONSTANDARD is not set
774
775#
776# Serial drivers
777#
778CONFIG_SERIAL_8250=y
779CONFIG_SERIAL_8250_CONSOLE=y
780CONFIG_SERIAL_8250_NR_UARTS=4
781# CONFIG_SERIAL_8250_EXTENDED is not set
782
783#
784# Non-8250 serial port support
785#
786CONFIG_SERIAL_CORE=y
787CONFIG_SERIAL_CORE_CONSOLE=y
788CONFIG_UNIX98_PTYS=y
789CONFIG_LEGACY_PTYS=y
790CONFIG_LEGACY_PTY_COUNT=256
791
792#
793# IPMI
794#
795# CONFIG_IPMI_HANDLER is not set
796
797#
798# Watchdog Cards
799#
800# CONFIG_WATCHDOG is not set
801# CONFIG_RTC is not set
802# CONFIG_GEN_RTC is not set
803# CONFIG_DTLK is not set
804# CONFIG_R3964 is not set
805# CONFIG_APPLICOM is not set
806
807#
808# Ftape, the floppy tape device driver
809#
810# CONFIG_DRM is not set
811# CONFIG_RAW_DRIVER is not set
812
813#
814# I2C support
815#
816# CONFIG_I2C is not set
817
818#
819# Dallas's 1-wire bus
820#
821# CONFIG_W1 is not set
822
823#
824# Misc devices
825#
826
827#
828# Multimedia devices
829#
830# CONFIG_VIDEO_DEV is not set
831
832#
833# Digital Video Broadcasting Devices
834#
835# CONFIG_DVB is not set
836
837#
838# Graphics support
839#
840# CONFIG_FB is not set
841
842#
843# Console display driver support
844#
845# CONFIG_VGA_CONSOLE is not set
846CONFIG_DUMMY_CONSOLE=y
847# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
848
849#
850# Sound
851#
852# CONFIG_SOUND is not set
853
854#
855# USB support
856#
857# CONFIG_USB is not set
858CONFIG_USB_ARCH_HAS_HCD=y
859CONFIG_USB_ARCH_HAS_OHCI=y
860
861#
862# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
863#
864
865#
866# USB Gadget Support
867#
868# CONFIG_USB_GADGET is not set
869
870#
871# MMC/SD Card support
872#
873# CONFIG_MMC is not set
874
875#
876# InfiniBand support
877#
878# CONFIG_INFINIBAND is not set
879
880#
881# File systems
882#
883CONFIG_EXT2_FS=y
884# CONFIG_EXT2_FS_XATTR is not set
885CONFIG_EXT3_FS=y
886CONFIG_EXT3_FS_XATTR=y
887# CONFIG_EXT3_FS_POSIX_ACL is not set
888# CONFIG_EXT3_FS_SECURITY is not set
889CONFIG_JBD=y
890# CONFIG_JBD_DEBUG is not set
891CONFIG_FS_MBCACHE=y
892CONFIG_REISERFS_FS=m
893# CONFIG_REISERFS_CHECK is not set
894CONFIG_REISERFS_PROC_INFO=y
895CONFIG_REISERFS_FS_XATTR=y
896CONFIG_REISERFS_FS_POSIX_ACL=y
897CONFIG_REISERFS_FS_SECURITY=y
898CONFIG_JFS_FS=m
899CONFIG_JFS_POSIX_ACL=y
900CONFIG_JFS_SECURITY=y
901# CONFIG_JFS_DEBUG is not set
902# CONFIG_JFS_STATISTICS is not set
903CONFIG_FS_POSIX_ACL=y
904CONFIG_XFS_FS=m
905# CONFIG_XFS_RT is not set
906CONFIG_XFS_QUOTA=y
907CONFIG_XFS_SECURITY=y
908CONFIG_XFS_POSIX_ACL=y
909CONFIG_MINIX_FS=m
910CONFIG_ROMFS_FS=m
911CONFIG_QUOTA=y
912# CONFIG_QFMT_V1 is not set
913CONFIG_QFMT_V2=y
914CONFIG_QUOTACTL=y
915CONFIG_DNOTIFY=y
916CONFIG_AUTOFS_FS=y
917# CONFIG_AUTOFS4_FS is not set
918
919#
920# CD-ROM/DVD Filesystems
921#
922CONFIG_ISO9660_FS=m
923CONFIG_JOLIET=y
924CONFIG_ZISOFS=y
925CONFIG_ZISOFS_FS=m
926CONFIG_UDF_FS=m
927CONFIG_UDF_NLS=y
928
929#
930# DOS/FAT/NT Filesystems
931#
932CONFIG_FAT_FS=m
933CONFIG_MSDOS_FS=m
934CONFIG_VFAT_FS=m
935CONFIG_FAT_DEFAULT_CODEPAGE=437
936CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
937# CONFIG_NTFS_FS is not set
938
939#
940# Pseudo filesystems
941#
942CONFIG_PROC_FS=y
943CONFIG_PROC_KCORE=y
944CONFIG_SYSFS=y
945# CONFIG_DEVFS_FS is not set
946CONFIG_DEVPTS_FS_XATTR=y
947CONFIG_DEVPTS_FS_SECURITY=y
948# CONFIG_TMPFS is not set
949# CONFIG_HUGETLB_PAGE is not set
950CONFIG_RAMFS=y
951
952#
953# Miscellaneous filesystems
954#
955# CONFIG_ADFS_FS is not set
956CONFIG_AFFS_FS=m
957CONFIG_HFS_FS=m
958CONFIG_HFSPLUS_FS=m
959CONFIG_BEFS_FS=m
960# CONFIG_BEFS_DEBUG is not set
961CONFIG_BFS_FS=m
962CONFIG_EFS_FS=m
963CONFIG_CRAMFS=m
964CONFIG_VXFS_FS=m
965# CONFIG_HPFS_FS is not set
966# CONFIG_QNX4FS_FS is not set
967CONFIG_SYSV_FS=m
968CONFIG_UFS_FS=m
969# CONFIG_UFS_FS_WRITE is not set
970
971#
972# Network File Systems
973#
974CONFIG_NFS_FS=y
975CONFIG_NFS_V3=y
976# CONFIG_NFS_V4 is not set
977# CONFIG_NFS_DIRECTIO is not set
978CONFIG_NFSD=y
979CONFIG_NFSD_V3=y
980# CONFIG_NFSD_V4 is not set
981# CONFIG_NFSD_TCP is not set
982CONFIG_ROOT_NFS=y
983CONFIG_LOCKD=y
984CONFIG_LOCKD_V4=y
985CONFIG_EXPORTFS=y
986CONFIG_SUNRPC=y
987# CONFIG_RPCSEC_GSS_KRB5 is not set
988# CONFIG_RPCSEC_GSS_SPKM3 is not set
989# CONFIG_SMB_FS is not set
990# CONFIG_CIFS is not set
991# CONFIG_NCP_FS is not set
992# CONFIG_CODA_FS is not set
993# CONFIG_AFS_FS is not set
994
995#
996# Partition Types
997#
998# CONFIG_PARTITION_ADVANCED is not set
999CONFIG_MSDOS_PARTITION=y
1000
1001#
1002# Native Language Support
1003#
1004CONFIG_NLS=m
1005CONFIG_NLS_DEFAULT="iso8859-1"
1006CONFIG_NLS_CODEPAGE_437=m
1007CONFIG_NLS_CODEPAGE_737=m
1008CONFIG_NLS_CODEPAGE_775=m
1009CONFIG_NLS_CODEPAGE_850=m
1010CONFIG_NLS_CODEPAGE_852=m
1011CONFIG_NLS_CODEPAGE_855=m
1012CONFIG_NLS_CODEPAGE_857=m
1013CONFIG_NLS_CODEPAGE_860=m
1014CONFIG_NLS_CODEPAGE_861=m
1015CONFIG_NLS_CODEPAGE_862=m
1016CONFIG_NLS_CODEPAGE_863=m
1017CONFIG_NLS_CODEPAGE_864=m
1018CONFIG_NLS_CODEPAGE_865=m
1019CONFIG_NLS_CODEPAGE_866=m
1020CONFIG_NLS_CODEPAGE_869=m
1021CONFIG_NLS_CODEPAGE_936=m
1022CONFIG_NLS_CODEPAGE_950=m
1023CONFIG_NLS_CODEPAGE_932=m
1024CONFIG_NLS_CODEPAGE_949=m
1025CONFIG_NLS_CODEPAGE_874=m
1026CONFIG_NLS_ISO8859_8=m
1027CONFIG_NLS_CODEPAGE_1250=m
1028CONFIG_NLS_CODEPAGE_1251=m
1029CONFIG_NLS_ASCII=m
1030CONFIG_NLS_ISO8859_1=m
1031CONFIG_NLS_ISO8859_2=m
1032CONFIG_NLS_ISO8859_3=m
1033CONFIG_NLS_ISO8859_4=m
1034CONFIG_NLS_ISO8859_5=m
1035CONFIG_NLS_ISO8859_6=m
1036CONFIG_NLS_ISO8859_7=m
1037CONFIG_NLS_ISO8859_9=m
1038CONFIG_NLS_ISO8859_13=m
1039CONFIG_NLS_ISO8859_14=m
1040CONFIG_NLS_ISO8859_15=m
1041CONFIG_NLS_KOI8_R=m
1042CONFIG_NLS_KOI8_U=m
1043CONFIG_NLS_UTF8=m
1044
1045#
1046# Profiling support
1047#
1048# CONFIG_PROFILING is not set
1049
1050#
1051# Kernel hacking
1052#
1053# CONFIG_DEBUG_KERNEL is not set
1054CONFIG_CROSSCOMPILE=y
1055CONFIG_CMDLINE=""
1056
1057#
1058# Security options
1059#
1060# CONFIG_KEYS is not set
1061# CONFIG_SECURITY is not set
1062
1063#
1064# Cryptographic options
1065#
1066CONFIG_CRYPTO=y
1067CONFIG_CRYPTO_HMAC=y
1068CONFIG_CRYPTO_NULL=m
1069CONFIG_CRYPTO_MD4=m
1070CONFIG_CRYPTO_MD5=m
1071CONFIG_CRYPTO_SHA1=m
1072CONFIG_CRYPTO_SHA256=m
1073CONFIG_CRYPTO_SHA512=m
1074CONFIG_CRYPTO_WP512=m
1075CONFIG_CRYPTO_DES=m
1076CONFIG_CRYPTO_BLOWFISH=m
1077CONFIG_CRYPTO_TWOFISH=m
1078CONFIG_CRYPTO_SERPENT=m
1079CONFIG_CRYPTO_AES=m
1080CONFIG_CRYPTO_CAST5=m
1081CONFIG_CRYPTO_CAST6=m
1082CONFIG_CRYPTO_TEA=m
1083CONFIG_CRYPTO_ARC4=m
1084CONFIG_CRYPTO_KHAZAD=m
1085CONFIG_CRYPTO_ANUBIS=m
1086CONFIG_CRYPTO_DEFLATE=m
1087CONFIG_CRYPTO_MICHAEL_MIC=m
1088CONFIG_CRYPTO_CRC32C=m
1089# CONFIG_CRYPTO_TEST is not set
1090
1091#
1092# Hardware crypto devices
1093#
1094
1095#
1096# Library routines
1097#
1098# CONFIG_CRC_CCITT is not set
1099CONFIG_CRC32=y
1100CONFIG_LIBCRC32C=m
1101CONFIG_ZLIB_INFLATE=m
1102CONFIG_ZLIB_DEFLATE=m
1103CONFIG_GENERIC_HARDIRQS=y
1104CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
new file mode 100644
index 000000000000..1b7f8a702d06
--- /dev/null
+++ b/arch/mips/configs/capcella_defconfig
@@ -0,0 +1,705 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:00 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60CONFIG_MACH_VR41XX=y
61# CONFIG_NEC_CMBVR4133 is not set
62# CONFIG_CASIO_E55 is not set
63# CONFIG_IBM_WORKPAD is not set
64# CONFIG_TANBAC_TB0226 is not set
65# CONFIG_TANBAC_TB0229 is not set
66# CONFIG_VICTOR_MPC30X is not set
67CONFIG_ZAO_CAPCELLA=y
68CONFIG_PCI_VR41XX=y
69CONFIG_VRC4173=y
70# CONFIG_TOSHIBA_JMR3927 is not set
71# CONFIG_MIPS_COBALT is not set
72# CONFIG_MACH_DECSTATION is not set
73# CONFIG_MIPS_EV64120 is not set
74# CONFIG_MIPS_EV96100 is not set
75# CONFIG_MIPS_IVR is not set
76# CONFIG_LASAT is not set
77# CONFIG_MIPS_ITE8172 is not set
78# CONFIG_MIPS_ATLAS is not set
79# CONFIG_MIPS_MALTA is not set
80# CONFIG_MIPS_SEAD is not set
81# CONFIG_MOMENCO_OCELOT is not set
82# CONFIG_MOMENCO_OCELOT_G is not set
83# CONFIG_MOMENCO_OCELOT_C is not set
84# CONFIG_MOMENCO_OCELOT_3 is not set
85# CONFIG_MOMENCO_JAGUAR_ATX is not set
86# CONFIG_PMC_YOSEMITE is not set
87# CONFIG_DDB5074 is not set
88# CONFIG_DDB5476 is not set
89# CONFIG_DDB5477 is not set
90# CONFIG_NEC_OSPREY is not set
91# CONFIG_SGI_IP22 is not set
92# CONFIG_SOC_AU1X00 is not set
93# CONFIG_SIBYTE_SB1xxx_SOC is not set
94# CONFIG_SNI_RM200_PCI is not set
95# CONFIG_TOSHIBA_RBTX4927 is not set
96CONFIG_RWSEM_GENERIC_SPINLOCK=y
97CONFIG_GENERIC_CALIBRATE_DELAY=y
98CONFIG_HAVE_DEC_LOCK=y
99CONFIG_DMA_NONCOHERENT=y
100CONFIG_CPU_LITTLE_ENDIAN=y
101CONFIG_IRQ_CPU=y
102CONFIG_MIPS_L1_CACHE_SHIFT=5
103
104#
105# CPU selection
106#
107# CONFIG_CPU_MIPS32 is not set
108# CONFIG_CPU_MIPS64 is not set
109# CONFIG_CPU_R3000 is not set
110# CONFIG_CPU_TX39XX is not set
111CONFIG_CPU_VR41XX=y
112# CONFIG_CPU_R4300 is not set
113# CONFIG_CPU_R4X00 is not set
114# CONFIG_CPU_TX49XX is not set
115# CONFIG_CPU_R5000 is not set
116# CONFIG_CPU_R5432 is not set
117# CONFIG_CPU_R6000 is not set
118# CONFIG_CPU_NEVADA is not set
119# CONFIG_CPU_R8000 is not set
120# CONFIG_CPU_R10000 is not set
121# CONFIG_CPU_RM7000 is not set
122# CONFIG_CPU_RM9000 is not set
123# CONFIG_CPU_SB1 is not set
124CONFIG_PAGE_SIZE_4KB=y
125# CONFIG_PAGE_SIZE_8KB is not set
126# CONFIG_PAGE_SIZE_16KB is not set
127# CONFIG_PAGE_SIZE_64KB is not set
128# CONFIG_CPU_ADVANCED is not set
129CONFIG_CPU_HAS_SYNC=y
130# CONFIG_PREEMPT is not set
131
132#
133# Bus options (PCI, PCMCIA, EISA, ISA, TC)
134#
135CONFIG_HW_HAS_PCI=y
136CONFIG_PCI=y
137CONFIG_PCI_LEGACY_PROC=y
138CONFIG_PCI_NAMES=y
139CONFIG_MMU=y
140
141#
142# PCCARD (PCMCIA/CardBus) support
143#
144# CONFIG_PCCARD is not set
145
146#
147# PC-card bridges
148#
149
150#
151# PCI Hotplug Support
152#
153# CONFIG_HOTPLUG_PCI is not set
154
155#
156# Executable file formats
157#
158CONFIG_BINFMT_ELF=y
159# CONFIG_BINFMT_MISC is not set
160CONFIG_TRAD_SIGNALS=y
161
162#
163# Device Drivers
164#
165
166#
167# Generic Driver Options
168#
169CONFIG_STANDALONE=y
170CONFIG_PREVENT_FIRMWARE_BUILD=y
171# CONFIG_FW_LOADER is not set
172
173#
174# Memory Technology Devices (MTD)
175#
176# CONFIG_MTD is not set
177
178#
179# Parallel port support
180#
181# CONFIG_PARPORT is not set
182
183#
184# Plug and Play support
185#
186
187#
188# Block devices
189#
190# CONFIG_BLK_DEV_FD is not set
191# CONFIG_BLK_CPQ_DA is not set
192# CONFIG_BLK_CPQ_CISS_DA is not set
193# CONFIG_BLK_DEV_DAC960 is not set
194# CONFIG_BLK_DEV_UMEM is not set
195# CONFIG_BLK_DEV_COW_COMMON is not set
196# CONFIG_BLK_DEV_LOOP is not set
197# CONFIG_BLK_DEV_NBD is not set
198# CONFIG_BLK_DEV_SX8 is not set
199# CONFIG_BLK_DEV_RAM is not set
200CONFIG_BLK_DEV_RAM_COUNT=16
201CONFIG_INITRAMFS_SOURCE=""
202# CONFIG_LBD is not set
203CONFIG_CDROM_PKTCDVD=m
204CONFIG_CDROM_PKTCDVD_BUFFERS=8
205# CONFIG_CDROM_PKTCDVD_WCACHE is not set
206
207#
208# IO Schedulers
209#
210CONFIG_IOSCHED_NOOP=y
211CONFIG_IOSCHED_AS=y
212CONFIG_IOSCHED_DEADLINE=y
213CONFIG_IOSCHED_CFQ=y
214CONFIG_ATA_OVER_ETH=m
215
216#
217# ATA/ATAPI/MFM/RLL support
218#
219CONFIG_IDE=y
220CONFIG_BLK_DEV_IDE=y
221
222#
223# Please see Documentation/ide.txt for help/info on IDE drives
224#
225# CONFIG_BLK_DEV_IDE_SATA is not set
226CONFIG_BLK_DEV_IDEDISK=y
227# CONFIG_IDEDISK_MULTI_MODE is not set
228# CONFIG_BLK_DEV_IDECD is not set
229# CONFIG_BLK_DEV_IDETAPE is not set
230# CONFIG_BLK_DEV_IDEFLOPPY is not set
231# CONFIG_IDE_TASK_IOCTL is not set
232
233#
234# IDE chipset support/bugfixes
235#
236CONFIG_IDE_GENERIC=y
237# CONFIG_BLK_DEV_IDEPCI is not set
238# CONFIG_IDE_ARM is not set
239# CONFIG_BLK_DEV_IDEDMA is not set
240# CONFIG_IDEDMA_AUTO is not set
241# CONFIG_BLK_DEV_HD is not set
242
243#
244# SCSI device support
245#
246# CONFIG_SCSI is not set
247
248#
249# Multi-device support (RAID and LVM)
250#
251# CONFIG_MD is not set
252
253#
254# Fusion MPT device support
255#
256
257#
258# IEEE 1394 (FireWire) support
259#
260# CONFIG_IEEE1394 is not set
261
262#
263# I2O device support
264#
265# CONFIG_I2O is not set
266
267#
268# Networking support
269#
270CONFIG_NET=y
271
272#
273# Networking options
274#
275CONFIG_PACKET=y
276CONFIG_PACKET_MMAP=y
277CONFIG_NETLINK_DEV=y
278CONFIG_UNIX=y
279CONFIG_NET_KEY=y
280CONFIG_INET=y
281CONFIG_IP_MULTICAST=y
282# CONFIG_IP_ADVANCED_ROUTER is not set
283CONFIG_IP_PNP=y
284# CONFIG_IP_PNP_DHCP is not set
285CONFIG_IP_PNP_BOOTP=y
286# CONFIG_IP_PNP_RARP is not set
287# CONFIG_NET_IPIP is not set
288# CONFIG_NET_IPGRE is not set
289# CONFIG_IP_MROUTE 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
295CONFIG_INET_TUNNEL=m
296CONFIG_IP_TCPDIAG=m
297# CONFIG_IP_TCPDIAG_IPV6 is not set
298# CONFIG_IPV6 is not set
299# CONFIG_NETFILTER is not set
300CONFIG_XFRM=y
301CONFIG_XFRM_USER=m
302
303#
304# SCTP Configuration (EXPERIMENTAL)
305#
306# CONFIG_IP_SCTP is not set
307# CONFIG_ATM is not set
308# CONFIG_BRIDGE is not set
309# CONFIG_VLAN_8021Q is not set
310# CONFIG_DECNET is not set
311# CONFIG_LLC2 is not set
312# CONFIG_IPX is not set
313# CONFIG_ATALK is not set
314# CONFIG_X25 is not set
315# CONFIG_LAPB is not set
316# CONFIG_NET_DIVERT is not set
317# CONFIG_ECONET is not set
318# CONFIG_WAN_ROUTER is not set
319
320#
321# QoS and/or fair queueing
322#
323# CONFIG_NET_SCHED is not set
324# CONFIG_NET_CLS_ROUTE is not set
325
326#
327# Network testing
328#
329# CONFIG_NET_PKTGEN is not set
330# CONFIG_NETPOLL is not set
331# CONFIG_NET_POLL_CONTROLLER is not set
332# CONFIG_HAMRADIO is not set
333# CONFIG_IRDA is not set
334# CONFIG_BT is not set
335CONFIG_NETDEVICES=y
336# CONFIG_DUMMY is not set
337# CONFIG_BONDING is not set
338# CONFIG_EQUALIZER is not set
339# CONFIG_TUN is not set
340# CONFIG_ETHERTAP is not set
341
342#
343# ARCnet devices
344#
345# CONFIG_ARCNET is not set
346
347#
348# Ethernet (10 or 100Mbit)
349#
350CONFIG_NET_ETHERNET=y
351# CONFIG_MII is not set
352# CONFIG_HAPPYMEAL is not set
353# CONFIG_SUNGEM is not set
354# CONFIG_NET_VENDOR_3COM is not set
355
356#
357# Tulip family network device support
358#
359# CONFIG_NET_TULIP is not set
360# CONFIG_HP100 is not set
361# CONFIG_NET_PCI is not set
362
363#
364# Ethernet (1000 Mbit)
365#
366# CONFIG_ACENIC is not set
367# CONFIG_DL2K is not set
368# CONFIG_E1000 is not set
369# CONFIG_NS83820 is not set
370# CONFIG_HAMACHI is not set
371# CONFIG_YELLOWFIN is not set
372# CONFIG_R8169 is not set
373# CONFIG_SK98LIN is not set
374# CONFIG_TIGON3 is not set
375
376#
377# Ethernet (10000 Mbit)
378#
379# CONFIG_IXGB is not set
380# CONFIG_S2IO is not set
381
382#
383# Token Ring devices
384#
385# CONFIG_TR is not set
386
387#
388# Wireless LAN (non-hamradio)
389#
390# CONFIG_NET_RADIO is not set
391
392#
393# Wan interfaces
394#
395# CONFIG_WAN is not set
396# CONFIG_FDDI is not set
397# CONFIG_HIPPI is not set
398# CONFIG_PPP is not set
399# CONFIG_SLIP is not set
400# CONFIG_SHAPER is not set
401# CONFIG_NETCONSOLE is not set
402
403#
404# ISDN subsystem
405#
406# CONFIG_ISDN is not set
407
408#
409# Telephony Support
410#
411# CONFIG_PHONE is not set
412
413#
414# Input device support
415#
416CONFIG_INPUT=y
417
418#
419# Userland interfaces
420#
421CONFIG_INPUT_MOUSEDEV=y
422CONFIG_INPUT_MOUSEDEV_PSAUX=y
423CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
424CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
425# CONFIG_INPUT_JOYDEV is not set
426# CONFIG_INPUT_TSDEV is not set
427# CONFIG_INPUT_EVDEV is not set
428# CONFIG_INPUT_EVBUG is not set
429
430#
431# Input I/O drivers
432#
433# CONFIG_GAMEPORT is not set
434CONFIG_SOUND_GAMEPORT=y
435CONFIG_SERIO=y
436CONFIG_SERIO_I8042=y
437CONFIG_SERIO_SERPORT=y
438# CONFIG_SERIO_CT82C710 is not set
439# CONFIG_SERIO_PCIPS2 is not set
440CONFIG_SERIO_LIBPS2=m
441CONFIG_SERIO_RAW=m
442
443#
444# Input Device Drivers
445#
446# CONFIG_INPUT_KEYBOARD is not set
447# CONFIG_INPUT_MOUSE is not set
448# CONFIG_INPUT_JOYSTICK is not set
449# CONFIG_INPUT_TOUCHSCREEN is not set
450# CONFIG_INPUT_MISC is not set
451
452#
453# Character devices
454#
455CONFIG_VT=y
456CONFIG_VT_CONSOLE=y
457CONFIG_HW_CONSOLE=y
458# CONFIG_SERIAL_NONSTANDARD is not set
459
460#
461# Serial drivers
462#
463CONFIG_SERIAL_8250=y
464CONFIG_SERIAL_8250_CONSOLE=y
465CONFIG_SERIAL_8250_NR_UARTS=4
466# CONFIG_SERIAL_8250_EXTENDED is not set
467
468#
469# Non-8250 serial port support
470#
471CONFIG_SERIAL_CORE=y
472CONFIG_SERIAL_CORE_CONSOLE=y
473CONFIG_UNIX98_PTYS=y
474CONFIG_LEGACY_PTYS=y
475CONFIG_LEGACY_PTY_COUNT=256
476
477#
478# IPMI
479#
480# CONFIG_IPMI_HANDLER is not set
481
482#
483# Watchdog Cards
484#
485CONFIG_WATCHDOG=y
486# CONFIG_WATCHDOG_NOWAYOUT is not set
487
488#
489# Watchdog Device Drivers
490#
491# CONFIG_SOFT_WATCHDOG is not set
492
493#
494# PCI-based Watchdog Cards
495#
496# CONFIG_PCIPCWATCHDOG is not set
497# CONFIG_WDTPCI is not set
498# CONFIG_RTC is not set
499# CONFIG_GEN_RTC is not set
500# CONFIG_DTLK is not set
501# CONFIG_R3964 is not set
502# CONFIG_APPLICOM is not set
503
504#
505# Ftape, the floppy tape device driver
506#
507# CONFIG_DRM is not set
508# CONFIG_RAW_DRIVER is not set
509
510#
511# I2C support
512#
513# CONFIG_I2C is not set
514
515#
516# Dallas's 1-wire bus
517#
518# CONFIG_W1 is not set
519
520#
521# Misc devices
522#
523
524#
525# Multimedia devices
526#
527# CONFIG_VIDEO_DEV is not set
528
529#
530# Digital Video Broadcasting Devices
531#
532# CONFIG_DVB is not set
533
534#
535# Graphics support
536#
537# CONFIG_FB is not set
538
539#
540# Console display driver support
541#
542# CONFIG_VGA_CONSOLE is not set
543CONFIG_DUMMY_CONSOLE=y
544# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
545
546#
547# Sound
548#
549# CONFIG_SOUND is not set
550
551#
552# USB support
553#
554# CONFIG_USB is not set
555CONFIG_USB_ARCH_HAS_HCD=y
556CONFIG_USB_ARCH_HAS_OHCI=y
557
558#
559# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
560#
561
562#
563# USB Gadget Support
564#
565# CONFIG_USB_GADGET is not set
566
567#
568# MMC/SD Card support
569#
570# CONFIG_MMC is not set
571
572#
573# InfiniBand support
574#
575# CONFIG_INFINIBAND is not set
576
577#
578# File systems
579#
580CONFIG_EXT2_FS=y
581# CONFIG_EXT2_FS_XATTR is not set
582# CONFIG_EXT3_FS is not set
583# CONFIG_JBD is not set
584# CONFIG_REISERFS_FS is not set
585# CONFIG_JFS_FS is not set
586# CONFIG_XFS_FS is not set
587# CONFIG_MINIX_FS is not set
588# CONFIG_ROMFS_FS is not set
589# CONFIG_QUOTA is not set
590CONFIG_DNOTIFY=y
591CONFIG_AUTOFS_FS=y
592CONFIG_AUTOFS4_FS=y
593
594#
595# CD-ROM/DVD Filesystems
596#
597# CONFIG_ISO9660_FS is not set
598# CONFIG_UDF_FS is not set
599
600#
601# DOS/FAT/NT Filesystems
602#
603# CONFIG_MSDOS_FS is not set
604# CONFIG_VFAT_FS is not set
605# CONFIG_NTFS_FS is not set
606
607#
608# Pseudo filesystems
609#
610CONFIG_PROC_FS=y
611CONFIG_PROC_KCORE=y
612CONFIG_SYSFS=y
613# CONFIG_DEVFS_FS is not set
614CONFIG_DEVPTS_FS_XATTR=y
615CONFIG_DEVPTS_FS_SECURITY=y
616# CONFIG_TMPFS is not set
617# CONFIG_HUGETLB_PAGE is not set
618CONFIG_RAMFS=y
619
620#
621# Miscellaneous filesystems
622#
623# CONFIG_ADFS_FS is not set
624# CONFIG_AFFS_FS is not set
625# CONFIG_HFS_FS is not set
626# CONFIG_HFSPLUS_FS is not set
627# CONFIG_BEFS_FS is not set
628# CONFIG_BFS_FS is not set
629# CONFIG_EFS_FS is not set
630# CONFIG_CRAMFS is not set
631# CONFIG_VXFS_FS is not set
632# CONFIG_HPFS_FS is not set
633# CONFIG_QNX4FS_FS is not set
634# CONFIG_SYSV_FS is not set
635# CONFIG_UFS_FS is not set
636
637#
638# Network File Systems
639#
640CONFIG_NFS_FS=y
641# CONFIG_NFS_V3 is not set
642# CONFIG_NFS_V4 is not set
643# CONFIG_NFS_DIRECTIO is not set
644CONFIG_NFSD=y
645# CONFIG_NFSD_V3 is not set
646# CONFIG_NFSD_TCP is not set
647CONFIG_ROOT_NFS=y
648CONFIG_LOCKD=y
649CONFIG_EXPORTFS=y
650CONFIG_SUNRPC=y
651# CONFIG_RPCSEC_GSS_KRB5 is not set
652# CONFIG_RPCSEC_GSS_SPKM3 is not set
653# CONFIG_SMB_FS is not set
654# CONFIG_CIFS is not set
655# CONFIG_NCP_FS is not set
656# CONFIG_CODA_FS is not set
657# CONFIG_AFS_FS is not set
658
659#
660# Partition Types
661#
662# CONFIG_PARTITION_ADVANCED is not set
663CONFIG_MSDOS_PARTITION=y
664
665#
666# Native Language Support
667#
668# CONFIG_NLS is not set
669
670#
671# Profiling support
672#
673# CONFIG_PROFILING is not set
674
675#
676# Kernel hacking
677#
678# CONFIG_DEBUG_KERNEL is not set
679CONFIG_CROSSCOMPILE=y
680CONFIG_CMDLINE=""
681
682#
683# Security options
684#
685CONFIG_KEYS=y
686CONFIG_KEYS_DEBUG_PROC_KEYS=y
687# CONFIG_SECURITY is not set
688
689#
690# Cryptographic options
691#
692# CONFIG_CRYPTO is not set
693
694#
695# Hardware crypto devices
696#
697
698#
699# Library routines
700#
701# CONFIG_CRC_CCITT is not set
702# CONFIG_CRC32 is not set
703CONFIG_LIBCRC32C=m
704CONFIG_GENERIC_HARDIRQS=y
705CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
new file mode 100644
index 000000000000..8861854561e5
--- /dev/null
+++ b/arch/mips/configs/cobalt_defconfig
@@ -0,0 +1,680 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:00 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48# CONFIG_MODULES is not set
49
50#
51# Machine selection
52#
53# CONFIG_MACH_JAZZ is not set
54# CONFIG_MACH_VR41XX is not set
55# CONFIG_TOSHIBA_JMR3927 is not set
56CONFIG_MIPS_COBALT=y
57# CONFIG_MACH_DECSTATION is not set
58# CONFIG_MIPS_EV64120 is not set
59# CONFIG_MIPS_EV96100 is not set
60# CONFIG_MIPS_IVR is not set
61# CONFIG_LASAT is not set
62# CONFIG_MIPS_ITE8172 is not set
63# CONFIG_MIPS_ATLAS is not set
64# CONFIG_MIPS_MALTA is not set
65# CONFIG_MIPS_SEAD is not set
66# CONFIG_MOMENCO_OCELOT is not set
67# CONFIG_MOMENCO_OCELOT_G is not set
68# CONFIG_MOMENCO_OCELOT_C is not set
69# CONFIG_MOMENCO_OCELOT_3 is not set
70# CONFIG_MOMENCO_JAGUAR_ATX is not set
71# CONFIG_PMC_YOSEMITE is not set
72# CONFIG_DDB5074 is not set
73# CONFIG_DDB5476 is not set
74# CONFIG_DDB5477 is not set
75# CONFIG_NEC_OSPREY is not set
76# CONFIG_SGI_IP22 is not set
77# CONFIG_SOC_AU1X00 is not set
78# CONFIG_SIBYTE_SB1xxx_SOC is not set
79# CONFIG_SNI_RM200_PCI is not set
80# CONFIG_TOSHIBA_RBTX4927 is not set
81CONFIG_RWSEM_GENERIC_SPINLOCK=y
82CONFIG_GENERIC_CALIBRATE_DELAY=y
83CONFIG_HAVE_DEC_LOCK=y
84CONFIG_DMA_NONCOHERENT=y
85CONFIG_I8259=y
86CONFIG_CPU_LITTLE_ENDIAN=y
87CONFIG_IRQ_CPU=y
88CONFIG_MIPS_GT64111=y
89CONFIG_MIPS_L1_CACHE_SHIFT=5
90
91#
92# CPU selection
93#
94# CONFIG_CPU_MIPS32 is not set
95# CONFIG_CPU_MIPS64 is not set
96# CONFIG_CPU_R3000 is not set
97# CONFIG_CPU_TX39XX is not set
98# CONFIG_CPU_VR41XX is not set
99# CONFIG_CPU_R4300 is not set
100# CONFIG_CPU_R4X00 is not set
101# CONFIG_CPU_TX49XX is not set
102# CONFIG_CPU_R5000 is not set
103# CONFIG_CPU_R5432 is not set
104# CONFIG_CPU_R6000 is not set
105CONFIG_CPU_NEVADA=y
106# CONFIG_CPU_R8000 is not set
107# CONFIG_CPU_R10000 is not set
108# CONFIG_CPU_RM7000 is not set
109# CONFIG_CPU_RM9000 is not set
110# CONFIG_CPU_SB1 is not set
111CONFIG_PAGE_SIZE_4KB=y
112# CONFIG_PAGE_SIZE_8KB is not set
113# CONFIG_PAGE_SIZE_16KB is not set
114# CONFIG_PAGE_SIZE_64KB is not set
115# CONFIG_CPU_ADVANCED is not set
116CONFIG_CPU_HAS_LLSC=y
117CONFIG_CPU_HAS_LLDSCD=y
118CONFIG_CPU_HAS_SYNC=y
119# CONFIG_PREEMPT is not set
120
121#
122# Bus options (PCI, PCMCIA, EISA, ISA, TC)
123#
124CONFIG_HW_HAS_PCI=y
125CONFIG_PCI=y
126CONFIG_PCI_LEGACY_PROC=y
127CONFIG_PCI_NAMES=y
128CONFIG_MMU=y
129
130#
131# PCCARD (PCMCIA/CardBus) support
132#
133# CONFIG_PCCARD is not set
134
135#
136# PC-card bridges
137#
138
139#
140# PCI Hotplug Support
141#
142# CONFIG_HOTPLUG_PCI is not set
143
144#
145# Executable file formats
146#
147CONFIG_BINFMT_ELF=y
148# CONFIG_BINFMT_MISC is not set
149CONFIG_TRAD_SIGNALS=y
150
151#
152# Device Drivers
153#
154
155#
156# Generic Driver Options
157#
158CONFIG_STANDALONE=y
159CONFIG_PREVENT_FIRMWARE_BUILD=y
160CONFIG_FW_LOADER=y
161
162#
163# Memory Technology Devices (MTD)
164#
165# CONFIG_MTD is not set
166
167#
168# Parallel port support
169#
170# CONFIG_PARPORT is not set
171
172#
173# Plug and Play support
174#
175
176#
177# Block devices
178#
179# CONFIG_BLK_DEV_FD is not set
180# CONFIG_BLK_CPQ_DA is not set
181# CONFIG_BLK_CPQ_CISS_DA is not set
182# CONFIG_BLK_DEV_DAC960 is not set
183# CONFIG_BLK_DEV_UMEM is not set
184# CONFIG_BLK_DEV_COW_COMMON is not set
185CONFIG_BLK_DEV_LOOP=y
186# CONFIG_BLK_DEV_CRYPTOLOOP is not set
187# CONFIG_BLK_DEV_NBD is not set
188# CONFIG_BLK_DEV_SX8 is not set
189# CONFIG_BLK_DEV_RAM is not set
190CONFIG_BLK_DEV_RAM_COUNT=16
191CONFIG_INITRAMFS_SOURCE=""
192# CONFIG_LBD is not set
193CONFIG_CDROM_PKTCDVD=y
194CONFIG_CDROM_PKTCDVD_BUFFERS=8
195# CONFIG_CDROM_PKTCDVD_WCACHE is not set
196
197#
198# IO Schedulers
199#
200CONFIG_IOSCHED_NOOP=y
201CONFIG_IOSCHED_AS=y
202CONFIG_IOSCHED_DEADLINE=y
203CONFIG_IOSCHED_CFQ=y
204CONFIG_ATA_OVER_ETH=y
205
206#
207# ATA/ATAPI/MFM/RLL support
208#
209CONFIG_IDE=y
210CONFIG_BLK_DEV_IDE=y
211
212#
213# Please see Documentation/ide.txt for help/info on IDE drives
214#
215# CONFIG_BLK_DEV_IDE_SATA is not set
216CONFIG_BLK_DEV_IDEDISK=y
217# CONFIG_IDEDISK_MULTI_MODE is not set
218# CONFIG_BLK_DEV_IDECD is not set
219# CONFIG_BLK_DEV_IDETAPE is not set
220# CONFIG_BLK_DEV_IDEFLOPPY is not set
221# CONFIG_IDE_TASK_IOCTL is not set
222
223#
224# IDE chipset support/bugfixes
225#
226CONFIG_IDE_GENERIC=y
227# CONFIG_BLK_DEV_IDEPCI is not set
228# CONFIG_IDE_ARM is not set
229# CONFIG_BLK_DEV_IDEDMA is not set
230# CONFIG_IDEDMA_AUTO is not set
231# CONFIG_BLK_DEV_HD is not set
232
233#
234# SCSI device support
235#
236# CONFIG_SCSI is not set
237
238#
239# Multi-device support (RAID and LVM)
240#
241# CONFIG_MD is not set
242
243#
244# Fusion MPT device support
245#
246
247#
248# IEEE 1394 (FireWire) support
249#
250# CONFIG_IEEE1394 is not set
251
252#
253# I2O device support
254#
255# CONFIG_I2O is not set
256
257#
258# Networking support
259#
260CONFIG_NET=y
261
262#
263# Networking options
264#
265CONFIG_PACKET=y
266# CONFIG_PACKET_MMAP is not set
267CONFIG_NETLINK_DEV=y
268CONFIG_UNIX=y
269CONFIG_NET_KEY=y
270CONFIG_INET=y
271# CONFIG_IP_MULTICAST is not set
272# CONFIG_IP_ADVANCED_ROUTER is not set
273# CONFIG_IP_PNP is not set
274# CONFIG_NET_IPIP is not set
275# CONFIG_NET_IPGRE is not set
276# CONFIG_ARPD is not set
277# CONFIG_SYN_COOKIES is not set
278# CONFIG_INET_AH is not set
279# CONFIG_INET_ESP is not set
280# CONFIG_INET_IPCOMP is not set
281CONFIG_INET_TUNNEL=y
282CONFIG_IP_TCPDIAG=y
283# CONFIG_IP_TCPDIAG_IPV6 is not set
284# CONFIG_IPV6 is not set
285# CONFIG_NETFILTER is not set
286CONFIG_XFRM=y
287CONFIG_XFRM_USER=y
288
289#
290# SCTP Configuration (EXPERIMENTAL)
291#
292# CONFIG_IP_SCTP is not set
293# CONFIG_ATM is not set
294# CONFIG_BRIDGE is not set
295# CONFIG_VLAN_8021Q is not set
296# CONFIG_DECNET is not set
297# CONFIG_LLC2 is not set
298# CONFIG_IPX is not set
299# CONFIG_ATALK is not set
300# CONFIG_X25 is not set
301# CONFIG_LAPB is not set
302# CONFIG_NET_DIVERT is not set
303# CONFIG_ECONET is not set
304# CONFIG_WAN_ROUTER is not set
305
306#
307# QoS and/or fair queueing
308#
309# CONFIG_NET_SCHED is not set
310# CONFIG_NET_CLS_ROUTE is not set
311
312#
313# Network testing
314#
315# CONFIG_NET_PKTGEN is not set
316# CONFIG_NETPOLL is not set
317# CONFIG_NET_POLL_CONTROLLER is not set
318# CONFIG_HAMRADIO is not set
319# CONFIG_IRDA is not set
320# CONFIG_BT is not set
321CONFIG_NETDEVICES=y
322# CONFIG_DUMMY is not set
323# CONFIG_BONDING is not set
324# CONFIG_EQUALIZER is not set
325# CONFIG_TUN is not set
326# CONFIG_ETHERTAP is not set
327
328#
329# ARCnet devices
330#
331# CONFIG_ARCNET is not set
332
333#
334# Ethernet (10 or 100Mbit)
335#
336CONFIG_NET_ETHERNET=y
337# CONFIG_MII is not set
338# CONFIG_HAPPYMEAL is not set
339# CONFIG_SUNGEM is not set
340# CONFIG_NET_VENDOR_3COM is not set
341
342#
343# Tulip family network device support
344#
345# CONFIG_NET_TULIP is not set
346# CONFIG_HP100 is not set
347# CONFIG_NET_PCI is not set
348
349#
350# Ethernet (1000 Mbit)
351#
352# CONFIG_ACENIC is not set
353# CONFIG_DL2K is not set
354# CONFIG_E1000 is not set
355# CONFIG_NS83820 is not set
356# CONFIG_HAMACHI is not set
357# CONFIG_YELLOWFIN is not set
358# CONFIG_R8169 is not set
359# CONFIG_SK98LIN is not set
360# CONFIG_TIGON3 is not set
361
362#
363# Ethernet (10000 Mbit)
364#
365# CONFIG_IXGB is not set
366# CONFIG_S2IO is not set
367
368#
369# Token Ring devices
370#
371# CONFIG_TR is not set
372
373#
374# Wireless LAN (non-hamradio)
375#
376# CONFIG_NET_RADIO is not set
377
378#
379# Wan interfaces
380#
381# CONFIG_WAN is not set
382# CONFIG_FDDI is not set
383# CONFIG_HIPPI is not set
384# CONFIG_PPP is not set
385# CONFIG_SLIP is not set
386# CONFIG_SHAPER is not set
387# CONFIG_NETCONSOLE is not set
388
389#
390# ISDN subsystem
391#
392# CONFIG_ISDN is not set
393
394#
395# Telephony Support
396#
397# CONFIG_PHONE is not set
398
399#
400# Input device support
401#
402CONFIG_INPUT=y
403
404#
405# Userland interfaces
406#
407CONFIG_INPUT_MOUSEDEV=y
408CONFIG_INPUT_MOUSEDEV_PSAUX=y
409CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
410CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
411# CONFIG_INPUT_JOYDEV is not set
412# CONFIG_INPUT_TSDEV is not set
413# CONFIG_INPUT_EVDEV is not set
414# CONFIG_INPUT_EVBUG is not set
415
416#
417# Input I/O drivers
418#
419# CONFIG_GAMEPORT is not set
420CONFIG_SOUND_GAMEPORT=y
421CONFIG_SERIO=y
422# CONFIG_SERIO_I8042 is not set
423CONFIG_SERIO_SERPORT=y
424# CONFIG_SERIO_CT82C710 is not set
425# CONFIG_SERIO_PCIPS2 is not set
426# CONFIG_SERIO_LIBPS2 is not set
427CONFIG_SERIO_RAW=y
428
429#
430# Input Device Drivers
431#
432# CONFIG_INPUT_KEYBOARD is not set
433# CONFIG_INPUT_MOUSE is not set
434# CONFIG_INPUT_JOYSTICK is not set
435# CONFIG_INPUT_TOUCHSCREEN is not set
436# CONFIG_INPUT_MISC is not set
437
438#
439# Character devices
440#
441CONFIG_VT=y
442CONFIG_VT_CONSOLE=y
443CONFIG_HW_CONSOLE=y
444# CONFIG_SERIAL_NONSTANDARD is not set
445
446#
447# Serial drivers
448#
449CONFIG_SERIAL_8250=y
450CONFIG_SERIAL_8250_CONSOLE=y
451CONFIG_SERIAL_8250_NR_UARTS=4
452# CONFIG_SERIAL_8250_EXTENDED is not set
453
454#
455# Non-8250 serial port support
456#
457CONFIG_SERIAL_CORE=y
458CONFIG_SERIAL_CORE_CONSOLE=y
459CONFIG_UNIX98_PTYS=y
460CONFIG_LEGACY_PTYS=y
461CONFIG_LEGACY_PTY_COUNT=256
462
463#
464# IPMI
465#
466# CONFIG_IPMI_HANDLER is not set
467
468#
469# Watchdog Cards
470#
471# CONFIG_WATCHDOG is not set
472CONFIG_RTC=y
473CONFIG_COBALT_LCD=y
474# CONFIG_DTLK is not set
475# CONFIG_R3964 is not set
476# CONFIG_APPLICOM is not set
477
478#
479# Ftape, the floppy tape device driver
480#
481# CONFIG_DRM is not set
482# CONFIG_RAW_DRIVER is not set
483
484#
485# I2C support
486#
487# CONFIG_I2C is not set
488
489#
490# Dallas's 1-wire bus
491#
492# CONFIG_W1 is not set
493
494#
495# Misc devices
496#
497
498#
499# Multimedia devices
500#
501# CONFIG_VIDEO_DEV is not set
502
503#
504# Digital Video Broadcasting Devices
505#
506# CONFIG_DVB is not set
507
508#
509# Graphics support
510#
511# CONFIG_FB is not set
512
513#
514# Console display driver support
515#
516# CONFIG_VGA_CONSOLE is not set
517CONFIG_DUMMY_CONSOLE=y
518# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
519
520#
521# Sound
522#
523# CONFIG_SOUND is not set
524
525#
526# USB support
527#
528# CONFIG_USB is not set
529CONFIG_USB_ARCH_HAS_HCD=y
530CONFIG_USB_ARCH_HAS_OHCI=y
531
532#
533# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
534#
535
536#
537# USB Gadget Support
538#
539# CONFIG_USB_GADGET is not set
540
541#
542# MMC/SD Card support
543#
544# CONFIG_MMC is not set
545
546#
547# InfiniBand support
548#
549# CONFIG_INFINIBAND is not set
550
551#
552# File systems
553#
554CONFIG_EXT2_FS=y
555CONFIG_EXT2_FS_XATTR=y
556CONFIG_EXT2_FS_POSIX_ACL=y
557CONFIG_EXT2_FS_SECURITY=y
558# CONFIG_EXT3_FS is not set
559# CONFIG_JBD is not set
560CONFIG_FS_MBCACHE=y
561# CONFIG_REISERFS_FS is not set
562# CONFIG_JFS_FS is not set
563CONFIG_FS_POSIX_ACL=y
564# CONFIG_XFS_FS is not set
565# CONFIG_MINIX_FS is not set
566# CONFIG_ROMFS_FS is not set
567# CONFIG_QUOTA is not set
568CONFIG_DNOTIFY=y
569# CONFIG_AUTOFS_FS is not set
570# CONFIG_AUTOFS4_FS is not set
571
572#
573# CD-ROM/DVD Filesystems
574#
575# CONFIG_ISO9660_FS is not set
576# CONFIG_UDF_FS is not set
577
578#
579# DOS/FAT/NT Filesystems
580#
581# CONFIG_MSDOS_FS is not set
582# CONFIG_VFAT_FS is not set
583# CONFIG_NTFS_FS is not set
584
585#
586# Pseudo filesystems
587#
588CONFIG_PROC_FS=y
589CONFIG_PROC_KCORE=y
590CONFIG_SYSFS=y
591# CONFIG_DEVFS_FS is not set
592CONFIG_DEVPTS_FS_XATTR=y
593CONFIG_DEVPTS_FS_SECURITY=y
594# CONFIG_TMPFS is not set
595# CONFIG_HUGETLB_PAGE is not set
596CONFIG_RAMFS=y
597
598#
599# Miscellaneous filesystems
600#
601# CONFIG_ADFS_FS is not set
602# CONFIG_AFFS_FS is not set
603# CONFIG_HFS_FS is not set
604# CONFIG_HFSPLUS_FS is not set
605# CONFIG_BEFS_FS is not set
606# CONFIG_BFS_FS is not set
607# CONFIG_EFS_FS is not set
608# CONFIG_CRAMFS is not set
609# CONFIG_VXFS_FS is not set
610# CONFIG_HPFS_FS is not set
611# CONFIG_QNX4FS_FS is not set
612# CONFIG_SYSV_FS is not set
613# CONFIG_UFS_FS is not set
614
615#
616# Network File Systems
617#
618CONFIG_NFS_FS=y
619# CONFIG_NFS_V3 is not set
620# CONFIG_NFS_V4 is not set
621# CONFIG_NFS_DIRECTIO is not set
622# CONFIG_NFSD is not set
623CONFIG_LOCKD=y
624# CONFIG_EXPORTFS is not set
625CONFIG_SUNRPC=y
626# CONFIG_RPCSEC_GSS_KRB5 is not set
627# CONFIG_RPCSEC_GSS_SPKM3 is not set
628# CONFIG_SMB_FS is not set
629# CONFIG_CIFS is not set
630# CONFIG_NCP_FS is not set
631# CONFIG_CODA_FS is not set
632# CONFIG_AFS_FS is not set
633
634#
635# Partition Types
636#
637# CONFIG_PARTITION_ADVANCED is not set
638CONFIG_MSDOS_PARTITION=y
639
640#
641# Native Language Support
642#
643# CONFIG_NLS is not set
644
645#
646# Profiling support
647#
648# CONFIG_PROFILING is not set
649
650#
651# Kernel hacking
652#
653# CONFIG_DEBUG_KERNEL is not set
654CONFIG_CROSSCOMPILE=y
655CONFIG_CMDLINE=""
656
657#
658# Security options
659#
660CONFIG_KEYS=y
661CONFIG_KEYS_DEBUG_PROC_KEYS=y
662# CONFIG_SECURITY is not set
663
664#
665# Cryptographic options
666#
667# CONFIG_CRYPTO is not set
668
669#
670# Hardware crypto devices
671#
672
673#
674# Library routines
675#
676# CONFIG_CRC_CCITT is not set
677# CONFIG_CRC32 is not set
678# CONFIG_LIBCRC32C is not set
679CONFIG_GENERIC_HARDIRQS=y
680CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
new file mode 100644
index 000000000000..19cac1bf4f01
--- /dev/null
+++ b/arch/mips/configs/db1000_defconfig
@@ -0,0 +1,763 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:01 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83CONFIG_SOC_AU1X00=y
84CONFIG_SOC_AU1000=y
85# CONFIG_SOC_AU1100 is not set
86# CONFIG_SOC_AU1500 is not set
87# CONFIG_SOC_AU1550 is not set
88# CONFIG_MIPS_PB1000 is not set
89# CONFIG_MIPS_PB1100 is not set
90# CONFIG_MIPS_PB1500 is not set
91# CONFIG_MIPS_PB1550 is not set
92CONFIG_MIPS_DB1000=y
93# CONFIG_MIPS_DB1100 is not set
94# CONFIG_MIPS_DB1500 is not set
95# CONFIG_MIPS_DB1550 is not set
96# CONFIG_MIPS_BOSPORUS is not set
97# CONFIG_MIPS_MIRAGE is not set
98# CONFIG_MIPS_XXS1500 is not set
99# CONFIG_MIPS_MTX1 is not set
100# CONFIG_SIBYTE_SB1xxx_SOC is not set
101# CONFIG_SNI_RM200_PCI is not set
102# CONFIG_TOSHIBA_RBTX4927 is not set
103CONFIG_RWSEM_GENERIC_SPINLOCK=y
104CONFIG_GENERIC_CALIBRATE_DELAY=y
105CONFIG_HAVE_DEC_LOCK=y
106CONFIG_DMA_NONCOHERENT=y
107CONFIG_CPU_LITTLE_ENDIAN=y
108CONFIG_MIPS_L1_CACHE_SHIFT=5
109
110#
111# CPU selection
112#
113CONFIG_CPU_MIPS32=y
114# CONFIG_CPU_MIPS64 is not set
115# CONFIG_CPU_R3000 is not set
116# CONFIG_CPU_TX39XX is not set
117# CONFIG_CPU_VR41XX is not set
118# CONFIG_CPU_R4300 is not set
119# CONFIG_CPU_R4X00 is not set
120# CONFIG_CPU_TX49XX is not set
121# CONFIG_CPU_R5000 is not set
122# CONFIG_CPU_R5432 is not set
123# CONFIG_CPU_R6000 is not set
124# CONFIG_CPU_NEVADA is not set
125# CONFIG_CPU_R8000 is not set
126# CONFIG_CPU_R10000 is not set
127# CONFIG_CPU_RM7000 is not set
128# CONFIG_CPU_RM9000 is not set
129# CONFIG_CPU_SB1 is not set
130CONFIG_PAGE_SIZE_4KB=y
131# CONFIG_PAGE_SIZE_8KB is not set
132# CONFIG_PAGE_SIZE_16KB is not set
133# CONFIG_PAGE_SIZE_64KB is not set
134CONFIG_CPU_HAS_PREFETCH=y
135CONFIG_64BIT_PHYS_ADDR=y
136# CONFIG_CPU_ADVANCED is not set
137CONFIG_CPU_HAS_LLSC=y
138CONFIG_CPU_HAS_SYNC=y
139# CONFIG_PREEMPT is not set
140
141#
142# Bus options (PCI, PCMCIA, EISA, ISA, TC)
143#
144CONFIG_HW_HAS_PCI=y
145# CONFIG_PCI is not set
146CONFIG_MMU=y
147
148#
149# PCCARD (PCMCIA/CardBus) support
150#
151CONFIG_PCCARD=m
152# CONFIG_PCMCIA_DEBUG is not set
153CONFIG_PCMCIA=m
154
155#
156# PC-card bridges
157#
158# CONFIG_TCIC is not set
159# CONFIG_PCMCIA_AU1X00 is not set
160
161#
162# PCI Hotplug Support
163#
164
165#
166# Executable file formats
167#
168CONFIG_BINFMT_ELF=y
169# CONFIG_BINFMT_MISC is not set
170CONFIG_TRAD_SIGNALS=y
171
172#
173# Device Drivers
174#
175
176#
177# Generic Driver Options
178#
179CONFIG_STANDALONE=y
180CONFIG_PREVENT_FIRMWARE_BUILD=y
181# CONFIG_FW_LOADER is not set
182
183#
184# Memory Technology Devices (MTD)
185#
186# CONFIG_MTD is not set
187
188#
189# Parallel port support
190#
191# CONFIG_PARPORT is not set
192
193#
194# Plug and Play support
195#
196
197#
198# Block devices
199#
200# CONFIG_BLK_DEV_FD is not set
201# CONFIG_BLK_DEV_COW_COMMON is not set
202CONFIG_BLK_DEV_LOOP=y
203# CONFIG_BLK_DEV_CRYPTOLOOP is not set
204# CONFIG_BLK_DEV_NBD is not set
205# CONFIG_BLK_DEV_RAM is not set
206CONFIG_BLK_DEV_RAM_COUNT=16
207CONFIG_INITRAMFS_SOURCE=""
208# CONFIG_LBD is not set
209CONFIG_CDROM_PKTCDVD=m
210CONFIG_CDROM_PKTCDVD_BUFFERS=8
211# CONFIG_CDROM_PKTCDVD_WCACHE is not set
212
213#
214# IO Schedulers
215#
216CONFIG_IOSCHED_NOOP=y
217CONFIG_IOSCHED_AS=y
218CONFIG_IOSCHED_DEADLINE=y
219CONFIG_IOSCHED_CFQ=y
220CONFIG_ATA_OVER_ETH=m
221
222#
223# ATA/ATAPI/MFM/RLL support
224#
225# CONFIG_IDE is not set
226
227#
228# SCSI device support
229#
230# CONFIG_SCSI is not set
231
232#
233# Multi-device support (RAID and LVM)
234#
235# CONFIG_MD is not set
236
237#
238# Fusion MPT device support
239#
240
241#
242# IEEE 1394 (FireWire) support
243#
244
245#
246# I2O device support
247#
248
249#
250# Networking support
251#
252CONFIG_NET=y
253
254#
255# Networking options
256#
257CONFIG_PACKET=y
258# CONFIG_PACKET_MMAP is not set
259CONFIG_NETLINK_DEV=y
260CONFIG_UNIX=y
261CONFIG_NET_KEY=y
262CONFIG_INET=y
263CONFIG_IP_MULTICAST=y
264# CONFIG_IP_ADVANCED_ROUTER is not set
265CONFIG_IP_PNP=y
266# CONFIG_IP_PNP_DHCP is not set
267CONFIG_IP_PNP_BOOTP=y
268# CONFIG_IP_PNP_RARP is not set
269# CONFIG_NET_IPIP is not set
270# CONFIG_NET_IPGRE is not set
271# CONFIG_IP_MROUTE is not set
272# CONFIG_ARPD is not set
273# CONFIG_SYN_COOKIES is not set
274# CONFIG_INET_AH is not set
275# CONFIG_INET_ESP is not set
276# CONFIG_INET_IPCOMP is not set
277CONFIG_INET_TUNNEL=m
278CONFIG_IP_TCPDIAG=m
279# CONFIG_IP_TCPDIAG_IPV6 is not set
280
281#
282# IP: Virtual Server Configuration
283#
284# CONFIG_IP_VS is not set
285# CONFIG_IPV6 is not set
286CONFIG_NETFILTER=y
287# CONFIG_NETFILTER_DEBUG is not set
288
289#
290# IP: Netfilter Configuration
291#
292# CONFIG_IP_NF_CONNTRACK is not set
293CONFIG_IP_NF_CONNTRACK_MARK=y
294# CONFIG_IP_NF_QUEUE is not set
295# CONFIG_IP_NF_IPTABLES is not set
296# CONFIG_IP_NF_ARPTABLES is not set
297CONFIG_XFRM=y
298CONFIG_XFRM_USER=m
299
300#
301# SCTP Configuration (EXPERIMENTAL)
302#
303# CONFIG_IP_SCTP is not set
304# CONFIG_ATM is not set
305# CONFIG_BRIDGE is not set
306# CONFIG_VLAN_8021Q is not set
307# CONFIG_DECNET is not set
308# CONFIG_LLC2 is not set
309# CONFIG_IPX is not set
310# CONFIG_ATALK is not set
311# CONFIG_X25 is not set
312# CONFIG_LAPB is not set
313# CONFIG_NET_DIVERT is not set
314# CONFIG_ECONET is not set
315# CONFIG_WAN_ROUTER is not set
316
317#
318# QoS and/or fair queueing
319#
320# CONFIG_NET_SCHED is not set
321# CONFIG_NET_CLS_ROUTE is not set
322
323#
324# Network testing
325#
326# CONFIG_NET_PKTGEN is not set
327# CONFIG_NETPOLL is not set
328# CONFIG_NET_POLL_CONTROLLER is not set
329# CONFIG_HAMRADIO is not set
330# CONFIG_IRDA is not set
331# CONFIG_BT is not set
332CONFIG_NETDEVICES=y
333# CONFIG_DUMMY is not set
334# CONFIG_BONDING is not set
335# CONFIG_EQUALIZER is not set
336# CONFIG_TUN is not set
337# CONFIG_ETHERTAP is not set
338
339#
340# Ethernet (10 or 100Mbit)
341#
342CONFIG_NET_ETHERNET=y
343CONFIG_MII=m
344CONFIG_MIPS_AU1X00_ENET=y
345
346#
347# Ethernet (1000 Mbit)
348#
349
350#
351# Ethernet (10000 Mbit)
352#
353
354#
355# Token Ring devices
356#
357
358#
359# Wireless LAN (non-hamradio)
360#
361# CONFIG_NET_RADIO is not set
362
363#
364# PCMCIA network device support
365#
366CONFIG_NET_PCMCIA=y
367CONFIG_PCMCIA_3C589=m
368CONFIG_PCMCIA_3C574=m
369CONFIG_PCMCIA_FMVJ18X=m
370CONFIG_PCMCIA_PCNET=m
371CONFIG_PCMCIA_NMCLAN=m
372CONFIG_PCMCIA_SMC91C92=m
373CONFIG_PCMCIA_XIRC2PS=m
374CONFIG_PCMCIA_AXNET=m
375
376#
377# Wan interfaces
378#
379# CONFIG_WAN is not set
380CONFIG_PPP=m
381CONFIG_PPP_MULTILINK=y
382# CONFIG_PPP_FILTER is not set
383CONFIG_PPP_ASYNC=m
384# CONFIG_PPP_SYNC_TTY is not set
385CONFIG_PPP_DEFLATE=m
386# CONFIG_PPP_BSDCOMP is not set
387CONFIG_PPPOE=m
388# CONFIG_SLIP is not set
389# CONFIG_SHAPER is not set
390# CONFIG_NETCONSOLE is not set
391
392#
393# ISDN subsystem
394#
395# CONFIG_ISDN is not set
396
397#
398# Telephony Support
399#
400# CONFIG_PHONE is not set
401
402#
403# Input device support
404#
405CONFIG_INPUT=y
406
407#
408# Userland interfaces
409#
410CONFIG_INPUT_MOUSEDEV=y
411CONFIG_INPUT_MOUSEDEV_PSAUX=y
412CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
413CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
414# CONFIG_INPUT_JOYDEV is not set
415# CONFIG_INPUT_TSDEV is not set
416CONFIG_INPUT_EVDEV=y
417# CONFIG_INPUT_EVBUG is not set
418
419#
420# Input I/O drivers
421#
422# CONFIG_GAMEPORT is not set
423CONFIG_SOUND_GAMEPORT=y
424CONFIG_SERIO=y
425# CONFIG_SERIO_I8042 is not set
426CONFIG_SERIO_SERPORT=y
427# CONFIG_SERIO_CT82C710 is not set
428# CONFIG_SERIO_LIBPS2 is not set
429CONFIG_SERIO_RAW=m
430
431#
432# Input Device Drivers
433#
434# CONFIG_INPUT_KEYBOARD is not set
435# CONFIG_INPUT_MOUSE is not set
436# CONFIG_INPUT_JOYSTICK is not set
437# CONFIG_INPUT_TOUCHSCREEN is not set
438# CONFIG_INPUT_MISC is not set
439
440#
441# Character devices
442#
443CONFIG_VT=y
444CONFIG_VT_CONSOLE=y
445CONFIG_HW_CONSOLE=y
446# CONFIG_SERIAL_NONSTANDARD is not set
447# CONFIG_AU1X00_GPIO is not set
448# CONFIG_TS_AU1X00_ADS7846 is not set
449
450#
451# Serial drivers
452#
453# CONFIG_SERIAL_8250 is not set
454
455#
456# Non-8250 serial port support
457#
458CONFIG_SERIAL_AU1X00=y
459CONFIG_SERIAL_AU1X00_CONSOLE=y
460CONFIG_SERIAL_CORE=y
461CONFIG_SERIAL_CORE_CONSOLE=y
462CONFIG_UNIX98_PTYS=y
463CONFIG_LEGACY_PTYS=y
464CONFIG_LEGACY_PTY_COUNT=256
465
466#
467# IPMI
468#
469# CONFIG_IPMI_HANDLER is not set
470
471#
472# Watchdog Cards
473#
474# CONFIG_WATCHDOG is not set
475CONFIG_RTC=y
476# CONFIG_DTLK is not set
477# CONFIG_R3964 is not set
478
479#
480# Ftape, the floppy tape device driver
481#
482# CONFIG_DRM is not set
483
484#
485# PCMCIA character devices
486#
487CONFIG_SYNCLINK_CS=m
488# CONFIG_RAW_DRIVER is not set
489
490#
491# I2C support
492#
493# CONFIG_I2C is not set
494
495#
496# Dallas's 1-wire bus
497#
498# CONFIG_W1 is not set
499
500#
501# Misc devices
502#
503
504#
505# Multimedia devices
506#
507# CONFIG_VIDEO_DEV is not set
508
509#
510# Digital Video Broadcasting Devices
511#
512# CONFIG_DVB is not set
513
514#
515# Graphics support
516#
517# CONFIG_FB is not set
518
519#
520# Console display driver support
521#
522# CONFIG_VGA_CONSOLE is not set
523CONFIG_DUMMY_CONSOLE=y
524# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
525
526#
527# Sound
528#
529# CONFIG_SOUND is not set
530
531#
532# USB support
533#
534# CONFIG_USB_ARCH_HAS_HCD is not set
535# CONFIG_USB_ARCH_HAS_OHCI is not set
536
537#
538# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
539#
540
541#
542# USB Gadget Support
543#
544# CONFIG_USB_GADGET is not set
545
546#
547# MMC/SD Card support
548#
549# CONFIG_MMC is not set
550
551#
552# InfiniBand support
553#
554# CONFIG_INFINIBAND is not set
555
556#
557# File systems
558#
559CONFIG_EXT2_FS=y
560CONFIG_EXT2_FS_XATTR=y
561CONFIG_EXT2_FS_POSIX_ACL=y
562# CONFIG_EXT2_FS_SECURITY is not set
563CONFIG_EXT3_FS=y
564CONFIG_EXT3_FS_XATTR=y
565CONFIG_EXT3_FS_POSIX_ACL=y
566CONFIG_EXT3_FS_SECURITY=y
567CONFIG_JBD=y
568# CONFIG_JBD_DEBUG is not set
569CONFIG_FS_MBCACHE=y
570CONFIG_REISERFS_FS=m
571# CONFIG_REISERFS_CHECK is not set
572# CONFIG_REISERFS_PROC_INFO is not set
573CONFIG_REISERFS_FS_XATTR=y
574CONFIG_REISERFS_FS_POSIX_ACL=y
575CONFIG_REISERFS_FS_SECURITY=y
576# CONFIG_JFS_FS is not set
577CONFIG_FS_POSIX_ACL=y
578# CONFIG_XFS_FS is not set
579# CONFIG_MINIX_FS is not set
580# CONFIG_ROMFS_FS is not set
581# CONFIG_QUOTA is not set
582CONFIG_DNOTIFY=y
583CONFIG_AUTOFS_FS=m
584CONFIG_AUTOFS4_FS=m
585
586#
587# CD-ROM/DVD Filesystems
588#
589# CONFIG_ISO9660_FS is not set
590# CONFIG_UDF_FS is not set
591
592#
593# DOS/FAT/NT Filesystems
594#
595# CONFIG_MSDOS_FS is not set
596# CONFIG_VFAT_FS is not set
597# CONFIG_NTFS_FS is not set
598
599#
600# Pseudo filesystems
601#
602CONFIG_PROC_FS=y
603CONFIG_PROC_KCORE=y
604CONFIG_SYSFS=y
605# CONFIG_DEVFS_FS is not set
606CONFIG_DEVPTS_FS_XATTR=y
607CONFIG_DEVPTS_FS_SECURITY=y
608CONFIG_TMPFS=y
609# CONFIG_TMPFS_XATTR is not set
610# CONFIG_HUGETLB_PAGE is not set
611CONFIG_RAMFS=y
612
613#
614# Miscellaneous filesystems
615#
616# CONFIG_ADFS_FS is not set
617# CONFIG_AFFS_FS is not set
618# CONFIG_HFS_FS is not set
619# CONFIG_HFSPLUS_FS is not set
620# CONFIG_BEFS_FS is not set
621# CONFIG_BFS_FS is not set
622# CONFIG_EFS_FS is not set
623CONFIG_CRAMFS=m
624# CONFIG_VXFS_FS is not set
625# CONFIG_HPFS_FS is not set
626# CONFIG_QNX4FS_FS is not set
627# CONFIG_SYSV_FS is not set
628# CONFIG_UFS_FS is not set
629
630#
631# Network File Systems
632#
633CONFIG_NFS_FS=y
634# CONFIG_NFS_V3 is not set
635# CONFIG_NFS_V4 is not set
636# CONFIG_NFS_DIRECTIO is not set
637CONFIG_NFSD=m
638# CONFIG_NFSD_V3 is not set
639# CONFIG_NFSD_TCP is not set
640CONFIG_ROOT_NFS=y
641CONFIG_LOCKD=y
642CONFIG_EXPORTFS=m
643CONFIG_SUNRPC=y
644# CONFIG_RPCSEC_GSS_KRB5 is not set
645# CONFIG_RPCSEC_GSS_SPKM3 is not set
646CONFIG_SMB_FS=m
647# CONFIG_SMB_NLS_DEFAULT is not set
648# CONFIG_CIFS is not set
649# CONFIG_NCP_FS is not set
650# CONFIG_CODA_FS is not set
651# CONFIG_AFS_FS is not set
652
653#
654# Partition Types
655#
656# CONFIG_PARTITION_ADVANCED is not set
657CONFIG_MSDOS_PARTITION=y
658
659#
660# Native Language Support
661#
662CONFIG_NLS=m
663CONFIG_NLS_DEFAULT="iso8859-1"
664# CONFIG_NLS_CODEPAGE_437 is not set
665# CONFIG_NLS_CODEPAGE_737 is not set
666# CONFIG_NLS_CODEPAGE_775 is not set
667# CONFIG_NLS_CODEPAGE_850 is not set
668# CONFIG_NLS_CODEPAGE_852 is not set
669# CONFIG_NLS_CODEPAGE_855 is not set
670# CONFIG_NLS_CODEPAGE_857 is not set
671# CONFIG_NLS_CODEPAGE_860 is not set
672# CONFIG_NLS_CODEPAGE_861 is not set
673# CONFIG_NLS_CODEPAGE_862 is not set
674# CONFIG_NLS_CODEPAGE_863 is not set
675# CONFIG_NLS_CODEPAGE_864 is not set
676# CONFIG_NLS_CODEPAGE_865 is not set
677# CONFIG_NLS_CODEPAGE_866 is not set
678# CONFIG_NLS_CODEPAGE_869 is not set
679# CONFIG_NLS_CODEPAGE_936 is not set
680# CONFIG_NLS_CODEPAGE_950 is not set
681# CONFIG_NLS_CODEPAGE_932 is not set
682# CONFIG_NLS_CODEPAGE_949 is not set
683# CONFIG_NLS_CODEPAGE_874 is not set
684# CONFIG_NLS_ISO8859_8 is not set
685# CONFIG_NLS_CODEPAGE_1250 is not set
686# CONFIG_NLS_CODEPAGE_1251 is not set
687# CONFIG_NLS_ASCII is not set
688# CONFIG_NLS_ISO8859_1 is not set
689# CONFIG_NLS_ISO8859_2 is not set
690# CONFIG_NLS_ISO8859_3 is not set
691# CONFIG_NLS_ISO8859_4 is not set
692# CONFIG_NLS_ISO8859_5 is not set
693# CONFIG_NLS_ISO8859_6 is not set
694# CONFIG_NLS_ISO8859_7 is not set
695# CONFIG_NLS_ISO8859_9 is not set
696# CONFIG_NLS_ISO8859_13 is not set
697# CONFIG_NLS_ISO8859_14 is not set
698# CONFIG_NLS_ISO8859_15 is not set
699# CONFIG_NLS_KOI8_R is not set
700# CONFIG_NLS_KOI8_U is not set
701# CONFIG_NLS_UTF8 is not set
702
703#
704# Profiling support
705#
706# CONFIG_PROFILING is not set
707
708#
709# Kernel hacking
710#
711# CONFIG_DEBUG_KERNEL is not set
712CONFIG_CROSSCOMPILE=y
713CONFIG_CMDLINE=""
714
715#
716# Security options
717#
718CONFIG_KEYS=y
719CONFIG_KEYS_DEBUG_PROC_KEYS=y
720# CONFIG_SECURITY is not set
721
722#
723# Cryptographic options
724#
725CONFIG_CRYPTO=y
726CONFIG_CRYPTO_HMAC=y
727CONFIG_CRYPTO_NULL=y
728# CONFIG_CRYPTO_MD4 is not set
729# CONFIG_CRYPTO_MD5 is not set
730# CONFIG_CRYPTO_SHA1 is not set
731# CONFIG_CRYPTO_SHA256 is not set
732CONFIG_CRYPTO_SHA512=y
733CONFIG_CRYPTO_WP512=m
734# CONFIG_CRYPTO_DES is not set
735# CONFIG_CRYPTO_BLOWFISH is not set
736CONFIG_CRYPTO_TWOFISH=y
737# CONFIG_CRYPTO_SERPENT is not set
738CONFIG_CRYPTO_AES=m
739# CONFIG_CRYPTO_CAST5 is not set
740# CONFIG_CRYPTO_CAST6 is not set
741CONFIG_CRYPTO_TEA=m
742# CONFIG_CRYPTO_ARC4 is not set
743CONFIG_CRYPTO_KHAZAD=m
744CONFIG_CRYPTO_ANUBIS=m
745CONFIG_CRYPTO_DEFLATE=y
746CONFIG_CRYPTO_MICHAEL_MIC=y
747CONFIG_CRYPTO_CRC32C=m
748# CONFIG_CRYPTO_TEST is not set
749
750#
751# Hardware crypto devices
752#
753
754#
755# Library routines
756#
757CONFIG_CRC_CCITT=m
758CONFIG_CRC32=y
759CONFIG_LIBCRC32C=m
760CONFIG_ZLIB_INFLATE=y
761CONFIG_ZLIB_DEFLATE=y
762CONFIG_GENERIC_HARDIRQS=y
763CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
new file mode 100644
index 000000000000..035ac95d197e
--- /dev/null
+++ b/arch/mips/configs/db1100_defconfig
@@ -0,0 +1,758 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:01 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83CONFIG_SOC_AU1X00=y
84# CONFIG_SOC_AU1000 is not set
85CONFIG_SOC_AU1100=y
86# CONFIG_SOC_AU1500 is not set
87# CONFIG_SOC_AU1550 is not set
88# CONFIG_MIPS_PB1000 is not set
89# CONFIG_MIPS_PB1100 is not set
90# CONFIG_MIPS_PB1500 is not set
91# CONFIG_MIPS_PB1550 is not set
92# CONFIG_MIPS_DB1000 is not set
93CONFIG_MIPS_DB1100=y
94# CONFIG_MIPS_DB1500 is not set
95# CONFIG_MIPS_DB1550 is not set
96# CONFIG_MIPS_BOSPORUS is not set
97# CONFIG_MIPS_MIRAGE is not set
98# CONFIG_MIPS_XXS1500 is not set
99# CONFIG_MIPS_MTX1 is not set
100# CONFIG_SIBYTE_SB1xxx_SOC is not set
101# CONFIG_SNI_RM200_PCI is not set
102# CONFIG_TOSHIBA_RBTX4927 is not set
103CONFIG_RWSEM_GENERIC_SPINLOCK=y
104CONFIG_GENERIC_CALIBRATE_DELAY=y
105CONFIG_HAVE_DEC_LOCK=y
106CONFIG_DMA_NONCOHERENT=y
107CONFIG_CPU_LITTLE_ENDIAN=y
108CONFIG_MIPS_L1_CACHE_SHIFT=5
109
110#
111# CPU selection
112#
113CONFIG_CPU_MIPS32=y
114# CONFIG_CPU_MIPS64 is not set
115# CONFIG_CPU_R3000 is not set
116# CONFIG_CPU_TX39XX is not set
117# CONFIG_CPU_VR41XX is not set
118# CONFIG_CPU_R4300 is not set
119# CONFIG_CPU_R4X00 is not set
120# CONFIG_CPU_TX49XX is not set
121# CONFIG_CPU_R5000 is not set
122# CONFIG_CPU_R5432 is not set
123# CONFIG_CPU_R6000 is not set
124# CONFIG_CPU_NEVADA is not set
125# CONFIG_CPU_R8000 is not set
126# CONFIG_CPU_R10000 is not set
127# CONFIG_CPU_RM7000 is not set
128# CONFIG_CPU_RM9000 is not set
129# CONFIG_CPU_SB1 is not set
130CONFIG_PAGE_SIZE_4KB=y
131# CONFIG_PAGE_SIZE_8KB is not set
132# CONFIG_PAGE_SIZE_16KB is not set
133# CONFIG_PAGE_SIZE_64KB is not set
134CONFIG_CPU_HAS_PREFETCH=y
135# CONFIG_64BIT_PHYS_ADDR is not set
136# CONFIG_CPU_ADVANCED is not set
137CONFIG_CPU_HAS_LLSC=y
138CONFIG_CPU_HAS_SYNC=y
139# CONFIG_PREEMPT is not set
140
141#
142# Bus options (PCI, PCMCIA, EISA, ISA, TC)
143#
144CONFIG_MMU=y
145
146#
147# PCCARD (PCMCIA/CardBus) support
148#
149CONFIG_PCCARD=m
150# CONFIG_PCMCIA_DEBUG is not set
151CONFIG_PCMCIA=m
152
153#
154# PC-card bridges
155#
156# CONFIG_TCIC is not set
157# CONFIG_PCMCIA_AU1X00 is not set
158
159#
160# PCI Hotplug Support
161#
162
163#
164# Executable file formats
165#
166CONFIG_BINFMT_ELF=y
167# CONFIG_BINFMT_MISC is not set
168CONFIG_TRAD_SIGNALS=y
169
170#
171# Device Drivers
172#
173
174#
175# Generic Driver Options
176#
177CONFIG_STANDALONE=y
178CONFIG_PREVENT_FIRMWARE_BUILD=y
179# CONFIG_FW_LOADER is not set
180
181#
182# Memory Technology Devices (MTD)
183#
184# CONFIG_MTD is not set
185
186#
187# Parallel port support
188#
189# CONFIG_PARPORT is not set
190
191#
192# Plug and Play support
193#
194
195#
196# Block devices
197#
198# CONFIG_BLK_DEV_FD is not set
199# CONFIG_BLK_DEV_COW_COMMON is not set
200CONFIG_BLK_DEV_LOOP=y
201# CONFIG_BLK_DEV_CRYPTOLOOP is not set
202# CONFIG_BLK_DEV_NBD is not set
203# CONFIG_BLK_DEV_RAM is not set
204CONFIG_BLK_DEV_RAM_COUNT=16
205CONFIG_INITRAMFS_SOURCE=""
206# CONFIG_LBD is not set
207CONFIG_CDROM_PKTCDVD=m
208CONFIG_CDROM_PKTCDVD_BUFFERS=8
209# CONFIG_CDROM_PKTCDVD_WCACHE is not set
210
211#
212# IO Schedulers
213#
214CONFIG_IOSCHED_NOOP=y
215CONFIG_IOSCHED_AS=y
216CONFIG_IOSCHED_DEADLINE=y
217CONFIG_IOSCHED_CFQ=y
218CONFIG_ATA_OVER_ETH=m
219
220#
221# ATA/ATAPI/MFM/RLL support
222#
223# CONFIG_IDE is not set
224
225#
226# SCSI device support
227#
228# CONFIG_SCSI is not set
229
230#
231# Multi-device support (RAID and LVM)
232#
233# CONFIG_MD is not set
234
235#
236# Fusion MPT device support
237#
238
239#
240# IEEE 1394 (FireWire) support
241#
242
243#
244# I2O device support
245#
246
247#
248# Networking support
249#
250CONFIG_NET=y
251
252#
253# Networking options
254#
255CONFIG_PACKET=y
256# CONFIG_PACKET_MMAP is not set
257CONFIG_NETLINK_DEV=y
258CONFIG_UNIX=y
259CONFIG_NET_KEY=y
260CONFIG_INET=y
261CONFIG_IP_MULTICAST=y
262# CONFIG_IP_ADVANCED_ROUTER is not set
263CONFIG_IP_PNP=y
264# CONFIG_IP_PNP_DHCP is not set
265CONFIG_IP_PNP_BOOTP=y
266# CONFIG_IP_PNP_RARP is not set
267# CONFIG_NET_IPIP is not set
268# CONFIG_NET_IPGRE is not set
269# CONFIG_IP_MROUTE is not set
270# CONFIG_ARPD is not set
271# CONFIG_SYN_COOKIES is not set
272# CONFIG_INET_AH is not set
273# CONFIG_INET_ESP is not set
274# CONFIG_INET_IPCOMP is not set
275CONFIG_INET_TUNNEL=m
276CONFIG_IP_TCPDIAG=m
277# CONFIG_IP_TCPDIAG_IPV6 is not set
278
279#
280# IP: Virtual Server Configuration
281#
282# CONFIG_IP_VS is not set
283# CONFIG_IPV6 is not set
284CONFIG_NETFILTER=y
285# CONFIG_NETFILTER_DEBUG is not set
286
287#
288# IP: Netfilter Configuration
289#
290# CONFIG_IP_NF_CONNTRACK is not set
291CONFIG_IP_NF_CONNTRACK_MARK=y
292# CONFIG_IP_NF_QUEUE is not set
293# CONFIG_IP_NF_IPTABLES is not set
294# CONFIG_IP_NF_ARPTABLES is not set
295CONFIG_XFRM=y
296CONFIG_XFRM_USER=m
297
298#
299# SCTP Configuration (EXPERIMENTAL)
300#
301# CONFIG_IP_SCTP is not set
302# CONFIG_ATM is not set
303# CONFIG_BRIDGE is not set
304# CONFIG_VLAN_8021Q is not set
305# CONFIG_DECNET is not set
306# CONFIG_LLC2 is not set
307# CONFIG_IPX is not set
308# CONFIG_ATALK is not set
309# CONFIG_X25 is not set
310# CONFIG_LAPB is not set
311# CONFIG_NET_DIVERT is not set
312# CONFIG_ECONET is not set
313# CONFIG_WAN_ROUTER is not set
314
315#
316# QoS and/or fair queueing
317#
318# CONFIG_NET_SCHED is not set
319# CONFIG_NET_CLS_ROUTE is not set
320
321#
322# Network testing
323#
324# CONFIG_NET_PKTGEN is not set
325# CONFIG_NETPOLL is not set
326# CONFIG_NET_POLL_CONTROLLER is not set
327# CONFIG_HAMRADIO is not set
328# CONFIG_IRDA is not set
329# CONFIG_BT is not set
330CONFIG_NETDEVICES=y
331# CONFIG_DUMMY is not set
332# CONFIG_BONDING is not set
333# CONFIG_EQUALIZER is not set
334# CONFIG_TUN is not set
335# CONFIG_ETHERTAP is not set
336
337#
338# Ethernet (10 or 100Mbit)
339#
340CONFIG_NET_ETHERNET=y
341CONFIG_MII=m
342# CONFIG_MIPS_AU1X00_ENET is not set
343
344#
345# Ethernet (1000 Mbit)
346#
347
348#
349# Ethernet (10000 Mbit)
350#
351
352#
353# Token Ring devices
354#
355
356#
357# Wireless LAN (non-hamradio)
358#
359# CONFIG_NET_RADIO is not set
360
361#
362# PCMCIA network device support
363#
364CONFIG_NET_PCMCIA=y
365CONFIG_PCMCIA_3C589=m
366CONFIG_PCMCIA_3C574=m
367CONFIG_PCMCIA_FMVJ18X=m
368CONFIG_PCMCIA_PCNET=m
369CONFIG_PCMCIA_NMCLAN=m
370CONFIG_PCMCIA_SMC91C92=m
371CONFIG_PCMCIA_XIRC2PS=m
372CONFIG_PCMCIA_AXNET=m
373
374#
375# Wan interfaces
376#
377# CONFIG_WAN is not set
378CONFIG_PPP=m
379CONFIG_PPP_MULTILINK=y
380# CONFIG_PPP_FILTER is not set
381CONFIG_PPP_ASYNC=m
382# CONFIG_PPP_SYNC_TTY is not set
383CONFIG_PPP_DEFLATE=m
384# CONFIG_PPP_BSDCOMP is not set
385CONFIG_PPPOE=m
386# CONFIG_SLIP is not set
387# CONFIG_SHAPER is not set
388# CONFIG_NETCONSOLE is not set
389
390#
391# ISDN subsystem
392#
393# CONFIG_ISDN is not set
394
395#
396# Telephony Support
397#
398# CONFIG_PHONE is not set
399
400#
401# Input device support
402#
403CONFIG_INPUT=y
404
405#
406# Userland interfaces
407#
408CONFIG_INPUT_MOUSEDEV=y
409CONFIG_INPUT_MOUSEDEV_PSAUX=y
410CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
411CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
412# CONFIG_INPUT_JOYDEV is not set
413# CONFIG_INPUT_TSDEV is not set
414CONFIG_INPUT_EVDEV=y
415# CONFIG_INPUT_EVBUG is not set
416
417#
418# Input I/O drivers
419#
420# CONFIG_GAMEPORT is not set
421CONFIG_SOUND_GAMEPORT=y
422CONFIG_SERIO=y
423# CONFIG_SERIO_I8042 is not set
424CONFIG_SERIO_SERPORT=y
425# CONFIG_SERIO_CT82C710 is not set
426CONFIG_SERIO_LIBPS2=m
427CONFIG_SERIO_RAW=m
428
429#
430# Input Device Drivers
431#
432# CONFIG_INPUT_KEYBOARD is not set
433# CONFIG_INPUT_MOUSE is not set
434# CONFIG_INPUT_JOYSTICK is not set
435# CONFIG_INPUT_TOUCHSCREEN is not set
436# CONFIG_INPUT_MISC is not set
437
438#
439# Character devices
440#
441CONFIG_VT=y
442CONFIG_VT_CONSOLE=y
443CONFIG_HW_CONSOLE=y
444# CONFIG_SERIAL_NONSTANDARD is not set
445# CONFIG_AU1X00_GPIO is not set
446# CONFIG_TS_AU1X00_ADS7846 is not set
447
448#
449# Serial drivers
450#
451# CONFIG_SERIAL_8250 is not set
452
453#
454# Non-8250 serial port support
455#
456# CONFIG_SERIAL_AU1X00 is not set
457CONFIG_UNIX98_PTYS=y
458CONFIG_LEGACY_PTYS=y
459CONFIG_LEGACY_PTY_COUNT=256
460
461#
462# IPMI
463#
464# CONFIG_IPMI_HANDLER is not set
465
466#
467# Watchdog Cards
468#
469# CONFIG_WATCHDOG is not set
470CONFIG_RTC=y
471# CONFIG_DTLK is not set
472# CONFIG_R3964 is not set
473
474#
475# Ftape, the floppy tape device driver
476#
477# CONFIG_DRM is not set
478
479#
480# PCMCIA character devices
481#
482CONFIG_SYNCLINK_CS=m
483# CONFIG_RAW_DRIVER is not set
484
485#
486# I2C support
487#
488# CONFIG_I2C is not set
489
490#
491# Dallas's 1-wire bus
492#
493# CONFIG_W1 is not set
494
495#
496# Misc devices
497#
498
499#
500# Multimedia devices
501#
502# CONFIG_VIDEO_DEV is not set
503
504#
505# Digital Video Broadcasting Devices
506#
507# CONFIG_DVB is not set
508
509#
510# Graphics support
511#
512# CONFIG_FB is not set
513
514#
515# Console display driver support
516#
517# CONFIG_VGA_CONSOLE is not set
518CONFIG_DUMMY_CONSOLE=y
519# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
520
521#
522# Sound
523#
524# CONFIG_SOUND is not set
525
526#
527# USB support
528#
529# CONFIG_USB_ARCH_HAS_HCD is not set
530# CONFIG_USB_ARCH_HAS_OHCI is not set
531
532#
533# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
534#
535
536#
537# USB Gadget Support
538#
539# CONFIG_USB_GADGET is not set
540
541#
542# MMC/SD Card support
543#
544# CONFIG_MMC is not set
545
546#
547# InfiniBand support
548#
549# CONFIG_INFINIBAND is not set
550
551#
552# File systems
553#
554CONFIG_EXT2_FS=y
555CONFIG_EXT2_FS_XATTR=y
556CONFIG_EXT2_FS_POSIX_ACL=y
557# CONFIG_EXT2_FS_SECURITY is not set
558CONFIG_EXT3_FS=y
559CONFIG_EXT3_FS_XATTR=y
560CONFIG_EXT3_FS_POSIX_ACL=y
561CONFIG_EXT3_FS_SECURITY=y
562CONFIG_JBD=y
563# CONFIG_JBD_DEBUG is not set
564CONFIG_FS_MBCACHE=y
565CONFIG_REISERFS_FS=m
566# CONFIG_REISERFS_CHECK is not set
567# CONFIG_REISERFS_PROC_INFO is not set
568CONFIG_REISERFS_FS_XATTR=y
569CONFIG_REISERFS_FS_POSIX_ACL=y
570CONFIG_REISERFS_FS_SECURITY=y
571# CONFIG_JFS_FS is not set
572CONFIG_FS_POSIX_ACL=y
573# CONFIG_XFS_FS is not set
574# CONFIG_MINIX_FS is not set
575# CONFIG_ROMFS_FS is not set
576# CONFIG_QUOTA is not set
577CONFIG_DNOTIFY=y
578CONFIG_AUTOFS_FS=m
579CONFIG_AUTOFS4_FS=m
580
581#
582# CD-ROM/DVD Filesystems
583#
584# CONFIG_ISO9660_FS is not set
585# CONFIG_UDF_FS is not set
586
587#
588# DOS/FAT/NT Filesystems
589#
590# CONFIG_MSDOS_FS is not set
591# CONFIG_VFAT_FS is not set
592# CONFIG_NTFS_FS is not set
593
594#
595# Pseudo filesystems
596#
597CONFIG_PROC_FS=y
598CONFIG_PROC_KCORE=y
599CONFIG_SYSFS=y
600# CONFIG_DEVFS_FS is not set
601CONFIG_DEVPTS_FS_XATTR=y
602CONFIG_DEVPTS_FS_SECURITY=y
603CONFIG_TMPFS=y
604# CONFIG_TMPFS_XATTR is not set
605# CONFIG_HUGETLB_PAGE is not set
606CONFIG_RAMFS=y
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
618CONFIG_CRAMFS=m
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# Network File Systems
627#
628CONFIG_NFS_FS=y
629# CONFIG_NFS_V3 is not set
630# CONFIG_NFS_V4 is not set
631# CONFIG_NFS_DIRECTIO is not set
632CONFIG_NFSD=m
633# CONFIG_NFSD_V3 is not set
634# CONFIG_NFSD_TCP is not set
635CONFIG_ROOT_NFS=y
636CONFIG_LOCKD=y
637CONFIG_EXPORTFS=m
638CONFIG_SUNRPC=y
639# CONFIG_RPCSEC_GSS_KRB5 is not set
640# CONFIG_RPCSEC_GSS_SPKM3 is not set
641CONFIG_SMB_FS=m
642# CONFIG_SMB_NLS_DEFAULT is not set
643# CONFIG_CIFS is not set
644# CONFIG_NCP_FS is not set
645# CONFIG_CODA_FS is not set
646# CONFIG_AFS_FS is not set
647
648#
649# Partition Types
650#
651# CONFIG_PARTITION_ADVANCED is not set
652CONFIG_MSDOS_PARTITION=y
653
654#
655# Native Language Support
656#
657CONFIG_NLS=m
658CONFIG_NLS_DEFAULT="iso8859-1"
659# CONFIG_NLS_CODEPAGE_437 is not set
660# CONFIG_NLS_CODEPAGE_737 is not set
661# CONFIG_NLS_CODEPAGE_775 is not set
662# CONFIG_NLS_CODEPAGE_850 is not set
663# CONFIG_NLS_CODEPAGE_852 is not set
664# CONFIG_NLS_CODEPAGE_855 is not set
665# CONFIG_NLS_CODEPAGE_857 is not set
666# CONFIG_NLS_CODEPAGE_860 is not set
667# CONFIG_NLS_CODEPAGE_861 is not set
668# CONFIG_NLS_CODEPAGE_862 is not set
669# CONFIG_NLS_CODEPAGE_863 is not set
670# CONFIG_NLS_CODEPAGE_864 is not set
671# CONFIG_NLS_CODEPAGE_865 is not set
672# CONFIG_NLS_CODEPAGE_866 is not set
673# CONFIG_NLS_CODEPAGE_869 is not set
674# CONFIG_NLS_CODEPAGE_936 is not set
675# CONFIG_NLS_CODEPAGE_950 is not set
676# CONFIG_NLS_CODEPAGE_932 is not set
677# CONFIG_NLS_CODEPAGE_949 is not set
678# CONFIG_NLS_CODEPAGE_874 is not set
679# CONFIG_NLS_ISO8859_8 is not set
680# CONFIG_NLS_CODEPAGE_1250 is not set
681# CONFIG_NLS_CODEPAGE_1251 is not set
682# CONFIG_NLS_ASCII is not set
683# CONFIG_NLS_ISO8859_1 is not set
684# CONFIG_NLS_ISO8859_2 is not set
685# CONFIG_NLS_ISO8859_3 is not set
686# CONFIG_NLS_ISO8859_4 is not set
687# CONFIG_NLS_ISO8859_5 is not set
688# CONFIG_NLS_ISO8859_6 is not set
689# CONFIG_NLS_ISO8859_7 is not set
690# CONFIG_NLS_ISO8859_9 is not set
691# CONFIG_NLS_ISO8859_13 is not set
692# CONFIG_NLS_ISO8859_14 is not set
693# CONFIG_NLS_ISO8859_15 is not set
694# CONFIG_NLS_KOI8_R is not set
695# CONFIG_NLS_KOI8_U is not set
696# CONFIG_NLS_UTF8 is not set
697
698#
699# Profiling support
700#
701# CONFIG_PROFILING is not set
702
703#
704# Kernel hacking
705#
706# CONFIG_DEBUG_KERNEL is not set
707CONFIG_CROSSCOMPILE=y
708CONFIG_CMDLINE=""
709
710#
711# Security options
712#
713CONFIG_KEYS=y
714CONFIG_KEYS_DEBUG_PROC_KEYS=y
715# CONFIG_SECURITY is not set
716
717#
718# Cryptographic options
719#
720CONFIG_CRYPTO=y
721CONFIG_CRYPTO_HMAC=y
722CONFIG_CRYPTO_NULL=y
723# CONFIG_CRYPTO_MD4 is not set
724# CONFIG_CRYPTO_MD5 is not set
725# CONFIG_CRYPTO_SHA1 is not set
726# CONFIG_CRYPTO_SHA256 is not set
727CONFIG_CRYPTO_SHA512=y
728CONFIG_CRYPTO_WP512=m
729# CONFIG_CRYPTO_DES is not set
730# CONFIG_CRYPTO_BLOWFISH is not set
731CONFIG_CRYPTO_TWOFISH=y
732# CONFIG_CRYPTO_SERPENT is not set
733CONFIG_CRYPTO_AES=m
734# CONFIG_CRYPTO_CAST5 is not set
735# CONFIG_CRYPTO_CAST6 is not set
736CONFIG_CRYPTO_TEA=m
737# CONFIG_CRYPTO_ARC4 is not set
738CONFIG_CRYPTO_KHAZAD=m
739CONFIG_CRYPTO_ANUBIS=m
740CONFIG_CRYPTO_DEFLATE=y
741CONFIG_CRYPTO_MICHAEL_MIC=y
742CONFIG_CRYPTO_CRC32C=m
743# CONFIG_CRYPTO_TEST is not set
744
745#
746# Hardware crypto devices
747#
748
749#
750# Library routines
751#
752CONFIG_CRC_CCITT=m
753CONFIG_CRC32=y
754CONFIG_LIBCRC32C=m
755CONFIG_ZLIB_INFLATE=y
756CONFIG_ZLIB_DEFLATE=y
757CONFIG_GENERIC_HARDIRQS=y
758CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
new file mode 100644
index 000000000000..c38c4ed18fe7
--- /dev/null
+++ b/arch/mips/configs/db1500_defconfig
@@ -0,0 +1,1018 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:01 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83CONFIG_SOC_AU1X00=y
84# CONFIG_SOC_AU1000 is not set
85# CONFIG_SOC_AU1100 is not set
86CONFIG_SOC_AU1500=y
87# CONFIG_SOC_AU1550 is not set
88# CONFIG_MIPS_PB1000 is not set
89# CONFIG_MIPS_PB1100 is not set
90# CONFIG_MIPS_PB1500 is not set
91# CONFIG_MIPS_PB1550 is not set
92# CONFIG_MIPS_DB1000 is not set
93# CONFIG_MIPS_DB1100 is not set
94CONFIG_MIPS_DB1500=y
95# CONFIG_MIPS_DB1550 is not set
96# CONFIG_MIPS_BOSPORUS is not set
97# CONFIG_MIPS_MIRAGE is not set
98# CONFIG_MIPS_XXS1500 is not set
99# CONFIG_MIPS_MTX1 is not set
100# CONFIG_SIBYTE_SB1xxx_SOC is not set
101# CONFIG_SNI_RM200_PCI is not set
102# CONFIG_TOSHIBA_RBTX4927 is not set
103CONFIG_RWSEM_GENERIC_SPINLOCK=y
104CONFIG_GENERIC_CALIBRATE_DELAY=y
105CONFIG_HAVE_DEC_LOCK=y
106CONFIG_DMA_COHERENT=y
107CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
108CONFIG_CPU_LITTLE_ENDIAN=y
109CONFIG_MIPS_L1_CACHE_SHIFT=5
110
111#
112# CPU selection
113#
114CONFIG_CPU_MIPS32=y
115# CONFIG_CPU_MIPS64 is not set
116# CONFIG_CPU_R3000 is not set
117# CONFIG_CPU_TX39XX is not set
118# CONFIG_CPU_VR41XX is not set
119# CONFIG_CPU_R4300 is not set
120# CONFIG_CPU_R4X00 is not set
121# CONFIG_CPU_TX49XX is not set
122# CONFIG_CPU_R5000 is not set
123# CONFIG_CPU_R5432 is not set
124# CONFIG_CPU_R6000 is not set
125# CONFIG_CPU_NEVADA is not set
126# CONFIG_CPU_R8000 is not set
127# CONFIG_CPU_R10000 is not set
128# CONFIG_CPU_RM7000 is not set
129# CONFIG_CPU_RM9000 is not set
130# CONFIG_CPU_SB1 is not set
131CONFIG_PAGE_SIZE_4KB=y
132# CONFIG_PAGE_SIZE_8KB is not set
133# CONFIG_PAGE_SIZE_16KB is not set
134# CONFIG_PAGE_SIZE_64KB is not set
135CONFIG_CPU_HAS_PREFETCH=y
136CONFIG_64BIT_PHYS_ADDR=y
137# CONFIG_CPU_ADVANCED is not set
138CONFIG_CPU_HAS_LLSC=y
139CONFIG_CPU_HAS_SYNC=y
140# CONFIG_PREEMPT is not set
141
142#
143# Bus options (PCI, PCMCIA, EISA, ISA, TC)
144#
145CONFIG_HW_HAS_PCI=y
146CONFIG_PCI=y
147CONFIG_PCI_LEGACY_PROC=y
148CONFIG_PCI_NAMES=y
149CONFIG_MMU=y
150
151#
152# PCCARD (PCMCIA/CardBus) support
153#
154CONFIG_PCCARD=m
155# CONFIG_PCMCIA_DEBUG is not set
156CONFIG_PCMCIA=m
157CONFIG_CARDBUS=y
158
159#
160# PC-card bridges
161#
162# CONFIG_YENTA is not set
163# CONFIG_PD6729 is not set
164# CONFIG_I82092 is not set
165# CONFIG_TCIC is not set
166CONFIG_PCMCIA_AU1X00=m
167
168#
169# PCI Hotplug Support
170#
171# CONFIG_HOTPLUG_PCI is not set
172
173#
174# Executable file formats
175#
176CONFIG_BINFMT_ELF=y
177# CONFIG_BINFMT_MISC is not set
178CONFIG_TRAD_SIGNALS=y
179
180#
181# Device Drivers
182#
183
184#
185# Generic Driver Options
186#
187CONFIG_STANDALONE=y
188CONFIG_PREVENT_FIRMWARE_BUILD=y
189# CONFIG_FW_LOADER is not set
190
191#
192# Memory Technology Devices (MTD)
193#
194CONFIG_MTD=y
195# CONFIG_MTD_DEBUG is not set
196CONFIG_MTD_PARTITIONS=y
197# CONFIG_MTD_CONCAT is not set
198# CONFIG_MTD_REDBOOT_PARTS is not set
199# CONFIG_MTD_CMDLINE_PARTS is not set
200
201#
202# User Modules And Translation Layers
203#
204CONFIG_MTD_CHAR=y
205CONFIG_MTD_BLOCK=y
206# CONFIG_FTL is not set
207# CONFIG_NFTL is not set
208# CONFIG_INFTL is not set
209
210#
211# RAM/ROM/Flash chip drivers
212#
213CONFIG_MTD_CFI=y
214# CONFIG_MTD_JEDECPROBE is not set
215CONFIG_MTD_GEN_PROBE=y
216# CONFIG_MTD_CFI_ADV_OPTIONS is not set
217CONFIG_MTD_MAP_BANK_WIDTH_1=y
218CONFIG_MTD_MAP_BANK_WIDTH_2=y
219CONFIG_MTD_MAP_BANK_WIDTH_4=y
220# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
221# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
222# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
223CONFIG_MTD_CFI_I1=y
224CONFIG_MTD_CFI_I2=y
225# CONFIG_MTD_CFI_I4 is not set
226# CONFIG_MTD_CFI_I8 is not set
227CONFIG_MTD_CFI_INTELEXT=y
228CONFIG_MTD_CFI_AMDSTD=y
229CONFIG_MTD_CFI_AMDSTD_RETRY=0
230# CONFIG_MTD_CFI_STAA is not set
231CONFIG_MTD_CFI_UTIL=y
232# CONFIG_MTD_RAM is not set
233# CONFIG_MTD_ROM is not set
234# CONFIG_MTD_ABSENT is not set
235# CONFIG_MTD_XIP is not set
236
237#
238# Mapping drivers for chip access
239#
240# CONFIG_MTD_COMPLEX_MAPPINGS is not set
241# CONFIG_MTD_PHYSMAP is not set
242CONFIG_MTD_DB1X00=y
243CONFIG_MTD_DB1X00_BOOT=y
244CONFIG_MTD_DB1X00_USER=y
245
246#
247# Self-contained MTD device drivers
248#
249# CONFIG_MTD_PMC551 is not set
250# CONFIG_MTD_SLRAM is not set
251# CONFIG_MTD_PHRAM is not set
252# CONFIG_MTD_MTDRAM is not set
253# CONFIG_MTD_BLKMTD is not set
254# CONFIG_MTD_BLOCK2MTD is not set
255
256#
257# Disk-On-Chip Device Drivers
258#
259# CONFIG_MTD_DOC2000 is not set
260# CONFIG_MTD_DOC2001 is not set
261# CONFIG_MTD_DOC2001PLUS is not set
262
263#
264# NAND Flash Device Drivers
265#
266# CONFIG_MTD_NAND is not set
267
268#
269# Parallel port support
270#
271# CONFIG_PARPORT is not set
272
273#
274# Plug and Play support
275#
276
277#
278# Block devices
279#
280# CONFIG_BLK_DEV_FD is not set
281# CONFIG_BLK_CPQ_DA is not set
282# CONFIG_BLK_CPQ_CISS_DA is not set
283# CONFIG_BLK_DEV_DAC960 is not set
284# CONFIG_BLK_DEV_UMEM is not set
285# CONFIG_BLK_DEV_COW_COMMON is not set
286CONFIG_BLK_DEV_LOOP=y
287# CONFIG_BLK_DEV_CRYPTOLOOP is not set
288# CONFIG_BLK_DEV_NBD is not set
289# CONFIG_BLK_DEV_SX8 is not set
290# CONFIG_BLK_DEV_UB is not set
291# CONFIG_BLK_DEV_RAM is not set
292CONFIG_BLK_DEV_RAM_COUNT=16
293CONFIG_INITRAMFS_SOURCE=""
294# CONFIG_LBD is not set
295CONFIG_CDROM_PKTCDVD=m
296CONFIG_CDROM_PKTCDVD_BUFFERS=8
297# CONFIG_CDROM_PKTCDVD_WCACHE is not set
298
299#
300# IO Schedulers
301#
302CONFIG_IOSCHED_NOOP=y
303CONFIG_IOSCHED_AS=y
304CONFIG_IOSCHED_DEADLINE=y
305CONFIG_IOSCHED_CFQ=y
306CONFIG_ATA_OVER_ETH=m
307
308#
309# ATA/ATAPI/MFM/RLL support
310#
311CONFIG_IDE=y
312CONFIG_BLK_DEV_IDE=y
313
314#
315# Please see Documentation/ide.txt for help/info on IDE drives
316#
317# CONFIG_BLK_DEV_IDE_SATA is not set
318CONFIG_BLK_DEV_IDEDISK=y
319# CONFIG_IDEDISK_MULTI_MODE is not set
320CONFIG_BLK_DEV_IDECS=m
321# CONFIG_BLK_DEV_IDECD is not set
322# CONFIG_BLK_DEV_IDETAPE is not set
323# CONFIG_BLK_DEV_IDEFLOPPY is not set
324# CONFIG_IDE_TASK_IOCTL is not set
325
326#
327# IDE chipset support/bugfixes
328#
329# CONFIG_IDE_GENERIC is not set
330# CONFIG_BLK_DEV_IDEPCI is not set
331# CONFIG_IDE_ARM is not set
332# CONFIG_BLK_DEV_IDEDMA is not set
333# CONFIG_IDEDMA_AUTO is not set
334# CONFIG_BLK_DEV_HD is not set
335
336#
337# SCSI device support
338#
339# CONFIG_SCSI is not set
340
341#
342# Multi-device support (RAID and LVM)
343#
344# CONFIG_MD is not set
345
346#
347# Fusion MPT device support
348#
349
350#
351# IEEE 1394 (FireWire) support
352#
353# CONFIG_IEEE1394 is not set
354
355#
356# I2O device support
357#
358# CONFIG_I2O is not set
359
360#
361# Networking support
362#
363CONFIG_NET=y
364
365#
366# Networking options
367#
368CONFIG_PACKET=y
369# CONFIG_PACKET_MMAP is not set
370CONFIG_NETLINK_DEV=y
371CONFIG_UNIX=y
372CONFIG_NET_KEY=y
373CONFIG_INET=y
374CONFIG_IP_MULTICAST=y
375# CONFIG_IP_ADVANCED_ROUTER is not set
376CONFIG_IP_PNP=y
377# CONFIG_IP_PNP_DHCP is not set
378CONFIG_IP_PNP_BOOTP=y
379# CONFIG_IP_PNP_RARP is not set
380# CONFIG_NET_IPIP is not set
381# CONFIG_NET_IPGRE is not set
382# CONFIG_IP_MROUTE is not set
383# CONFIG_ARPD is not set
384# CONFIG_SYN_COOKIES is not set
385# CONFIG_INET_AH is not set
386# CONFIG_INET_ESP is not set
387# CONFIG_INET_IPCOMP is not set
388CONFIG_INET_TUNNEL=m
389CONFIG_IP_TCPDIAG=m
390# CONFIG_IP_TCPDIAG_IPV6 is not set
391
392#
393# IP: Virtual Server Configuration
394#
395# CONFIG_IP_VS is not set
396# CONFIG_IPV6 is not set
397CONFIG_NETFILTER=y
398# CONFIG_NETFILTER_DEBUG is not set
399
400#
401# IP: Netfilter Configuration
402#
403# CONFIG_IP_NF_CONNTRACK is not set
404CONFIG_IP_NF_CONNTRACK_MARK=y
405# CONFIG_IP_NF_QUEUE is not set
406# CONFIG_IP_NF_IPTABLES is not set
407# CONFIG_IP_NF_ARPTABLES is not set
408CONFIG_XFRM=y
409CONFIG_XFRM_USER=m
410
411#
412# SCTP Configuration (EXPERIMENTAL)
413#
414# CONFIG_IP_SCTP is not set
415# CONFIG_ATM is not set
416# CONFIG_BRIDGE is not set
417# CONFIG_VLAN_8021Q is not set
418# CONFIG_DECNET is not set
419# CONFIG_LLC2 is not set
420# CONFIG_IPX is not set
421# CONFIG_ATALK is not set
422# CONFIG_X25 is not set
423# CONFIG_LAPB is not set
424# CONFIG_NET_DIVERT is not set
425# CONFIG_ECONET is not set
426# CONFIG_WAN_ROUTER is not set
427
428#
429# QoS and/or fair queueing
430#
431# CONFIG_NET_SCHED is not set
432# CONFIG_NET_CLS_ROUTE is not set
433
434#
435# Network testing
436#
437# CONFIG_NET_PKTGEN is not set
438# CONFIG_NETPOLL is not set
439# CONFIG_NET_POLL_CONTROLLER is not set
440# CONFIG_HAMRADIO is not set
441# CONFIG_IRDA is not set
442# CONFIG_BT is not set
443CONFIG_NETDEVICES=y
444# CONFIG_DUMMY is not set
445# CONFIG_BONDING is not set
446# CONFIG_EQUALIZER is not set
447# CONFIG_TUN is not set
448# CONFIG_ETHERTAP is not set
449
450#
451# ARCnet devices
452#
453# CONFIG_ARCNET is not set
454
455#
456# Ethernet (10 or 100Mbit)
457#
458CONFIG_NET_ETHERNET=y
459# CONFIG_MII is not set
460CONFIG_MIPS_AU1X00_ENET=y
461# CONFIG_HAPPYMEAL is not set
462# CONFIG_SUNGEM is not set
463# CONFIG_NET_VENDOR_3COM is not set
464
465#
466# Tulip family network device support
467#
468# CONFIG_NET_TULIP is not set
469# CONFIG_HP100 is not set
470# CONFIG_NET_PCI is not set
471
472#
473# Ethernet (1000 Mbit)
474#
475# CONFIG_ACENIC is not set
476# CONFIG_DL2K is not set
477# CONFIG_E1000 is not set
478# CONFIG_NS83820 is not set
479# CONFIG_HAMACHI is not set
480# CONFIG_YELLOWFIN is not set
481# CONFIG_R8169 is not set
482# CONFIG_SK98LIN is not set
483# CONFIG_TIGON3 is not set
484
485#
486# Ethernet (10000 Mbit)
487#
488# CONFIG_IXGB is not set
489# CONFIG_S2IO is not set
490
491#
492# Token Ring devices
493#
494# CONFIG_TR is not set
495
496#
497# Wireless LAN (non-hamradio)
498#
499# CONFIG_NET_RADIO is not set
500
501#
502# PCMCIA network device support
503#
504# CONFIG_NET_PCMCIA is not set
505
506#
507# Wan interfaces
508#
509# CONFIG_WAN is not set
510# CONFIG_FDDI is not set
511# CONFIG_HIPPI is not set
512CONFIG_PPP=m
513CONFIG_PPP_MULTILINK=y
514# CONFIG_PPP_FILTER is not set
515CONFIG_PPP_ASYNC=m
516# CONFIG_PPP_SYNC_TTY is not set
517CONFIG_PPP_DEFLATE=m
518# CONFIG_PPP_BSDCOMP is not set
519CONFIG_PPPOE=m
520# CONFIG_SLIP is not set
521# CONFIG_SHAPER is not set
522# CONFIG_NETCONSOLE is not set
523
524#
525# ISDN subsystem
526#
527# CONFIG_ISDN is not set
528
529#
530# Telephony Support
531#
532# CONFIG_PHONE is not set
533
534#
535# Input device support
536#
537CONFIG_INPUT=y
538
539#
540# Userland interfaces
541#
542CONFIG_INPUT_MOUSEDEV=y
543CONFIG_INPUT_MOUSEDEV_PSAUX=y
544CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
545CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
546# CONFIG_INPUT_JOYDEV is not set
547# CONFIG_INPUT_TSDEV is not set
548CONFIG_INPUT_EVDEV=y
549# CONFIG_INPUT_EVBUG is not set
550
551#
552# Input I/O drivers
553#
554# CONFIG_GAMEPORT is not set
555CONFIG_SOUND_GAMEPORT=y
556CONFIG_SERIO=y
557# CONFIG_SERIO_I8042 is not set
558CONFIG_SERIO_SERPORT=y
559# CONFIG_SERIO_CT82C710 is not set
560# CONFIG_SERIO_PCIPS2 is not set
561# CONFIG_SERIO_LIBPS2 is not set
562CONFIG_SERIO_RAW=m
563
564#
565# Input Device Drivers
566#
567# CONFIG_INPUT_KEYBOARD is not set
568# CONFIG_INPUT_MOUSE is not set
569# CONFIG_INPUT_JOYSTICK is not set
570# CONFIG_INPUT_TOUCHSCREEN is not set
571# CONFIG_INPUT_MISC is not set
572
573#
574# Character devices
575#
576# CONFIG_VT is not set
577# CONFIG_SERIAL_NONSTANDARD is not set
578# CONFIG_AU1X00_GPIO is not set
579# CONFIG_TS_AU1X00_ADS7846 is not set
580
581#
582# Serial drivers
583#
584# CONFIG_SERIAL_8250 is not set
585
586#
587# Non-8250 serial port support
588#
589CONFIG_SERIAL_AU1X00=y
590CONFIG_SERIAL_AU1X00_CONSOLE=y
591CONFIG_SERIAL_CORE=y
592CONFIG_SERIAL_CORE_CONSOLE=y
593CONFIG_UNIX98_PTYS=y
594CONFIG_LEGACY_PTYS=y
595CONFIG_LEGACY_PTY_COUNT=256
596
597#
598# IPMI
599#
600# CONFIG_IPMI_HANDLER is not set
601
602#
603# Watchdog Cards
604#
605# CONFIG_WATCHDOG is not set
606CONFIG_RTC=y
607# CONFIG_DTLK is not set
608# CONFIG_R3964 is not set
609# CONFIG_APPLICOM is not set
610
611#
612# Ftape, the floppy tape device driver
613#
614# CONFIG_DRM is not set
615
616#
617# PCMCIA character devices
618#
619CONFIG_SYNCLINK_CS=m
620# CONFIG_RAW_DRIVER is not set
621
622#
623# I2C support
624#
625# CONFIG_I2C is not set
626
627#
628# Dallas's 1-wire bus
629#
630# CONFIG_W1 is not set
631
632#
633# Misc devices
634#
635
636#
637# Multimedia devices
638#
639# CONFIG_VIDEO_DEV is not set
640
641#
642# Digital Video Broadcasting Devices
643#
644# CONFIG_DVB is not set
645
646#
647# Graphics support
648#
649# CONFIG_FB is not set
650# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
651
652#
653# Sound
654#
655CONFIG_SOUND=y
656
657#
658# Advanced Linux Sound Architecture
659#
660# CONFIG_SND is not set
661
662#
663# Open Sound System
664#
665CONFIG_SOUND_PRIME=y
666# CONFIG_SOUND_BT878 is not set
667# CONFIG_SOUND_CMPCI is not set
668# CONFIG_SOUND_EMU10K1 is not set
669# CONFIG_SOUND_FUSION is not set
670# CONFIG_SOUND_CS4281 is not set
671# CONFIG_SOUND_ES1370 is not set
672# CONFIG_SOUND_ES1371 is not set
673# CONFIG_SOUND_ESSSOLO1 is not set
674# CONFIG_SOUND_MAESTRO is not set
675# CONFIG_SOUND_MAESTRO3 is not set
676# CONFIG_SOUND_ICH is not set
677# CONFIG_SOUND_SONICVIBES is not set
678CONFIG_SOUND_AU1000=y
679# CONFIG_SOUND_TRIDENT is not set
680# CONFIG_SOUND_MSNDCLAS is not set
681# CONFIG_SOUND_MSNDPIN is not set
682# CONFIG_SOUND_VIA82CXXX is not set
683# CONFIG_SOUND_OSS is not set
684# CONFIG_SOUND_ALI5455 is not set
685# CONFIG_SOUND_FORTE is not set
686# CONFIG_SOUND_RME96XX is not set
687# CONFIG_SOUND_AD1980 is not set
688
689#
690# USB support
691#
692CONFIG_USB=y
693# CONFIG_USB_DEBUG is not set
694
695#
696# Miscellaneous USB options
697#
698# CONFIG_USB_DEVICEFS is not set
699# CONFIG_USB_BANDWIDTH is not set
700# CONFIG_USB_DYNAMIC_MINORS is not set
701# CONFIG_USB_OTG is not set
702CONFIG_USB_ARCH_HAS_HCD=y
703CONFIG_USB_ARCH_HAS_OHCI=y
704
705#
706# USB Host Controller Drivers
707#
708# CONFIG_USB_EHCI_HCD is not set
709CONFIG_USB_OHCI_HCD=y
710# CONFIG_USB_UHCI_HCD is not set
711# CONFIG_USB_SL811_HCD is not set
712
713#
714# USB Device Class drivers
715#
716# CONFIG_USB_AUDIO is not set
717# CONFIG_USB_BLUETOOTH_TTY is not set
718# CONFIG_USB_MIDI is not set
719# CONFIG_USB_ACM is not set
720# CONFIG_USB_PRINTER is not set
721
722#
723# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
724#
725# CONFIG_USB_STORAGE is not set
726
727#
728# USB Input Devices
729#
730CONFIG_USB_HID=y
731CONFIG_USB_HIDINPUT=y
732# CONFIG_HID_FF is not set
733# CONFIG_USB_HIDDEV is not set
734# CONFIG_USB_AIPTEK is not set
735# CONFIG_USB_WACOM is not set
736# CONFIG_USB_KBTAB is not set
737# CONFIG_USB_POWERMATE is not set
738# CONFIG_USB_MTOUCH is not set
739# CONFIG_USB_EGALAX is not set
740# CONFIG_USB_XPAD is not set
741# CONFIG_USB_ATI_REMOTE is not set
742
743#
744# USB Imaging devices
745#
746# CONFIG_USB_MDC800 is not set
747
748#
749# USB Multimedia devices
750#
751# CONFIG_USB_DABUSB is not set
752
753#
754# Video4Linux support is needed for USB Multimedia device support
755#
756
757#
758# USB Network Adapters
759#
760# CONFIG_USB_CATC is not set
761# CONFIG_USB_KAWETH is not set
762# CONFIG_USB_PEGASUS is not set
763# CONFIG_USB_RTL8150 is not set
764# CONFIG_USB_USBNET is not set
765
766#
767# USB port drivers
768#
769
770#
771# USB Serial Converter support
772#
773# CONFIG_USB_SERIAL is not set
774
775#
776# USB Miscellaneous drivers
777#
778# CONFIG_USB_EMI62 is not set
779# CONFIG_USB_EMI26 is not set
780# CONFIG_USB_AUERSWALD is not set
781# CONFIG_USB_RIO500 is not set
782# CONFIG_USB_LEGOTOWER is not set
783# CONFIG_USB_LCD is not set
784# CONFIG_USB_LED is not set
785# CONFIG_USB_CYTHERM is not set
786# CONFIG_USB_PHIDGETKIT is not set
787# CONFIG_USB_PHIDGETSERVO is not set
788# CONFIG_USB_IDMOUSE is not set
789
790#
791# USB ATM/DSL drivers
792#
793
794#
795# USB Gadget Support
796#
797# CONFIG_USB_GADGET is not set
798
799#
800# MMC/SD Card support
801#
802# CONFIG_MMC is not set
803
804#
805# InfiniBand support
806#
807# CONFIG_INFINIBAND is not set
808
809#
810# File systems
811#
812CONFIG_EXT2_FS=y
813CONFIG_EXT2_FS_XATTR=y
814CONFIG_EXT2_FS_POSIX_ACL=y
815# CONFIG_EXT2_FS_SECURITY is not set
816CONFIG_EXT3_FS=y
817CONFIG_EXT3_FS_XATTR=y
818CONFIG_EXT3_FS_POSIX_ACL=y
819CONFIG_EXT3_FS_SECURITY=y
820CONFIG_JBD=y
821# CONFIG_JBD_DEBUG is not set
822CONFIG_FS_MBCACHE=y
823CONFIG_REISERFS_FS=m
824# CONFIG_REISERFS_CHECK is not set
825# CONFIG_REISERFS_PROC_INFO is not set
826CONFIG_REISERFS_FS_XATTR=y
827CONFIG_REISERFS_FS_POSIX_ACL=y
828CONFIG_REISERFS_FS_SECURITY=y
829# CONFIG_JFS_FS is not set
830CONFIG_FS_POSIX_ACL=y
831# CONFIG_XFS_FS is not set
832# CONFIG_MINIX_FS is not set
833# CONFIG_ROMFS_FS is not set
834# CONFIG_QUOTA is not set
835CONFIG_DNOTIFY=y
836CONFIG_AUTOFS_FS=m
837CONFIG_AUTOFS4_FS=m
838
839#
840# CD-ROM/DVD Filesystems
841#
842# CONFIG_ISO9660_FS is not set
843# CONFIG_UDF_FS is not set
844
845#
846# DOS/FAT/NT Filesystems
847#
848# CONFIG_MSDOS_FS is not set
849# CONFIG_VFAT_FS is not set
850# CONFIG_NTFS_FS is not set
851
852#
853# Pseudo filesystems
854#
855CONFIG_PROC_FS=y
856CONFIG_PROC_KCORE=y
857CONFIG_SYSFS=y
858# CONFIG_DEVFS_FS is not set
859CONFIG_DEVPTS_FS_XATTR=y
860CONFIG_DEVPTS_FS_SECURITY=y
861CONFIG_TMPFS=y
862# CONFIG_TMPFS_XATTR is not set
863# CONFIG_HUGETLB_PAGE is not set
864CONFIG_RAMFS=y
865
866#
867# Miscellaneous filesystems
868#
869# CONFIG_ADFS_FS is not set
870# CONFIG_AFFS_FS is not set
871# CONFIG_HFS_FS is not set
872# CONFIG_HFSPLUS_FS is not set
873# CONFIG_BEFS_FS is not set
874# CONFIG_BFS_FS is not set
875# CONFIG_EFS_FS is not set
876# CONFIG_JFFS_FS is not set
877# CONFIG_JFFS2_FS is not set
878CONFIG_CRAMFS=m
879# CONFIG_VXFS_FS is not set
880# CONFIG_HPFS_FS is not set
881# CONFIG_QNX4FS_FS is not set
882# CONFIG_SYSV_FS is not set
883# CONFIG_UFS_FS is not set
884
885#
886# Network File Systems
887#
888CONFIG_NFS_FS=y
889# CONFIG_NFS_V3 is not set
890# CONFIG_NFS_V4 is not set
891# CONFIG_NFS_DIRECTIO is not set
892CONFIG_NFSD=m
893# CONFIG_NFSD_V3 is not set
894# CONFIG_NFSD_TCP is not set
895CONFIG_ROOT_NFS=y
896CONFIG_LOCKD=y
897CONFIG_EXPORTFS=m
898CONFIG_SUNRPC=y
899# CONFIG_RPCSEC_GSS_KRB5 is not set
900# CONFIG_RPCSEC_GSS_SPKM3 is not set
901CONFIG_SMB_FS=m
902# CONFIG_SMB_NLS_DEFAULT is not set
903# CONFIG_CIFS is not set
904# CONFIG_NCP_FS is not set
905# CONFIG_CODA_FS is not set
906# CONFIG_AFS_FS is not set
907
908#
909# Partition Types
910#
911# CONFIG_PARTITION_ADVANCED is not set
912CONFIG_MSDOS_PARTITION=y
913
914#
915# Native Language Support
916#
917CONFIG_NLS=m
918CONFIG_NLS_DEFAULT="iso8859-1"
919# CONFIG_NLS_CODEPAGE_437 is not set
920# CONFIG_NLS_CODEPAGE_737 is not set
921# CONFIG_NLS_CODEPAGE_775 is not set
922# CONFIG_NLS_CODEPAGE_850 is not set
923# CONFIG_NLS_CODEPAGE_852 is not set
924# CONFIG_NLS_CODEPAGE_855 is not set
925# CONFIG_NLS_CODEPAGE_857 is not set
926# CONFIG_NLS_CODEPAGE_860 is not set
927# CONFIG_NLS_CODEPAGE_861 is not set
928# CONFIG_NLS_CODEPAGE_862 is not set
929# CONFIG_NLS_CODEPAGE_863 is not set
930# CONFIG_NLS_CODEPAGE_864 is not set
931# CONFIG_NLS_CODEPAGE_865 is not set
932# CONFIG_NLS_CODEPAGE_866 is not set
933# CONFIG_NLS_CODEPAGE_869 is not set
934# CONFIG_NLS_CODEPAGE_936 is not set
935# CONFIG_NLS_CODEPAGE_950 is not set
936# CONFIG_NLS_CODEPAGE_932 is not set
937# CONFIG_NLS_CODEPAGE_949 is not set
938# CONFIG_NLS_CODEPAGE_874 is not set
939# CONFIG_NLS_ISO8859_8 is not set
940# CONFIG_NLS_CODEPAGE_1250 is not set
941# CONFIG_NLS_CODEPAGE_1251 is not set
942# CONFIG_NLS_ASCII is not set
943# CONFIG_NLS_ISO8859_1 is not set
944# CONFIG_NLS_ISO8859_2 is not set
945# CONFIG_NLS_ISO8859_3 is not set
946# CONFIG_NLS_ISO8859_4 is not set
947# CONFIG_NLS_ISO8859_5 is not set
948# CONFIG_NLS_ISO8859_6 is not set
949# CONFIG_NLS_ISO8859_7 is not set
950# CONFIG_NLS_ISO8859_9 is not set
951# CONFIG_NLS_ISO8859_13 is not set
952# CONFIG_NLS_ISO8859_14 is not set
953# CONFIG_NLS_ISO8859_15 is not set
954# CONFIG_NLS_KOI8_R is not set
955# CONFIG_NLS_KOI8_U is not set
956# CONFIG_NLS_UTF8 is not set
957
958#
959# Profiling support
960#
961# CONFIG_PROFILING is not set
962
963#
964# Kernel hacking
965#
966# CONFIG_DEBUG_KERNEL is not set
967CONFIG_CROSSCOMPILE=y
968CONFIG_CMDLINE=""
969
970#
971# Security options
972#
973CONFIG_KEYS=y
974CONFIG_KEYS_DEBUG_PROC_KEYS=y
975# CONFIG_SECURITY is not set
976
977#
978# Cryptographic options
979#
980CONFIG_CRYPTO=y
981CONFIG_CRYPTO_HMAC=y
982CONFIG_CRYPTO_NULL=y
983# CONFIG_CRYPTO_MD4 is not set
984# CONFIG_CRYPTO_MD5 is not set
985# CONFIG_CRYPTO_SHA1 is not set
986# CONFIG_CRYPTO_SHA256 is not set
987CONFIG_CRYPTO_SHA512=y
988CONFIG_CRYPTO_WP512=m
989# CONFIG_CRYPTO_DES is not set
990# CONFIG_CRYPTO_BLOWFISH is not set
991CONFIG_CRYPTO_TWOFISH=y
992# CONFIG_CRYPTO_SERPENT is not set
993CONFIG_CRYPTO_AES=m
994# CONFIG_CRYPTO_CAST5 is not set
995# CONFIG_CRYPTO_CAST6 is not set
996CONFIG_CRYPTO_TEA=m
997# CONFIG_CRYPTO_ARC4 is not set
998CONFIG_CRYPTO_KHAZAD=m
999CONFIG_CRYPTO_ANUBIS=m
1000CONFIG_CRYPTO_DEFLATE=y
1001CONFIG_CRYPTO_MICHAEL_MIC=y
1002CONFIG_CRYPTO_CRC32C=m
1003# CONFIG_CRYPTO_TEST is not set
1004
1005#
1006# Hardware crypto devices
1007#
1008
1009#
1010# Library routines
1011#
1012CONFIG_CRC_CCITT=m
1013CONFIG_CRC32=y
1014CONFIG_LIBCRC32C=m
1015CONFIG_ZLIB_INFLATE=y
1016CONFIG_ZLIB_DEFLATE=y
1017CONFIG_GENERIC_HARDIRQS=y
1018CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
new file mode 100644
index 000000000000..ee81309ae3a5
--- /dev/null
+++ b/arch/mips/configs/db1550_defconfig
@@ -0,0 +1,932 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:02 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83CONFIG_SOC_AU1X00=y
84# CONFIG_SOC_AU1000 is not set
85# CONFIG_SOC_AU1100 is not set
86# CONFIG_SOC_AU1500 is not set
87CONFIG_SOC_AU1550=y
88# CONFIG_MIPS_PB1000 is not set
89# CONFIG_MIPS_PB1100 is not set
90# CONFIG_MIPS_PB1500 is not set
91# CONFIG_MIPS_PB1550 is not set
92# CONFIG_MIPS_DB1000 is not set
93# CONFIG_MIPS_DB1100 is not set
94# CONFIG_MIPS_DB1500 is not set
95CONFIG_MIPS_DB1550=y
96# CONFIG_MIPS_BOSPORUS is not set
97# CONFIG_MIPS_MIRAGE is not set
98# CONFIG_MIPS_XXS1500 is not set
99# CONFIG_MIPS_MTX1 is not set
100# CONFIG_SIBYTE_SB1xxx_SOC is not set
101# CONFIG_SNI_RM200_PCI is not set
102# CONFIG_TOSHIBA_RBTX4927 is not set
103CONFIG_RWSEM_GENERIC_SPINLOCK=y
104CONFIG_GENERIC_CALIBRATE_DELAY=y
105CONFIG_HAVE_DEC_LOCK=y
106CONFIG_DMA_COHERENT=y
107CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
108CONFIG_CPU_LITTLE_ENDIAN=y
109CONFIG_MIPS_L1_CACHE_SHIFT=5
110
111#
112# CPU selection
113#
114CONFIG_CPU_MIPS32=y
115# CONFIG_CPU_MIPS64 is not set
116# CONFIG_CPU_R3000 is not set
117# CONFIG_CPU_TX39XX is not set
118# CONFIG_CPU_VR41XX is not set
119# CONFIG_CPU_R4300 is not set
120# CONFIG_CPU_R4X00 is not set
121# CONFIG_CPU_TX49XX is not set
122# CONFIG_CPU_R5000 is not set
123# CONFIG_CPU_R5432 is not set
124# CONFIG_CPU_R6000 is not set
125# CONFIG_CPU_NEVADA is not set
126# CONFIG_CPU_R8000 is not set
127# CONFIG_CPU_R10000 is not set
128# CONFIG_CPU_RM7000 is not set
129# CONFIG_CPU_RM9000 is not set
130# CONFIG_CPU_SB1 is not set
131CONFIG_PAGE_SIZE_4KB=y
132# CONFIG_PAGE_SIZE_8KB is not set
133# CONFIG_PAGE_SIZE_16KB is not set
134# CONFIG_PAGE_SIZE_64KB is not set
135CONFIG_CPU_HAS_PREFETCH=y
136CONFIG_64BIT_PHYS_ADDR=y
137# CONFIG_CPU_ADVANCED is not set
138CONFIG_CPU_HAS_LLSC=y
139CONFIG_CPU_HAS_SYNC=y
140# CONFIG_PREEMPT is not set
141
142#
143# Bus options (PCI, PCMCIA, EISA, ISA, TC)
144#
145CONFIG_HW_HAS_PCI=y
146CONFIG_PCI=y
147CONFIG_PCI_LEGACY_PROC=y
148CONFIG_PCI_NAMES=y
149CONFIG_MMU=y
150
151#
152# PCCARD (PCMCIA/CardBus) support
153#
154CONFIG_PCCARD=m
155# CONFIG_PCMCIA_DEBUG is not set
156CONFIG_PCMCIA=m
157CONFIG_CARDBUS=y
158
159#
160# PC-card bridges
161#
162# CONFIG_YENTA is not set
163# CONFIG_PD6729 is not set
164# CONFIG_I82092 is not set
165# CONFIG_TCIC is not set
166CONFIG_PCMCIA_AU1X00=m
167
168#
169# PCI Hotplug Support
170#
171# CONFIG_HOTPLUG_PCI is not set
172
173#
174# Executable file formats
175#
176CONFIG_BINFMT_ELF=y
177# CONFIG_BINFMT_MISC is not set
178CONFIG_TRAD_SIGNALS=y
179
180#
181# Device Drivers
182#
183
184#
185# Generic Driver Options
186#
187CONFIG_STANDALONE=y
188CONFIG_PREVENT_FIRMWARE_BUILD=y
189# CONFIG_FW_LOADER is not set
190
191#
192# Memory Technology Devices (MTD)
193#
194CONFIG_MTD=y
195# CONFIG_MTD_DEBUG is not set
196CONFIG_MTD_PARTITIONS=y
197# CONFIG_MTD_CONCAT is not set
198# CONFIG_MTD_REDBOOT_PARTS is not set
199# CONFIG_MTD_CMDLINE_PARTS is not set
200
201#
202# User Modules And Translation Layers
203#
204CONFIG_MTD_CHAR=y
205CONFIG_MTD_BLOCK=y
206# CONFIG_FTL is not set
207# CONFIG_NFTL is not set
208# CONFIG_INFTL is not set
209
210#
211# RAM/ROM/Flash chip drivers
212#
213CONFIG_MTD_CFI=y
214# CONFIG_MTD_JEDECPROBE is not set
215CONFIG_MTD_GEN_PROBE=y
216# CONFIG_MTD_CFI_ADV_OPTIONS is not set
217CONFIG_MTD_MAP_BANK_WIDTH_1=y
218CONFIG_MTD_MAP_BANK_WIDTH_2=y
219CONFIG_MTD_MAP_BANK_WIDTH_4=y
220# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
221# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
222# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
223CONFIG_MTD_CFI_I1=y
224CONFIG_MTD_CFI_I2=y
225# CONFIG_MTD_CFI_I4 is not set
226# CONFIG_MTD_CFI_I8 is not set
227# CONFIG_MTD_CFI_INTELEXT is not set
228CONFIG_MTD_CFI_AMDSTD=y
229CONFIG_MTD_CFI_AMDSTD_RETRY=0
230# CONFIG_MTD_CFI_STAA is not set
231CONFIG_MTD_CFI_UTIL=y
232# CONFIG_MTD_RAM is not set
233# CONFIG_MTD_ROM is not set
234# CONFIG_MTD_ABSENT is not set
235
236#
237# Mapping drivers for chip access
238#
239# CONFIG_MTD_COMPLEX_MAPPINGS is not set
240# CONFIG_MTD_PHYSMAP is not set
241CONFIG_MTD_DB1550=y
242CONFIG_MTD_DB1550_BOOT=y
243CONFIG_MTD_DB1550_USER=y
244
245#
246# Self-contained MTD device drivers
247#
248# CONFIG_MTD_PMC551 is not set
249# CONFIG_MTD_SLRAM is not set
250# CONFIG_MTD_PHRAM is not set
251# CONFIG_MTD_MTDRAM is not set
252# CONFIG_MTD_BLKMTD is not set
253# CONFIG_MTD_BLOCK2MTD is not set
254
255#
256# Disk-On-Chip Device Drivers
257#
258# CONFIG_MTD_DOC2000 is not set
259# CONFIG_MTD_DOC2001 is not set
260# CONFIG_MTD_DOC2001PLUS is not set
261
262#
263# NAND Flash Device Drivers
264#
265CONFIG_MTD_NAND=m
266# CONFIG_MTD_NAND_VERIFY_WRITE is not set
267CONFIG_MTD_NAND_IDS=m
268CONFIG_MTD_NAND_AU1550=m
269# CONFIG_MTD_NAND_DISKONCHIP is not set
270# CONFIG_MTD_NAND_NANDSIM is not set
271
272#
273# Parallel port support
274#
275# CONFIG_PARPORT is not set
276
277#
278# Plug and Play support
279#
280
281#
282# Block devices
283#
284# CONFIG_BLK_DEV_FD is not set
285# CONFIG_BLK_CPQ_DA is not set
286# CONFIG_BLK_CPQ_CISS_DA is not set
287# CONFIG_BLK_DEV_DAC960 is not set
288# CONFIG_BLK_DEV_UMEM is not set
289# CONFIG_BLK_DEV_COW_COMMON is not set
290CONFIG_BLK_DEV_LOOP=y
291# CONFIG_BLK_DEV_CRYPTOLOOP is not set
292# CONFIG_BLK_DEV_NBD is not set
293# CONFIG_BLK_DEV_SX8 is not set
294# CONFIG_BLK_DEV_RAM is not set
295CONFIG_BLK_DEV_RAM_COUNT=16
296CONFIG_INITRAMFS_SOURCE=""
297# CONFIG_LBD is not set
298CONFIG_CDROM_PKTCDVD=m
299CONFIG_CDROM_PKTCDVD_BUFFERS=8
300# CONFIG_CDROM_PKTCDVD_WCACHE is not set
301
302#
303# IO Schedulers
304#
305CONFIG_IOSCHED_NOOP=y
306CONFIG_IOSCHED_AS=y
307CONFIG_IOSCHED_DEADLINE=y
308CONFIG_IOSCHED_CFQ=y
309CONFIG_ATA_OVER_ETH=m
310
311#
312# ATA/ATAPI/MFM/RLL support
313#
314CONFIG_IDE=y
315CONFIG_BLK_DEV_IDE=y
316
317#
318# Please see Documentation/ide.txt for help/info on IDE drives
319#
320# CONFIG_BLK_DEV_IDE_SATA is not set
321CONFIG_BLK_DEV_IDEDISK=y
322# CONFIG_IDEDISK_MULTI_MODE is not set
323CONFIG_BLK_DEV_IDECS=m
324# CONFIG_BLK_DEV_IDECD is not set
325# CONFIG_BLK_DEV_IDETAPE is not set
326# CONFIG_BLK_DEV_IDEFLOPPY is not set
327# CONFIG_IDE_TASK_IOCTL is not set
328
329#
330# IDE chipset support/bugfixes
331#
332CONFIG_IDE_GENERIC=y
333CONFIG_BLK_DEV_IDEPCI=y
334# CONFIG_IDEPCI_SHARE_IRQ is not set
335# CONFIG_BLK_DEV_OFFBOARD is not set
336CONFIG_BLK_DEV_GENERIC=y
337# CONFIG_BLK_DEV_OPTI621 is not set
338CONFIG_BLK_DEV_IDEDMA_PCI=y
339# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
340# CONFIG_IDEDMA_PCI_AUTO is not set
341# CONFIG_BLK_DEV_AEC62XX is not set
342# CONFIG_BLK_DEV_ALI15X3 is not set
343# CONFIG_BLK_DEV_AMD74XX is not set
344# CONFIG_BLK_DEV_CMD64X is not set
345# CONFIG_BLK_DEV_TRIFLEX is not set
346# CONFIG_BLK_DEV_CY82C693 is not set
347# CONFIG_BLK_DEV_CS5520 is not set
348# CONFIG_BLK_DEV_CS5530 is not set
349# CONFIG_BLK_DEV_HPT34X is not set
350# CONFIG_BLK_DEV_HPT366 is not set
351# CONFIG_BLK_DEV_SC1200 is not set
352# CONFIG_BLK_DEV_PIIX is not set
353# CONFIG_BLK_DEV_NS87415 is not set
354# CONFIG_BLK_DEV_PDC202XX_OLD is not set
355# CONFIG_BLK_DEV_PDC202XX_NEW is not set
356# CONFIG_BLK_DEV_SVWKS is not set
357# CONFIG_BLK_DEV_SIIMAGE is not set
358# CONFIG_BLK_DEV_SLC90E66 is not set
359# CONFIG_BLK_DEV_TRM290 is not set
360# CONFIG_BLK_DEV_VIA82CXXX is not set
361# CONFIG_IDE_ARM is not set
362CONFIG_BLK_DEV_IDEDMA=y
363# CONFIG_IDEDMA_IVB is not set
364# CONFIG_IDEDMA_AUTO is not set
365# CONFIG_BLK_DEV_HD is not set
366
367#
368# SCSI device support
369#
370# CONFIG_SCSI is not set
371
372#
373# Multi-device support (RAID and LVM)
374#
375# CONFIG_MD is not set
376
377#
378# Fusion MPT device support
379#
380
381#
382# IEEE 1394 (FireWire) support
383#
384# CONFIG_IEEE1394 is not set
385
386#
387# I2O device support
388#
389# CONFIG_I2O is not set
390
391#
392# Networking support
393#
394CONFIG_NET=y
395
396#
397# Networking options
398#
399CONFIG_PACKET=y
400# CONFIG_PACKET_MMAP is not set
401CONFIG_NETLINK_DEV=y
402CONFIG_UNIX=y
403CONFIG_NET_KEY=y
404CONFIG_INET=y
405CONFIG_IP_MULTICAST=y
406# CONFIG_IP_ADVANCED_ROUTER is not set
407CONFIG_IP_PNP=y
408# CONFIG_IP_PNP_DHCP is not set
409CONFIG_IP_PNP_BOOTP=y
410# CONFIG_IP_PNP_RARP is not set
411# CONFIG_NET_IPIP is not set
412# CONFIG_NET_IPGRE is not set
413# CONFIG_IP_MROUTE is not set
414# CONFIG_ARPD is not set
415# CONFIG_SYN_COOKIES is not set
416# CONFIG_INET_AH is not set
417# CONFIG_INET_ESP is not set
418# CONFIG_INET_IPCOMP is not set
419CONFIG_INET_TUNNEL=m
420CONFIG_IP_TCPDIAG=m
421# CONFIG_IP_TCPDIAG_IPV6 is not set
422
423#
424# IP: Virtual Server Configuration
425#
426# CONFIG_IP_VS is not set
427# CONFIG_IPV6 is not set
428CONFIG_NETFILTER=y
429# CONFIG_NETFILTER_DEBUG is not set
430
431#
432# IP: Netfilter Configuration
433#
434# CONFIG_IP_NF_CONNTRACK is not set
435CONFIG_IP_NF_CONNTRACK_MARK=y
436# CONFIG_IP_NF_QUEUE is not set
437# CONFIG_IP_NF_IPTABLES is not set
438# CONFIG_IP_NF_ARPTABLES is not set
439CONFIG_XFRM=y
440CONFIG_XFRM_USER=m
441
442#
443# SCTP Configuration (EXPERIMENTAL)
444#
445# CONFIG_IP_SCTP is not set
446# CONFIG_ATM is not set
447# CONFIG_BRIDGE is not set
448# CONFIG_VLAN_8021Q is not set
449# CONFIG_DECNET is not set
450# CONFIG_LLC2 is not set
451# CONFIG_IPX is not set
452# CONFIG_ATALK is not set
453# CONFIG_X25 is not set
454# CONFIG_LAPB is not set
455# CONFIG_NET_DIVERT is not set
456# CONFIG_ECONET is not set
457# CONFIG_WAN_ROUTER is not set
458
459#
460# QoS and/or fair queueing
461#
462# CONFIG_NET_SCHED is not set
463# CONFIG_NET_CLS_ROUTE is not set
464
465#
466# Network testing
467#
468# CONFIG_NET_PKTGEN is not set
469# CONFIG_NETPOLL is not set
470# CONFIG_NET_POLL_CONTROLLER is not set
471# CONFIG_HAMRADIO is not set
472# CONFIG_IRDA is not set
473# CONFIG_BT is not set
474CONFIG_NETDEVICES=y
475# CONFIG_DUMMY is not set
476# CONFIG_BONDING is not set
477# CONFIG_EQUALIZER is not set
478# CONFIG_TUN is not set
479# CONFIG_ETHERTAP is not set
480
481#
482# ARCnet devices
483#
484# CONFIG_ARCNET is not set
485
486#
487# Ethernet (10 or 100Mbit)
488#
489CONFIG_NET_ETHERNET=y
490CONFIG_MII=m
491CONFIG_MIPS_AU1X00_ENET=y
492# CONFIG_HAPPYMEAL is not set
493# CONFIG_SUNGEM is not set
494# CONFIG_NET_VENDOR_3COM is not set
495
496#
497# Tulip family network device support
498#
499# CONFIG_NET_TULIP is not set
500# CONFIG_HP100 is not set
501# CONFIG_NET_PCI is not set
502
503#
504# Ethernet (1000 Mbit)
505#
506# CONFIG_ACENIC is not set
507# CONFIG_DL2K is not set
508# CONFIG_E1000 is not set
509# CONFIG_NS83820 is not set
510# CONFIG_HAMACHI is not set
511# CONFIG_YELLOWFIN is not set
512# CONFIG_R8169 is not set
513# CONFIG_SK98LIN is not set
514# CONFIG_TIGON3 is not set
515
516#
517# Ethernet (10000 Mbit)
518#
519# CONFIG_IXGB is not set
520# CONFIG_S2IO is not set
521
522#
523# Token Ring devices
524#
525# CONFIG_TR is not set
526
527#
528# Wireless LAN (non-hamradio)
529#
530# CONFIG_NET_RADIO is not set
531
532#
533# PCMCIA network device support
534#
535CONFIG_NET_PCMCIA=y
536CONFIG_PCMCIA_3C589=m
537CONFIG_PCMCIA_3C574=m
538CONFIG_PCMCIA_FMVJ18X=m
539CONFIG_PCMCIA_PCNET=m
540CONFIG_PCMCIA_NMCLAN=m
541CONFIG_PCMCIA_SMC91C92=m
542CONFIG_PCMCIA_XIRC2PS=m
543CONFIG_PCMCIA_AXNET=m
544
545#
546# Wan interfaces
547#
548# CONFIG_WAN is not set
549# CONFIG_FDDI is not set
550# CONFIG_HIPPI is not set
551CONFIG_PPP=m
552CONFIG_PPP_MULTILINK=y
553# CONFIG_PPP_FILTER is not set
554CONFIG_PPP_ASYNC=m
555# CONFIG_PPP_SYNC_TTY is not set
556CONFIG_PPP_DEFLATE=m
557# CONFIG_PPP_BSDCOMP is not set
558CONFIG_PPPOE=m
559# CONFIG_SLIP is not set
560# CONFIG_SHAPER is not set
561# CONFIG_NETCONSOLE is not set
562
563#
564# ISDN subsystem
565#
566# CONFIG_ISDN is not set
567
568#
569# Telephony Support
570#
571# CONFIG_PHONE is not set
572
573#
574# Input device support
575#
576CONFIG_INPUT=y
577
578#
579# Userland interfaces
580#
581CONFIG_INPUT_MOUSEDEV=y
582CONFIG_INPUT_MOUSEDEV_PSAUX=y
583CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
584CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
585# CONFIG_INPUT_JOYDEV is not set
586# CONFIG_INPUT_TSDEV is not set
587CONFIG_INPUT_EVDEV=y
588# CONFIG_INPUT_EVBUG is not set
589
590#
591# Input I/O drivers
592#
593# CONFIG_GAMEPORT is not set
594CONFIG_SOUND_GAMEPORT=y
595CONFIG_SERIO=y
596# CONFIG_SERIO_I8042 is not set
597CONFIG_SERIO_SERPORT=y
598# CONFIG_SERIO_CT82C710 is not set
599# CONFIG_SERIO_PCIPS2 is not set
600# CONFIG_SERIO_LIBPS2 is not set
601CONFIG_SERIO_RAW=m
602
603#
604# Input Device Drivers
605#
606# CONFIG_INPUT_KEYBOARD is not set
607# CONFIG_INPUT_MOUSE is not set
608# CONFIG_INPUT_JOYSTICK is not set
609# CONFIG_INPUT_TOUCHSCREEN is not set
610# CONFIG_INPUT_MISC is not set
611
612#
613# Character devices
614#
615# CONFIG_VT is not set
616# CONFIG_SERIAL_NONSTANDARD is not set
617# CONFIG_AU1X00_GPIO is not set
618# CONFIG_TS_AU1X00_ADS7846 is not set
619
620#
621# Serial drivers
622#
623# CONFIG_SERIAL_8250 is not set
624
625#
626# Non-8250 serial port support
627#
628CONFIG_SERIAL_AU1X00=y
629CONFIG_SERIAL_AU1X00_CONSOLE=y
630CONFIG_SERIAL_CORE=y
631CONFIG_SERIAL_CORE_CONSOLE=y
632CONFIG_UNIX98_PTYS=y
633CONFIG_LEGACY_PTYS=y
634CONFIG_LEGACY_PTY_COUNT=256
635
636#
637# IPMI
638#
639# CONFIG_IPMI_HANDLER is not set
640
641#
642# Watchdog Cards
643#
644# CONFIG_WATCHDOG is not set
645# CONFIG_RTC is not set
646# CONFIG_GEN_RTC is not set
647# CONFIG_DTLK is not set
648# CONFIG_R3964 is not set
649# CONFIG_APPLICOM is not set
650
651#
652# Ftape, the floppy tape device driver
653#
654# CONFIG_DRM is not set
655
656#
657# PCMCIA character devices
658#
659CONFIG_SYNCLINK_CS=m
660# CONFIG_RAW_DRIVER is not set
661
662#
663# I2C support
664#
665# CONFIG_I2C is not set
666
667#
668# Dallas's 1-wire bus
669#
670# CONFIG_W1 is not set
671
672#
673# Misc devices
674#
675
676#
677# Multimedia devices
678#
679# CONFIG_VIDEO_DEV is not set
680
681#
682# Digital Video Broadcasting Devices
683#
684# CONFIG_DVB is not set
685
686#
687# Graphics support
688#
689# CONFIG_FB is not set
690# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
691
692#
693# Sound
694#
695# CONFIG_SOUND is not set
696
697#
698# USB support
699#
700# CONFIG_USB is not set
701CONFIG_USB_ARCH_HAS_HCD=y
702CONFIG_USB_ARCH_HAS_OHCI=y
703
704#
705# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
706#
707
708#
709# USB Gadget Support
710#
711# CONFIG_USB_GADGET is not set
712
713#
714# MMC/SD Card support
715#
716# CONFIG_MMC is not set
717
718#
719# InfiniBand support
720#
721# CONFIG_INFINIBAND is not set
722
723#
724# File systems
725#
726CONFIG_EXT2_FS=y
727CONFIG_EXT2_FS_XATTR=y
728CONFIG_EXT2_FS_POSIX_ACL=y
729# CONFIG_EXT2_FS_SECURITY is not set
730CONFIG_EXT3_FS=y
731CONFIG_EXT3_FS_XATTR=y
732CONFIG_EXT3_FS_POSIX_ACL=y
733CONFIG_EXT3_FS_SECURITY=y
734CONFIG_JBD=y
735# CONFIG_JBD_DEBUG is not set
736CONFIG_FS_MBCACHE=y
737CONFIG_REISERFS_FS=m
738# CONFIG_REISERFS_CHECK is not set
739# CONFIG_REISERFS_PROC_INFO is not set
740CONFIG_REISERFS_FS_XATTR=y
741CONFIG_REISERFS_FS_POSIX_ACL=y
742CONFIG_REISERFS_FS_SECURITY=y
743# CONFIG_JFS_FS is not set
744CONFIG_FS_POSIX_ACL=y
745# CONFIG_XFS_FS is not set
746# CONFIG_MINIX_FS is not set
747# CONFIG_ROMFS_FS is not set
748# CONFIG_QUOTA is not set
749CONFIG_DNOTIFY=y
750CONFIG_AUTOFS_FS=m
751CONFIG_AUTOFS4_FS=m
752
753#
754# CD-ROM/DVD Filesystems
755#
756# CONFIG_ISO9660_FS is not set
757# CONFIG_UDF_FS is not set
758
759#
760# DOS/FAT/NT Filesystems
761#
762# CONFIG_MSDOS_FS is not set
763# CONFIG_VFAT_FS is not set
764# CONFIG_NTFS_FS is not set
765
766#
767# Pseudo filesystems
768#
769CONFIG_PROC_FS=y
770CONFIG_PROC_KCORE=y
771CONFIG_SYSFS=y
772# CONFIG_DEVFS_FS is not set
773CONFIG_DEVPTS_FS_XATTR=y
774CONFIG_DEVPTS_FS_SECURITY=y
775CONFIG_TMPFS=y
776# CONFIG_TMPFS_XATTR is not set
777# CONFIG_HUGETLB_PAGE is not set
778CONFIG_RAMFS=y
779
780#
781# Miscellaneous filesystems
782#
783# CONFIG_ADFS_FS is not set
784# CONFIG_AFFS_FS is not set
785# CONFIG_HFS_FS is not set
786# CONFIG_HFSPLUS_FS is not set
787# CONFIG_BEFS_FS is not set
788# CONFIG_BFS_FS is not set
789# CONFIG_EFS_FS is not set
790# CONFIG_JFFS_FS is not set
791# CONFIG_JFFS2_FS is not set
792CONFIG_CRAMFS=m
793# CONFIG_VXFS_FS is not set
794# CONFIG_HPFS_FS is not set
795# CONFIG_QNX4FS_FS is not set
796# CONFIG_SYSV_FS is not set
797# CONFIG_UFS_FS is not set
798
799#
800# Network File Systems
801#
802CONFIG_NFS_FS=y
803# CONFIG_NFS_V3 is not set
804# CONFIG_NFS_V4 is not set
805# CONFIG_NFS_DIRECTIO is not set
806CONFIG_NFSD=m
807# CONFIG_NFSD_V3 is not set
808# CONFIG_NFSD_TCP is not set
809CONFIG_ROOT_NFS=y
810CONFIG_LOCKD=y
811CONFIG_EXPORTFS=m
812CONFIG_SUNRPC=y
813# CONFIG_RPCSEC_GSS_KRB5 is not set
814# CONFIG_RPCSEC_GSS_SPKM3 is not set
815CONFIG_SMB_FS=m
816# CONFIG_SMB_NLS_DEFAULT is not set
817# CONFIG_CIFS is not set
818# CONFIG_NCP_FS is not set
819# CONFIG_CODA_FS is not set
820# CONFIG_AFS_FS is not set
821
822#
823# Partition Types
824#
825# CONFIG_PARTITION_ADVANCED is not set
826CONFIG_MSDOS_PARTITION=y
827
828#
829# Native Language Support
830#
831CONFIG_NLS=m
832CONFIG_NLS_DEFAULT="iso8859-1"
833# CONFIG_NLS_CODEPAGE_437 is not set
834# CONFIG_NLS_CODEPAGE_737 is not set
835# CONFIG_NLS_CODEPAGE_775 is not set
836# CONFIG_NLS_CODEPAGE_850 is not set
837# CONFIG_NLS_CODEPAGE_852 is not set
838# CONFIG_NLS_CODEPAGE_855 is not set
839# CONFIG_NLS_CODEPAGE_857 is not set
840# CONFIG_NLS_CODEPAGE_860 is not set
841# CONFIG_NLS_CODEPAGE_861 is not set
842# CONFIG_NLS_CODEPAGE_862 is not set
843# CONFIG_NLS_CODEPAGE_863 is not set
844# CONFIG_NLS_CODEPAGE_864 is not set
845# CONFIG_NLS_CODEPAGE_865 is not set
846# CONFIG_NLS_CODEPAGE_866 is not set
847# CONFIG_NLS_CODEPAGE_869 is not set
848# CONFIG_NLS_CODEPAGE_936 is not set
849# CONFIG_NLS_CODEPAGE_950 is not set
850# CONFIG_NLS_CODEPAGE_932 is not set
851# CONFIG_NLS_CODEPAGE_949 is not set
852# CONFIG_NLS_CODEPAGE_874 is not set
853# CONFIG_NLS_ISO8859_8 is not set
854# CONFIG_NLS_CODEPAGE_1250 is not set
855# CONFIG_NLS_CODEPAGE_1251 is not set
856# CONFIG_NLS_ASCII is not set
857# CONFIG_NLS_ISO8859_1 is not set
858# CONFIG_NLS_ISO8859_2 is not set
859# CONFIG_NLS_ISO8859_3 is not set
860# CONFIG_NLS_ISO8859_4 is not set
861# CONFIG_NLS_ISO8859_5 is not set
862# CONFIG_NLS_ISO8859_6 is not set
863# CONFIG_NLS_ISO8859_7 is not set
864# CONFIG_NLS_ISO8859_9 is not set
865# CONFIG_NLS_ISO8859_13 is not set
866# CONFIG_NLS_ISO8859_14 is not set
867# CONFIG_NLS_ISO8859_15 is not set
868# CONFIG_NLS_KOI8_R is not set
869# CONFIG_NLS_KOI8_U is not set
870# CONFIG_NLS_UTF8 is not set
871
872#
873# Profiling support
874#
875# CONFIG_PROFILING is not set
876
877#
878# Kernel hacking
879#
880# CONFIG_DEBUG_KERNEL is not set
881CONFIG_CROSSCOMPILE=y
882CONFIG_CMDLINE=""
883
884#
885# Security options
886#
887CONFIG_KEYS=y
888CONFIG_KEYS_DEBUG_PROC_KEYS=y
889# CONFIG_SECURITY is not set
890
891#
892# Cryptographic options
893#
894CONFIG_CRYPTO=y
895CONFIG_CRYPTO_HMAC=y
896CONFIG_CRYPTO_NULL=y
897# CONFIG_CRYPTO_MD4 is not set
898# CONFIG_CRYPTO_MD5 is not set
899# CONFIG_CRYPTO_SHA1 is not set
900# CONFIG_CRYPTO_SHA256 is not set
901CONFIG_CRYPTO_SHA512=y
902CONFIG_CRYPTO_WP512=m
903# CONFIG_CRYPTO_DES is not set
904# CONFIG_CRYPTO_BLOWFISH is not set
905CONFIG_CRYPTO_TWOFISH=y
906# CONFIG_CRYPTO_SERPENT is not set
907CONFIG_CRYPTO_AES=m
908# CONFIG_CRYPTO_CAST5 is not set
909# CONFIG_CRYPTO_CAST6 is not set
910CONFIG_CRYPTO_TEA=m
911# CONFIG_CRYPTO_ARC4 is not set
912CONFIG_CRYPTO_KHAZAD=m
913CONFIG_CRYPTO_ANUBIS=m
914CONFIG_CRYPTO_DEFLATE=y
915CONFIG_CRYPTO_MICHAEL_MIC=y
916CONFIG_CRYPTO_CRC32C=m
917# CONFIG_CRYPTO_TEST is not set
918
919#
920# Hardware crypto devices
921#
922
923#
924# Library routines
925#
926CONFIG_CRC_CCITT=m
927CONFIG_CRC32=y
928CONFIG_LIBCRC32C=m
929CONFIG_ZLIB_INFLATE=y
930CONFIG_ZLIB_DEFLATE=y
931CONFIG_GENERIC_HARDIRQS=y
932CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ddb5476_defconfig b/arch/mips/configs/ddb5476_defconfig
new file mode 100644
index 000000000000..d43ed57c4b4e
--- /dev/null
+++ b/arch/mips/configs/ddb5476_defconfig
@@ -0,0 +1,726 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:02 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48# CONFIG_MODULES is not set
49
50#
51# Machine selection
52#
53# CONFIG_MACH_JAZZ is not set
54# CONFIG_MACH_VR41XX is not set
55# CONFIG_TOSHIBA_JMR3927 is not set
56# CONFIG_MIPS_COBALT is not set
57# CONFIG_MACH_DECSTATION is not set
58# CONFIG_MIPS_EV64120 is not set
59# CONFIG_MIPS_EV96100 is not set
60# CONFIG_MIPS_IVR is not set
61# CONFIG_LASAT is not set
62# CONFIG_MIPS_ITE8172 is not set
63# CONFIG_MIPS_ATLAS is not set
64# CONFIG_MIPS_MALTA is not set
65# CONFIG_MIPS_SEAD is not set
66# CONFIG_MOMENCO_OCELOT is not set
67# CONFIG_MOMENCO_OCELOT_G is not set
68# CONFIG_MOMENCO_OCELOT_C is not set
69# CONFIG_MOMENCO_OCELOT_3 is not set
70# CONFIG_MOMENCO_JAGUAR_ATX is not set
71# CONFIG_PMC_YOSEMITE is not set
72# CONFIG_DDB5074 is not set
73CONFIG_DDB5476=y
74# CONFIG_DDB5477 is not set
75# CONFIG_NEC_OSPREY is not set
76# CONFIG_SGI_IP22 is not set
77# CONFIG_SOC_AU1X00 is not set
78# CONFIG_SIBYTE_SB1xxx_SOC is not set
79# CONFIG_SNI_RM200_PCI is not set
80# CONFIG_TOSHIBA_RBTX4927 is not set
81CONFIG_RWSEM_GENERIC_SPINLOCK=y
82CONFIG_GENERIC_CALIBRATE_DELAY=y
83CONFIG_HAVE_DEC_LOCK=y
84CONFIG_DMA_NONCOHERENT=y
85CONFIG_I8259=y
86CONFIG_CPU_LITTLE_ENDIAN=y
87CONFIG_IRQ_CPU=y
88CONFIG_DDB5XXX_COMMON=y
89CONFIG_MIPS_L1_CACHE_SHIFT=5
90CONFIG_HAVE_STD_PC_SERIAL_PORT=y
91
92#
93# CPU selection
94#
95# CONFIG_CPU_MIPS32 is not set
96# CONFIG_CPU_MIPS64 is not set
97# CONFIG_CPU_R3000 is not set
98# CONFIG_CPU_TX39XX is not set
99# CONFIG_CPU_VR41XX is not set
100# CONFIG_CPU_R4300 is not set
101# CONFIG_CPU_R4X00 is not set
102# CONFIG_CPU_TX49XX is not set
103# CONFIG_CPU_R5000 is not set
104CONFIG_CPU_R5432=y
105# CONFIG_CPU_R6000 is not set
106# CONFIG_CPU_NEVADA is not set
107# CONFIG_CPU_R8000 is not set
108# CONFIG_CPU_R10000 is not set
109# CONFIG_CPU_RM7000 is not set
110# CONFIG_CPU_RM9000 is not set
111# CONFIG_CPU_SB1 is not set
112CONFIG_PAGE_SIZE_4KB=y
113# CONFIG_PAGE_SIZE_8KB is not set
114# CONFIG_PAGE_SIZE_16KB is not set
115# CONFIG_PAGE_SIZE_64KB is not set
116# CONFIG_CPU_ADVANCED is not set
117CONFIG_CPU_HAS_LLSC=y
118CONFIG_CPU_HAS_LLDSCD=y
119CONFIG_CPU_HAS_SYNC=y
120# CONFIG_PREEMPT is not set
121
122#
123# Bus options (PCI, PCMCIA, EISA, ISA, TC)
124#
125CONFIG_HW_HAS_PCI=y
126CONFIG_PCI=y
127CONFIG_PCI_LEGACY_PROC=y
128CONFIG_PCI_NAMES=y
129CONFIG_ISA=y
130CONFIG_MMU=y
131
132#
133# PCCARD (PCMCIA/CardBus) support
134#
135# CONFIG_PCCARD is not set
136
137#
138# PC-card bridges
139#
140CONFIG_PCMCIA_PROBE=y
141
142#
143# PCI Hotplug Support
144#
145# CONFIG_HOTPLUG_PCI is not set
146
147#
148# Executable file formats
149#
150CONFIG_BINFMT_ELF=y
151# CONFIG_BINFMT_MISC is not set
152CONFIG_TRAD_SIGNALS=y
153
154#
155# Device Drivers
156#
157
158#
159# Generic Driver Options
160#
161CONFIG_STANDALONE=y
162CONFIG_PREVENT_FIRMWARE_BUILD=y
163# CONFIG_FW_LOADER is not set
164
165#
166# Memory Technology Devices (MTD)
167#
168# CONFIG_MTD is not set
169
170#
171# Parallel port support
172#
173# CONFIG_PARPORT is not set
174
175#
176# Plug and Play support
177#
178# CONFIG_PNP is not set
179
180#
181# Block devices
182#
183# CONFIG_BLK_DEV_FD is not set
184# CONFIG_BLK_DEV_XD is not set
185# CONFIG_BLK_CPQ_DA is not set
186# CONFIG_BLK_CPQ_CISS_DA is not set
187# CONFIG_BLK_DEV_DAC960 is not set
188# CONFIG_BLK_DEV_UMEM is not set
189# CONFIG_BLK_DEV_COW_COMMON is not set
190# CONFIG_BLK_DEV_LOOP is not set
191# CONFIG_BLK_DEV_NBD is not set
192# CONFIG_BLK_DEV_SX8 is not set
193# CONFIG_BLK_DEV_RAM is not set
194CONFIG_BLK_DEV_RAM_COUNT=16
195CONFIG_INITRAMFS_SOURCE=""
196# CONFIG_LBD is not set
197CONFIG_CDROM_PKTCDVD=y
198CONFIG_CDROM_PKTCDVD_BUFFERS=8
199# CONFIG_CDROM_PKTCDVD_WCACHE is not set
200
201#
202# IO Schedulers
203#
204CONFIG_IOSCHED_NOOP=y
205CONFIG_IOSCHED_AS=y
206CONFIG_IOSCHED_DEADLINE=y
207CONFIG_IOSCHED_CFQ=y
208CONFIG_ATA_OVER_ETH=y
209
210#
211# ATA/ATAPI/MFM/RLL support
212#
213CONFIG_IDE=y
214CONFIG_BLK_DEV_IDE=y
215
216#
217# Please see Documentation/ide.txt for help/info on IDE drives
218#
219# CONFIG_BLK_DEV_IDE_SATA is not set
220CONFIG_BLK_DEV_IDEDISK=y
221# CONFIG_IDEDISK_MULTI_MODE is not set
222# CONFIG_BLK_DEV_IDECD is not set
223# CONFIG_BLK_DEV_IDETAPE is not set
224# CONFIG_BLK_DEV_IDEFLOPPY is not set
225# CONFIG_IDE_TASK_IOCTL is not set
226
227#
228# IDE chipset support/bugfixes
229#
230CONFIG_IDE_GENERIC=y
231# CONFIG_BLK_DEV_IDEPCI is not set
232# CONFIG_IDE_ARM is not set
233# CONFIG_IDE_CHIPSETS is not set
234# CONFIG_BLK_DEV_IDEDMA is not set
235# CONFIG_IDEDMA_AUTO is not set
236# CONFIG_BLK_DEV_HD is not set
237
238#
239# SCSI device support
240#
241# CONFIG_SCSI is not set
242
243#
244# Old CD-ROM drivers (not SCSI, not IDE)
245#
246# CONFIG_CD_NO_IDESCSI is not set
247
248#
249# Multi-device support (RAID and LVM)
250#
251# CONFIG_MD is not set
252
253#
254# Fusion MPT device support
255#
256
257#
258# IEEE 1394 (FireWire) support
259#
260# CONFIG_IEEE1394 is not set
261
262#
263# I2O device support
264#
265# CONFIG_I2O is not set
266
267#
268# Networking support
269#
270CONFIG_NET=y
271
272#
273# Networking options
274#
275CONFIG_PACKET=y
276# CONFIG_PACKET_MMAP is not set
277CONFIG_NETLINK_DEV=y
278CONFIG_UNIX=y
279CONFIG_NET_KEY=y
280CONFIG_INET=y
281# CONFIG_IP_MULTICAST is not set
282# CONFIG_IP_ADVANCED_ROUTER is not set
283CONFIG_IP_PNP=y
284# CONFIG_IP_PNP_DHCP is not set
285CONFIG_IP_PNP_BOOTP=y
286# CONFIG_IP_PNP_RARP is not set
287# CONFIG_NET_IPIP is not set
288# CONFIG_NET_IPGRE is not set
289# CONFIG_ARPD is not set
290# CONFIG_SYN_COOKIES is not set
291# CONFIG_INET_AH is not set
292# CONFIG_INET_ESP is not set
293# CONFIG_INET_IPCOMP is not set
294CONFIG_INET_TUNNEL=y
295CONFIG_IP_TCPDIAG=y
296# CONFIG_IP_TCPDIAG_IPV6 is not set
297# CONFIG_IPV6 is not set
298# CONFIG_NETFILTER is not set
299CONFIG_XFRM=y
300CONFIG_XFRM_USER=y
301
302#
303# SCTP Configuration (EXPERIMENTAL)
304#
305# CONFIG_IP_SCTP is not set
306# CONFIG_ATM is not set
307# CONFIG_BRIDGE is not set
308# CONFIG_VLAN_8021Q is not set
309# CONFIG_DECNET is not set
310# CONFIG_LLC2 is not set
311# CONFIG_IPX is not set
312# CONFIG_ATALK is not set
313# CONFIG_X25 is not set
314# CONFIG_LAPB is not set
315# CONFIG_NET_DIVERT is not set
316# CONFIG_ECONET is not set
317# CONFIG_WAN_ROUTER is not set
318
319#
320# QoS and/or fair queueing
321#
322# CONFIG_NET_SCHED is not set
323# CONFIG_NET_CLS_ROUTE is not set
324
325#
326# Network testing
327#
328# CONFIG_NET_PKTGEN is not set
329# CONFIG_NETPOLL is not set
330# CONFIG_NET_POLL_CONTROLLER is not set
331# CONFIG_HAMRADIO is not set
332# CONFIG_IRDA is not set
333# CONFIG_BT is not set
334CONFIG_NETDEVICES=y
335# CONFIG_DUMMY is not set
336# CONFIG_BONDING is not set
337# CONFIG_EQUALIZER is not set
338# CONFIG_TUN is not set
339# CONFIG_ETHERTAP is not set
340
341#
342# ARCnet devices
343#
344# CONFIG_ARCNET is not set
345
346#
347# Ethernet (10 or 100Mbit)
348#
349CONFIG_NET_ETHERNET=y
350# CONFIG_MII is not set
351# CONFIG_HAPPYMEAL is not set
352# CONFIG_SUNGEM is not set
353# CONFIG_NET_VENDOR_3COM is not set
354# CONFIG_LANCE is not set
355# CONFIG_NET_VENDOR_SMC is not set
356# CONFIG_NET_VENDOR_RACAL is not set
357
358#
359# Tulip family network device support
360#
361# CONFIG_NET_TULIP is not set
362# CONFIG_AT1700 is not set
363# CONFIG_DEPCA is not set
364# CONFIG_HP100 is not set
365# CONFIG_NET_ISA is not set
366# CONFIG_NET_PCI is not set
367# CONFIG_NET_POCKET is not set
368
369#
370# Ethernet (1000 Mbit)
371#
372# CONFIG_ACENIC is not set
373# CONFIG_DL2K is not set
374# CONFIG_E1000 is not set
375# CONFIG_NS83820 is not set
376# CONFIG_HAMACHI is not set
377# CONFIG_YELLOWFIN is not set
378# CONFIG_R8169 is not set
379# CONFIG_SK98LIN is not set
380# CONFIG_TIGON3 is not set
381
382#
383# Ethernet (10000 Mbit)
384#
385# CONFIG_IXGB is not set
386# CONFIG_S2IO is not set
387
388#
389# Token Ring devices
390#
391# CONFIG_TR is not set
392
393#
394# Wireless LAN (non-hamradio)
395#
396# CONFIG_NET_RADIO is not set
397
398#
399# Wan interfaces
400#
401# CONFIG_WAN is not set
402# CONFIG_FDDI is not set
403# CONFIG_HIPPI is not set
404# CONFIG_PPP is not set
405# CONFIG_SLIP is not set
406# CONFIG_SHAPER is not set
407# CONFIG_NETCONSOLE is not set
408
409#
410# ISDN subsystem
411#
412# CONFIG_ISDN is not set
413
414#
415# Telephony Support
416#
417# CONFIG_PHONE is not set
418
419#
420# Input device support
421#
422CONFIG_INPUT=y
423
424#
425# Userland interfaces
426#
427CONFIG_INPUT_MOUSEDEV=y
428CONFIG_INPUT_MOUSEDEV_PSAUX=y
429CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
430CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
431# CONFIG_INPUT_JOYDEV is not set
432# CONFIG_INPUT_TSDEV is not set
433# CONFIG_INPUT_EVDEV is not set
434# CONFIG_INPUT_EVBUG is not set
435
436#
437# Input I/O drivers
438#
439# CONFIG_GAMEPORT is not set
440CONFIG_SOUND_GAMEPORT=y
441CONFIG_SERIO=y
442# CONFIG_SERIO_I8042 is not set
443CONFIG_SERIO_SERPORT=y
444# CONFIG_SERIO_CT82C710 is not set
445# CONFIG_SERIO_PCIPS2 is not set
446# CONFIG_SERIO_LIBPS2 is not set
447CONFIG_SERIO_RAW=y
448
449#
450# Input Device Drivers
451#
452# CONFIG_INPUT_KEYBOARD is not set
453# CONFIG_INPUT_MOUSE is not set
454# CONFIG_INPUT_JOYSTICK is not set
455# CONFIG_INPUT_TOUCHSCREEN is not set
456# CONFIG_INPUT_MISC is not set
457
458#
459# Character devices
460#
461CONFIG_VT=y
462CONFIG_VT_CONSOLE=y
463CONFIG_HW_CONSOLE=y
464# CONFIG_SERIAL_NONSTANDARD is not set
465
466#
467# Serial drivers
468#
469CONFIG_SERIAL_8250=y
470CONFIG_SERIAL_8250_CONSOLE=y
471CONFIG_SERIAL_8250_NR_UARTS=4
472# CONFIG_SERIAL_8250_EXTENDED is not set
473
474#
475# Non-8250 serial port support
476#
477CONFIG_SERIAL_CORE=y
478CONFIG_SERIAL_CORE_CONSOLE=y
479CONFIG_UNIX98_PTYS=y
480CONFIG_LEGACY_PTYS=y
481CONFIG_LEGACY_PTY_COUNT=256
482
483#
484# IPMI
485#
486# CONFIG_IPMI_HANDLER is not set
487
488#
489# Watchdog Cards
490#
491# CONFIG_WATCHDOG is not set
492# CONFIG_RTC is not set
493# CONFIG_GEN_RTC is not set
494# CONFIG_DTLK is not set
495# CONFIG_R3964 is not set
496# CONFIG_APPLICOM is not set
497
498#
499# Ftape, the floppy tape device driver
500#
501# CONFIG_DRM is not set
502# CONFIG_RAW_DRIVER is not set
503
504#
505# I2C support
506#
507# CONFIG_I2C is not set
508
509#
510# Dallas's 1-wire bus
511#
512# CONFIG_W1 is not set
513
514#
515# Misc devices
516#
517
518#
519# Multimedia devices
520#
521# CONFIG_VIDEO_DEV is not set
522
523#
524# Digital Video Broadcasting Devices
525#
526# CONFIG_DVB is not set
527
528#
529# Graphics support
530#
531CONFIG_FB=y
532# CONFIG_FB_MODE_HELPERS is not set
533# CONFIG_FB_TILEBLITTING is not set
534# CONFIG_FB_CIRRUS is not set
535# CONFIG_FB_PM2 is not set
536# CONFIG_FB_CYBER2000 is not set
537# CONFIG_FB_ASILIANT is not set
538# CONFIG_FB_IMSTT is not set
539# CONFIG_FB_RIVA is not set
540# CONFIG_FB_MATROX is not set
541# CONFIG_FB_RADEON_OLD is not set
542# CONFIG_FB_RADEON is not set
543# CONFIG_FB_ATY128 is not set
544# CONFIG_FB_ATY is not set
545# CONFIG_FB_SAVAGE is not set
546# CONFIG_FB_SIS is not set
547# CONFIG_FB_NEOMAGIC is not set
548# CONFIG_FB_KYRO is not set
549# CONFIG_FB_3DFX is not set
550# CONFIG_FB_VOODOO1 is not set
551# CONFIG_FB_TRIDENT is not set
552# CONFIG_FB_E1356 is not set
553# CONFIG_FB_VIRTUAL is not set
554
555#
556# Console display driver support
557#
558# CONFIG_VGA_CONSOLE is not set
559# CONFIG_MDA_CONSOLE is not set
560CONFIG_DUMMY_CONSOLE=y
561# CONFIG_FRAMEBUFFER_CONSOLE is not set
562
563#
564# Logo configuration
565#
566# CONFIG_LOGO is not set
567# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
568
569#
570# Sound
571#
572# CONFIG_SOUND is not set
573
574#
575# USB support
576#
577# CONFIG_USB is not set
578CONFIG_USB_ARCH_HAS_HCD=y
579CONFIG_USB_ARCH_HAS_OHCI=y
580
581#
582# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
583#
584
585#
586# USB Gadget Support
587#
588# CONFIG_USB_GADGET is not set
589
590#
591# MMC/SD Card support
592#
593# CONFIG_MMC is not set
594
595#
596# InfiniBand support
597#
598# CONFIG_INFINIBAND is not set
599
600#
601# File systems
602#
603CONFIG_EXT2_FS=y
604# CONFIG_EXT2_FS_XATTR is not set
605# CONFIG_EXT3_FS is not set
606# CONFIG_JBD is not set
607# CONFIG_REISERFS_FS is not set
608# CONFIG_JFS_FS is not set
609# CONFIG_XFS_FS is not set
610# CONFIG_MINIX_FS is not set
611# CONFIG_ROMFS_FS is not set
612# CONFIG_QUOTA is not set
613CONFIG_DNOTIFY=y
614# CONFIG_AUTOFS_FS is not set
615# CONFIG_AUTOFS4_FS is not set
616
617#
618# CD-ROM/DVD Filesystems
619#
620# CONFIG_ISO9660_FS is not set
621# CONFIG_UDF_FS is not set
622
623#
624# DOS/FAT/NT Filesystems
625#
626# CONFIG_MSDOS_FS is not set
627# CONFIG_VFAT_FS is not set
628# CONFIG_NTFS_FS is not set
629
630#
631# Pseudo filesystems
632#
633CONFIG_PROC_FS=y
634CONFIG_PROC_KCORE=y
635CONFIG_SYSFS=y
636# CONFIG_DEVFS_FS is not set
637CONFIG_DEVPTS_FS_XATTR=y
638CONFIG_DEVPTS_FS_SECURITY=y
639# CONFIG_TMPFS is not set
640# CONFIG_HUGETLB_PAGE is not set
641CONFIG_RAMFS=y
642
643#
644# Miscellaneous filesystems
645#
646# CONFIG_ADFS_FS is not set
647# CONFIG_AFFS_FS is not set
648# CONFIG_HFS_FS is not set
649# CONFIG_HFSPLUS_FS is not set
650# CONFIG_BEFS_FS is not set
651# CONFIG_BFS_FS is not set
652# CONFIG_EFS_FS is not set
653# CONFIG_CRAMFS is not set
654# CONFIG_VXFS_FS is not set
655# CONFIG_HPFS_FS is not set
656# CONFIG_QNX4FS_FS is not set
657# CONFIG_SYSV_FS is not set
658# CONFIG_UFS_FS is not set
659
660#
661# Network File Systems
662#
663CONFIG_NFS_FS=y
664# CONFIG_NFS_V3 is not set
665# CONFIG_NFS_V4 is not set
666# CONFIG_NFS_DIRECTIO is not set
667# CONFIG_NFSD is not set
668CONFIG_ROOT_NFS=y
669CONFIG_LOCKD=y
670# CONFIG_EXPORTFS is not set
671CONFIG_SUNRPC=y
672# CONFIG_RPCSEC_GSS_KRB5 is not set
673# CONFIG_RPCSEC_GSS_SPKM3 is not set
674# CONFIG_SMB_FS is not set
675# CONFIG_CIFS is not set
676# CONFIG_NCP_FS is not set
677# CONFIG_CODA_FS is not set
678# CONFIG_AFS_FS is not set
679
680#
681# Partition Types
682#
683# CONFIG_PARTITION_ADVANCED is not set
684CONFIG_MSDOS_PARTITION=y
685
686#
687# Native Language Support
688#
689# CONFIG_NLS is not set
690
691#
692# Profiling support
693#
694# CONFIG_PROFILING is not set
695
696#
697# Kernel hacking
698#
699# CONFIG_DEBUG_KERNEL is not set
700CONFIG_CROSSCOMPILE=y
701CONFIG_CMDLINE="ip=any"
702
703#
704# Security options
705#
706CONFIG_KEYS=y
707CONFIG_KEYS_DEBUG_PROC_KEYS=y
708# CONFIG_SECURITY is not set
709
710#
711# Cryptographic options
712#
713# CONFIG_CRYPTO is not set
714
715#
716# Hardware crypto devices
717#
718
719#
720# Library routines
721#
722# CONFIG_CRC_CCITT is not set
723# CONFIG_CRC32 is not set
724# CONFIG_LIBCRC32C is not set
725CONFIG_GENERIC_HARDIRQS=y
726CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ddb5477_defconfig b/arch/mips/configs/ddb5477_defconfig
new file mode 100644
index 000000000000..5a032cdefd63
--- /dev/null
+++ b/arch/mips/configs/ddb5477_defconfig
@@ -0,0 +1,680 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:02 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48# CONFIG_MODULES is not set
49
50#
51# Machine selection
52#
53# CONFIG_MACH_JAZZ is not set
54# CONFIG_MACH_VR41XX is not set
55# CONFIG_TOSHIBA_JMR3927 is not set
56# CONFIG_MIPS_COBALT is not set
57# CONFIG_MACH_DECSTATION is not set
58# CONFIG_MIPS_EV64120 is not set
59# CONFIG_MIPS_EV96100 is not set
60# CONFIG_MIPS_IVR is not set
61# CONFIG_LASAT is not set
62# CONFIG_MIPS_ITE8172 is not set
63# CONFIG_MIPS_ATLAS is not set
64# CONFIG_MIPS_MALTA is not set
65# CONFIG_MIPS_SEAD is not set
66# CONFIG_MOMENCO_OCELOT is not set
67# CONFIG_MOMENCO_OCELOT_G is not set
68# CONFIG_MOMENCO_OCELOT_C is not set
69# CONFIG_MOMENCO_OCELOT_3 is not set
70# CONFIG_MOMENCO_JAGUAR_ATX is not set
71# CONFIG_PMC_YOSEMITE is not set
72# CONFIG_DDB5074 is not set
73# CONFIG_DDB5476 is not set
74CONFIG_DDB5477=y
75CONFIG_DDB5477_BUS_FREQUENCY=0
76# CONFIG_NEC_OSPREY is not set
77# CONFIG_SGI_IP22 is not set
78# CONFIG_SOC_AU1X00 is not set
79# CONFIG_SIBYTE_SB1xxx_SOC is not set
80# CONFIG_SNI_RM200_PCI is not set
81# CONFIG_TOSHIBA_RBTX4927 is not set
82CONFIG_RWSEM_GENERIC_SPINLOCK=y
83CONFIG_GENERIC_CALIBRATE_DELAY=y
84CONFIG_HAVE_DEC_LOCK=y
85CONFIG_DMA_NONCOHERENT=y
86CONFIG_I8259=y
87CONFIG_CPU_LITTLE_ENDIAN=y
88CONFIG_IRQ_CPU=y
89CONFIG_DDB5XXX_COMMON=y
90CONFIG_MIPS_L1_CACHE_SHIFT=5
91
92#
93# CPU selection
94#
95# CONFIG_CPU_MIPS32 is not set
96# CONFIG_CPU_MIPS64 is not set
97# CONFIG_CPU_R3000 is not set
98# CONFIG_CPU_TX39XX is not set
99# CONFIG_CPU_VR41XX is not set
100# CONFIG_CPU_R4300 is not set
101# CONFIG_CPU_R4X00 is not set
102# CONFIG_CPU_TX49XX is not set
103# CONFIG_CPU_R5000 is not set
104CONFIG_CPU_R5432=y
105# CONFIG_CPU_R6000 is not set
106# CONFIG_CPU_NEVADA is not set
107# CONFIG_CPU_R8000 is not set
108# CONFIG_CPU_R10000 is not set
109# CONFIG_CPU_RM7000 is not set
110# CONFIG_CPU_RM9000 is not set
111# CONFIG_CPU_SB1 is not set
112CONFIG_PAGE_SIZE_4KB=y
113# CONFIG_PAGE_SIZE_8KB is not set
114# CONFIG_PAGE_SIZE_16KB is not set
115# CONFIG_PAGE_SIZE_64KB is not set
116# CONFIG_CPU_ADVANCED is not set
117CONFIG_CPU_HAS_LLSC=y
118CONFIG_CPU_HAS_LLDSCD=y
119CONFIG_CPU_HAS_SYNC=y
120# CONFIG_PREEMPT is not set
121
122#
123# Bus options (PCI, PCMCIA, EISA, ISA, TC)
124#
125CONFIG_HW_HAS_PCI=y
126CONFIG_PCI=y
127CONFIG_PCI_LEGACY_PROC=y
128CONFIG_PCI_NAMES=y
129CONFIG_MMU=y
130
131#
132# PCCARD (PCMCIA/CardBus) support
133#
134# CONFIG_PCCARD is not set
135
136#
137# PC-card bridges
138#
139
140#
141# PCI Hotplug Support
142#
143# CONFIG_HOTPLUG_PCI is not set
144
145#
146# Executable file formats
147#
148CONFIG_BINFMT_ELF=y
149# CONFIG_BINFMT_MISC is not set
150CONFIG_TRAD_SIGNALS=y
151
152#
153# Device Drivers
154#
155
156#
157# Generic Driver Options
158#
159CONFIG_STANDALONE=y
160CONFIG_PREVENT_FIRMWARE_BUILD=y
161# CONFIG_FW_LOADER is not set
162
163#
164# Memory Technology Devices (MTD)
165#
166# CONFIG_MTD is not set
167
168#
169# Parallel port support
170#
171# CONFIG_PARPORT is not set
172
173#
174# Plug and Play support
175#
176
177#
178# Block devices
179#
180# CONFIG_BLK_DEV_FD is not set
181# CONFIG_BLK_CPQ_DA is not set
182# CONFIG_BLK_CPQ_CISS_DA is not set
183# CONFIG_BLK_DEV_DAC960 is not set
184# CONFIG_BLK_DEV_UMEM is not set
185# CONFIG_BLK_DEV_COW_COMMON is not set
186# CONFIG_BLK_DEV_LOOP is not set
187# CONFIG_BLK_DEV_NBD is not set
188# CONFIG_BLK_DEV_SX8 is not set
189# CONFIG_BLK_DEV_RAM is not set
190CONFIG_BLK_DEV_RAM_COUNT=16
191CONFIG_INITRAMFS_SOURCE=""
192# CONFIG_LBD is not set
193CONFIG_CDROM_PKTCDVD=y
194CONFIG_CDROM_PKTCDVD_BUFFERS=8
195# CONFIG_CDROM_PKTCDVD_WCACHE is not set
196
197#
198# IO Schedulers
199#
200CONFIG_IOSCHED_NOOP=y
201CONFIG_IOSCHED_AS=y
202CONFIG_IOSCHED_DEADLINE=y
203CONFIG_IOSCHED_CFQ=y
204CONFIG_ATA_OVER_ETH=y
205
206#
207# ATA/ATAPI/MFM/RLL support
208#
209# CONFIG_IDE is not set
210
211#
212# SCSI device support
213#
214# CONFIG_SCSI is not set
215
216#
217# Multi-device support (RAID and LVM)
218#
219# CONFIG_MD is not set
220
221#
222# Fusion MPT device support
223#
224
225#
226# IEEE 1394 (FireWire) support
227#
228# CONFIG_IEEE1394 is not set
229
230#
231# I2O device support
232#
233# CONFIG_I2O is not set
234
235#
236# Networking support
237#
238CONFIG_NET=y
239
240#
241# Networking options
242#
243CONFIG_PACKET=y
244# CONFIG_PACKET_MMAP is not set
245CONFIG_NETLINK_DEV=y
246CONFIG_UNIX=y
247CONFIG_NET_KEY=y
248CONFIG_INET=y
249# CONFIG_IP_MULTICAST is not set
250# CONFIG_IP_ADVANCED_ROUTER is not set
251CONFIG_IP_PNP=y
252# CONFIG_IP_PNP_DHCP is not set
253CONFIG_IP_PNP_BOOTP=y
254# CONFIG_IP_PNP_RARP is not set
255# CONFIG_NET_IPIP is not set
256# CONFIG_NET_IPGRE is not set
257# CONFIG_ARPD is not set
258# CONFIG_SYN_COOKIES is not set
259# CONFIG_INET_AH is not set
260# CONFIG_INET_ESP is not set
261# CONFIG_INET_IPCOMP is not set
262CONFIG_INET_TUNNEL=y
263CONFIG_IP_TCPDIAG=y
264# CONFIG_IP_TCPDIAG_IPV6 is not set
265# CONFIG_IPV6 is not set
266# CONFIG_NETFILTER is not set
267CONFIG_XFRM=y
268CONFIG_XFRM_USER=y
269
270#
271# SCTP Configuration (EXPERIMENTAL)
272#
273# CONFIG_IP_SCTP is not set
274# CONFIG_ATM is not set
275# CONFIG_BRIDGE is not set
276# CONFIG_VLAN_8021Q is not set
277# CONFIG_DECNET is not set
278# CONFIG_LLC2 is not set
279# CONFIG_IPX is not set
280# CONFIG_ATALK is not set
281# CONFIG_X25 is not set
282# CONFIG_LAPB is not set
283# CONFIG_NET_DIVERT is not set
284# CONFIG_ECONET is not set
285# CONFIG_WAN_ROUTER is not set
286
287#
288# QoS and/or fair queueing
289#
290# CONFIG_NET_SCHED is not set
291# CONFIG_NET_CLS_ROUTE is not set
292
293#
294# Network testing
295#
296# CONFIG_NET_PKTGEN is not set
297# CONFIG_NETPOLL is not set
298# CONFIG_NET_POLL_CONTROLLER is not set
299# CONFIG_HAMRADIO is not set
300# CONFIG_IRDA is not set
301# CONFIG_BT is not set
302CONFIG_NETDEVICES=y
303# CONFIG_DUMMY is not set
304# CONFIG_BONDING is not set
305# CONFIG_EQUALIZER is not set
306# CONFIG_TUN is not set
307# CONFIG_ETHERTAP is not set
308
309#
310# ARCnet devices
311#
312# CONFIG_ARCNET is not set
313
314#
315# Ethernet (10 or 100Mbit)
316#
317CONFIG_NET_ETHERNET=y
318CONFIG_MII=y
319# CONFIG_HAPPYMEAL is not set
320# CONFIG_SUNGEM is not set
321# CONFIG_NET_VENDOR_3COM is not set
322
323#
324# Tulip family network device support
325#
326# CONFIG_NET_TULIP is not set
327# CONFIG_HP100 is not set
328CONFIG_NET_PCI=y
329CONFIG_PCNET32=y
330# CONFIG_AMD8111_ETH is not set
331# CONFIG_ADAPTEC_STARFIRE is not set
332# CONFIG_B44 is not set
333# CONFIG_FORCEDETH is not set
334# CONFIG_DGRS is not set
335# CONFIG_EEPRO100 is not set
336# CONFIG_E100 is not set
337# CONFIG_FEALNX is not set
338# CONFIG_NATSEMI is not set
339# CONFIG_NE2K_PCI is not set
340# CONFIG_8139CP is not set
341# CONFIG_8139TOO is not set
342# CONFIG_SIS900 is not set
343# CONFIG_EPIC100 is not set
344# CONFIG_SUNDANCE is not set
345# CONFIG_TLAN is not set
346# CONFIG_VIA_RHINE is not set
347# CONFIG_LAN_SAA9730 is not set
348
349#
350# Ethernet (1000 Mbit)
351#
352# CONFIG_ACENIC is not set
353# CONFIG_DL2K is not set
354# CONFIG_E1000 is not set
355# CONFIG_NS83820 is not set
356# CONFIG_HAMACHI is not set
357# CONFIG_YELLOWFIN is not set
358# CONFIG_R8169 is not set
359# CONFIG_SK98LIN is not set
360# CONFIG_VIA_VELOCITY is not set
361# CONFIG_TIGON3 is not set
362
363#
364# Ethernet (10000 Mbit)
365#
366# CONFIG_IXGB is not set
367# CONFIG_S2IO is not set
368
369#
370# Token Ring devices
371#
372# CONFIG_TR is not set
373
374#
375# Wireless LAN (non-hamradio)
376#
377# CONFIG_NET_RADIO is not set
378
379#
380# Wan interfaces
381#
382# CONFIG_WAN is not set
383# CONFIG_FDDI is not set
384# CONFIG_HIPPI is not set
385# CONFIG_PPP is not set
386# CONFIG_SLIP is not set
387# CONFIG_SHAPER is not set
388# CONFIG_NETCONSOLE is not set
389
390#
391# ISDN subsystem
392#
393# CONFIG_ISDN is not set
394
395#
396# Telephony Support
397#
398# CONFIG_PHONE is not set
399
400#
401# Input device support
402#
403CONFIG_INPUT=y
404
405#
406# Userland interfaces
407#
408CONFIG_INPUT_MOUSEDEV=y
409CONFIG_INPUT_MOUSEDEV_PSAUX=y
410CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
411CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
412# CONFIG_INPUT_JOYDEV is not set
413# CONFIG_INPUT_TSDEV is not set
414# CONFIG_INPUT_EVDEV is not set
415# CONFIG_INPUT_EVBUG is not set
416
417#
418# Input I/O drivers
419#
420# CONFIG_GAMEPORT is not set
421CONFIG_SOUND_GAMEPORT=y
422CONFIG_SERIO=y
423# CONFIG_SERIO_I8042 is not set
424CONFIG_SERIO_SERPORT=y
425# CONFIG_SERIO_CT82C710 is not set
426# CONFIG_SERIO_PCIPS2 is not set
427# CONFIG_SERIO_LIBPS2 is not set
428CONFIG_SERIO_RAW=y
429
430#
431# Input Device Drivers
432#
433# CONFIG_INPUT_KEYBOARD is not set
434# CONFIG_INPUT_MOUSE is not set
435# CONFIG_INPUT_JOYSTICK is not set
436# CONFIG_INPUT_TOUCHSCREEN is not set
437# CONFIG_INPUT_MISC is not set
438
439#
440# Character devices
441#
442CONFIG_VT=y
443CONFIG_VT_CONSOLE=y
444CONFIG_HW_CONSOLE=y
445# CONFIG_SERIAL_NONSTANDARD is not set
446
447#
448# Serial drivers
449#
450CONFIG_SERIAL_8250=y
451CONFIG_SERIAL_8250_CONSOLE=y
452CONFIG_SERIAL_8250_NR_UARTS=4
453# CONFIG_SERIAL_8250_EXTENDED is not set
454
455#
456# Non-8250 serial port support
457#
458CONFIG_SERIAL_CORE=y
459CONFIG_SERIAL_CORE_CONSOLE=y
460CONFIG_UNIX98_PTYS=y
461CONFIG_LEGACY_PTYS=y
462CONFIG_LEGACY_PTY_COUNT=256
463
464#
465# IPMI
466#
467# CONFIG_IPMI_HANDLER is not set
468
469#
470# Watchdog Cards
471#
472# CONFIG_WATCHDOG is not set
473# CONFIG_RTC is not set
474# CONFIG_GEN_RTC is not set
475# CONFIG_DTLK is not set
476# CONFIG_R3964 is not set
477# CONFIG_APPLICOM is not set
478
479#
480# Ftape, the floppy tape device driver
481#
482# CONFIG_DRM is not set
483# CONFIG_RAW_DRIVER is not set
484
485#
486# I2C support
487#
488# CONFIG_I2C is not set
489
490#
491# Dallas's 1-wire bus
492#
493# CONFIG_W1 is not set
494
495#
496# Misc devices
497#
498
499#
500# Multimedia devices
501#
502# CONFIG_VIDEO_DEV is not set
503
504#
505# Digital Video Broadcasting Devices
506#
507# CONFIG_DVB is not set
508
509#
510# Graphics support
511#
512# CONFIG_FB is not set
513
514#
515# Console display driver support
516#
517# CONFIG_VGA_CONSOLE is not set
518CONFIG_DUMMY_CONSOLE=y
519# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
520
521#
522# Sound
523#
524# CONFIG_SOUND is not set
525
526#
527# USB support
528#
529# CONFIG_USB is not set
530CONFIG_USB_ARCH_HAS_HCD=y
531CONFIG_USB_ARCH_HAS_OHCI=y
532
533#
534# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
535#
536
537#
538# USB Gadget Support
539#
540# CONFIG_USB_GADGET is not set
541
542#
543# MMC/SD Card support
544#
545# CONFIG_MMC is not set
546
547#
548# InfiniBand support
549#
550# CONFIG_INFINIBAND is not set
551
552#
553# File systems
554#
555CONFIG_EXT2_FS=y
556# CONFIG_EXT2_FS_XATTR is not set
557# CONFIG_EXT3_FS is not set
558# CONFIG_JBD is not set
559# CONFIG_REISERFS_FS is not set
560# CONFIG_JFS_FS is not set
561# CONFIG_XFS_FS is not set
562# CONFIG_MINIX_FS is not set
563# CONFIG_ROMFS_FS is not set
564# CONFIG_QUOTA is not set
565CONFIG_DNOTIFY=y
566CONFIG_AUTOFS_FS=y
567CONFIG_AUTOFS4_FS=y
568
569#
570# CD-ROM/DVD Filesystems
571#
572# CONFIG_ISO9660_FS is not set
573# CONFIG_UDF_FS is not set
574
575#
576# DOS/FAT/NT Filesystems
577#
578# CONFIG_MSDOS_FS is not set
579# CONFIG_VFAT_FS is not set
580# CONFIG_NTFS_FS is not set
581
582#
583# Pseudo filesystems
584#
585CONFIG_PROC_FS=y
586CONFIG_PROC_KCORE=y
587CONFIG_SYSFS=y
588# CONFIG_DEVFS_FS is not set
589CONFIG_DEVPTS_FS_XATTR=y
590CONFIG_DEVPTS_FS_SECURITY=y
591# CONFIG_TMPFS is not set
592# CONFIG_HUGETLB_PAGE is not set
593CONFIG_RAMFS=y
594
595#
596# Miscellaneous filesystems
597#
598# CONFIG_ADFS_FS is not set
599# CONFIG_AFFS_FS is not set
600# CONFIG_HFS_FS is not set
601# CONFIG_HFSPLUS_FS is not set
602# CONFIG_BEFS_FS is not set
603# CONFIG_BFS_FS is not set
604# CONFIG_EFS_FS is not set
605# CONFIG_CRAMFS is not set
606# CONFIG_VXFS_FS is not set
607# CONFIG_HPFS_FS is not set
608# CONFIG_QNX4FS_FS is not set
609# CONFIG_SYSV_FS is not set
610# CONFIG_UFS_FS is not set
611
612#
613# Network File Systems
614#
615CONFIG_NFS_FS=y
616# CONFIG_NFS_V3 is not set
617# CONFIG_NFS_V4 is not set
618# CONFIG_NFS_DIRECTIO is not set
619CONFIG_NFSD=y
620# CONFIG_NFSD_V3 is not set
621# CONFIG_NFSD_TCP is not set
622CONFIG_ROOT_NFS=y
623CONFIG_LOCKD=y
624CONFIG_EXPORTFS=y
625CONFIG_SUNRPC=y
626# CONFIG_RPCSEC_GSS_KRB5 is not set
627# CONFIG_RPCSEC_GSS_SPKM3 is not set
628# CONFIG_SMB_FS is not set
629# CONFIG_CIFS is not set
630# CONFIG_NCP_FS is not set
631# CONFIG_CODA_FS is not set
632# CONFIG_AFS_FS is not set
633
634#
635# Partition Types
636#
637# CONFIG_PARTITION_ADVANCED is not set
638CONFIG_MSDOS_PARTITION=y
639
640#
641# Native Language Support
642#
643# CONFIG_NLS is not set
644
645#
646# Profiling support
647#
648# CONFIG_PROFILING is not set
649
650#
651# Kernel hacking
652#
653# CONFIG_DEBUG_KERNEL is not set
654CONFIG_CROSSCOMPILE=y
655CONFIG_CMDLINE="ip=any"
656
657#
658# Security options
659#
660CONFIG_KEYS=y
661CONFIG_KEYS_DEBUG_PROC_KEYS=y
662# CONFIG_SECURITY is not set
663
664#
665# Cryptographic options
666#
667# CONFIG_CRYPTO is not set
668
669#
670# Hardware crypto devices
671#
672
673#
674# Library routines
675#
676# CONFIG_CRC_CCITT is not set
677CONFIG_CRC32=y
678# CONFIG_LIBCRC32C is not set
679CONFIG_GENERIC_HARDIRQS=y
680CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
new file mode 100644
index 000000000000..32ada79da9d8
--- /dev/null
+++ b/arch/mips/configs/decstation_defconfig
@@ -0,0 +1,660 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:03 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63CONFIG_MACH_DECSTATION=y
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83# CONFIG_SOC_AU1X00 is not set
84# CONFIG_SIBYTE_SB1xxx_SOC is not set
85# CONFIG_SNI_RM200_PCI is not set
86# CONFIG_TOSHIBA_RBTX4927 is not set
87CONFIG_RWSEM_GENERIC_SPINLOCK=y
88CONFIG_GENERIC_CALIBRATE_DELAY=y
89CONFIG_HAVE_DEC_LOCK=y
90CONFIG_DMA_NONCOHERENT=y
91CONFIG_EARLY_PRINTK=y
92CONFIG_CPU_LITTLE_ENDIAN=y
93CONFIG_IRQ_CPU=y
94CONFIG_BOOT_ELF32=y
95CONFIG_MIPS_L1_CACHE_SHIFT=4
96
97#
98# CPU selection
99#
100# CONFIG_CPU_MIPS32 is not set
101# CONFIG_CPU_MIPS64 is not set
102CONFIG_CPU_R3000=y
103# CONFIG_CPU_TX39XX is not set
104# CONFIG_CPU_VR41XX is not set
105# CONFIG_CPU_R4300 is not set
106# CONFIG_CPU_R4X00 is not set
107# CONFIG_CPU_TX49XX is not set
108# CONFIG_CPU_R5000 is not set
109# CONFIG_CPU_R5432 is not set
110# CONFIG_CPU_R6000 is not set
111# CONFIG_CPU_NEVADA is not set
112# CONFIG_CPU_R8000 is not set
113# CONFIG_CPU_R10000 is not set
114# CONFIG_CPU_RM7000 is not set
115# CONFIG_CPU_RM9000 is not set
116# CONFIG_CPU_SB1 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
121# CONFIG_CPU_ADVANCED is not set
122CONFIG_CPU_HAS_WB=y
123# CONFIG_PREEMPT is not set
124
125#
126# Bus options (PCI, PCMCIA, EISA, ISA, TC)
127#
128CONFIG_TC=y
129CONFIG_MMU=y
130
131#
132# PCCARD (PCMCIA/CardBus) support
133#
134# CONFIG_PCCARD is not set
135
136#
137# PC-card bridges
138#
139
140#
141# PCI Hotplug Support
142#
143
144#
145# Executable file formats
146#
147CONFIG_BINFMT_ELF=y
148# CONFIG_BINFMT_MISC is not set
149CONFIG_TRAD_SIGNALS=y
150
151#
152# Device Drivers
153#
154
155#
156# Generic Driver Options
157#
158CONFIG_STANDALONE=y
159CONFIG_PREVENT_FIRMWARE_BUILD=y
160# CONFIG_FW_LOADER is not set
161
162#
163# Memory Technology Devices (MTD)
164#
165# CONFIG_MTD is not set
166
167#
168# Parallel port support
169#
170# CONFIG_PARPORT is not set
171
172#
173# Plug and Play support
174#
175
176#
177# Block devices
178#
179# CONFIG_BLK_DEV_FD is not set
180# CONFIG_BLK_DEV_COW_COMMON is not set
181# CONFIG_BLK_DEV_LOOP is not set
182# CONFIG_BLK_DEV_NBD is not set
183# CONFIG_BLK_DEV_RAM is not set
184CONFIG_BLK_DEV_RAM_COUNT=16
185CONFIG_INITRAMFS_SOURCE=""
186# CONFIG_LBD is not set
187CONFIG_CDROM_PKTCDVD=m
188CONFIG_CDROM_PKTCDVD_BUFFERS=8
189# CONFIG_CDROM_PKTCDVD_WCACHE is not set
190
191#
192# IO Schedulers
193#
194CONFIG_IOSCHED_NOOP=y
195CONFIG_IOSCHED_AS=y
196CONFIG_IOSCHED_DEADLINE=y
197CONFIG_IOSCHED_CFQ=y
198CONFIG_ATA_OVER_ETH=m
199
200#
201# ATA/ATAPI/MFM/RLL support
202#
203# CONFIG_IDE is not set
204
205#
206# SCSI device support
207#
208CONFIG_SCSI=y
209CONFIG_SCSI_PROC_FS=y
210
211#
212# SCSI support type (disk, tape, CD-ROM)
213#
214CONFIG_BLK_DEV_SD=y
215# CONFIG_CHR_DEV_ST is not set
216# CONFIG_CHR_DEV_OSST is not set
217# CONFIG_BLK_DEV_SR is not set
218# CONFIG_CHR_DEV_SG is not set
219
220#
221# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
222#
223# CONFIG_SCSI_MULTI_LUN is not set
224CONFIG_SCSI_CONSTANTS=y
225# CONFIG_SCSI_LOGGING is not set
226
227#
228# SCSI Transport Attributes
229#
230# CONFIG_SCSI_SPI_ATTRS is not set
231# CONFIG_SCSI_FC_ATTRS is not set
232# CONFIG_SCSI_ISCSI_ATTRS is not set
233
234#
235# SCSI low-level drivers
236#
237CONFIG_SCSI_DECNCR=y
238# CONFIG_SCSI_DECSII is not set
239# CONFIG_SCSI_SATA is not set
240# CONFIG_SCSI_DEBUG is not set
241
242#
243# Multi-device support (RAID and LVM)
244#
245# CONFIG_MD is not set
246
247#
248# Fusion MPT device support
249#
250
251#
252# IEEE 1394 (FireWire) support
253#
254
255#
256# I2O device support
257#
258
259#
260# Networking support
261#
262CONFIG_NET=y
263
264#
265# Networking options
266#
267CONFIG_PACKET=y
268# CONFIG_PACKET_MMAP is not set
269CONFIG_NETLINK_DEV=y
270CONFIG_UNIX=y
271CONFIG_NET_KEY=y
272CONFIG_INET=y
273# CONFIG_IP_MULTICAST is not set
274# CONFIG_IP_ADVANCED_ROUTER is not set
275CONFIG_IP_PNP=y
276# CONFIG_IP_PNP_DHCP is not set
277CONFIG_IP_PNP_BOOTP=y
278# CONFIG_IP_PNP_RARP is not set
279# CONFIG_NET_IPIP is not set
280# CONFIG_NET_IPGRE is not set
281# CONFIG_ARPD is not set
282# CONFIG_SYN_COOKIES is not set
283# CONFIG_INET_AH is not set
284# CONFIG_INET_ESP is not set
285# CONFIG_INET_IPCOMP is not set
286CONFIG_INET_TUNNEL=m
287CONFIG_IP_TCPDIAG=m
288# CONFIG_IP_TCPDIAG_IPV6 is not set
289# CONFIG_IPV6 is not set
290# CONFIG_NETFILTER is not set
291CONFIG_XFRM=y
292CONFIG_XFRM_USER=m
293
294#
295# SCTP Configuration (EXPERIMENTAL)
296#
297# CONFIG_IP_SCTP is not set
298# CONFIG_ATM is not set
299# CONFIG_BRIDGE is not set
300# CONFIG_VLAN_8021Q is not set
301# CONFIG_DECNET is not set
302# CONFIG_LLC2 is not set
303# CONFIG_IPX is not set
304# CONFIG_ATALK is not set
305# CONFIG_X25 is not set
306# CONFIG_LAPB is not set
307# CONFIG_NET_DIVERT is not set
308# CONFIG_ECONET is not set
309# CONFIG_WAN_ROUTER is not set
310
311#
312# QoS and/or fair queueing
313#
314# CONFIG_NET_SCHED is not set
315# CONFIG_NET_CLS_ROUTE is not set
316
317#
318# Network testing
319#
320# CONFIG_NET_PKTGEN is not set
321# CONFIG_NETPOLL is not set
322# CONFIG_NET_POLL_CONTROLLER is not set
323# CONFIG_HAMRADIO is not set
324# CONFIG_IRDA is not set
325# CONFIG_BT is not set
326CONFIG_NETDEVICES=y
327# CONFIG_DUMMY is not set
328# CONFIG_BONDING is not set
329# CONFIG_EQUALIZER is not set
330# CONFIG_TUN is not set
331# CONFIG_ETHERTAP is not set
332
333#
334# Ethernet (10 or 100Mbit)
335#
336CONFIG_NET_ETHERNET=y
337# CONFIG_MII is not set
338CONFIG_DECLANCE=y
339
340#
341# Ethernet (1000 Mbit)
342#
343
344#
345# Ethernet (10000 Mbit)
346#
347
348#
349# Token Ring devices
350#
351
352#
353# Wireless LAN (non-hamradio)
354#
355# CONFIG_NET_RADIO is not set
356
357#
358# Wan interfaces
359#
360# CONFIG_WAN is not set
361# CONFIG_PPP is not set
362# CONFIG_SLIP is not set
363# CONFIG_SHAPER is not set
364# CONFIG_NETCONSOLE is not set
365
366#
367# ISDN subsystem
368#
369# CONFIG_ISDN is not set
370
371#
372# Telephony Support
373#
374# CONFIG_PHONE is not set
375
376#
377# Input device support
378#
379CONFIG_INPUT=y
380
381#
382# Userland interfaces
383#
384CONFIG_INPUT_MOUSEDEV=y
385CONFIG_INPUT_MOUSEDEV_PSAUX=y
386CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
387CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
388# CONFIG_INPUT_JOYDEV is not set
389# CONFIG_INPUT_TSDEV is not set
390# CONFIG_INPUT_EVDEV is not set
391# CONFIG_INPUT_EVBUG is not set
392
393#
394# Input I/O drivers
395#
396# CONFIG_GAMEPORT is not set
397CONFIG_SOUND_GAMEPORT=y
398CONFIG_SERIO=y
399# CONFIG_SERIO_I8042 is not set
400CONFIG_SERIO_SERPORT=y
401# CONFIG_SERIO_CT82C710 is not set
402# CONFIG_SERIO_LIBPS2 is not set
403CONFIG_SERIO_RAW=m
404
405#
406# Input Device Drivers
407#
408# CONFIG_INPUT_KEYBOARD is not set
409# CONFIG_INPUT_MOUSE is not set
410# CONFIG_INPUT_JOYSTICK is not set
411# CONFIG_INPUT_TOUCHSCREEN is not set
412# CONFIG_INPUT_MISC is not set
413
414#
415# Character devices
416#
417CONFIG_VT=y
418CONFIG_VT_CONSOLE=y
419CONFIG_HW_CONSOLE=y
420# CONFIG_SERIAL_NONSTANDARD is not set
421
422#
423# Serial drivers
424#
425# CONFIG_SERIAL_8250 is not set
426
427#
428# Non-8250 serial port support
429#
430CONFIG_SERIAL_DZ=y
431CONFIG_SERIAL_DZ_CONSOLE=y
432CONFIG_SERIAL_CORE=y
433CONFIG_SERIAL_CORE_CONSOLE=y
434CONFIG_UNIX98_PTYS=y
435CONFIG_LEGACY_PTYS=y
436CONFIG_LEGACY_PTY_COUNT=256
437
438#
439# IPMI
440#
441# CONFIG_IPMI_HANDLER is not set
442
443#
444# Watchdog Cards
445#
446# CONFIG_WATCHDOG is not set
447# CONFIG_RTC is not set
448# CONFIG_GEN_RTC is not set
449# CONFIG_DTLK is not set
450# CONFIG_R3964 is not set
451
452#
453# Ftape, the floppy tape device driver
454#
455# CONFIG_DRM is not set
456# CONFIG_RAW_DRIVER is not set
457
458#
459# I2C support
460#
461# CONFIG_I2C is not set
462
463#
464# Dallas's 1-wire bus
465#
466# CONFIG_W1 is not set
467
468#
469# Misc devices
470#
471
472#
473# Multimedia devices
474#
475# CONFIG_VIDEO_DEV is not set
476
477#
478# Digital Video Broadcasting Devices
479#
480# CONFIG_DVB is not set
481
482#
483# Graphics support
484#
485# CONFIG_FB is not set
486
487#
488# Console display driver support
489#
490# CONFIG_VGA_CONSOLE is not set
491CONFIG_DUMMY_CONSOLE=y
492# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
493
494#
495# Sound
496#
497# CONFIG_SOUND is not set
498
499#
500# USB support
501#
502# CONFIG_USB_ARCH_HAS_HCD is not set
503# CONFIG_USB_ARCH_HAS_OHCI is not set
504
505#
506# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
507#
508
509#
510# USB Gadget Support
511#
512# CONFIG_USB_GADGET is not set
513
514#
515# MMC/SD Card support
516#
517# CONFIG_MMC is not set
518
519#
520# InfiniBand support
521#
522# CONFIG_INFINIBAND is not set
523
524#
525# File systems
526#
527CONFIG_EXT2_FS=y
528CONFIG_EXT2_FS_XATTR=y
529CONFIG_EXT2_FS_POSIX_ACL=y
530CONFIG_EXT2_FS_SECURITY=y
531# CONFIG_EXT3_FS is not set
532# CONFIG_JBD is not set
533CONFIG_FS_MBCACHE=y
534# CONFIG_REISERFS_FS is not set
535# CONFIG_JFS_FS is not set
536CONFIG_FS_POSIX_ACL=y
537# CONFIG_XFS_FS is not set
538# CONFIG_MINIX_FS is not set
539# CONFIG_ROMFS_FS is not set
540# CONFIG_QUOTA is not set
541CONFIG_DNOTIFY=y
542# CONFIG_AUTOFS_FS is not set
543# CONFIG_AUTOFS4_FS is not set
544
545#
546# CD-ROM/DVD Filesystems
547#
548# CONFIG_ISO9660_FS is not set
549# CONFIG_UDF_FS is not set
550
551#
552# DOS/FAT/NT Filesystems
553#
554# CONFIG_MSDOS_FS is not set
555# CONFIG_VFAT_FS is not set
556# CONFIG_NTFS_FS is not set
557
558#
559# Pseudo filesystems
560#
561CONFIG_PROC_FS=y
562CONFIG_PROC_KCORE=y
563CONFIG_SYSFS=y
564# CONFIG_DEVFS_FS is not set
565CONFIG_DEVPTS_FS_XATTR=y
566CONFIG_DEVPTS_FS_SECURITY=y
567# CONFIG_TMPFS is not set
568# CONFIG_HUGETLB_PAGE is not set
569CONFIG_RAMFS=y
570
571#
572# Miscellaneous filesystems
573#
574# CONFIG_ADFS_FS is not set
575# CONFIG_AFFS_FS is not set
576# CONFIG_HFS_FS is not set
577# CONFIG_HFSPLUS_FS is not set
578# CONFIG_BEFS_FS is not set
579# CONFIG_BFS_FS is not set
580# CONFIG_EFS_FS is not set
581# CONFIG_CRAMFS is not set
582# CONFIG_VXFS_FS is not set
583# CONFIG_HPFS_FS is not set
584# CONFIG_QNX4FS_FS is not set
585# CONFIG_SYSV_FS is not set
586# CONFIG_UFS_FS is not set
587
588#
589# Network File Systems
590#
591# CONFIG_NFS_FS is not set
592# CONFIG_NFSD is not set
593# CONFIG_EXPORTFS is not set
594# CONFIG_SMB_FS is not set
595# CONFIG_CIFS is not set
596# CONFIG_NCP_FS is not set
597# CONFIG_CODA_FS is not set
598# CONFIG_AFS_FS is not set
599
600#
601# Partition Types
602#
603CONFIG_PARTITION_ADVANCED=y
604# CONFIG_ACORN_PARTITION is not set
605CONFIG_OSF_PARTITION=y
606# CONFIG_AMIGA_PARTITION is not set
607# CONFIG_ATARI_PARTITION is not set
608# CONFIG_MAC_PARTITION is not set
609CONFIG_MSDOS_PARTITION=y
610# CONFIG_BSD_DISKLABEL is not set
611# CONFIG_MINIX_SUBPARTITION is not set
612# CONFIG_SOLARIS_X86_PARTITION is not set
613# CONFIG_UNIXWARE_DISKLABEL is not set
614# CONFIG_LDM_PARTITION is not set
615# CONFIG_SGI_PARTITION is not set
616CONFIG_ULTRIX_PARTITION=y
617# CONFIG_SUN_PARTITION is not set
618# CONFIG_EFI_PARTITION is not set
619
620#
621# Native Language Support
622#
623# CONFIG_NLS is not set
624
625#
626# Profiling support
627#
628# CONFIG_PROFILING is not set
629
630#
631# Kernel hacking
632#
633# CONFIG_DEBUG_KERNEL is not set
634CONFIG_CROSSCOMPILE=y
635CONFIG_CMDLINE=""
636
637#
638# Security options
639#
640CONFIG_KEYS=y
641CONFIG_KEYS_DEBUG_PROC_KEYS=y
642# CONFIG_SECURITY is not set
643
644#
645# Cryptographic options
646#
647# CONFIG_CRYPTO is not set
648
649#
650# Hardware crypto devices
651#
652
653#
654# Library routines
655#
656# CONFIG_CRC_CCITT is not set
657CONFIG_CRC32=y
658CONFIG_LIBCRC32C=m
659CONFIG_GENERIC_HARDIRQS=y
660CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
new file mode 100644
index 000000000000..52074a2085fb
--- /dev/null
+++ b/arch/mips/configs/e55_defconfig
@@ -0,0 +1,683 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:03 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60CONFIG_MACH_VR41XX=y
61# CONFIG_NEC_CMBVR4133 is not set
62CONFIG_CASIO_E55=y
63# CONFIG_IBM_WORKPAD is not set
64# CONFIG_TANBAC_TB0226 is not set
65# CONFIG_TANBAC_TB0229 is not set
66# CONFIG_VICTOR_MPC30X is not set
67# CONFIG_ZAO_CAPCELLA is not set
68# CONFIG_VRC4171 is not set
69# CONFIG_TOSHIBA_JMR3927 is not set
70# CONFIG_MIPS_COBALT is not set
71# CONFIG_MACH_DECSTATION is not set
72# CONFIG_MIPS_EV64120 is not set
73# CONFIG_MIPS_EV96100 is not set
74# CONFIG_MIPS_IVR is not set
75# CONFIG_LASAT is not set
76# CONFIG_MIPS_ITE8172 is not set
77# CONFIG_MIPS_ATLAS is not set
78# CONFIG_MIPS_MALTA is not set
79# CONFIG_MIPS_SEAD is not set
80# CONFIG_MOMENCO_OCELOT is not set
81# CONFIG_MOMENCO_OCELOT_G is not set
82# CONFIG_MOMENCO_OCELOT_C is not set
83# CONFIG_MOMENCO_OCELOT_3 is not set
84# CONFIG_MOMENCO_JAGUAR_ATX is not set
85# CONFIG_PMC_YOSEMITE is not set
86# CONFIG_DDB5074 is not set
87# CONFIG_DDB5476 is not set
88# CONFIG_DDB5477 is not set
89# CONFIG_NEC_OSPREY is not set
90# CONFIG_SGI_IP22 is not set
91# CONFIG_SOC_AU1X00 is not set
92# CONFIG_SIBYTE_SB1xxx_SOC is not set
93# CONFIG_SNI_RM200_PCI is not set
94# CONFIG_TOSHIBA_RBTX4927 is not set
95CONFIG_RWSEM_GENERIC_SPINLOCK=y
96CONFIG_GENERIC_CALIBRATE_DELAY=y
97CONFIG_HAVE_DEC_LOCK=y
98CONFIG_DMA_NONCOHERENT=y
99CONFIG_CPU_LITTLE_ENDIAN=y
100CONFIG_IRQ_CPU=y
101CONFIG_MIPS_L1_CACHE_SHIFT=5
102
103#
104# CPU selection
105#
106# CONFIG_CPU_MIPS32 is not set
107# CONFIG_CPU_MIPS64 is not set
108# CONFIG_CPU_R3000 is not set
109# CONFIG_CPU_TX39XX is not set
110CONFIG_CPU_VR41XX=y
111# CONFIG_CPU_R4300 is not set
112# CONFIG_CPU_R4X00 is not set
113# CONFIG_CPU_TX49XX is not set
114# CONFIG_CPU_R5000 is not set
115# CONFIG_CPU_R5432 is not set
116# CONFIG_CPU_R6000 is not set
117# CONFIG_CPU_NEVADA is not set
118# CONFIG_CPU_R8000 is not set
119# CONFIG_CPU_R10000 is not set
120# CONFIG_CPU_RM7000 is not set
121# CONFIG_CPU_RM9000 is not set
122# CONFIG_CPU_SB1 is not set
123CONFIG_PAGE_SIZE_4KB=y
124# CONFIG_PAGE_SIZE_8KB is not set
125# CONFIG_PAGE_SIZE_16KB is not set
126# CONFIG_PAGE_SIZE_64KB is not set
127# CONFIG_CPU_ADVANCED is not set
128CONFIG_CPU_HAS_SYNC=y
129# CONFIG_PREEMPT is not set
130
131#
132# Bus options (PCI, PCMCIA, EISA, ISA, TC)
133#
134CONFIG_ISA=y
135CONFIG_MMU=y
136
137#
138# PCCARD (PCMCIA/CardBus) support
139#
140# CONFIG_PCCARD is not set
141
142#
143# PC-card bridges
144#
145CONFIG_PCMCIA_PROBE=y
146
147#
148# PCI Hotplug Support
149#
150
151#
152# Executable file formats
153#
154CONFIG_BINFMT_ELF=y
155# CONFIG_BINFMT_MISC is not set
156CONFIG_TRAD_SIGNALS=y
157
158#
159# Device Drivers
160#
161
162#
163# Generic Driver Options
164#
165CONFIG_STANDALONE=y
166CONFIG_PREVENT_FIRMWARE_BUILD=y
167# CONFIG_FW_LOADER is not set
168
169#
170# Memory Technology Devices (MTD)
171#
172# CONFIG_MTD is not set
173
174#
175# Parallel port support
176#
177# CONFIG_PARPORT is not set
178
179#
180# Plug and Play support
181#
182# CONFIG_PNP is not set
183
184#
185# Block devices
186#
187# CONFIG_BLK_DEV_FD is not set
188# CONFIG_BLK_DEV_XD is not set
189# CONFIG_BLK_DEV_COW_COMMON is not set
190# CONFIG_BLK_DEV_LOOP is not set
191# CONFIG_BLK_DEV_NBD is not set
192# CONFIG_BLK_DEV_RAM is not set
193CONFIG_BLK_DEV_RAM_COUNT=16
194CONFIG_INITRAMFS_SOURCE=""
195# CONFIG_LBD is not set
196CONFIG_CDROM_PKTCDVD=m
197CONFIG_CDROM_PKTCDVD_BUFFERS=8
198# CONFIG_CDROM_PKTCDVD_WCACHE is not set
199
200#
201# IO Schedulers
202#
203CONFIG_IOSCHED_NOOP=y
204CONFIG_IOSCHED_AS=y
205CONFIG_IOSCHED_DEADLINE=y
206CONFIG_IOSCHED_CFQ=y
207CONFIG_ATA_OVER_ETH=m
208
209#
210# ATA/ATAPI/MFM/RLL support
211#
212CONFIG_IDE=y
213CONFIG_BLK_DEV_IDE=y
214
215#
216# Please see Documentation/ide.txt for help/info on IDE drives
217#
218# CONFIG_BLK_DEV_IDE_SATA is not set
219CONFIG_BLK_DEV_IDEDISK=y
220# CONFIG_IDEDISK_MULTI_MODE is not set
221# CONFIG_BLK_DEV_IDECD is not set
222# CONFIG_BLK_DEV_IDETAPE is not set
223# CONFIG_BLK_DEV_IDEFLOPPY is not set
224# CONFIG_IDE_TASK_IOCTL is not set
225
226#
227# IDE chipset support/bugfixes
228#
229CONFIG_IDE_GENERIC=y
230# CONFIG_IDE_ARM is not set
231# CONFIG_IDE_CHIPSETS is not set
232# CONFIG_BLK_DEV_IDEDMA is not set
233# CONFIG_IDEDMA_AUTO is not set
234# CONFIG_BLK_DEV_HD is not set
235
236#
237# SCSI device support
238#
239# CONFIG_SCSI is not set
240
241#
242# Old CD-ROM drivers (not SCSI, not IDE)
243#
244# CONFIG_CD_NO_IDESCSI is not set
245
246#
247# Multi-device support (RAID and LVM)
248#
249# CONFIG_MD is not set
250
251#
252# Fusion MPT device support
253#
254
255#
256# IEEE 1394 (FireWire) support
257#
258
259#
260# I2O device support
261#
262
263#
264# Networking support
265#
266CONFIG_NET=y
267
268#
269# Networking options
270#
271CONFIG_PACKET=y
272CONFIG_PACKET_MMAP=y
273CONFIG_NETLINK_DEV=y
274CONFIG_UNIX=y
275CONFIG_NET_KEY=y
276CONFIG_INET=y
277CONFIG_IP_MULTICAST=y
278# CONFIG_IP_ADVANCED_ROUTER is not set
279# CONFIG_IP_PNP is not set
280# CONFIG_NET_IPIP is not set
281# CONFIG_NET_IPGRE is not set
282# CONFIG_IP_MROUTE is not set
283# CONFIG_ARPD is not set
284# CONFIG_SYN_COOKIES is not set
285# CONFIG_INET_AH is not set
286# CONFIG_INET_ESP is not set
287# CONFIG_INET_IPCOMP is not set
288CONFIG_INET_TUNNEL=m
289CONFIG_IP_TCPDIAG=m
290# CONFIG_IP_TCPDIAG_IPV6 is not set
291# CONFIG_IPV6 is not set
292# CONFIG_NETFILTER is not set
293CONFIG_XFRM=y
294CONFIG_XFRM_USER=m
295
296#
297# SCTP Configuration (EXPERIMENTAL)
298#
299# CONFIG_IP_SCTP is not set
300# CONFIG_ATM is not set
301# CONFIG_BRIDGE is not set
302# CONFIG_VLAN_8021Q is not set
303# CONFIG_DECNET is not set
304# CONFIG_LLC2 is not set
305# CONFIG_IPX is not set
306# CONFIG_ATALK is not set
307# CONFIG_X25 is not set
308# CONFIG_LAPB is not set
309# CONFIG_NET_DIVERT is not set
310# CONFIG_ECONET is not set
311# CONFIG_WAN_ROUTER is not set
312
313#
314# QoS and/or fair queueing
315#
316# CONFIG_NET_SCHED is not set
317# CONFIG_NET_CLS_ROUTE is not set
318
319#
320# Network testing
321#
322# CONFIG_NET_PKTGEN is not set
323# CONFIG_NETPOLL is not set
324# CONFIG_NET_POLL_CONTROLLER is not set
325# CONFIG_HAMRADIO is not set
326# CONFIG_IRDA is not set
327# CONFIG_BT is not set
328CONFIG_NETDEVICES=y
329# CONFIG_DUMMY is not set
330# CONFIG_BONDING is not set
331# CONFIG_EQUALIZER is not set
332# CONFIG_TUN is not set
333# CONFIG_ETHERTAP is not set
334
335#
336# ARCnet devices
337#
338# CONFIG_ARCNET is not set
339
340#
341# Ethernet (10 or 100Mbit)
342#
343CONFIG_NET_ETHERNET=y
344# CONFIG_MII is not set
345# CONFIG_NET_VENDOR_3COM is not set
346# CONFIG_LANCE is not set
347# CONFIG_NET_VENDOR_SMC is not set
348# CONFIG_NET_VENDOR_RACAL is not set
349# CONFIG_AT1700 is not set
350# CONFIG_DEPCA is not set
351# CONFIG_HP100 is not set
352# CONFIG_NET_ISA is not set
353# CONFIG_NET_PCI is not set
354# CONFIG_NET_POCKET is not set
355
356#
357# Ethernet (1000 Mbit)
358#
359
360#
361# Ethernet (10000 Mbit)
362#
363
364#
365# Token Ring devices
366#
367# CONFIG_TR is not set
368
369#
370# Wireless LAN (non-hamradio)
371#
372# CONFIG_NET_RADIO is not set
373
374#
375# Wan interfaces
376#
377# CONFIG_WAN is not set
378# CONFIG_PPP is not set
379# CONFIG_SLIP is not set
380# CONFIG_SHAPER is not set
381# CONFIG_NETCONSOLE is not set
382
383#
384# ISDN subsystem
385#
386# CONFIG_ISDN is not set
387
388#
389# Telephony Support
390#
391# CONFIG_PHONE is not set
392
393#
394# Input device support
395#
396CONFIG_INPUT=y
397
398#
399# Userland interfaces
400#
401CONFIG_INPUT_MOUSEDEV=y
402CONFIG_INPUT_MOUSEDEV_PSAUX=y
403CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
404CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
405# CONFIG_INPUT_JOYDEV is not set
406# CONFIG_INPUT_TSDEV is not set
407# CONFIG_INPUT_EVDEV is not set
408# CONFIG_INPUT_EVBUG is not set
409
410#
411# Input I/O drivers
412#
413# CONFIG_GAMEPORT is not set
414CONFIG_SOUND_GAMEPORT=y
415CONFIG_SERIO=y
416CONFIG_SERIO_I8042=y
417CONFIG_SERIO_SERPORT=y
418# CONFIG_SERIO_CT82C710 is not set
419# CONFIG_SERIO_LIBPS2 is not set
420CONFIG_SERIO_RAW=m
421
422#
423# Input Device Drivers
424#
425# CONFIG_INPUT_KEYBOARD is not set
426# CONFIG_INPUT_MOUSE is not set
427# CONFIG_INPUT_JOYSTICK is not set
428# CONFIG_INPUT_TOUCHSCREEN is not set
429# CONFIG_INPUT_MISC is not set
430
431#
432# Character devices
433#
434CONFIG_VT=y
435CONFIG_VT_CONSOLE=y
436CONFIG_HW_CONSOLE=y
437# CONFIG_SERIAL_NONSTANDARD is not set
438
439#
440# Serial drivers
441#
442CONFIG_SERIAL_8250=y
443CONFIG_SERIAL_8250_CONSOLE=y
444CONFIG_SERIAL_8250_NR_UARTS=4
445# CONFIG_SERIAL_8250_EXTENDED is not set
446
447#
448# Non-8250 serial port support
449#
450CONFIG_SERIAL_CORE=y
451CONFIG_SERIAL_CORE_CONSOLE=y
452CONFIG_UNIX98_PTYS=y
453CONFIG_LEGACY_PTYS=y
454CONFIG_LEGACY_PTY_COUNT=256
455
456#
457# IPMI
458#
459# CONFIG_IPMI_HANDLER is not set
460
461#
462# Watchdog Cards
463#
464CONFIG_WATCHDOG=y
465# CONFIG_WATCHDOG_NOWAYOUT is not set
466
467#
468# Watchdog Device Drivers
469#
470# CONFIG_SOFT_WATCHDOG is not set
471
472#
473# ISA-based Watchdog Cards
474#
475# CONFIG_PCWATCHDOG is not set
476# CONFIG_MIXCOMWD is not set
477# CONFIG_WDT is not set
478# CONFIG_RTC is not set
479# CONFIG_GEN_RTC is not set
480# CONFIG_DTLK is not set
481# CONFIG_R3964 is not set
482
483#
484# Ftape, the floppy tape device driver
485#
486# CONFIG_DRM is not set
487# CONFIG_RAW_DRIVER is not set
488
489#
490# I2C support
491#
492# CONFIG_I2C is not set
493
494#
495# Dallas's 1-wire bus
496#
497# CONFIG_W1 is not set
498
499#
500# Misc devices
501#
502
503#
504# Multimedia devices
505#
506# CONFIG_VIDEO_DEV is not set
507
508#
509# Digital Video Broadcasting Devices
510#
511# CONFIG_DVB is not set
512
513#
514# Graphics support
515#
516# CONFIG_FB is not set
517
518#
519# Console display driver support
520#
521# CONFIG_VGA_CONSOLE is not set
522# CONFIG_MDA_CONSOLE is not set
523CONFIG_DUMMY_CONSOLE=y
524# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
525
526#
527# Sound
528#
529# CONFIG_SOUND is not set
530
531#
532# USB support
533#
534# CONFIG_USB_ARCH_HAS_HCD is not set
535# CONFIG_USB_ARCH_HAS_OHCI is not set
536
537#
538# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
539#
540
541#
542# USB Gadget Support
543#
544# CONFIG_USB_GADGET is not set
545
546#
547# MMC/SD Card support
548#
549# CONFIG_MMC is not set
550
551#
552# InfiniBand support
553#
554# CONFIG_INFINIBAND is not set
555
556#
557# File systems
558#
559CONFIG_EXT2_FS=y
560# CONFIG_EXT2_FS_XATTR is not set
561# CONFIG_EXT3_FS is not set
562# CONFIG_JBD is not set
563# CONFIG_REISERFS_FS is not set
564# CONFIG_JFS_FS is not set
565# CONFIG_XFS_FS is not set
566# CONFIG_MINIX_FS is not set
567# CONFIG_ROMFS_FS is not set
568# CONFIG_QUOTA is not set
569CONFIG_DNOTIFY=y
570CONFIG_AUTOFS_FS=y
571CONFIG_AUTOFS4_FS=y
572
573#
574# CD-ROM/DVD Filesystems
575#
576# CONFIG_ISO9660_FS is not set
577# CONFIG_UDF_FS is not set
578
579#
580# DOS/FAT/NT Filesystems
581#
582# CONFIG_MSDOS_FS is not set
583# CONFIG_VFAT_FS is not set
584# CONFIG_NTFS_FS is not set
585
586#
587# Pseudo filesystems
588#
589CONFIG_PROC_FS=y
590CONFIG_PROC_KCORE=y
591CONFIG_SYSFS=y
592# CONFIG_DEVFS_FS is not set
593CONFIG_DEVPTS_FS_XATTR=y
594CONFIG_DEVPTS_FS_SECURITY=y
595# CONFIG_TMPFS is not set
596# CONFIG_HUGETLB_PAGE is not set
597CONFIG_RAMFS=y
598
599#
600# Miscellaneous filesystems
601#
602# CONFIG_ADFS_FS is not set
603# CONFIG_AFFS_FS is not set
604# CONFIG_HFS_FS is not set
605# CONFIG_HFSPLUS_FS is not set
606# CONFIG_BEFS_FS is not set
607# CONFIG_BFS_FS is not set
608# CONFIG_EFS_FS is not set
609# CONFIG_CRAMFS is not set
610# CONFIG_VXFS_FS is not set
611# CONFIG_HPFS_FS is not set
612# CONFIG_QNX4FS_FS is not set
613# CONFIG_SYSV_FS is not set
614# CONFIG_UFS_FS is not set
615
616#
617# Network File Systems
618#
619CONFIG_NFS_FS=y
620# CONFIG_NFS_V3 is not set
621# CONFIG_NFS_V4 is not set
622# CONFIG_NFS_DIRECTIO is not set
623CONFIG_NFSD=y
624# CONFIG_NFSD_V3 is not set
625# CONFIG_NFSD_TCP is not set
626CONFIG_LOCKD=y
627CONFIG_EXPORTFS=y
628CONFIG_SUNRPC=y
629# CONFIG_RPCSEC_GSS_KRB5 is not set
630# CONFIG_RPCSEC_GSS_SPKM3 is not set
631# CONFIG_SMB_FS is not set
632# CONFIG_CIFS is not set
633# CONFIG_NCP_FS is not set
634# CONFIG_CODA_FS is not set
635# CONFIG_AFS_FS is not set
636
637#
638# Partition Types
639#
640# CONFIG_PARTITION_ADVANCED is not set
641CONFIG_MSDOS_PARTITION=y
642
643#
644# Native Language Support
645#
646# CONFIG_NLS is not set
647
648#
649# Profiling support
650#
651# CONFIG_PROFILING is not set
652
653#
654# Kernel hacking
655#
656# CONFIG_DEBUG_KERNEL is not set
657CONFIG_CROSSCOMPILE=y
658CONFIG_CMDLINE=""
659
660#
661# Security options
662#
663CONFIG_KEYS=y
664CONFIG_KEYS_DEBUG_PROC_KEYS=y
665# CONFIG_SECURITY is not set
666
667#
668# Cryptographic options
669#
670# CONFIG_CRYPTO is not set
671
672#
673# Hardware crypto devices
674#
675
676#
677# Library routines
678#
679# CONFIG_CRC_CCITT is not set
680# CONFIG_CRC32 is not set
681CONFIG_LIBCRC32C=m
682CONFIG_GENERIC_HARDIRQS=y
683CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ev64120_defconfig b/arch/mips/configs/ev64120_defconfig
new file mode 100644
index 000000000000..360e842fd4be
--- /dev/null
+++ b/arch/mips/configs/ev64120_defconfig
@@ -0,0 +1,672 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:03 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54# CONFIG_KMOD is not set
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64CONFIG_MIPS_EV64120=y
65# CONFIG_EVB_PCI1 is not set
66# CONFIG_MIPS_EV96100 is not set
67# CONFIG_MIPS_IVR is not set
68# CONFIG_LASAT is not set
69# CONFIG_MIPS_ITE8172 is not set
70# CONFIG_MIPS_ATLAS is not set
71# CONFIG_MIPS_MALTA is not set
72# CONFIG_MIPS_SEAD is not set
73# CONFIG_MOMENCO_OCELOT is not set
74# CONFIG_MOMENCO_OCELOT_G is not set
75# CONFIG_MOMENCO_OCELOT_C is not set
76# CONFIG_MOMENCO_OCELOT_3 is not set
77# CONFIG_MOMENCO_JAGUAR_ATX is not set
78# CONFIG_PMC_YOSEMITE is not set
79# CONFIG_DDB5074 is not set
80# CONFIG_DDB5476 is not set
81# CONFIG_DDB5477 is not set
82# CONFIG_NEC_OSPREY is not set
83# CONFIG_SGI_IP22 is not set
84# CONFIG_SOC_AU1X00 is not set
85# CONFIG_SIBYTE_SB1xxx_SOC is not set
86# CONFIG_SNI_RM200_PCI is not set
87# CONFIG_TOSHIBA_RBTX4927 is not set
88CONFIG_RWSEM_GENERIC_SPINLOCK=y
89CONFIG_GENERIC_CALIBRATE_DELAY=y
90CONFIG_HAVE_DEC_LOCK=y
91CONFIG_DMA_NONCOHERENT=y
92# CONFIG_CPU_LITTLE_ENDIAN is not set
93CONFIG_MIPS_GT64120=y
94# CONFIG_SYSCLK_75 is not set
95# CONFIG_SYSCLK_83 is not set
96CONFIG_SYSCLK_100=y
97CONFIG_MIPS_L1_CACHE_SHIFT=5
98
99#
100# CPU selection
101#
102# CONFIG_CPU_MIPS32 is not set
103# CONFIG_CPU_MIPS64 is not set
104# CONFIG_CPU_R3000 is not set
105# CONFIG_CPU_TX39XX is not set
106# CONFIG_CPU_VR41XX is not set
107# CONFIG_CPU_R4300 is not set
108# CONFIG_CPU_R4X00 is not set
109# CONFIG_CPU_TX49XX is not set
110CONFIG_CPU_R5000=y
111# CONFIG_CPU_R5432 is not set
112# CONFIG_CPU_R6000 is not set
113# CONFIG_CPU_NEVADA is not set
114# CONFIG_CPU_R8000 is not set
115# CONFIG_CPU_R10000 is not set
116# CONFIG_CPU_RM7000 is not set
117# CONFIG_CPU_RM9000 is not set
118# CONFIG_CPU_SB1 is not set
119CONFIG_PAGE_SIZE_4KB=y
120# CONFIG_PAGE_SIZE_8KB is not set
121# CONFIG_PAGE_SIZE_16KB is not set
122# CONFIG_PAGE_SIZE_64KB is not set
123# CONFIG_64BIT_PHYS_ADDR is not set
124# CONFIG_CPU_ADVANCED is not set
125CONFIG_CPU_HAS_LLSC=y
126CONFIG_CPU_HAS_LLDSCD=y
127CONFIG_CPU_HAS_SYNC=y
128# CONFIG_PREEMPT is not set
129
130#
131# Bus options (PCI, PCMCIA, EISA, ISA, TC)
132#
133CONFIG_HW_HAS_PCI=y
134CONFIG_PCI=y
135CONFIG_PCI_LEGACY_PROC=y
136CONFIG_PCI_NAMES=y
137CONFIG_MMU=y
138
139#
140# PCCARD (PCMCIA/CardBus) support
141#
142# CONFIG_PCCARD is not set
143
144#
145# PC-card bridges
146#
147
148#
149# PCI Hotplug Support
150#
151# CONFIG_HOTPLUG_PCI is not set
152
153#
154# Executable file formats
155#
156CONFIG_BINFMT_ELF=y
157# CONFIG_BINFMT_MISC is not set
158CONFIG_TRAD_SIGNALS=y
159
160#
161# Device Drivers
162#
163
164#
165# Generic Driver Options
166#
167CONFIG_STANDALONE=y
168CONFIG_PREVENT_FIRMWARE_BUILD=y
169# CONFIG_FW_LOADER is not set
170
171#
172# Memory Technology Devices (MTD)
173#
174# CONFIG_MTD is not set
175
176#
177# Parallel port support
178#
179# CONFIG_PARPORT is not set
180
181#
182# Plug and Play support
183#
184
185#
186# Block devices
187#
188# CONFIG_BLK_DEV_FD is not set
189# CONFIG_BLK_CPQ_DA is not set
190# CONFIG_BLK_CPQ_CISS_DA is not set
191# CONFIG_BLK_DEV_DAC960 is not set
192# CONFIG_BLK_DEV_UMEM is not set
193# CONFIG_BLK_DEV_COW_COMMON is not set
194# CONFIG_BLK_DEV_LOOP is not set
195# CONFIG_BLK_DEV_NBD is not set
196# CONFIG_BLK_DEV_SX8 is not set
197# CONFIG_BLK_DEV_RAM is not set
198CONFIG_BLK_DEV_RAM_COUNT=16
199CONFIG_INITRAMFS_SOURCE=""
200# CONFIG_LBD is not set
201CONFIG_CDROM_PKTCDVD=m
202CONFIG_CDROM_PKTCDVD_BUFFERS=8
203# CONFIG_CDROM_PKTCDVD_WCACHE is not set
204
205#
206# IO Schedulers
207#
208CONFIG_IOSCHED_NOOP=y
209CONFIG_IOSCHED_AS=y
210CONFIG_IOSCHED_DEADLINE=y
211CONFIG_IOSCHED_CFQ=y
212CONFIG_ATA_OVER_ETH=m
213
214#
215# ATA/ATAPI/MFM/RLL support
216#
217# CONFIG_IDE is not set
218
219#
220# SCSI device support
221#
222# CONFIG_SCSI is not set
223
224#
225# Multi-device support (RAID and LVM)
226#
227# CONFIG_MD is not set
228
229#
230# Fusion MPT device support
231#
232
233#
234# IEEE 1394 (FireWire) support
235#
236# CONFIG_IEEE1394 is not set
237
238#
239# I2O device support
240#
241# CONFIG_I2O is not set
242
243#
244# Networking support
245#
246CONFIG_NET=y
247
248#
249# Networking options
250#
251# CONFIG_PACKET is not set
252CONFIG_NETLINK_DEV=y
253CONFIG_UNIX=y
254CONFIG_NET_KEY=y
255CONFIG_INET=y
256# CONFIG_IP_MULTICAST is not set
257# CONFIG_IP_ADVANCED_ROUTER is not set
258CONFIG_IP_PNP=y
259# CONFIG_IP_PNP_DHCP is not set
260# CONFIG_IP_PNP_BOOTP is not set
261# CONFIG_IP_PNP_RARP is not set
262# CONFIG_NET_IPIP is not set
263# CONFIG_NET_IPGRE is not set
264# CONFIG_ARPD is not set
265# CONFIG_SYN_COOKIES is not set
266# CONFIG_INET_AH is not set
267# CONFIG_INET_ESP is not set
268# CONFIG_INET_IPCOMP is not set
269CONFIG_INET_TUNNEL=m
270CONFIG_IP_TCPDIAG=m
271# CONFIG_IP_TCPDIAG_IPV6 is not set
272# CONFIG_IPV6 is not set
273# CONFIG_NETFILTER is not set
274CONFIG_XFRM=y
275CONFIG_XFRM_USER=m
276
277#
278# SCTP Configuration (EXPERIMENTAL)
279#
280# CONFIG_IP_SCTP is not set
281# CONFIG_ATM is not set
282# CONFIG_BRIDGE is not set
283# CONFIG_VLAN_8021Q is not set
284# CONFIG_DECNET is not set
285# CONFIG_LLC2 is not set
286# CONFIG_IPX is not set
287# CONFIG_ATALK is not set
288# CONFIG_X25 is not set
289# CONFIG_LAPB is not set
290# CONFIG_NET_DIVERT is not set
291# CONFIG_ECONET is not set
292# CONFIG_WAN_ROUTER is not set
293
294#
295# QoS and/or fair queueing
296#
297# CONFIG_NET_SCHED is not set
298# CONFIG_NET_CLS_ROUTE is not set
299
300#
301# Network testing
302#
303# CONFIG_NET_PKTGEN is not set
304# CONFIG_NETPOLL is not set
305# CONFIG_NET_POLL_CONTROLLER is not set
306# CONFIG_HAMRADIO is not set
307# CONFIG_IRDA is not set
308# CONFIG_BT is not set
309CONFIG_NETDEVICES=y
310# CONFIG_DUMMY is not set
311# CONFIG_BONDING is not set
312# CONFIG_EQUALIZER is not set
313# CONFIG_TUN is not set
314# CONFIG_ETHERTAP is not set
315
316#
317# ARCnet devices
318#
319# CONFIG_ARCNET is not set
320
321#
322# Ethernet (10 or 100Mbit)
323#
324CONFIG_NET_ETHERNET=y
325# CONFIG_MII is not set
326# CONFIG_HAPPYMEAL is not set
327# CONFIG_SUNGEM is not set
328# CONFIG_NET_VENDOR_3COM is not set
329
330#
331# Tulip family network device support
332#
333# CONFIG_NET_TULIP is not set
334# CONFIG_HP100 is not set
335# CONFIG_NET_PCI is not set
336
337#
338# Ethernet (1000 Mbit)
339#
340# CONFIG_ACENIC is not set
341# CONFIG_DL2K is not set
342# CONFIG_E1000 is not set
343# CONFIG_NS83820 is not set
344# CONFIG_HAMACHI is not set
345# CONFIG_YELLOWFIN is not set
346# CONFIG_R8169 is not set
347# CONFIG_SK98LIN is not set
348# CONFIG_TIGON3 is not set
349
350#
351# Ethernet (10000 Mbit)
352#
353# CONFIG_IXGB is not set
354# CONFIG_S2IO is not set
355
356#
357# Token Ring devices
358#
359# CONFIG_TR is not set
360
361#
362# Wireless LAN (non-hamradio)
363#
364# CONFIG_NET_RADIO is not set
365
366#
367# Wan interfaces
368#
369# CONFIG_WAN is not set
370# CONFIG_FDDI is not set
371# CONFIG_HIPPI is not set
372CONFIG_PPP=y
373# CONFIG_PPP_MULTILINK is not set
374# CONFIG_PPP_FILTER is not set
375CONFIG_PPP_ASYNC=y
376# CONFIG_PPP_SYNC_TTY is not set
377# CONFIG_PPP_DEFLATE is not set
378# CONFIG_PPP_BSDCOMP is not set
379# CONFIG_PPPOE is not set
380# CONFIG_SLIP is not set
381# CONFIG_SHAPER is not set
382# CONFIG_NETCONSOLE is not set
383
384#
385# ISDN subsystem
386#
387# CONFIG_ISDN is not set
388
389#
390# Telephony Support
391#
392# CONFIG_PHONE is not set
393
394#
395# Input device support
396#
397CONFIG_INPUT=y
398
399#
400# Userland interfaces
401#
402CONFIG_INPUT_MOUSEDEV=y
403CONFIG_INPUT_MOUSEDEV_PSAUX=y
404CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
405CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
406# CONFIG_INPUT_JOYDEV is not set
407# CONFIG_INPUT_TSDEV is not set
408# CONFIG_INPUT_EVDEV is not set
409# CONFIG_INPUT_EVBUG is not set
410
411#
412# Input I/O drivers
413#
414# CONFIG_GAMEPORT is not set
415CONFIG_SOUND_GAMEPORT=y
416CONFIG_SERIO=y
417# CONFIG_SERIO_I8042 is not set
418CONFIG_SERIO_SERPORT=y
419# CONFIG_SERIO_CT82C710 is not set
420# CONFIG_SERIO_PCIPS2 is not set
421# CONFIG_SERIO_LIBPS2 is not set
422CONFIG_SERIO_RAW=m
423
424#
425# Input Device Drivers
426#
427# CONFIG_INPUT_KEYBOARD is not set
428# CONFIG_INPUT_MOUSE is not set
429# CONFIG_INPUT_JOYSTICK is not set
430# CONFIG_INPUT_TOUCHSCREEN is not set
431# CONFIG_INPUT_MISC is not set
432
433#
434# Character devices
435#
436CONFIG_VT=y
437CONFIG_VT_CONSOLE=y
438CONFIG_HW_CONSOLE=y
439# CONFIG_SERIAL_NONSTANDARD is not set
440
441#
442# Serial drivers
443#
444CONFIG_SERIAL_8250=y
445CONFIG_SERIAL_8250_CONSOLE=y
446CONFIG_SERIAL_8250_NR_UARTS=4
447# CONFIG_SERIAL_8250_EXTENDED is not set
448
449#
450# Non-8250 serial port support
451#
452CONFIG_SERIAL_CORE=y
453CONFIG_SERIAL_CORE_CONSOLE=y
454CONFIG_UNIX98_PTYS=y
455CONFIG_LEGACY_PTYS=y
456CONFIG_LEGACY_PTY_COUNT=256
457
458#
459# IPMI
460#
461# CONFIG_IPMI_HANDLER is not set
462
463#
464# Watchdog Cards
465#
466# CONFIG_WATCHDOG is not set
467# CONFIG_RTC is not set
468# CONFIG_GEN_RTC is not set
469# CONFIG_DTLK is not set
470# CONFIG_R3964 is not set
471# CONFIG_APPLICOM is not set
472
473#
474# Ftape, the floppy tape device driver
475#
476# CONFIG_DRM is not set
477# CONFIG_RAW_DRIVER is not set
478
479#
480# I2C support
481#
482# CONFIG_I2C is not set
483
484#
485# Dallas's 1-wire bus
486#
487# CONFIG_W1 is not set
488
489#
490# Misc devices
491#
492
493#
494# Multimedia devices
495#
496# CONFIG_VIDEO_DEV is not set
497
498#
499# Digital Video Broadcasting Devices
500#
501# CONFIG_DVB is not set
502
503#
504# Graphics support
505#
506# CONFIG_FB is not set
507
508#
509# Console display driver support
510#
511# CONFIG_VGA_CONSOLE is not set
512CONFIG_DUMMY_CONSOLE=y
513# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
514
515#
516# Sound
517#
518# CONFIG_SOUND is not set
519
520#
521# USB support
522#
523# CONFIG_USB is not set
524CONFIG_USB_ARCH_HAS_HCD=y
525CONFIG_USB_ARCH_HAS_OHCI=y
526
527#
528# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
529#
530
531#
532# USB Gadget Support
533#
534# CONFIG_USB_GADGET is not set
535
536#
537# MMC/SD Card support
538#
539# CONFIG_MMC is not set
540
541#
542# InfiniBand support
543#
544# CONFIG_INFINIBAND is not set
545
546#
547# File systems
548#
549CONFIG_EXT2_FS=y
550# CONFIG_EXT2_FS_XATTR is not set
551# CONFIG_EXT3_FS is not set
552# CONFIG_JBD is not set
553# CONFIG_REISERFS_FS is not set
554# CONFIG_JFS_FS is not set
555# CONFIG_XFS_FS is not set
556# CONFIG_MINIX_FS is not set
557# CONFIG_ROMFS_FS is not set
558# CONFIG_QUOTA is not set
559CONFIG_DNOTIFY=y
560# CONFIG_AUTOFS_FS is not set
561# CONFIG_AUTOFS4_FS is not set
562
563#
564# CD-ROM/DVD Filesystems
565#
566# CONFIG_ISO9660_FS is not set
567# CONFIG_UDF_FS is not set
568
569#
570# DOS/FAT/NT Filesystems
571#
572# CONFIG_MSDOS_FS is not set
573# CONFIG_VFAT_FS is not set
574# CONFIG_NTFS_FS is not set
575
576#
577# Pseudo filesystems
578#
579CONFIG_PROC_FS=y
580CONFIG_PROC_KCORE=y
581CONFIG_SYSFS=y
582# CONFIG_DEVFS_FS is not set
583CONFIG_DEVPTS_FS_XATTR=y
584CONFIG_DEVPTS_FS_SECURITY=y
585# CONFIG_TMPFS is not set
586# CONFIG_HUGETLB_PAGE is not set
587CONFIG_RAMFS=y
588
589#
590# Miscellaneous filesystems
591#
592# CONFIG_ADFS_FS is not set
593# CONFIG_AFFS_FS is not set
594# CONFIG_HFS_FS is not set
595# CONFIG_HFSPLUS_FS is not set
596# CONFIG_BEFS_FS is not set
597# CONFIG_BFS_FS is not set
598# CONFIG_EFS_FS is not set
599# CONFIG_CRAMFS is not set
600# CONFIG_VXFS_FS is not set
601# CONFIG_HPFS_FS is not set
602# CONFIG_QNX4FS_FS is not set
603# CONFIG_SYSV_FS is not set
604# CONFIG_UFS_FS is not set
605
606#
607# Network File Systems
608#
609CONFIG_NFS_FS=y
610# CONFIG_NFS_V3 is not set
611# CONFIG_NFS_V4 is not set
612# CONFIG_NFS_DIRECTIO is not set
613# CONFIG_NFSD is not set
614CONFIG_ROOT_NFS=y
615CONFIG_LOCKD=y
616# CONFIG_EXPORTFS is not set
617CONFIG_SUNRPC=y
618# CONFIG_RPCSEC_GSS_KRB5 is not set
619# CONFIG_RPCSEC_GSS_SPKM3 is not set
620# CONFIG_SMB_FS is not set
621# CONFIG_CIFS is not set
622# CONFIG_NCP_FS is not set
623# CONFIG_CODA_FS is not set
624# CONFIG_AFS_FS is not set
625
626#
627# Partition Types
628#
629# CONFIG_PARTITION_ADVANCED is not set
630CONFIG_MSDOS_PARTITION=y
631
632#
633# Native Language Support
634#
635# CONFIG_NLS is not set
636
637#
638# Profiling support
639#
640# CONFIG_PROFILING is not set
641
642#
643# Kernel hacking
644#
645# CONFIG_DEBUG_KERNEL is not set
646CONFIG_CROSSCOMPILE=y
647CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.1.1:/mnt/disk2/fs.gal ip=192.168.1.211:192.168.1.1:::gt::"
648
649#
650# Security options
651#
652CONFIG_KEYS=y
653CONFIG_KEYS_DEBUG_PROC_KEYS=y
654# CONFIG_SECURITY is not set
655
656#
657# Cryptographic options
658#
659# CONFIG_CRYPTO is not set
660
661#
662# Hardware crypto devices
663#
664
665#
666# Library routines
667#
668CONFIG_CRC_CCITT=y
669# CONFIG_CRC32 is not set
670CONFIG_LIBCRC32C=m
671CONFIG_GENERIC_HARDIRQS=y
672CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ev96100_defconfig b/arch/mips/configs/ev96100_defconfig
new file mode 100644
index 000000000000..657a9508d31a
--- /dev/null
+++ b/arch/mips/configs/ev96100_defconfig
@@ -0,0 +1,626 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:03 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54# CONFIG_KMOD is not set
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65CONFIG_MIPS_EV96100=y
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83# CONFIG_SOC_AU1X00 is not set
84# CONFIG_SIBYTE_SB1xxx_SOC is not set
85# CONFIG_SNI_RM200_PCI is not set
86# CONFIG_TOSHIBA_RBTX4927 is not set
87CONFIG_RWSEM_GENERIC_SPINLOCK=y
88CONFIG_GENERIC_CALIBRATE_DELAY=y
89CONFIG_HAVE_DEC_LOCK=y
90CONFIG_DMA_NONCOHERENT=y
91# CONFIG_CPU_LITTLE_ENDIAN is not set
92CONFIG_IRQ_CPU=y
93CONFIG_MIPS_GT64120=y
94CONFIG_SWAP_IO_SPACE=y
95CONFIG_MIPS_GT96100=y
96CONFIG_MIPS_L1_CACHE_SHIFT=5
97
98#
99# CPU selection
100#
101# CONFIG_CPU_MIPS32 is not set
102# CONFIG_CPU_MIPS64 is not set
103# CONFIG_CPU_R3000 is not set
104# CONFIG_CPU_TX39XX is not set
105# CONFIG_CPU_VR41XX is not set
106# CONFIG_CPU_R4300 is not set
107# CONFIG_CPU_R4X00 is not set
108# CONFIG_CPU_TX49XX is not set
109# CONFIG_CPU_R5000 is not set
110# CONFIG_CPU_R5432 is not set
111# CONFIG_CPU_R6000 is not set
112# CONFIG_CPU_NEVADA is not set
113# CONFIG_CPU_R8000 is not set
114# CONFIG_CPU_R10000 is not set
115CONFIG_CPU_RM7000=y
116# CONFIG_CPU_RM9000 is not set
117# CONFIG_CPU_SB1 is not set
118CONFIG_PAGE_SIZE_4KB=y
119# CONFIG_PAGE_SIZE_8KB is not set
120# CONFIG_PAGE_SIZE_16KB is not set
121# CONFIG_PAGE_SIZE_64KB is not set
122CONFIG_BOARD_SCACHE=y
123CONFIG_RM7000_CPU_SCACHE=y
124CONFIG_CPU_HAS_PREFETCH=y
125# CONFIG_64BIT_PHYS_ADDR is not set
126# CONFIG_CPU_ADVANCED is not set
127CONFIG_CPU_HAS_LLSC=y
128CONFIG_CPU_HAS_LLDSCD=y
129CONFIG_CPU_HAS_SYNC=y
130# CONFIG_PREEMPT is not set
131
132#
133# Bus options (PCI, PCMCIA, EISA, ISA, TC)
134#
135CONFIG_HW_HAS_PCI=y
136# CONFIG_PCI is not set
137CONFIG_MMU=y
138
139#
140# PCCARD (PCMCIA/CardBus) support
141#
142# CONFIG_PCCARD is not set
143
144#
145# PC-card bridges
146#
147
148#
149# PCI Hotplug Support
150#
151
152#
153# Executable file formats
154#
155CONFIG_BINFMT_ELF=y
156# CONFIG_BINFMT_MISC is not set
157CONFIG_TRAD_SIGNALS=y
158
159#
160# Device Drivers
161#
162
163#
164# Generic Driver Options
165#
166CONFIG_STANDALONE=y
167CONFIG_PREVENT_FIRMWARE_BUILD=y
168# CONFIG_FW_LOADER is not set
169
170#
171# Memory Technology Devices (MTD)
172#
173# CONFIG_MTD is not set
174
175#
176# Parallel port support
177#
178# CONFIG_PARPORT is not set
179
180#
181# Plug and Play support
182#
183
184#
185# Block devices
186#
187# CONFIG_BLK_DEV_FD is not set
188# CONFIG_BLK_DEV_COW_COMMON is not set
189# CONFIG_BLK_DEV_LOOP is not set
190# CONFIG_BLK_DEV_NBD is not set
191# CONFIG_BLK_DEV_RAM is not set
192CONFIG_BLK_DEV_RAM_COUNT=16
193CONFIG_INITRAMFS_SOURCE=""
194# CONFIG_LBD is not set
195CONFIG_CDROM_PKTCDVD=m
196CONFIG_CDROM_PKTCDVD_BUFFERS=8
197# CONFIG_CDROM_PKTCDVD_WCACHE is not set
198
199#
200# IO Schedulers
201#
202CONFIG_IOSCHED_NOOP=y
203CONFIG_IOSCHED_AS=y
204CONFIG_IOSCHED_DEADLINE=y
205CONFIG_IOSCHED_CFQ=y
206CONFIG_ATA_OVER_ETH=m
207
208#
209# ATA/ATAPI/MFM/RLL support
210#
211# CONFIG_IDE is not set
212
213#
214# SCSI device support
215#
216# CONFIG_SCSI is not set
217
218#
219# Multi-device support (RAID and LVM)
220#
221# CONFIG_MD is not set
222
223#
224# Fusion MPT device support
225#
226
227#
228# IEEE 1394 (FireWire) support
229#
230
231#
232# I2O device support
233#
234
235#
236# Networking support
237#
238CONFIG_NET=y
239
240#
241# Networking options
242#
243# CONFIG_PACKET is not set
244CONFIG_NETLINK_DEV=y
245CONFIG_UNIX=y
246CONFIG_NET_KEY=y
247CONFIG_INET=y
248# CONFIG_IP_MULTICAST is not set
249# CONFIG_IP_ADVANCED_ROUTER is not set
250CONFIG_IP_PNP=y
251# CONFIG_IP_PNP_DHCP is not set
252CONFIG_IP_PNP_BOOTP=y
253# CONFIG_IP_PNP_RARP is not set
254# CONFIG_NET_IPIP is not set
255# CONFIG_NET_IPGRE is not set
256# CONFIG_ARPD is not set
257# CONFIG_SYN_COOKIES is not set
258# CONFIG_INET_AH is not set
259# CONFIG_INET_ESP is not set
260# CONFIG_INET_IPCOMP is not set
261CONFIG_INET_TUNNEL=m
262CONFIG_IP_TCPDIAG=m
263# CONFIG_IP_TCPDIAG_IPV6 is not set
264# CONFIG_IPV6 is not set
265# CONFIG_NETFILTER is not set
266CONFIG_XFRM=y
267CONFIG_XFRM_USER=m
268
269#
270# SCTP Configuration (EXPERIMENTAL)
271#
272# CONFIG_IP_SCTP is not set
273# CONFIG_ATM is not set
274# CONFIG_BRIDGE is not set
275# CONFIG_VLAN_8021Q is not set
276# CONFIG_DECNET is not set
277# CONFIG_LLC2 is not set
278# CONFIG_IPX is not set
279# CONFIG_ATALK is not set
280# CONFIG_X25 is not set
281# CONFIG_LAPB is not set
282# CONFIG_NET_DIVERT is not set
283# CONFIG_ECONET is not set
284# CONFIG_WAN_ROUTER is not set
285
286#
287# QoS and/or fair queueing
288#
289# CONFIG_NET_SCHED is not set
290# CONFIG_NET_CLS_ROUTE is not set
291
292#
293# Network testing
294#
295# CONFIG_NET_PKTGEN is not set
296# CONFIG_NETPOLL is not set
297# CONFIG_NET_POLL_CONTROLLER is not set
298# CONFIG_HAMRADIO is not set
299# CONFIG_IRDA is not set
300# CONFIG_BT is not set
301CONFIG_NETDEVICES=y
302# CONFIG_DUMMY is not set
303# CONFIG_BONDING is not set
304# CONFIG_EQUALIZER is not set
305# CONFIG_TUN is not set
306# CONFIG_ETHERTAP is not set
307
308#
309# Ethernet (10 or 100Mbit)
310#
311CONFIG_NET_ETHERNET=y
312# CONFIG_MII is not set
313CONFIG_MIPS_GT96100ETH=y
314
315#
316# Ethernet (1000 Mbit)
317#
318
319#
320# Ethernet (10000 Mbit)
321#
322
323#
324# Token Ring devices
325#
326
327#
328# Wireless LAN (non-hamradio)
329#
330# CONFIG_NET_RADIO is not set
331
332#
333# Wan interfaces
334#
335# CONFIG_WAN is not set
336# CONFIG_PPP is not set
337# CONFIG_SLIP is not set
338# CONFIG_SHAPER is not set
339# CONFIG_NETCONSOLE is not set
340
341#
342# ISDN subsystem
343#
344# CONFIG_ISDN is not set
345
346#
347# Telephony Support
348#
349# CONFIG_PHONE is not set
350
351#
352# Input device support
353#
354CONFIG_INPUT=y
355
356#
357# Userland interfaces
358#
359CONFIG_INPUT_MOUSEDEV=y
360CONFIG_INPUT_MOUSEDEV_PSAUX=y
361CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
362CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
363# CONFIG_INPUT_JOYDEV is not set
364# CONFIG_INPUT_TSDEV is not set
365# CONFIG_INPUT_EVDEV is not set
366# CONFIG_INPUT_EVBUG is not set
367
368#
369# Input I/O drivers
370#
371# CONFIG_GAMEPORT is not set
372CONFIG_SOUND_GAMEPORT=y
373CONFIG_SERIO=y
374# CONFIG_SERIO_I8042 is not set
375CONFIG_SERIO_SERPORT=y
376# CONFIG_SERIO_CT82C710 is not set
377# CONFIG_SERIO_LIBPS2 is not set
378CONFIG_SERIO_RAW=m
379
380#
381# Input Device Drivers
382#
383# CONFIG_INPUT_KEYBOARD is not set
384# CONFIG_INPUT_MOUSE is not set
385# CONFIG_INPUT_JOYSTICK is not set
386# CONFIG_INPUT_TOUCHSCREEN is not set
387# CONFIG_INPUT_MISC is not set
388
389#
390# Character devices
391#
392CONFIG_VT=y
393CONFIG_VT_CONSOLE=y
394CONFIG_HW_CONSOLE=y
395# CONFIG_SERIAL_NONSTANDARD is not set
396
397#
398# Serial drivers
399#
400CONFIG_SERIAL_8250=y
401CONFIG_SERIAL_8250_CONSOLE=y
402CONFIG_SERIAL_8250_NR_UARTS=4
403# CONFIG_SERIAL_8250_EXTENDED is not set
404
405#
406# Non-8250 serial port support
407#
408CONFIG_SERIAL_CORE=y
409CONFIG_SERIAL_CORE_CONSOLE=y
410CONFIG_UNIX98_PTYS=y
411CONFIG_LEGACY_PTYS=y
412CONFIG_LEGACY_PTY_COUNT=256
413
414#
415# IPMI
416#
417# CONFIG_IPMI_HANDLER is not set
418
419#
420# Watchdog Cards
421#
422# CONFIG_WATCHDOG is not set
423# CONFIG_RTC is not set
424# CONFIG_GEN_RTC is not set
425# CONFIG_DTLK is not set
426# CONFIG_R3964 is not set
427
428#
429# Ftape, the floppy tape device driver
430#
431# CONFIG_DRM is not set
432# CONFIG_RAW_DRIVER is not set
433
434#
435# I2C support
436#
437# CONFIG_I2C is not set
438
439#
440# Dallas's 1-wire bus
441#
442# CONFIG_W1 is not set
443
444#
445# Misc devices
446#
447
448#
449# Multimedia devices
450#
451# CONFIG_VIDEO_DEV is not set
452
453#
454# Digital Video Broadcasting Devices
455#
456# CONFIG_DVB is not set
457
458#
459# Graphics support
460#
461# CONFIG_FB is not set
462
463#
464# Console display driver support
465#
466# CONFIG_VGA_CONSOLE is not set
467CONFIG_DUMMY_CONSOLE=y
468# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
469
470#
471# Sound
472#
473# CONFIG_SOUND is not set
474
475#
476# USB support
477#
478# CONFIG_USB_ARCH_HAS_HCD is not set
479# CONFIG_USB_ARCH_HAS_OHCI is not set
480
481#
482# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
483#
484
485#
486# USB Gadget Support
487#
488# CONFIG_USB_GADGET is not set
489
490#
491# MMC/SD Card support
492#
493# CONFIG_MMC is not set
494
495#
496# InfiniBand support
497#
498# CONFIG_INFINIBAND is not set
499
500#
501# File systems
502#
503CONFIG_EXT2_FS=y
504# CONFIG_EXT2_FS_XATTR is not set
505# CONFIG_EXT3_FS is not set
506# CONFIG_JBD is not set
507# CONFIG_REISERFS_FS is not set
508# CONFIG_JFS_FS is not set
509# CONFIG_XFS_FS is not set
510# CONFIG_MINIX_FS is not set
511# CONFIG_ROMFS_FS is not set
512# CONFIG_QUOTA is not set
513CONFIG_DNOTIFY=y
514# CONFIG_AUTOFS_FS is not set
515# CONFIG_AUTOFS4_FS is not set
516
517#
518# CD-ROM/DVD Filesystems
519#
520# CONFIG_ISO9660_FS is not set
521# CONFIG_UDF_FS is not set
522
523#
524# DOS/FAT/NT Filesystems
525#
526# CONFIG_MSDOS_FS is not set
527# CONFIG_VFAT_FS is not set
528# CONFIG_NTFS_FS is not set
529
530#
531# Pseudo filesystems
532#
533CONFIG_PROC_FS=y
534CONFIG_PROC_KCORE=y
535CONFIG_SYSFS=y
536# CONFIG_DEVFS_FS is not set
537CONFIG_DEVPTS_FS_XATTR=y
538CONFIG_DEVPTS_FS_SECURITY=y
539# CONFIG_TMPFS is not set
540# CONFIG_HUGETLB_PAGE is not set
541CONFIG_RAMFS=y
542
543#
544# Miscellaneous filesystems
545#
546# CONFIG_ADFS_FS is not set
547# CONFIG_AFFS_FS is not set
548# CONFIG_HFS_FS is not set
549# CONFIG_HFSPLUS_FS is not set
550# CONFIG_BEFS_FS is not set
551# CONFIG_BFS_FS is not set
552# CONFIG_EFS_FS is not set
553# CONFIG_CRAMFS is not set
554# CONFIG_VXFS_FS is not set
555# CONFIG_HPFS_FS is not set
556# CONFIG_QNX4FS_FS is not set
557# CONFIG_SYSV_FS is not set
558# CONFIG_UFS_FS is not set
559
560#
561# Network File Systems
562#
563CONFIG_NFS_FS=y
564# CONFIG_NFS_V3 is not set
565# CONFIG_NFS_V4 is not set
566# CONFIG_NFS_DIRECTIO is not set
567# CONFIG_NFSD is not set
568CONFIG_ROOT_NFS=y
569CONFIG_LOCKD=y
570# CONFIG_EXPORTFS is not set
571CONFIG_SUNRPC=y
572# CONFIG_RPCSEC_GSS_KRB5 is not set
573# CONFIG_RPCSEC_GSS_SPKM3 is not set
574# CONFIG_SMB_FS is not set
575# CONFIG_CIFS is not set
576# CONFIG_NCP_FS is not set
577# CONFIG_CODA_FS is not set
578# CONFIG_AFS_FS is not set
579
580#
581# Partition Types
582#
583# CONFIG_PARTITION_ADVANCED is not set
584CONFIG_MSDOS_PARTITION=y
585
586#
587# Native Language Support
588#
589# CONFIG_NLS is not set
590
591#
592# Profiling support
593#
594# CONFIG_PROFILING is not set
595
596#
597# Kernel hacking
598#
599# CONFIG_DEBUG_KERNEL is not set
600CONFIG_CROSSCOMPILE=y
601CONFIG_CMDLINE=""
602
603#
604# Security options
605#
606CONFIG_KEYS=y
607CONFIG_KEYS_DEBUG_PROC_KEYS=y
608# CONFIG_SECURITY is not set
609
610#
611# Cryptographic options
612#
613# CONFIG_CRYPTO is not set
614
615#
616# Hardware crypto devices
617#
618
619#
620# Library routines
621#
622# CONFIG_CRC_CCITT is not set
623# CONFIG_CRC32 is not set
624CONFIG_LIBCRC32C=m
625CONFIG_GENERIC_HARDIRQS=y
626CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
new file mode 100644
index 000000000000..3fb102e6a7f7
--- /dev/null
+++ b/arch/mips/configs/ip22_defconfig
@@ -0,0 +1,962 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:04 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31CONFIG_IKCONFIG=y
32CONFIG_IKCONFIG_PROC=y
33CONFIG_EMBEDDED=y
34CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_FUTEX=y
37CONFIG_EPOLL=y
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SHMEM=y
40CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0
44# CONFIG_TINY_SHMEM is not set
45
46#
47# Loadable module support
48#
49CONFIG_MODULES=y
50CONFIG_MODULE_UNLOAD=y
51# CONFIG_MODULE_FORCE_UNLOAD is not set
52CONFIG_OBSOLETE_MODPARM=y
53CONFIG_MODVERSIONS=y
54CONFIG_MODULE_SRCVERSION_ALL=y
55CONFIG_KMOD=y
56
57#
58# Machine selection
59#
60# CONFIG_MACH_JAZZ is not set
61# CONFIG_MACH_VR41XX is not set
62# CONFIG_TOSHIBA_JMR3927 is not set
63# CONFIG_MIPS_COBALT is not set
64# CONFIG_MACH_DECSTATION is not set
65# CONFIG_MIPS_EV64120 is not set
66# CONFIG_MIPS_EV96100 is not set
67# CONFIG_MIPS_IVR is not set
68# CONFIG_LASAT is not set
69# CONFIG_MIPS_ITE8172 is not set
70# CONFIG_MIPS_ATLAS is not set
71# CONFIG_MIPS_MALTA is not set
72# CONFIG_MIPS_SEAD is not set
73# CONFIG_MOMENCO_OCELOT is not set
74# CONFIG_MOMENCO_OCELOT_G is not set
75# CONFIG_MOMENCO_OCELOT_C is not set
76# CONFIG_MOMENCO_OCELOT_3 is not set
77# CONFIG_MOMENCO_JAGUAR_ATX is not set
78# CONFIG_PMC_YOSEMITE is not set
79# CONFIG_DDB5074 is not set
80# CONFIG_DDB5476 is not set
81# CONFIG_DDB5477 is not set
82# CONFIG_NEC_OSPREY is not set
83CONFIG_SGI_IP22=y
84# CONFIG_SOC_AU1X00 is not set
85# CONFIG_SIBYTE_SB1xxx_SOC is not set
86# CONFIG_SNI_RM200_PCI is not set
87# CONFIG_TOSHIBA_RBTX4927 is not set
88CONFIG_RWSEM_GENERIC_SPINLOCK=y
89CONFIG_GENERIC_CALIBRATE_DELAY=y
90CONFIG_HAVE_DEC_LOCK=y
91CONFIG_ARC=y
92CONFIG_DMA_NONCOHERENT=y
93# CONFIG_CPU_LITTLE_ENDIAN is not set
94CONFIG_IRQ_CPU=y
95CONFIG_SWAP_IO_SPACE=y
96CONFIG_ARC32=y
97CONFIG_BOOT_ELF32=y
98CONFIG_MIPS_L1_CACHE_SHIFT=5
99CONFIG_ARC_CONSOLE=y
100CONFIG_ARC_PROMLIB=y
101
102#
103# CPU selection
104#
105# CONFIG_CPU_MIPS32 is not set
106# CONFIG_CPU_MIPS64 is not set
107# CONFIG_CPU_R3000 is not set
108# CONFIG_CPU_TX39XX is not set
109# CONFIG_CPU_VR41XX is not set
110# CONFIG_CPU_R4300 is not set
111# CONFIG_CPU_R4X00 is not set
112# CONFIG_CPU_TX49XX is not set
113CONFIG_CPU_R5000=y
114# CONFIG_CPU_R5432 is not set
115# CONFIG_CPU_R6000 is not set
116# CONFIG_CPU_NEVADA is not set
117# CONFIG_CPU_R8000 is not set
118# CONFIG_CPU_R10000 is not set
119# CONFIG_CPU_RM7000 is not set
120# CONFIG_CPU_RM9000 is not set
121# CONFIG_CPU_SB1 is not set
122CONFIG_PAGE_SIZE_4KB=y
123# CONFIG_PAGE_SIZE_8KB is not set
124# CONFIG_PAGE_SIZE_16KB is not set
125# CONFIG_PAGE_SIZE_64KB is not set
126CONFIG_BOARD_SCACHE=y
127CONFIG_IP22_CPU_SCACHE=y
128# CONFIG_64BIT_PHYS_ADDR is not set
129# CONFIG_CPU_ADVANCED is not set
130CONFIG_CPU_HAS_LLSC=y
131CONFIG_CPU_HAS_LLDSCD=y
132CONFIG_CPU_HAS_SYNC=y
133# CONFIG_PREEMPT is not set
134
135#
136# Bus options (PCI, PCMCIA, EISA, ISA, TC)
137#
138# CONFIG_EISA is not set
139CONFIG_MMU=y
140
141#
142# PCCARD (PCMCIA/CardBus) support
143#
144# CONFIG_PCCARD is not set
145
146#
147# PC-card bridges
148#
149
150#
151# PCI Hotplug Support
152#
153
154#
155# Executable file formats
156#
157CONFIG_BINFMT_ELF=y
158CONFIG_BINFMT_MISC=m
159CONFIG_TRAD_SIGNALS=y
160
161#
162# Device Drivers
163#
164
165#
166# Generic Driver Options
167#
168CONFIG_STANDALONE=y
169CONFIG_PREVENT_FIRMWARE_BUILD=y
170# CONFIG_FW_LOADER is not set
171
172#
173# Memory Technology Devices (MTD)
174#
175# CONFIG_MTD is not set
176
177#
178# Parallel port support
179#
180# CONFIG_PARPORT is not set
181
182#
183# Plug and Play support
184#
185
186#
187# Block devices
188#
189# CONFIG_BLK_DEV_FD is not set
190# CONFIG_BLK_DEV_COW_COMMON is not set
191# CONFIG_BLK_DEV_LOOP is not set
192# CONFIG_BLK_DEV_NBD is not set
193# CONFIG_BLK_DEV_RAM is not set
194CONFIG_BLK_DEV_RAM_COUNT=16
195CONFIG_INITRAMFS_SOURCE=""
196# CONFIG_LBD is not set
197CONFIG_CDROM_PKTCDVD=m
198CONFIG_CDROM_PKTCDVD_BUFFERS=8
199# CONFIG_CDROM_PKTCDVD_WCACHE is not set
200
201#
202# IO Schedulers
203#
204CONFIG_IOSCHED_NOOP=y
205CONFIG_IOSCHED_AS=y
206CONFIG_IOSCHED_DEADLINE=y
207CONFIG_IOSCHED_CFQ=y
208CONFIG_ATA_OVER_ETH=m
209
210#
211# ATA/ATAPI/MFM/RLL support
212#
213# CONFIG_IDE is not set
214
215#
216# SCSI device support
217#
218CONFIG_SCSI=y
219CONFIG_SCSI_PROC_FS=y
220
221#
222# SCSI support type (disk, tape, CD-ROM)
223#
224CONFIG_BLK_DEV_SD=y
225CONFIG_CHR_DEV_ST=y
226# CONFIG_CHR_DEV_OSST is not set
227CONFIG_BLK_DEV_SR=y
228# CONFIG_BLK_DEV_SR_VENDOR is not set
229# CONFIG_CHR_DEV_SG is not set
230
231#
232# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
233#
234# CONFIG_SCSI_MULTI_LUN is not set
235CONFIG_SCSI_CONSTANTS=y
236# CONFIG_SCSI_LOGGING is not set
237
238#
239# SCSI Transport Attributes
240#
241CONFIG_SCSI_SPI_ATTRS=m
242# CONFIG_SCSI_FC_ATTRS is not set
243# CONFIG_SCSI_ISCSI_ATTRS is not set
244
245#
246# SCSI low-level drivers
247#
248CONFIG_SGIWD93_SCSI=y
249# CONFIG_SCSI_SATA is not set
250# CONFIG_SCSI_DEBUG is not set
251
252#
253# Multi-device support (RAID and LVM)
254#
255# CONFIG_MD is not set
256
257#
258# Fusion MPT device support
259#
260
261#
262# IEEE 1394 (FireWire) support
263#
264
265#
266# I2O device support
267#
268
269#
270# Networking support
271#
272CONFIG_NET=y
273
274#
275# Networking options
276#
277CONFIG_PACKET=y
278CONFIG_PACKET_MMAP=y
279CONFIG_NETLINK_DEV=y
280CONFIG_UNIX=y
281CONFIG_NET_KEY=y
282CONFIG_INET=y
283CONFIG_IP_MULTICAST=y
284# CONFIG_IP_ADVANCED_ROUTER is not set
285CONFIG_IP_PNP=y
286# CONFIG_IP_PNP_DHCP is not set
287CONFIG_IP_PNP_BOOTP=y
288# CONFIG_IP_PNP_RARP is not set
289# CONFIG_NET_IPIP is not set
290# CONFIG_NET_IPGRE is not set
291# CONFIG_IP_MROUTE is not set
292# CONFIG_ARPD is not set
293# CONFIG_SYN_COOKIES is not set
294CONFIG_INET_AH=m
295CONFIG_INET_ESP=m
296CONFIG_INET_IPCOMP=m
297CONFIG_INET_TUNNEL=m
298CONFIG_IP_TCPDIAG=m
299CONFIG_IP_TCPDIAG_IPV6=y
300
301#
302# IP: Virtual Server Configuration
303#
304CONFIG_IP_VS=m
305# CONFIG_IP_VS_DEBUG is not set
306CONFIG_IP_VS_TAB_BITS=12
307
308#
309# IPVS transport protocol load balancing support
310#
311CONFIG_IP_VS_PROTO_TCP=y
312CONFIG_IP_VS_PROTO_UDP=y
313CONFIG_IP_VS_PROTO_ESP=y
314CONFIG_IP_VS_PROTO_AH=y
315
316#
317# IPVS scheduler
318#
319CONFIG_IP_VS_RR=m
320CONFIG_IP_VS_WRR=m
321CONFIG_IP_VS_LC=m
322CONFIG_IP_VS_WLC=m
323CONFIG_IP_VS_LBLC=m
324CONFIG_IP_VS_LBLCR=m
325CONFIG_IP_VS_DH=m
326CONFIG_IP_VS_SH=m
327CONFIG_IP_VS_SED=m
328CONFIG_IP_VS_NQ=m
329
330#
331# IPVS application helper
332#
333CONFIG_IP_VS_FTP=m
334CONFIG_IPV6=m
335CONFIG_IPV6_PRIVACY=y
336CONFIG_INET6_AH=m
337CONFIG_INET6_ESP=m
338CONFIG_INET6_IPCOMP=m
339CONFIG_INET6_TUNNEL=m
340CONFIG_IPV6_TUNNEL=m
341CONFIG_NETFILTER=y
342# CONFIG_NETFILTER_DEBUG is not set
343
344#
345# IP: Netfilter Configuration
346#
347CONFIG_IP_NF_CONNTRACK=m
348CONFIG_IP_NF_CT_ACCT=y
349CONFIG_IP_NF_CONNTRACK_MARK=y
350# CONFIG_IP_NF_CT_PROTO_SCTP is not set
351CONFIG_IP_NF_FTP=m
352CONFIG_IP_NF_IRC=m
353CONFIG_IP_NF_TFTP=m
354CONFIG_IP_NF_AMANDA=m
355CONFIG_IP_NF_QUEUE=m
356CONFIG_IP_NF_IPTABLES=m
357CONFIG_IP_NF_MATCH_LIMIT=m
358CONFIG_IP_NF_MATCH_IPRANGE=m
359CONFIG_IP_NF_MATCH_MAC=m
360CONFIG_IP_NF_MATCH_PKTTYPE=m
361CONFIG_IP_NF_MATCH_MARK=m
362CONFIG_IP_NF_MATCH_MULTIPORT=m
363CONFIG_IP_NF_MATCH_TOS=m
364CONFIG_IP_NF_MATCH_RECENT=m
365CONFIG_IP_NF_MATCH_ECN=m
366CONFIG_IP_NF_MATCH_DSCP=m
367CONFIG_IP_NF_MATCH_AH_ESP=m
368CONFIG_IP_NF_MATCH_LENGTH=m
369CONFIG_IP_NF_MATCH_TTL=m
370CONFIG_IP_NF_MATCH_TCPMSS=m
371CONFIG_IP_NF_MATCH_HELPER=m
372CONFIG_IP_NF_MATCH_STATE=m
373CONFIG_IP_NF_MATCH_CONNTRACK=m
374CONFIG_IP_NF_MATCH_OWNER=m
375CONFIG_IP_NF_MATCH_ADDRTYPE=m
376CONFIG_IP_NF_MATCH_REALM=m
377CONFIG_IP_NF_MATCH_SCTP=m
378CONFIG_IP_NF_MATCH_COMMENT=m
379CONFIG_IP_NF_MATCH_CONNMARK=m
380CONFIG_IP_NF_MATCH_HASHLIMIT=m
381CONFIG_IP_NF_FILTER=m
382CONFIG_IP_NF_TARGET_REJECT=m
383CONFIG_IP_NF_TARGET_LOG=m
384CONFIG_IP_NF_TARGET_ULOG=m
385CONFIG_IP_NF_TARGET_TCPMSS=m
386CONFIG_IP_NF_NAT=m
387CONFIG_IP_NF_NAT_NEEDED=y
388CONFIG_IP_NF_TARGET_MASQUERADE=m
389CONFIG_IP_NF_TARGET_REDIRECT=m
390CONFIG_IP_NF_TARGET_NETMAP=m
391CONFIG_IP_NF_TARGET_SAME=m
392CONFIG_IP_NF_NAT_SNMP_BASIC=m
393CONFIG_IP_NF_NAT_IRC=m
394CONFIG_IP_NF_NAT_FTP=m
395CONFIG_IP_NF_NAT_TFTP=m
396CONFIG_IP_NF_NAT_AMANDA=m
397CONFIG_IP_NF_MANGLE=m
398CONFIG_IP_NF_TARGET_TOS=m
399CONFIG_IP_NF_TARGET_ECN=m
400CONFIG_IP_NF_TARGET_DSCP=m
401CONFIG_IP_NF_TARGET_MARK=m
402CONFIG_IP_NF_TARGET_CLASSIFY=m
403CONFIG_IP_NF_TARGET_CONNMARK=m
404CONFIG_IP_NF_TARGET_CLUSTERIP=m
405CONFIG_IP_NF_RAW=m
406CONFIG_IP_NF_TARGET_NOTRACK=m
407CONFIG_IP_NF_ARPTABLES=m
408CONFIG_IP_NF_ARPFILTER=m
409CONFIG_IP_NF_ARP_MANGLE=m
410
411#
412# IPv6: Netfilter Configuration
413#
414CONFIG_IP6_NF_QUEUE=m
415CONFIG_IP6_NF_IPTABLES=m
416CONFIG_IP6_NF_MATCH_LIMIT=m
417CONFIG_IP6_NF_MATCH_MAC=m
418CONFIG_IP6_NF_MATCH_RT=m
419CONFIG_IP6_NF_MATCH_OPTS=m
420CONFIG_IP6_NF_MATCH_FRAG=m
421CONFIG_IP6_NF_MATCH_HL=m
422CONFIG_IP6_NF_MATCH_MULTIPORT=m
423CONFIG_IP6_NF_MATCH_OWNER=m
424CONFIG_IP6_NF_MATCH_MARK=m
425CONFIG_IP6_NF_MATCH_IPV6HEADER=m
426CONFIG_IP6_NF_MATCH_AHESP=m
427CONFIG_IP6_NF_MATCH_LENGTH=m
428CONFIG_IP6_NF_MATCH_EUI64=m
429CONFIG_IP6_NF_FILTER=m
430CONFIG_IP6_NF_TARGET_LOG=m
431CONFIG_IP6_NF_MANGLE=m
432CONFIG_IP6_NF_TARGET_MARK=m
433CONFIG_IP6_NF_RAW=m
434CONFIG_XFRM=y
435CONFIG_XFRM_USER=m
436
437#
438# SCTP Configuration (EXPERIMENTAL)
439#
440CONFIG_IP_SCTP=m
441# CONFIG_SCTP_DBG_MSG is not set
442# CONFIG_SCTP_DBG_OBJCNT is not set
443# CONFIG_SCTP_HMAC_NONE is not set
444# CONFIG_SCTP_HMAC_SHA1 is not set
445CONFIG_SCTP_HMAC_MD5=y
446# CONFIG_ATM is not set
447# CONFIG_BRIDGE is not set
448# CONFIG_VLAN_8021Q is not set
449# CONFIG_DECNET is not set
450# CONFIG_LLC2 is not set
451# CONFIG_IPX is not set
452# CONFIG_ATALK is not set
453# CONFIG_X25 is not set
454# CONFIG_LAPB is not set
455CONFIG_NET_DIVERT=y
456# CONFIG_ECONET is not set
457# CONFIG_WAN_ROUTER is not set
458
459#
460# QoS and/or fair queueing
461#
462CONFIG_NET_SCHED=y
463# CONFIG_NET_SCH_CLK_JIFFIES is not set
464CONFIG_NET_SCH_CLK_GETTIMEOFDAY=y
465# CONFIG_NET_SCH_CLK_CPU is not set
466CONFIG_NET_SCH_CBQ=m
467CONFIG_NET_SCH_HTB=m
468CONFIG_NET_SCH_HFSC=m
469CONFIG_NET_SCH_PRIO=m
470CONFIG_NET_SCH_RED=m
471CONFIG_NET_SCH_SFQ=m
472CONFIG_NET_SCH_TEQL=m
473CONFIG_NET_SCH_TBF=m
474CONFIG_NET_SCH_GRED=m
475CONFIG_NET_SCH_DSMARK=m
476CONFIG_NET_SCH_NETEM=m
477CONFIG_NET_SCH_INGRESS=m
478CONFIG_NET_QOS=y
479CONFIG_NET_ESTIMATOR=y
480CONFIG_NET_CLS=y
481CONFIG_NET_CLS_TCINDEX=m
482CONFIG_NET_CLS_ROUTE4=m
483CONFIG_NET_CLS_ROUTE=y
484CONFIG_NET_CLS_FW=m
485CONFIG_NET_CLS_U32=m
486# CONFIG_CLS_U32_PERF is not set
487# CONFIG_NET_CLS_IND is not set
488# CONFIG_CLS_U32_MARK is not set
489CONFIG_NET_CLS_RSVP=m
490CONFIG_NET_CLS_RSVP6=m
491# CONFIG_NET_CLS_ACT is not set
492CONFIG_NET_CLS_POLICE=y
493
494#
495# Network testing
496#
497# CONFIG_NET_PKTGEN is not set
498# CONFIG_NETPOLL is not set
499# CONFIG_NET_POLL_CONTROLLER is not set
500# CONFIG_HAMRADIO is not set
501# CONFIG_IRDA is not set
502# CONFIG_BT is not set
503CONFIG_NETDEVICES=y
504CONFIG_DUMMY=m
505CONFIG_BONDING=m
506CONFIG_EQUALIZER=m
507CONFIG_TUN=m
508CONFIG_ETHERTAP=m
509
510#
511# Ethernet (10 or 100Mbit)
512#
513CONFIG_NET_ETHERNET=y
514# CONFIG_MII is not set
515CONFIG_SGISEEQ=y
516
517#
518# Ethernet (1000 Mbit)
519#
520
521#
522# Ethernet (10000 Mbit)
523#
524
525#
526# Token Ring devices
527#
528
529#
530# Wireless LAN (non-hamradio)
531#
532# CONFIG_NET_RADIO is not set
533
534#
535# Wan interfaces
536#
537# CONFIG_WAN is not set
538# CONFIG_PPP is not set
539# CONFIG_SLIP is not set
540# CONFIG_SHAPER is not set
541# CONFIG_NETCONSOLE is not set
542
543#
544# ISDN subsystem
545#
546# CONFIG_ISDN is not set
547
548#
549# Telephony Support
550#
551# CONFIG_PHONE is not set
552
553#
554# Input device support
555#
556CONFIG_INPUT=y
557
558#
559# Userland interfaces
560#
561CONFIG_INPUT_MOUSEDEV=m
562CONFIG_INPUT_MOUSEDEV_PSAUX=y
563CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
564CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
565# CONFIG_INPUT_JOYDEV is not set
566# CONFIG_INPUT_TSDEV is not set
567# CONFIG_INPUT_EVDEV is not set
568# CONFIG_INPUT_EVBUG is not set
569
570#
571# Input I/O drivers
572#
573# CONFIG_GAMEPORT is not set
574CONFIG_SOUND_GAMEPORT=y
575CONFIG_SERIO=y
576CONFIG_SERIO_I8042=y
577CONFIG_SERIO_SERPORT=y
578# CONFIG_SERIO_CT82C710 is not set
579CONFIG_SERIO_LIBPS2=y
580CONFIG_SERIO_RAW=m
581
582#
583# Input Device Drivers
584#
585CONFIG_INPUT_KEYBOARD=y
586CONFIG_KEYBOARD_ATKBD=y
587# CONFIG_KEYBOARD_SUNKBD is not set
588# CONFIG_KEYBOARD_LKKBD is not set
589# CONFIG_KEYBOARD_XTKBD is not set
590# CONFIG_KEYBOARD_NEWTON is not set
591CONFIG_INPUT_MOUSE=y
592CONFIG_MOUSE_PS2=m
593CONFIG_MOUSE_SERIAL=m
594# CONFIG_MOUSE_VSXXXAA is not set
595# CONFIG_INPUT_JOYSTICK is not set
596# CONFIG_INPUT_TOUCHSCREEN is not set
597# CONFIG_INPUT_MISC is not set
598
599#
600# Character devices
601#
602CONFIG_VT=y
603CONFIG_VT_CONSOLE=y
604CONFIG_HW_CONSOLE=y
605# CONFIG_SERIAL_NONSTANDARD is not set
606
607#
608# Serial drivers
609#
610# CONFIG_SERIAL_8250 is not set
611
612#
613# Non-8250 serial port support
614#
615CONFIG_SERIAL_IP22_ZILOG=m
616CONFIG_SERIAL_CORE=m
617CONFIG_UNIX98_PTYS=y
618CONFIG_LEGACY_PTYS=y
619CONFIG_LEGACY_PTY_COUNT=256
620
621#
622# IPMI
623#
624# CONFIG_IPMI_HANDLER is not set
625
626#
627# Watchdog Cards
628#
629CONFIG_WATCHDOG=y
630# CONFIG_WATCHDOG_NOWAYOUT is not set
631
632#
633# Watchdog Device Drivers
634#
635# CONFIG_SOFT_WATCHDOG is not set
636CONFIG_INDYDOG=m
637# CONFIG_RTC is not set
638CONFIG_SGI_DS1286=m
639# CONFIG_GEN_RTC is not set
640# CONFIG_DTLK is not set
641# CONFIG_R3964 is not set
642
643#
644# Ftape, the floppy tape device driver
645#
646# CONFIG_DRM is not set
647CONFIG_RAW_DRIVER=m
648CONFIG_MAX_RAW_DEVS=256
649
650#
651# I2C support
652#
653# CONFIG_I2C is not set
654
655#
656# Dallas's 1-wire bus
657#
658# CONFIG_W1 is not set
659
660#
661# Misc devices
662#
663
664#
665# Multimedia devices
666#
667# CONFIG_VIDEO_DEV is not set
668
669#
670# Digital Video Broadcasting Devices
671#
672# CONFIG_DVB is not set
673
674#
675# Graphics support
676#
677# CONFIG_FB is not set
678
679#
680# Console display driver support
681#
682# CONFIG_VGA_CONSOLE is not set
683CONFIG_SGI_NEWPORT_CONSOLE=y
684CONFIG_DUMMY_CONSOLE=y
685CONFIG_FONT_8x16=y
686
687#
688# Logo configuration
689#
690CONFIG_LOGO=y
691# CONFIG_LOGO_LINUX_MONO is not set
692# CONFIG_LOGO_LINUX_VGA16 is not set
693# CONFIG_LOGO_LINUX_CLUT224 is not set
694CONFIG_LOGO_SGI_CLUT224=y
695# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
696
697#
698# Sound
699#
700# CONFIG_SOUND is not set
701
702#
703# USB support
704#
705# CONFIG_USB_ARCH_HAS_HCD is not set
706# CONFIG_USB_ARCH_HAS_OHCI is not set
707
708#
709# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
710#
711
712#
713# USB Gadget Support
714#
715# CONFIG_USB_GADGET is not set
716
717#
718# MMC/SD Card support
719#
720# CONFIG_MMC is not set
721
722#
723# InfiniBand support
724#
725# CONFIG_INFINIBAND is not set
726
727#
728# File systems
729#
730CONFIG_EXT2_FS=m
731# CONFIG_EXT2_FS_XATTR is not set
732CONFIG_EXT3_FS=y
733CONFIG_EXT3_FS_XATTR=y
734CONFIG_EXT3_FS_POSIX_ACL=y
735CONFIG_EXT3_FS_SECURITY=y
736CONFIG_JBD=y
737# CONFIG_JBD_DEBUG is not set
738CONFIG_FS_MBCACHE=y
739# CONFIG_REISERFS_FS is not set
740# CONFIG_JFS_FS is not set
741CONFIG_FS_POSIX_ACL=y
742CONFIG_XFS_FS=m
743# CONFIG_XFS_RT is not set
744CONFIG_XFS_QUOTA=y
745CONFIG_XFS_SECURITY=y
746# CONFIG_XFS_POSIX_ACL is not set
747CONFIG_MINIX_FS=m
748# CONFIG_ROMFS_FS is not set
749CONFIG_QUOTA=y
750# CONFIG_QFMT_V1 is not set
751CONFIG_QFMT_V2=m
752CONFIG_QUOTACTL=y
753CONFIG_DNOTIFY=y
754CONFIG_AUTOFS_FS=m
755CONFIG_AUTOFS4_FS=m
756
757#
758# CD-ROM/DVD Filesystems
759#
760CONFIG_ISO9660_FS=m
761CONFIG_JOLIET=y
762CONFIG_ZISOFS=y
763CONFIG_ZISOFS_FS=m
764CONFIG_UDF_FS=m
765CONFIG_UDF_NLS=y
766
767#
768# DOS/FAT/NT Filesystems
769#
770CONFIG_FAT_FS=m
771CONFIG_MSDOS_FS=m
772CONFIG_VFAT_FS=m
773CONFIG_FAT_DEFAULT_CODEPAGE=437
774CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
775# CONFIG_NTFS_FS is not set
776
777#
778# Pseudo filesystems
779#
780CONFIG_PROC_FS=y
781CONFIG_PROC_KCORE=y
782CONFIG_SYSFS=y
783# CONFIG_DEVFS_FS is not set
784CONFIG_DEVPTS_FS_XATTR=y
785CONFIG_DEVPTS_FS_SECURITY=y
786# CONFIG_TMPFS is not set
787# CONFIG_HUGETLB_PAGE is not set
788CONFIG_RAMFS=y
789
790#
791# Miscellaneous filesystems
792#
793# CONFIG_ADFS_FS is not set
794# CONFIG_AFFS_FS is not set
795# CONFIG_HFS_FS is not set
796# CONFIG_HFSPLUS_FS is not set
797# CONFIG_BEFS_FS is not set
798# CONFIG_BFS_FS is not set
799CONFIG_EFS_FS=m
800# CONFIG_CRAMFS is not set
801# CONFIG_VXFS_FS is not set
802# CONFIG_HPFS_FS is not set
803# CONFIG_QNX4FS_FS is not set
804# CONFIG_SYSV_FS is not set
805CONFIG_UFS_FS=m
806# CONFIG_UFS_FS_WRITE is not set
807
808#
809# Network File Systems
810#
811CONFIG_NFS_FS=m
812CONFIG_NFS_V3=y
813# CONFIG_NFS_V4 is not set
814# CONFIG_NFS_DIRECTIO is not set
815CONFIG_NFSD=m
816CONFIG_NFSD_V3=y
817# CONFIG_NFSD_V4 is not set
818CONFIG_NFSD_TCP=y
819CONFIG_LOCKD=m
820CONFIG_LOCKD_V4=y
821CONFIG_EXPORTFS=m
822CONFIG_SUNRPC=m
823CONFIG_SUNRPC_GSS=m
824CONFIG_RPCSEC_GSS_KRB5=m
825# CONFIG_RPCSEC_GSS_SPKM3 is not set
826CONFIG_SMB_FS=m
827CONFIG_SMB_NLS_DEFAULT=y
828CONFIG_SMB_NLS_REMOTE="cp437"
829CONFIG_CIFS=m
830# CONFIG_CIFS_STATS is not set
831# CONFIG_CIFS_XATTR is not set
832# CONFIG_CIFS_EXPERIMENTAL is not set
833# CONFIG_NCP_FS is not set
834CONFIG_CODA_FS=m
835# CONFIG_CODA_FS_OLD_API is not set
836# CONFIG_AFS_FS is not set
837
838#
839# Partition Types
840#
841CONFIG_PARTITION_ADVANCED=y
842# CONFIG_ACORN_PARTITION is not set
843# CONFIG_OSF_PARTITION is not set
844# CONFIG_AMIGA_PARTITION is not set
845# CONFIG_ATARI_PARTITION is not set
846# CONFIG_MAC_PARTITION is not set
847CONFIG_MSDOS_PARTITION=y
848# CONFIG_BSD_DISKLABEL is not set
849# CONFIG_MINIX_SUBPARTITION is not set
850# CONFIG_SOLARIS_X86_PARTITION is not set
851# CONFIG_UNIXWARE_DISKLABEL is not set
852# CONFIG_LDM_PARTITION is not set
853CONFIG_SGI_PARTITION=y
854# CONFIG_ULTRIX_PARTITION is not set
855# CONFIG_SUN_PARTITION is not set
856# CONFIG_EFI_PARTITION is not set
857
858#
859# Native Language Support
860#
861CONFIG_NLS=m
862CONFIG_NLS_DEFAULT="iso8859-1"
863CONFIG_NLS_CODEPAGE_437=m
864CONFIG_NLS_CODEPAGE_737=m
865CONFIG_NLS_CODEPAGE_775=m
866CONFIG_NLS_CODEPAGE_850=m
867CONFIG_NLS_CODEPAGE_852=m
868CONFIG_NLS_CODEPAGE_855=m
869CONFIG_NLS_CODEPAGE_857=m
870CONFIG_NLS_CODEPAGE_860=m
871CONFIG_NLS_CODEPAGE_861=m
872CONFIG_NLS_CODEPAGE_862=m
873CONFIG_NLS_CODEPAGE_863=m
874CONFIG_NLS_CODEPAGE_864=m
875CONFIG_NLS_CODEPAGE_865=m
876CONFIG_NLS_CODEPAGE_866=m
877CONFIG_NLS_CODEPAGE_869=m
878CONFIG_NLS_CODEPAGE_936=m
879CONFIG_NLS_CODEPAGE_950=m
880CONFIG_NLS_CODEPAGE_932=m
881CONFIG_NLS_CODEPAGE_949=m
882CONFIG_NLS_CODEPAGE_874=m
883CONFIG_NLS_ISO8859_8=m
884CONFIG_NLS_CODEPAGE_1250=m
885CONFIG_NLS_CODEPAGE_1251=m
886CONFIG_NLS_ASCII=m
887CONFIG_NLS_ISO8859_1=m
888CONFIG_NLS_ISO8859_2=m
889CONFIG_NLS_ISO8859_3=m
890CONFIG_NLS_ISO8859_4=m
891CONFIG_NLS_ISO8859_5=m
892CONFIG_NLS_ISO8859_6=m
893CONFIG_NLS_ISO8859_7=m
894CONFIG_NLS_ISO8859_9=m
895CONFIG_NLS_ISO8859_13=m
896CONFIG_NLS_ISO8859_14=m
897CONFIG_NLS_ISO8859_15=m
898CONFIG_NLS_KOI8_R=m
899CONFIG_NLS_KOI8_U=m
900CONFIG_NLS_UTF8=m
901
902#
903# Profiling support
904#
905# CONFIG_PROFILING is not set
906
907#
908# Kernel hacking
909#
910# CONFIG_DEBUG_KERNEL is not set
911CONFIG_CROSSCOMPILE=y
912CONFIG_CMDLINE=""
913
914#
915# Security options
916#
917CONFIG_KEYS=y
918CONFIG_KEYS_DEBUG_PROC_KEYS=y
919# CONFIG_SECURITY is not set
920
921#
922# Cryptographic options
923#
924CONFIG_CRYPTO=y
925CONFIG_CRYPTO_HMAC=y
926CONFIG_CRYPTO_NULL=m
927CONFIG_CRYPTO_MD4=m
928CONFIG_CRYPTO_MD5=m
929CONFIG_CRYPTO_SHA1=m
930CONFIG_CRYPTO_SHA256=m
931CONFIG_CRYPTO_SHA512=m
932CONFIG_CRYPTO_WP512=m
933CONFIG_CRYPTO_DES=m
934CONFIG_CRYPTO_BLOWFISH=m
935CONFIG_CRYPTO_TWOFISH=m
936CONFIG_CRYPTO_SERPENT=m
937CONFIG_CRYPTO_AES=m
938CONFIG_CRYPTO_CAST5=m
939CONFIG_CRYPTO_CAST6=m
940CONFIG_CRYPTO_TEA=m
941CONFIG_CRYPTO_ARC4=m
942CONFIG_CRYPTO_KHAZAD=m
943CONFIG_CRYPTO_ANUBIS=m
944CONFIG_CRYPTO_DEFLATE=y
945CONFIG_CRYPTO_MICHAEL_MIC=m
946CONFIG_CRYPTO_CRC32C=m
947CONFIG_CRYPTO_TEST=m
948
949#
950# Hardware crypto devices
951#
952
953#
954# Library routines
955#
956# CONFIG_CRC_CCITT is not set
957CONFIG_CRC32=m
958CONFIG_LIBCRC32C=m
959CONFIG_ZLIB_INFLATE=y
960CONFIG_ZLIB_DEFLATE=y
961CONFIG_GENERIC_HARDIRQS=y
962CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
new file mode 100644
index 000000000000..13472292d0ec
--- /dev/null
+++ b/arch/mips/configs/ip27_defconfig
@@ -0,0 +1,827 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:04 2005
5#
6CONFIG_MIPS=y
7CONFIG_MIPS64=y
8CONFIG_64BIT=y
9
10#
11# Code maturity level options
12#
13CONFIG_EXPERIMENTAL=y
14CONFIG_CLEAN_COMPILE=y
15CONFIG_LOCK_KERNEL=y
16
17#
18# General setup
19#
20CONFIG_LOCALVERSION=""
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23CONFIG_POSIX_MQUEUE=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_LOG_BUF_SHIFT=15
28# CONFIG_HOTPLUG is not set
29CONFIG_KOBJECT_UEVENT=y
30CONFIG_IKCONFIG=y
31CONFIG_IKCONFIG_PROC=y
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52# CONFIG_MODVERSIONS is not set
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55CONFIG_STOP_MACHINE=y
56
57#
58# Machine selection
59#
60# CONFIG_MACH_JAZZ is not set
61# CONFIG_MACH_VR41XX is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83CONFIG_SGI_IP27=y
84# CONFIG_SGI_SN0_N_MODE is not set
85CONFIG_DISCONTIGMEM=y
86CONFIG_NUMA=y
87# CONFIG_MAPPED_KERNEL is not set
88# CONFIG_REPLICATE_KTEXT is not set
89# CONFIG_REPLICATE_EXHANDLERS is not set
90# CONFIG_SGI_IP32 is not set
91# CONFIG_SIBYTE_SB1xxx_SOC is not set
92# CONFIG_SNI_RM200_PCI is not set
93CONFIG_RWSEM_GENERIC_SPINLOCK=y
94CONFIG_GENERIC_CALIBRATE_DELAY=y
95CONFIG_HAVE_DEC_LOCK=y
96CONFIG_ARC=y
97CONFIG_DMA_IP27=y
98# CONFIG_CPU_LITTLE_ENDIAN is not set
99CONFIG_MIPS_L1_CACHE_SHIFT=7
100CONFIG_ARC64=y
101CONFIG_BOOT_ELF64=y
102CONFIG_QL_ISP_A64=y
103
104#
105# CPU selection
106#
107# CONFIG_CPU_MIPS32 is not set
108# CONFIG_CPU_MIPS64 is not set
109# CONFIG_CPU_R3000 is not set
110# CONFIG_CPU_TX39XX is not set
111# CONFIG_CPU_VR41XX is not set
112# CONFIG_CPU_R4300 is not set
113# CONFIG_CPU_R4X00 is not set
114# CONFIG_CPU_TX49XX is not set
115# CONFIG_CPU_R5000 is not set
116# CONFIG_CPU_R5432 is not set
117# CONFIG_CPU_R6000 is not set
118# CONFIG_CPU_NEVADA is not set
119# CONFIG_CPU_R8000 is not set
120CONFIG_CPU_R10000=y
121# CONFIG_CPU_RM7000 is not set
122# CONFIG_CPU_RM9000 is not set
123# CONFIG_CPU_SB1 is not set
124CONFIG_PAGE_SIZE_4KB=y
125# CONFIG_PAGE_SIZE_8KB is not set
126# CONFIG_PAGE_SIZE_16KB is not set
127# CONFIG_PAGE_SIZE_64KB is not set
128CONFIG_CPU_HAS_PREFETCH=y
129CONFIG_CPU_HAS_LLSC=y
130CONFIG_CPU_HAS_LLDSCD=y
131CONFIG_CPU_HAS_SYNC=y
132CONFIG_SMP=y
133CONFIG_NR_CPUS=64
134# CONFIG_PREEMPT is not set
135# CONFIG_MIPS_INSANE_LARGE is not set
136
137#
138# Bus options (PCI, PCMCIA, EISA, ISA, TC)
139#
140CONFIG_HW_HAS_PCI=y
141CONFIG_PCI=y
142CONFIG_PCI_DOMAINS=y
143CONFIG_PCI_LEGACY_PROC=y
144CONFIG_PCI_NAMES=y
145CONFIG_MMU=y
146
147#
148# PCCARD (PCMCIA/CardBus) support
149#
150# CONFIG_PCCARD is not set
151
152#
153# PC-card bridges
154#
155
156#
157# PCI Hotplug Support
158#
159# CONFIG_HOTPLUG_PCI is not set
160
161#
162# Executable file formats
163#
164CONFIG_BINFMT_ELF=y
165# CONFIG_BINFMT_MISC is not set
166# CONFIG_BUILD_ELF64 is not set
167CONFIG_MIPS32_COMPAT=y
168CONFIG_COMPAT=y
169CONFIG_MIPS32_O32=y
170# CONFIG_MIPS32_N32 is not set
171CONFIG_BINFMT_ELF32=y
172
173#
174# Device Drivers
175#
176
177#
178# Generic Driver Options
179#
180CONFIG_STANDALONE=y
181CONFIG_PREVENT_FIRMWARE_BUILD=y
182# CONFIG_FW_LOADER is not set
183
184#
185# Memory Technology Devices (MTD)
186#
187# CONFIG_MTD is not set
188
189#
190# Parallel port support
191#
192# CONFIG_PARPORT is not set
193
194#
195# Plug and Play support
196#
197
198#
199# Block devices
200#
201# CONFIG_BLK_DEV_FD is not set
202# CONFIG_BLK_CPQ_DA is not set
203# CONFIG_BLK_CPQ_CISS_DA is not set
204# CONFIG_BLK_DEV_DAC960 is not set
205# CONFIG_BLK_DEV_UMEM is not set
206# CONFIG_BLK_DEV_COW_COMMON is not set
207CONFIG_BLK_DEV_LOOP=y
208CONFIG_BLK_DEV_CRYPTOLOOP=m
209# CONFIG_BLK_DEV_NBD is not set
210# CONFIG_BLK_DEV_SX8 is not set
211# CONFIG_BLK_DEV_RAM is not set
212CONFIG_BLK_DEV_RAM_COUNT=16
213CONFIG_INITRAMFS_SOURCE=""
214CONFIG_CDROM_PKTCDVD=m
215CONFIG_CDROM_PKTCDVD_BUFFERS=8
216# CONFIG_CDROM_PKTCDVD_WCACHE is not set
217
218#
219# IO Schedulers
220#
221CONFIG_IOSCHED_NOOP=y
222CONFIG_IOSCHED_AS=y
223CONFIG_IOSCHED_DEADLINE=y
224CONFIG_IOSCHED_CFQ=y
225CONFIG_ATA_OVER_ETH=m
226
227#
228# ATA/ATAPI/MFM/RLL support
229#
230# CONFIG_IDE is not set
231
232#
233# SCSI device support
234#
235CONFIG_SCSI=y
236CONFIG_SCSI_PROC_FS=y
237
238#
239# SCSI support type (disk, tape, CD-ROM)
240#
241CONFIG_BLK_DEV_SD=y
242CONFIG_CHR_DEV_ST=y
243# CONFIG_CHR_DEV_OSST is not set
244# CONFIG_BLK_DEV_SR is not set
245# CONFIG_CHR_DEV_SG is not set
246
247#
248# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
249#
250# CONFIG_SCSI_MULTI_LUN is not set
251CONFIG_SCSI_CONSTANTS=y
252CONFIG_SCSI_LOGGING=y
253
254#
255# SCSI Transport Attributes
256#
257CONFIG_SCSI_SPI_ATTRS=y
258# CONFIG_SCSI_FC_ATTRS is not set
259# CONFIG_SCSI_ISCSI_ATTRS is not set
260
261#
262# SCSI low-level drivers
263#
264# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
265# CONFIG_SCSI_3W_9XXX is not set
266# CONFIG_SCSI_ACARD is not set
267# CONFIG_SCSI_AACRAID is not set
268# CONFIG_SCSI_AIC7XXX is not set
269# CONFIG_SCSI_AIC7XXX_OLD is not set
270# CONFIG_SCSI_AIC79XX is not set
271# CONFIG_MEGARAID_NEWGEN is not set
272# CONFIG_MEGARAID_LEGACY is not set
273# CONFIG_SCSI_SATA is not set
274# CONFIG_SCSI_BUSLOGIC is not set
275# CONFIG_SCSI_DMX3191D is not set
276# CONFIG_SCSI_EATA is not set
277# CONFIG_SCSI_EATA_PIO is not set
278# CONFIG_SCSI_FUTURE_DOMAIN is not set
279# CONFIG_SCSI_GDTH is not set
280# CONFIG_SCSI_IPS is not set
281# CONFIG_SCSI_INITIO is not set
282# CONFIG_SCSI_INIA100 is not set
283# CONFIG_SCSI_SYM53C8XX_2 is not set
284# CONFIG_SCSI_IPR is not set
285CONFIG_SCSI_QLOGIC_ISP=y
286# CONFIG_SCSI_QLOGIC_FC is not set
287# CONFIG_SCSI_QLOGIC_1280 is not set
288CONFIG_SCSI_QLA2XXX=y
289# CONFIG_SCSI_QLA21XX is not set
290# CONFIG_SCSI_QLA22XX is not set
291# CONFIG_SCSI_QLA2300 is not set
292# CONFIG_SCSI_QLA2322 is not set
293# CONFIG_SCSI_QLA6312 is not set
294# CONFIG_SCSI_DC395x is not set
295# CONFIG_SCSI_DC390T is not set
296# CONFIG_SCSI_DEBUG is not set
297
298#
299# Multi-device support (RAID and LVM)
300#
301CONFIG_MD=y
302CONFIG_BLK_DEV_MD=y
303CONFIG_MD_LINEAR=m
304CONFIG_MD_RAID0=y
305CONFIG_MD_RAID1=y
306CONFIG_MD_RAID10=m
307CONFIG_MD_RAID5=y
308CONFIG_MD_RAID6=m
309CONFIG_MD_MULTIPATH=m
310CONFIG_MD_FAULTY=m
311CONFIG_BLK_DEV_DM=m
312CONFIG_DM_CRYPT=m
313CONFIG_DM_SNAPSHOT=m
314CONFIG_DM_MIRROR=m
315CONFIG_DM_ZERO=m
316
317#
318# Fusion MPT device support
319#
320# CONFIG_FUSION is not set
321
322#
323# IEEE 1394 (FireWire) support
324#
325# CONFIG_IEEE1394 is not set
326
327#
328# I2O device support
329#
330# CONFIG_I2O is not set
331
332#
333# Networking support
334#
335CONFIG_NET=y
336
337#
338# Networking options
339#
340CONFIG_PACKET=y
341CONFIG_PACKET_MMAP=y
342CONFIG_NETLINK_DEV=y
343CONFIG_UNIX=y
344CONFIG_NET_KEY=y
345CONFIG_INET=y
346CONFIG_IP_MULTICAST=y
347# CONFIG_IP_ADVANCED_ROUTER is not set
348CONFIG_IP_PNP=y
349# CONFIG_IP_PNP_DHCP is not set
350# CONFIG_IP_PNP_BOOTP is not set
351# CONFIG_IP_PNP_RARP is not set
352# CONFIG_NET_IPIP is not set
353# CONFIG_NET_IPGRE is not set
354# CONFIG_IP_MROUTE is not set
355# CONFIG_ARPD is not set
356# CONFIG_SYN_COOKIES is not set
357# CONFIG_INET_AH is not set
358# CONFIG_INET_ESP is not set
359# CONFIG_INET_IPCOMP is not set
360CONFIG_INET_TUNNEL=m
361CONFIG_IP_TCPDIAG=m
362# CONFIG_IP_TCPDIAG_IPV6 is not set
363# CONFIG_IPV6 is not set
364# CONFIG_NETFILTER is not set
365CONFIG_XFRM=y
366CONFIG_XFRM_USER=m
367
368#
369# SCTP Configuration (EXPERIMENTAL)
370#
371# CONFIG_IP_SCTP is not set
372# CONFIG_ATM is not set
373# CONFIG_BRIDGE is not set
374# CONFIG_VLAN_8021Q is not set
375# CONFIG_DECNET is not set
376# CONFIG_LLC2 is not set
377# CONFIG_IPX is not set
378# CONFIG_ATALK is not set
379# CONFIG_X25 is not set
380# CONFIG_LAPB is not set
381# CONFIG_NET_DIVERT is not set
382# CONFIG_ECONET is not set
383# CONFIG_WAN_ROUTER is not set
384
385#
386# QoS and/or fair queueing
387#
388CONFIG_NET_SCHED=y
389# CONFIG_NET_SCH_CLK_JIFFIES is not set
390CONFIG_NET_SCH_CLK_GETTIMEOFDAY=y
391# CONFIG_NET_SCH_CLK_CPU is not set
392CONFIG_NET_SCH_CBQ=m
393CONFIG_NET_SCH_HTB=m
394CONFIG_NET_SCH_HFSC=m
395CONFIG_NET_SCH_PRIO=m
396CONFIG_NET_SCH_RED=m
397CONFIG_NET_SCH_SFQ=m
398CONFIG_NET_SCH_TEQL=m
399CONFIG_NET_SCH_TBF=m
400CONFIG_NET_SCH_GRED=m
401CONFIG_NET_SCH_DSMARK=m
402CONFIG_NET_SCH_NETEM=m
403CONFIG_NET_SCH_INGRESS=m
404CONFIG_NET_QOS=y
405CONFIG_NET_ESTIMATOR=y
406CONFIG_NET_CLS=y
407CONFIG_NET_CLS_TCINDEX=m
408CONFIG_NET_CLS_ROUTE4=m
409CONFIG_NET_CLS_ROUTE=y
410CONFIG_NET_CLS_FW=m
411CONFIG_NET_CLS_U32=m
412# CONFIG_CLS_U32_PERF is not set
413# CONFIG_NET_CLS_IND is not set
414CONFIG_NET_CLS_RSVP=m
415CONFIG_NET_CLS_RSVP6=m
416# CONFIG_NET_CLS_ACT is not set
417CONFIG_NET_CLS_POLICE=y
418
419#
420# Network testing
421#
422# CONFIG_NET_PKTGEN is not set
423# CONFIG_NETPOLL is not set
424# CONFIG_NET_POLL_CONTROLLER is not set
425# CONFIG_HAMRADIO is not set
426# CONFIG_IRDA is not set
427# CONFIG_BT is not set
428CONFIG_NETDEVICES=y
429# CONFIG_DUMMY is not set
430# CONFIG_BONDING is not set
431# CONFIG_EQUALIZER is not set
432# CONFIG_TUN is not set
433# CONFIG_ETHERTAP is not set
434
435#
436# ARCnet devices
437#
438# CONFIG_ARCNET is not set
439
440#
441# Ethernet (10 or 100Mbit)
442#
443CONFIG_NET_ETHERNET=y
444CONFIG_MII=y
445CONFIG_SGI_IOC3_ETH=y
446CONFIG_SGI_IOC3_ETH_HW_RX_CSUM=y
447CONFIG_SGI_IOC3_ETH_HW_TX_CSUM=y
448# CONFIG_HAPPYMEAL is not set
449# CONFIG_SUNGEM is not set
450# CONFIG_NET_VENDOR_3COM is not set
451
452#
453# Tulip family network device support
454#
455# CONFIG_NET_TULIP is not set
456# CONFIG_HP100 is not set
457# CONFIG_NET_PCI is not set
458
459#
460# Ethernet (1000 Mbit)
461#
462# CONFIG_ACENIC is not set
463# CONFIG_DL2K is not set
464# CONFIG_E1000 is not set
465# CONFIG_NS83820 is not set
466# CONFIG_HAMACHI is not set
467# CONFIG_YELLOWFIN is not set
468# CONFIG_R8169 is not set
469# CONFIG_SK98LIN is not set
470# CONFIG_TIGON3 is not set
471
472#
473# Ethernet (10000 Mbit)
474#
475# CONFIG_IXGB is not set
476# CONFIG_S2IO is not set
477
478#
479# Token Ring devices
480#
481# CONFIG_TR is not set
482
483#
484# Wireless LAN (non-hamradio)
485#
486# CONFIG_NET_RADIO is not set
487
488#
489# Wan interfaces
490#
491# CONFIG_WAN is not set
492# CONFIG_FDDI is not set
493# CONFIG_HIPPI is not set
494# CONFIG_PPP is not set
495# CONFIG_SLIP is not set
496# CONFIG_NET_FC is not set
497# CONFIG_SHAPER is not set
498# CONFIG_NETCONSOLE is not set
499
500#
501# ISDN subsystem
502#
503# CONFIG_ISDN is not set
504
505#
506# Telephony Support
507#
508# CONFIG_PHONE is not set
509
510#
511# Input device support
512#
513# CONFIG_INPUT is not set
514
515#
516# Userland interfaces
517#
518
519#
520# Input I/O drivers
521#
522# CONFIG_GAMEPORT is not set
523CONFIG_SOUND_GAMEPORT=y
524CONFIG_SERIO=y
525# CONFIG_SERIO_I8042 is not set
526CONFIG_SERIO_SERPORT=y
527# CONFIG_SERIO_CT82C710 is not set
528# CONFIG_SERIO_PCIPS2 is not set
529# CONFIG_SERIO_LIBPS2 is not set
530CONFIG_SERIO_RAW=m
531
532#
533# Input Device Drivers
534#
535
536#
537# Character devices
538#
539# CONFIG_VT is not set
540# CONFIG_SERIAL_NONSTANDARD is not set
541
542#
543# Serial drivers
544#
545CONFIG_SERIAL_8250=y
546CONFIG_SERIAL_8250_CONSOLE=y
547CONFIG_SERIAL_8250_NR_UARTS=4
548CONFIG_SERIAL_8250_EXTENDED=y
549CONFIG_SERIAL_8250_MANY_PORTS=y
550CONFIG_SERIAL_8250_SHARE_IRQ=y
551# CONFIG_SERIAL_8250_DETECT_IRQ is not set
552# CONFIG_SERIAL_8250_MULTIPORT is not set
553# CONFIG_SERIAL_8250_RSA is not set
554
555#
556# Non-8250 serial port support
557#
558CONFIG_SERIAL_CORE=y
559CONFIG_SERIAL_CORE_CONSOLE=y
560CONFIG_UNIX98_PTYS=y
561CONFIG_LEGACY_PTYS=y
562CONFIG_LEGACY_PTY_COUNT=256
563
564#
565# IPMI
566#
567# CONFIG_IPMI_HANDLER is not set
568
569#
570# Watchdog Cards
571#
572# CONFIG_WATCHDOG is not set
573# CONFIG_RTC is not set
574CONFIG_SGI_IP27_RTC=y
575# CONFIG_GEN_RTC is not set
576# CONFIG_DTLK is not set
577# CONFIG_R3964 is not set
578# CONFIG_APPLICOM is not set
579
580#
581# Ftape, the floppy tape device driver
582#
583# CONFIG_DRM is not set
584# CONFIG_RAW_DRIVER is not set
585
586#
587# I2C support
588#
589# CONFIG_I2C is not set
590
591#
592# Dallas's 1-wire bus
593#
594# CONFIG_W1 is not set
595
596#
597# Misc devices
598#
599
600#
601# Multimedia devices
602#
603# CONFIG_VIDEO_DEV is not set
604
605#
606# Digital Video Broadcasting Devices
607#
608# CONFIG_DVB is not set
609
610#
611# Graphics support
612#
613# CONFIG_FB is not set
614# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
615
616#
617# Sound
618#
619# CONFIG_SOUND is not set
620
621#
622# USB support
623#
624# CONFIG_USB is not set
625CONFIG_USB_ARCH_HAS_HCD=y
626CONFIG_USB_ARCH_HAS_OHCI=y
627
628#
629# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
630#
631
632#
633# USB Gadget Support
634#
635# CONFIG_USB_GADGET is not set
636
637#
638# MMC/SD Card support
639#
640# CONFIG_MMC is not set
641
642#
643# InfiniBand support
644#
645# CONFIG_INFINIBAND is not set
646
647#
648# File systems
649#
650CONFIG_EXT2_FS=y
651CONFIG_EXT2_FS_XATTR=y
652CONFIG_EXT2_FS_POSIX_ACL=y
653CONFIG_EXT2_FS_SECURITY=y
654CONFIG_EXT3_FS=y
655CONFIG_EXT3_FS_XATTR=y
656CONFIG_EXT3_FS_POSIX_ACL=y
657CONFIG_EXT3_FS_SECURITY=y
658CONFIG_JBD=y
659CONFIG_JBD_DEBUG=y
660CONFIG_FS_MBCACHE=y
661# CONFIG_REISERFS_FS is not set
662# CONFIG_JFS_FS is not set
663CONFIG_FS_POSIX_ACL=y
664CONFIG_XFS_FS=m
665# CONFIG_XFS_RT is not set
666CONFIG_XFS_QUOTA=y
667CONFIG_XFS_SECURITY=y
668CONFIG_XFS_POSIX_ACL=y
669# CONFIG_MINIX_FS is not set
670# CONFIG_ROMFS_FS is not set
671# CONFIG_QUOTA is not set
672CONFIG_QUOTACTL=y
673CONFIG_DNOTIFY=y
674CONFIG_AUTOFS_FS=m
675# CONFIG_AUTOFS4_FS is not set
676
677#
678# CD-ROM/DVD Filesystems
679#
680# CONFIG_ISO9660_FS is not set
681# CONFIG_UDF_FS is not set
682
683#
684# DOS/FAT/NT Filesystems
685#
686# CONFIG_MSDOS_FS is not set
687# CONFIG_VFAT_FS is not set
688# CONFIG_NTFS_FS is not set
689
690#
691# Pseudo filesystems
692#
693CONFIG_PROC_FS=y
694CONFIG_PROC_KCORE=y
695CONFIG_SYSFS=y
696# CONFIG_DEVFS_FS is not set
697CONFIG_DEVPTS_FS_XATTR=y
698CONFIG_DEVPTS_FS_SECURITY=y
699# CONFIG_TMPFS is not set
700# CONFIG_HUGETLB_PAGE is not set
701CONFIG_RAMFS=y
702
703#
704# Miscellaneous filesystems
705#
706# CONFIG_ADFS_FS is not set
707# CONFIG_AFFS_FS is not set
708# CONFIG_HFS_FS is not set
709# CONFIG_HFSPLUS_FS is not set
710# CONFIG_BEFS_FS is not set
711# CONFIG_BFS_FS is not set
712# CONFIG_EFS_FS is not set
713# CONFIG_CRAMFS is not set
714# CONFIG_VXFS_FS is not set
715# CONFIG_HPFS_FS is not set
716# CONFIG_QNX4FS_FS is not set
717# CONFIG_SYSV_FS is not set
718# CONFIG_UFS_FS is not set
719
720#
721# Network File Systems
722#
723CONFIG_NFS_FS=y
724CONFIG_NFS_V3=y
725# CONFIG_NFS_V4 is not set
726# CONFIG_NFS_DIRECTIO is not set
727# CONFIG_NFSD is not set
728# CONFIG_ROOT_NFS is not set
729CONFIG_LOCKD=y
730CONFIG_LOCKD_V4=y
731# CONFIG_EXPORTFS is not set
732CONFIG_SUNRPC=y
733CONFIG_SUNRPC_GSS=y
734CONFIG_RPCSEC_GSS_KRB5=y
735# CONFIG_RPCSEC_GSS_SPKM3 is not set
736# CONFIG_SMB_FS is not set
737# CONFIG_CIFS is not set
738# CONFIG_NCP_FS is not set
739# CONFIG_CODA_FS is not set
740# CONFIG_AFS_FS is not set
741
742#
743# Partition Types
744#
745CONFIG_PARTITION_ADVANCED=y
746# CONFIG_ACORN_PARTITION is not set
747# CONFIG_OSF_PARTITION is not set
748# CONFIG_AMIGA_PARTITION is not set
749# CONFIG_ATARI_PARTITION is not set
750# CONFIG_MAC_PARTITION is not set
751CONFIG_MSDOS_PARTITION=y
752# CONFIG_BSD_DISKLABEL is not set
753# CONFIG_MINIX_SUBPARTITION is not set
754# CONFIG_SOLARIS_X86_PARTITION is not set
755# CONFIG_UNIXWARE_DISKLABEL is not set
756# CONFIG_LDM_PARTITION is not set
757CONFIG_SGI_PARTITION=y
758# CONFIG_ULTRIX_PARTITION is not set
759# CONFIG_SUN_PARTITION is not set
760# CONFIG_EFI_PARTITION is not set
761
762#
763# Native Language Support
764#
765# CONFIG_NLS is not set
766
767#
768# Profiling support
769#
770# CONFIG_PROFILING is not set
771
772#
773# Kernel hacking
774#
775# CONFIG_DEBUG_KERNEL is not set
776CONFIG_CROSSCOMPILE=y
777CONFIG_CMDLINE=""
778
779#
780# Security options
781#
782CONFIG_KEYS=y
783CONFIG_KEYS_DEBUG_PROC_KEYS=y
784# CONFIG_SECURITY is not set
785
786#
787# Cryptographic options
788#
789CONFIG_CRYPTO=y
790CONFIG_CRYPTO_HMAC=y
791CONFIG_CRYPTO_NULL=y
792CONFIG_CRYPTO_MD4=y
793CONFIG_CRYPTO_MD5=y
794CONFIG_CRYPTO_SHA1=y
795CONFIG_CRYPTO_SHA256=y
796CONFIG_CRYPTO_SHA512=y
797CONFIG_CRYPTO_WP512=m
798CONFIG_CRYPTO_DES=y
799CONFIG_CRYPTO_BLOWFISH=y
800CONFIG_CRYPTO_TWOFISH=y
801CONFIG_CRYPTO_SERPENT=y
802CONFIG_CRYPTO_AES=m
803CONFIG_CRYPTO_CAST5=y
804CONFIG_CRYPTO_CAST6=y
805CONFIG_CRYPTO_TEA=m
806CONFIG_CRYPTO_ARC4=y
807CONFIG_CRYPTO_KHAZAD=m
808CONFIG_CRYPTO_ANUBIS=m
809CONFIG_CRYPTO_DEFLATE=y
810CONFIG_CRYPTO_MICHAEL_MIC=y
811CONFIG_CRYPTO_CRC32C=m
812CONFIG_CRYPTO_TEST=m
813
814#
815# Hardware crypto devices
816#
817
818#
819# Library routines
820#
821# CONFIG_CRC_CCITT is not set
822CONFIG_CRC32=y
823CONFIG_LIBCRC32C=m
824CONFIG_ZLIB_INFLATE=y
825CONFIG_ZLIB_DEFLATE=y
826CONFIG_GENERIC_HARDIRQS=y
827CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
new file mode 100644
index 000000000000..bdf1415475ff
--- /dev/null
+++ b/arch/mips/configs/ip32_defconfig
@@ -0,0 +1,750 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:04 2005
5#
6CONFIG_MIPS=y
7CONFIG_MIPS64=y
8CONFIG_64BIT=y
9
10#
11# Code maturity level options
12#
13CONFIG_EXPERIMENTAL=y
14CONFIG_CLEAN_COMPILE=y
15CONFIG_BROKEN_ON_SMP=y
16
17#
18# General setup
19#
20CONFIG_LOCALVERSION=""
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24CONFIG_BSD_PROCESS_ACCT=y
25# CONFIG_BSD_PROCESS_ACCT_V3 is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48# CONFIG_MODULES is not set
49
50#
51# Machine selection
52#
53# CONFIG_MACH_JAZZ is not set
54# CONFIG_MACH_VR41XX is not set
55# CONFIG_MIPS_COBALT is not set
56# CONFIG_MACH_DECSTATION is not set
57# CONFIG_MIPS_EV64120 is not set
58# CONFIG_MIPS_EV96100 is not set
59# CONFIG_MIPS_IVR is not set
60# CONFIG_LASAT is not set
61# CONFIG_MIPS_ITE8172 is not set
62# CONFIG_MIPS_ATLAS is not set
63# CONFIG_MIPS_MALTA is not set
64# CONFIG_MIPS_SEAD is not set
65# CONFIG_MOMENCO_OCELOT is not set
66# CONFIG_MOMENCO_OCELOT_G is not set
67# CONFIG_MOMENCO_OCELOT_C is not set
68# CONFIG_MOMENCO_OCELOT_3 is not set
69# CONFIG_MOMENCO_JAGUAR_ATX is not set
70# CONFIG_PMC_YOSEMITE is not set
71# CONFIG_DDB5074 is not set
72# CONFIG_DDB5476 is not set
73# CONFIG_DDB5477 is not set
74# CONFIG_NEC_OSPREY is not set
75# CONFIG_SGI_IP22 is not set
76# CONFIG_SGI_IP27 is not set
77CONFIG_SGI_IP32=y
78# CONFIG_SIBYTE_SB1xxx_SOC is not set
79# CONFIG_SNI_RM200_PCI is not set
80CONFIG_RWSEM_GENERIC_SPINLOCK=y
81CONFIG_GENERIC_CALIBRATE_DELAY=y
82CONFIG_HAVE_DEC_LOCK=y
83CONFIG_ARC=y
84CONFIG_DMA_IP32=y
85CONFIG_OWN_DMA=y
86CONFIG_DMA_NONCOHERENT=y
87# CONFIG_CPU_LITTLE_ENDIAN is not set
88CONFIG_ARC32=y
89CONFIG_BOOT_ELF32=y
90CONFIG_MIPS_L1_CACHE_SHIFT=5
91CONFIG_ARC_MEMORY=y
92CONFIG_ARC_PROMLIB=y
93
94#
95# CPU selection
96#
97# CONFIG_CPU_MIPS32 is not set
98# CONFIG_CPU_MIPS64 is not set
99# CONFIG_CPU_R3000 is not set
100# CONFIG_CPU_TX39XX is not set
101# CONFIG_CPU_VR41XX is not set
102# CONFIG_CPU_R4300 is not set
103# CONFIG_CPU_R4X00 is not set
104# CONFIG_CPU_TX49XX is not set
105CONFIG_CPU_R5000=y
106# CONFIG_CPU_R5432 is not set
107# CONFIG_CPU_R6000 is not set
108# CONFIG_CPU_NEVADA is not set
109# CONFIG_CPU_R8000 is not set
110# CONFIG_CPU_R10000 is not set
111# CONFIG_CPU_RM7000 is not set
112# CONFIG_CPU_RM9000 is not set
113# CONFIG_CPU_SB1 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_BOARD_SCACHE=y
119CONFIG_R5000_CPU_SCACHE=y
120CONFIG_RM7000_CPU_SCACHE=y
121CONFIG_CPU_HAS_LLSC=y
122CONFIG_CPU_HAS_LLDSCD=y
123CONFIG_CPU_HAS_SYNC=y
124# CONFIG_PREEMPT is not set
125
126#
127# Bus options (PCI, PCMCIA, EISA, ISA, TC)
128#
129CONFIG_HW_HAS_PCI=y
130CONFIG_PCI=y
131CONFIG_PCI_LEGACY_PROC=y
132CONFIG_PCI_NAMES=y
133CONFIG_MMU=y
134
135#
136# PCCARD (PCMCIA/CardBus) support
137#
138# CONFIG_PCCARD is not set
139
140#
141# PC-card bridges
142#
143
144#
145# PCI Hotplug Support
146#
147# CONFIG_HOTPLUG_PCI is not set
148
149#
150# Executable file formats
151#
152CONFIG_BINFMT_ELF=y
153CONFIG_BINFMT_MISC=y
154# CONFIG_BUILD_ELF64 is not set
155CONFIG_MIPS32_COMPAT=y
156CONFIG_COMPAT=y
157CONFIG_MIPS32_O32=y
158# CONFIG_MIPS32_N32 is not set
159CONFIG_BINFMT_ELF32=y
160
161#
162# Device Drivers
163#
164
165#
166# Generic Driver Options
167#
168CONFIG_STANDALONE=y
169CONFIG_PREVENT_FIRMWARE_BUILD=y
170# CONFIG_FW_LOADER is not set
171
172#
173# Memory Technology Devices (MTD)
174#
175# CONFIG_MTD is not set
176
177#
178# Parallel port support
179#
180# CONFIG_PARPORT is not set
181
182#
183# Plug and Play support
184#
185
186#
187# Block devices
188#
189# CONFIG_BLK_DEV_FD is not set
190# CONFIG_BLK_CPQ_DA is not set
191# CONFIG_BLK_CPQ_CISS_DA is not set
192# CONFIG_BLK_DEV_DAC960 is not set
193# CONFIG_BLK_DEV_UMEM is not set
194# CONFIG_BLK_DEV_COW_COMMON is not set
195CONFIG_BLK_DEV_LOOP=y
196# CONFIG_BLK_DEV_CRYPTOLOOP is not set
197# CONFIG_BLK_DEV_NBD is not set
198# CONFIG_BLK_DEV_SX8 is not set
199# CONFIG_BLK_DEV_RAM is not set
200CONFIG_BLK_DEV_RAM_COUNT=16
201CONFIG_INITRAMFS_SOURCE=""
202CONFIG_CDROM_PKTCDVD=y
203CONFIG_CDROM_PKTCDVD_BUFFERS=8
204# CONFIG_CDROM_PKTCDVD_WCACHE is not set
205
206#
207# IO Schedulers
208#
209CONFIG_IOSCHED_NOOP=y
210CONFIG_IOSCHED_AS=y
211CONFIG_IOSCHED_DEADLINE=y
212CONFIG_IOSCHED_CFQ=y
213CONFIG_ATA_OVER_ETH=y
214
215#
216# ATA/ATAPI/MFM/RLL support
217#
218# CONFIG_IDE is not set
219
220#
221# SCSI device support
222#
223CONFIG_SCSI=y
224CONFIG_SCSI_PROC_FS=y
225
226#
227# SCSI support type (disk, tape, CD-ROM)
228#
229CONFIG_BLK_DEV_SD=y
230CONFIG_CHR_DEV_ST=y
231CONFIG_CHR_DEV_OSST=y
232CONFIG_BLK_DEV_SR=y
233CONFIG_BLK_DEV_SR_VENDOR=y
234CONFIG_CHR_DEV_SG=y
235
236#
237# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
238#
239CONFIG_SCSI_MULTI_LUN=y
240CONFIG_SCSI_CONSTANTS=y
241CONFIG_SCSI_LOGGING=y
242
243#
244# SCSI Transport Attributes
245#
246# CONFIG_SCSI_SPI_ATTRS is not set
247# CONFIG_SCSI_FC_ATTRS is not set
248# CONFIG_SCSI_ISCSI_ATTRS is not set
249
250#
251# SCSI low-level drivers
252#
253# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
254# CONFIG_SCSI_3W_9XXX is not set
255# CONFIG_SCSI_ACARD is not set
256# CONFIG_SCSI_AACRAID is not set
257CONFIG_SCSI_AIC7XXX=y
258CONFIG_AIC7XXX_CMDS_PER_DEVICE=8
259CONFIG_AIC7XXX_RESET_DELAY_MS=15000
260CONFIG_AIC7XXX_DEBUG_ENABLE=y
261CONFIG_AIC7XXX_DEBUG_MASK=0
262CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
263# CONFIG_SCSI_AIC7XXX_OLD is not set
264# CONFIG_SCSI_AIC79XX is not set
265# CONFIG_MEGARAID_NEWGEN is not set
266# CONFIG_MEGARAID_LEGACY is not set
267# CONFIG_SCSI_SATA is not set
268# CONFIG_SCSI_BUSLOGIC is not set
269# CONFIG_SCSI_DMX3191D is not set
270# CONFIG_SCSI_EATA is not set
271# CONFIG_SCSI_EATA_PIO is not set
272# CONFIG_SCSI_FUTURE_DOMAIN is not set
273# CONFIG_SCSI_GDTH is not set
274# CONFIG_SCSI_IPS is not set
275# CONFIG_SCSI_INITIO is not set
276# CONFIG_SCSI_INIA100 is not set
277# CONFIG_SCSI_SYM53C8XX_2 is not set
278# CONFIG_SCSI_IPR is not set
279# CONFIG_SCSI_QLOGIC_ISP is not set
280# CONFIG_SCSI_QLOGIC_FC is not set
281# CONFIG_SCSI_QLOGIC_1280 is not set
282CONFIG_SCSI_QLA2XXX=y
283# CONFIG_SCSI_QLA21XX is not set
284# CONFIG_SCSI_QLA22XX is not set
285# CONFIG_SCSI_QLA2300 is not set
286# CONFIG_SCSI_QLA2322 is not set
287# CONFIG_SCSI_QLA6312 is not set
288# CONFIG_SCSI_DC395x is not set
289# CONFIG_SCSI_DC390T is not set
290# CONFIG_SCSI_DEBUG is not set
291
292#
293# Multi-device support (RAID and LVM)
294#
295# CONFIG_MD is not set
296
297#
298# Fusion MPT device support
299#
300# CONFIG_FUSION is not set
301
302#
303# IEEE 1394 (FireWire) support
304#
305# CONFIG_IEEE1394 is not set
306
307#
308# I2O device support
309#
310# CONFIG_I2O is not set
311
312#
313# Networking support
314#
315CONFIG_NET=y
316
317#
318# Networking options
319#
320CONFIG_PACKET=y
321CONFIG_PACKET_MMAP=y
322CONFIG_NETLINK_DEV=y
323CONFIG_UNIX=y
324CONFIG_NET_KEY=y
325CONFIG_INET=y
326# CONFIG_IP_MULTICAST is not set
327# CONFIG_IP_ADVANCED_ROUTER is not set
328CONFIG_IP_PNP=y
329# CONFIG_IP_PNP_DHCP is not set
330CONFIG_IP_PNP_BOOTP=y
331# CONFIG_IP_PNP_RARP is not set
332# CONFIG_NET_IPIP is not set
333# CONFIG_NET_IPGRE is not set
334# CONFIG_ARPD is not set
335# CONFIG_SYN_COOKIES is not set
336# CONFIG_INET_AH is not set
337# CONFIG_INET_ESP is not set
338# CONFIG_INET_IPCOMP is not set
339CONFIG_INET_TUNNEL=y
340CONFIG_IP_TCPDIAG=y
341# CONFIG_IP_TCPDIAG_IPV6 is not set
342# CONFIG_IPV6 is not set
343# CONFIG_NETFILTER is not set
344CONFIG_XFRM=y
345CONFIG_XFRM_USER=y
346
347#
348# SCTP Configuration (EXPERIMENTAL)
349#
350# CONFIG_IP_SCTP is not set
351# CONFIG_ATM is not set
352# CONFIG_BRIDGE is not set
353# CONFIG_VLAN_8021Q is not set
354# CONFIG_DECNET is not set
355# CONFIG_LLC2 is not set
356# CONFIG_IPX is not set
357# CONFIG_ATALK is not set
358# CONFIG_X25 is not set
359# CONFIG_LAPB is not set
360# CONFIG_NET_DIVERT is not set
361# CONFIG_ECONET is not set
362# CONFIG_WAN_ROUTER is not set
363
364#
365# QoS and/or fair queueing
366#
367# CONFIG_NET_SCHED is not set
368# CONFIG_NET_CLS_ROUTE is not set
369
370#
371# Network testing
372#
373# CONFIG_NET_PKTGEN is not set
374# CONFIG_NETPOLL is not set
375# CONFIG_NET_POLL_CONTROLLER is not set
376# CONFIG_HAMRADIO is not set
377# CONFIG_IRDA is not set
378# CONFIG_BT is not set
379CONFIG_NETDEVICES=y
380# CONFIG_DUMMY is not set
381# CONFIG_BONDING is not set
382# CONFIG_EQUALIZER is not set
383# CONFIG_TUN is not set
384# CONFIG_ETHERTAP is not set
385
386#
387# ARCnet devices
388#
389# CONFIG_ARCNET is not set
390
391#
392# Ethernet (10 or 100Mbit)
393#
394CONFIG_NET_ETHERNET=y
395# CONFIG_MII is not set
396CONFIG_SGI_O2MACE_ETH=y
397# CONFIG_HAPPYMEAL is not set
398# CONFIG_SUNGEM is not set
399# CONFIG_NET_VENDOR_3COM is not set
400
401#
402# Tulip family network device support
403#
404# CONFIG_NET_TULIP is not set
405# CONFIG_HP100 is not set
406# CONFIG_NET_PCI is not set
407
408#
409# Ethernet (1000 Mbit)
410#
411# CONFIG_ACENIC is not set
412# CONFIG_DL2K is not set
413# CONFIG_E1000 is not set
414# CONFIG_NS83820 is not set
415# CONFIG_HAMACHI is not set
416# CONFIG_YELLOWFIN is not set
417# CONFIG_R8169 is not set
418# CONFIG_SK98LIN is not set
419# CONFIG_TIGON3 is not set
420
421#
422# Ethernet (10000 Mbit)
423#
424# CONFIG_IXGB is not set
425# CONFIG_S2IO is not set
426
427#
428# Token Ring devices
429#
430# CONFIG_TR is not set
431
432#
433# Wireless LAN (non-hamradio)
434#
435# CONFIG_NET_RADIO is not set
436
437#
438# Wan interfaces
439#
440# CONFIG_WAN is not set
441# CONFIG_FDDI is not set
442# CONFIG_HIPPI is not set
443# CONFIG_PPP is not set
444# CONFIG_SLIP is not set
445# CONFIG_NET_FC is not set
446# CONFIG_SHAPER is not set
447# CONFIG_NETCONSOLE is not set
448
449#
450# ISDN subsystem
451#
452# CONFIG_ISDN is not set
453
454#
455# Telephony Support
456#
457# CONFIG_PHONE is not set
458
459#
460# Input device support
461#
462CONFIG_INPUT=y
463
464#
465# Userland interfaces
466#
467CONFIG_INPUT_MOUSEDEV=y
468CONFIG_INPUT_MOUSEDEV_PSAUX=y
469CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
470CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
471# CONFIG_INPUT_JOYDEV is not set
472# CONFIG_INPUT_TSDEV is not set
473# CONFIG_INPUT_EVDEV is not set
474# CONFIG_INPUT_EVBUG is not set
475
476#
477# Input I/O drivers
478#
479# CONFIG_GAMEPORT is not set
480CONFIG_SOUND_GAMEPORT=y
481CONFIG_SERIO=y
482# CONFIG_SERIO_I8042 is not set
483CONFIG_SERIO_SERPORT=y
484# CONFIG_SERIO_CT82C710 is not set
485# CONFIG_SERIO_PCIPS2 is not set
486# CONFIG_SERIO_MACEPS2 is not set
487# CONFIG_SERIO_LIBPS2 is not set
488CONFIG_SERIO_RAW=y
489
490#
491# Input Device Drivers
492#
493# CONFIG_INPUT_KEYBOARD is not set
494# CONFIG_INPUT_MOUSE is not set
495# CONFIG_INPUT_JOYSTICK is not set
496# CONFIG_INPUT_TOUCHSCREEN is not set
497# CONFIG_INPUT_MISC is not set
498
499#
500# Character devices
501#
502CONFIG_VT=y
503CONFIG_VT_CONSOLE=y
504CONFIG_HW_CONSOLE=y
505# CONFIG_SERIAL_NONSTANDARD is not set
506
507#
508# Serial drivers
509#
510CONFIG_SERIAL_8250=y
511CONFIG_SERIAL_8250_CONSOLE=y
512CONFIG_SERIAL_8250_NR_UARTS=4
513# CONFIG_SERIAL_8250_EXTENDED is not set
514
515#
516# Non-8250 serial port support
517#
518CONFIG_SERIAL_CORE=y
519CONFIG_SERIAL_CORE_CONSOLE=y
520CONFIG_UNIX98_PTYS=y
521CONFIG_LEGACY_PTYS=y
522CONFIG_LEGACY_PTY_COUNT=256
523
524#
525# IPMI
526#
527# CONFIG_IPMI_HANDLER is not set
528
529#
530# Watchdog Cards
531#
532# CONFIG_WATCHDOG is not set
533# CONFIG_RTC is not set
534# CONFIG_GEN_RTC is not set
535# CONFIG_DTLK is not set
536# CONFIG_R3964 is not set
537# CONFIG_APPLICOM is not set
538
539#
540# Ftape, the floppy tape device driver
541#
542# CONFIG_DRM is not set
543# CONFIG_RAW_DRIVER is not set
544
545#
546# I2C support
547#
548# CONFIG_I2C is not set
549
550#
551# Dallas's 1-wire bus
552#
553# CONFIG_W1 is not set
554
555#
556# Misc devices
557#
558
559#
560# Multimedia devices
561#
562# CONFIG_VIDEO_DEV is not set
563
564#
565# Digital Video Broadcasting Devices
566#
567# CONFIG_DVB is not set
568
569#
570# Graphics support
571#
572# CONFIG_FB is not set
573
574#
575# Console display driver support
576#
577# CONFIG_VGA_CONSOLE is not set
578CONFIG_DUMMY_CONSOLE=y
579# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
580
581#
582# Sound
583#
584# CONFIG_SOUND is not set
585
586#
587# USB support
588#
589# CONFIG_USB is not set
590CONFIG_USB_ARCH_HAS_HCD=y
591CONFIG_USB_ARCH_HAS_OHCI=y
592
593#
594# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
595#
596
597#
598# USB Gadget Support
599#
600# CONFIG_USB_GADGET is not set
601
602#
603# MMC/SD Card support
604#
605# CONFIG_MMC is not set
606
607#
608# InfiniBand support
609#
610# CONFIG_INFINIBAND is not set
611
612#
613# File systems
614#
615CONFIG_EXT2_FS=y
616# CONFIG_EXT2_FS_XATTR is not set
617# CONFIG_EXT3_FS is not set
618# CONFIG_JBD is not set
619# CONFIG_REISERFS_FS is not set
620# CONFIG_JFS_FS is not set
621# CONFIG_XFS_FS is not set
622# CONFIG_MINIX_FS is not set
623# CONFIG_ROMFS_FS is not set
624# CONFIG_QUOTA is not set
625CONFIG_DNOTIFY=y
626# CONFIG_AUTOFS_FS is not set
627# CONFIG_AUTOFS4_FS is not set
628
629#
630# CD-ROM/DVD Filesystems
631#
632# CONFIG_ISO9660_FS is not set
633# CONFIG_UDF_FS is not set
634
635#
636# DOS/FAT/NT Filesystems
637#
638# CONFIG_MSDOS_FS is not set
639# CONFIG_VFAT_FS is not set
640# CONFIG_NTFS_FS is not set
641
642#
643# Pseudo filesystems
644#
645CONFIG_PROC_FS=y
646CONFIG_PROC_KCORE=y
647CONFIG_SYSFS=y
648# CONFIG_DEVFS_FS is not set
649CONFIG_DEVPTS_FS_XATTR=y
650CONFIG_DEVPTS_FS_SECURITY=y
651CONFIG_TMPFS=y
652# CONFIG_TMPFS_XATTR is not set
653# CONFIG_HUGETLB_PAGE is not set
654CONFIG_RAMFS=y
655
656#
657# Miscellaneous filesystems
658#
659# CONFIG_ADFS_FS is not set
660# CONFIG_AFFS_FS is not set
661# CONFIG_HFS_FS is not set
662# CONFIG_HFSPLUS_FS is not set
663# CONFIG_BEFS_FS is not set
664# CONFIG_BFS_FS is not set
665# CONFIG_EFS_FS is not set
666# CONFIG_CRAMFS is not set
667# CONFIG_VXFS_FS is not set
668# CONFIG_HPFS_FS is not set
669# CONFIG_QNX4FS_FS is not set
670# CONFIG_SYSV_FS is not set
671# CONFIG_UFS_FS is not set
672
673#
674# Network File Systems
675#
676CONFIG_NFS_FS=y
677CONFIG_NFS_V3=y
678# CONFIG_NFS_V4 is not set
679# CONFIG_NFS_DIRECTIO is not set
680# CONFIG_NFSD is not set
681CONFIG_ROOT_NFS=y
682CONFIG_LOCKD=y
683CONFIG_LOCKD_V4=y
684# CONFIG_EXPORTFS is not set
685CONFIG_SUNRPC=y
686# CONFIG_RPCSEC_GSS_KRB5 is not set
687# CONFIG_RPCSEC_GSS_SPKM3 is not set
688# CONFIG_SMB_FS is not set
689# CONFIG_CIFS is not set
690# CONFIG_NCP_FS is not set
691# CONFIG_CODA_FS is not set
692# CONFIG_AFS_FS is not set
693
694#
695# Partition Types
696#
697CONFIG_PARTITION_ADVANCED=y
698# CONFIG_ACORN_PARTITION is not set
699# CONFIG_OSF_PARTITION is not set
700# CONFIG_AMIGA_PARTITION is not set
701# CONFIG_ATARI_PARTITION is not set
702# CONFIG_MAC_PARTITION is not set
703# CONFIG_MSDOS_PARTITION is not set
704# CONFIG_LDM_PARTITION is not set
705CONFIG_SGI_PARTITION=y
706# CONFIG_ULTRIX_PARTITION is not set
707# CONFIG_SUN_PARTITION is not set
708# CONFIG_EFI_PARTITION is not set
709
710#
711# Native Language Support
712#
713# CONFIG_NLS is not set
714
715#
716# Profiling support
717#
718# CONFIG_PROFILING is not set
719
720#
721# Kernel hacking
722#
723# CONFIG_DEBUG_KERNEL is not set
724CONFIG_CROSSCOMPILE=y
725CONFIG_CMDLINE=""
726
727#
728# Security options
729#
730CONFIG_KEYS=y
731CONFIG_KEYS_DEBUG_PROC_KEYS=y
732# CONFIG_SECURITY is not set
733
734#
735# Cryptographic options
736#
737# CONFIG_CRYPTO is not set
738
739#
740# Hardware crypto devices
741#
742
743#
744# Library routines
745#
746# CONFIG_CRC_CCITT is not set
747# CONFIG_CRC32 is not set
748# CONFIG_LIBCRC32C is not set
749CONFIG_GENERIC_HARDIRQS=y
750CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/it8172_defconfig b/arch/mips/configs/it8172_defconfig
new file mode 100644
index 000000000000..1ca7746388f0
--- /dev/null
+++ b/arch/mips/configs/it8172_defconfig
@@ -0,0 +1,740 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:05 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25CONFIG_BSD_PROCESS_ACCT=y
26# CONFIG_BSD_PROCESS_ACCT_V3 is not set
27CONFIG_SYSCTL=y
28# CONFIG_AUDIT is not set
29CONFIG_LOG_BUF_SHIFT=14
30# CONFIG_HOTPLUG is not set
31CONFIG_KOBJECT_UEVENT=y
32# CONFIG_IKCONFIG is not set
33CONFIG_EMBEDDED=y
34CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_FUTEX=y
37CONFIG_EPOLL=y
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SHMEM=y
40CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0
44# CONFIG_TINY_SHMEM is not set
45
46#
47# Loadable module support
48#
49CONFIG_MODULES=y
50CONFIG_MODULE_UNLOAD=y
51# CONFIG_MODULE_FORCE_UNLOAD is not set
52CONFIG_OBSOLETE_MODPARM=y
53CONFIG_MODVERSIONS=y
54CONFIG_MODULE_SRCVERSION_ALL=y
55CONFIG_KMOD=y
56
57#
58# Machine selection
59#
60# CONFIG_MACH_JAZZ is not set
61# CONFIG_MACH_VR41XX is not set
62# CONFIG_TOSHIBA_JMR3927 is not set
63# CONFIG_MIPS_COBALT is not set
64# CONFIG_MACH_DECSTATION is not set
65# CONFIG_MIPS_EV64120 is not set
66# CONFIG_MIPS_EV96100 is not set
67# CONFIG_MIPS_IVR is not set
68# CONFIG_LASAT is not set
69CONFIG_MIPS_ITE8172=y
70# CONFIG_IT8172_REVC is not set
71# CONFIG_MIPS_ATLAS is not set
72# CONFIG_MIPS_MALTA is not set
73# CONFIG_MIPS_SEAD is not set
74# CONFIG_MOMENCO_OCELOT is not set
75# CONFIG_MOMENCO_OCELOT_G is not set
76# CONFIG_MOMENCO_OCELOT_C is not set
77# CONFIG_MOMENCO_OCELOT_3 is not set
78# CONFIG_MOMENCO_JAGUAR_ATX is not set
79# CONFIG_PMC_YOSEMITE is not set
80# CONFIG_DDB5074 is not set
81# CONFIG_DDB5476 is not set
82# CONFIG_DDB5477 is not set
83# CONFIG_NEC_OSPREY is not set
84# CONFIG_SGI_IP22 is not set
85# CONFIG_SOC_AU1X00 is not set
86# CONFIG_SIBYTE_SB1xxx_SOC is not set
87# CONFIG_SNI_RM200_PCI is not set
88# CONFIG_TOSHIBA_RBTX4927 is not set
89CONFIG_RWSEM_GENERIC_SPINLOCK=y
90CONFIG_GENERIC_CALIBRATE_DELAY=y
91CONFIG_HAVE_DEC_LOCK=y
92CONFIG_DMA_NONCOHERENT=y
93CONFIG_CPU_LITTLE_ENDIAN=y
94CONFIG_ITE_BOARD_GEN=y
95CONFIG_IT8172_CIR=y
96CONFIG_IT8712=y
97CONFIG_MIPS_L1_CACHE_SHIFT=5
98
99#
100# CPU selection
101#
102# CONFIG_CPU_MIPS32 is not set
103# CONFIG_CPU_MIPS64 is not set
104# CONFIG_CPU_R3000 is not set
105# CONFIG_CPU_TX39XX is not set
106# CONFIG_CPU_VR41XX is not set
107# CONFIG_CPU_R4300 is not set
108# CONFIG_CPU_R4X00 is not set
109# CONFIG_CPU_TX49XX is not set
110# CONFIG_CPU_R5000 is not set
111# CONFIG_CPU_R5432 is not set
112# CONFIG_CPU_R6000 is not set
113CONFIG_CPU_NEVADA=y
114# CONFIG_CPU_R8000 is not set
115# CONFIG_CPU_R10000 is not set
116# CONFIG_CPU_RM7000 is not set
117# CONFIG_CPU_RM9000 is not set
118# CONFIG_CPU_SB1 is not set
119CONFIG_PAGE_SIZE_4KB=y
120# CONFIG_PAGE_SIZE_8KB is not set
121# CONFIG_PAGE_SIZE_16KB is not set
122# CONFIG_PAGE_SIZE_64KB is not set
123# CONFIG_CPU_ADVANCED is not set
124CONFIG_CPU_HAS_LLSC=y
125CONFIG_CPU_HAS_LLDSCD=y
126CONFIG_CPU_HAS_SYNC=y
127# CONFIG_PREEMPT is not set
128
129#
130# Bus options (PCI, PCMCIA, EISA, ISA, TC)
131#
132CONFIG_HW_HAS_PCI=y
133# CONFIG_PCI is not set
134CONFIG_MMU=y
135
136#
137# PCCARD (PCMCIA/CardBus) support
138#
139# CONFIG_PCCARD is not set
140
141#
142# PC-card bridges
143#
144
145#
146# PCI Hotplug Support
147#
148
149#
150# Executable file formats
151#
152CONFIG_BINFMT_ELF=y
153# CONFIG_BINFMT_MISC is not set
154CONFIG_TRAD_SIGNALS=y
155
156#
157# Device Drivers
158#
159
160#
161# Generic Driver Options
162#
163CONFIG_STANDALONE=y
164CONFIG_PREVENT_FIRMWARE_BUILD=y
165# CONFIG_FW_LOADER is not set
166
167#
168# Memory Technology Devices (MTD)
169#
170CONFIG_MTD=y
171# CONFIG_MTD_DEBUG is not set
172# CONFIG_MTD_PARTITIONS is not set
173# CONFIG_MTD_CONCAT is not set
174
175#
176# User Modules And Translation Layers
177#
178CONFIG_MTD_CHAR=y
179# CONFIG_MTD_BLOCK is not set
180# CONFIG_MTD_BLOCK_RO is not set
181# CONFIG_FTL is not set
182# CONFIG_NFTL is not set
183# CONFIG_INFTL is not set
184
185#
186# RAM/ROM/Flash chip drivers
187#
188CONFIG_MTD_CFI=y
189# CONFIG_MTD_JEDECPROBE is not set
190CONFIG_MTD_GEN_PROBE=y
191# CONFIG_MTD_CFI_ADV_OPTIONS is not set
192CONFIG_MTD_MAP_BANK_WIDTH_1=y
193CONFIG_MTD_MAP_BANK_WIDTH_2=y
194CONFIG_MTD_MAP_BANK_WIDTH_4=y
195# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
196# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
197# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
198CONFIG_MTD_CFI_I1=y
199CONFIG_MTD_CFI_I2=y
200# CONFIG_MTD_CFI_I4 is not set
201# CONFIG_MTD_CFI_I8 is not set
202CONFIG_MTD_CFI_INTELEXT=y
203# CONFIG_MTD_CFI_AMDSTD is not set
204# CONFIG_MTD_CFI_STAA is not set
205CONFIG_MTD_CFI_UTIL=y
206# CONFIG_MTD_RAM is not set
207# CONFIG_MTD_ROM is not set
208# CONFIG_MTD_ABSENT is not set
209# CONFIG_MTD_XIP is not set
210
211#
212# Mapping drivers for chip access
213#
214# CONFIG_MTD_COMPLEX_MAPPINGS is not set
215CONFIG_MTD_PHYSMAP=y
216CONFIG_MTD_PHYSMAP_START=0x8000000
217CONFIG_MTD_PHYSMAP_LEN=0x2000000
218CONFIG_MTD_PHYSMAP_BANKWIDTH=2
219
220#
221# Self-contained MTD device drivers
222#
223# CONFIG_MTD_SLRAM is not set
224# CONFIG_MTD_PHRAM is not set
225# CONFIG_MTD_MTDRAM is not set
226# CONFIG_MTD_BLKMTD is not set
227# CONFIG_MTD_BLOCK2MTD is not set
228
229#
230# Disk-On-Chip Device Drivers
231#
232# CONFIG_MTD_DOC2000 is not set
233# CONFIG_MTD_DOC2001 is not set
234# CONFIG_MTD_DOC2001PLUS is not set
235
236#
237# NAND Flash Device Drivers
238#
239# CONFIG_MTD_NAND is not set
240
241#
242# Parallel port support
243#
244# CONFIG_PARPORT is not set
245
246#
247# Plug and Play support
248#
249
250#
251# Block devices
252#
253# CONFIG_BLK_DEV_FD is not set
254# CONFIG_BLK_DEV_COW_COMMON is not set
255CONFIG_BLK_DEV_LOOP=y
256# CONFIG_BLK_DEV_CRYPTOLOOP is not set
257# CONFIG_BLK_DEV_NBD is not set
258# CONFIG_BLK_DEV_RAM is not set
259CONFIG_BLK_DEV_RAM_COUNT=16
260CONFIG_INITRAMFS_SOURCE=""
261# CONFIG_LBD is not set
262CONFIG_CDROM_PKTCDVD=m
263CONFIG_CDROM_PKTCDVD_BUFFERS=8
264# CONFIG_CDROM_PKTCDVD_WCACHE is not set
265
266#
267# IO Schedulers
268#
269CONFIG_IOSCHED_NOOP=y
270CONFIG_IOSCHED_AS=y
271CONFIG_IOSCHED_DEADLINE=y
272CONFIG_IOSCHED_CFQ=y
273CONFIG_ATA_OVER_ETH=m
274
275#
276# ATA/ATAPI/MFM/RLL support
277#
278CONFIG_IDE=y
279CONFIG_BLK_DEV_IDE=y
280
281#
282# Please see Documentation/ide.txt for help/info on IDE drives
283#
284# CONFIG_BLK_DEV_IDE_SATA is not set
285CONFIG_BLK_DEV_IDEDISK=y
286# CONFIG_IDEDISK_MULTI_MODE is not set
287# CONFIG_BLK_DEV_IDECD is not set
288# CONFIG_BLK_DEV_IDETAPE is not set
289# CONFIG_BLK_DEV_IDEFLOPPY is not set
290# CONFIG_IDE_TASK_IOCTL is not set
291
292#
293# IDE chipset support/bugfixes
294#
295CONFIG_IDE_GENERIC=y
296# CONFIG_IDE_ARM is not set
297# CONFIG_BLK_DEV_IDEDMA is not set
298# CONFIG_IDEDMA_AUTO is not set
299# CONFIG_BLK_DEV_HD is not set
300
301#
302# SCSI device support
303#
304# CONFIG_SCSI is not set
305
306#
307# Multi-device support (RAID and LVM)
308#
309# CONFIG_MD is not set
310
311#
312# Fusion MPT device support
313#
314
315#
316# IEEE 1394 (FireWire) support
317#
318
319#
320# I2O device support
321#
322
323#
324# Networking support
325#
326CONFIG_NET=y
327
328#
329# Networking options
330#
331CONFIG_PACKET=y
332CONFIG_PACKET_MMAP=y
333CONFIG_NETLINK_DEV=y
334CONFIG_UNIX=y
335CONFIG_NET_KEY=y
336CONFIG_INET=y
337# CONFIG_IP_MULTICAST is not set
338# CONFIG_IP_ADVANCED_ROUTER is not set
339CONFIG_IP_PNP=y
340# CONFIG_IP_PNP_DHCP is not set
341CONFIG_IP_PNP_BOOTP=y
342# CONFIG_IP_PNP_RARP is not set
343# CONFIG_NET_IPIP is not set
344# CONFIG_NET_IPGRE is not set
345# CONFIG_ARPD is not set
346# CONFIG_SYN_COOKIES is not set
347# CONFIG_INET_AH is not set
348# CONFIG_INET_ESP is not set
349# CONFIG_INET_IPCOMP is not set
350CONFIG_INET_TUNNEL=m
351CONFIG_IP_TCPDIAG=m
352# CONFIG_IP_TCPDIAG_IPV6 is not set
353# CONFIG_IPV6 is not set
354# CONFIG_NETFILTER is not set
355CONFIG_XFRM=y
356CONFIG_XFRM_USER=m
357
358#
359# SCTP Configuration (EXPERIMENTAL)
360#
361# CONFIG_IP_SCTP is not set
362# CONFIG_ATM is not set
363# CONFIG_BRIDGE is not set
364# CONFIG_VLAN_8021Q is not set
365# CONFIG_DECNET is not set
366# CONFIG_LLC2 is not set
367# CONFIG_IPX is not set
368# CONFIG_ATALK is not set
369# CONFIG_X25 is not set
370# CONFIG_LAPB is not set
371# CONFIG_NET_DIVERT is not set
372# CONFIG_ECONET is not set
373# CONFIG_WAN_ROUTER is not set
374
375#
376# QoS and/or fair queueing
377#
378# CONFIG_NET_SCHED is not set
379# CONFIG_NET_CLS_ROUTE is not set
380
381#
382# Network testing
383#
384# CONFIG_NET_PKTGEN is not set
385# CONFIG_NETPOLL is not set
386# CONFIG_NET_POLL_CONTROLLER is not set
387# CONFIG_HAMRADIO is not set
388# CONFIG_IRDA is not set
389# CONFIG_BT is not set
390CONFIG_NETDEVICES=y
391# CONFIG_DUMMY is not set
392# CONFIG_BONDING is not set
393# CONFIG_EQUALIZER is not set
394# CONFIG_TUN is not set
395# CONFIG_ETHERTAP is not set
396
397#
398# Ethernet (10 or 100Mbit)
399#
400CONFIG_NET_ETHERNET=y
401# CONFIG_MII is not set
402
403#
404# Ethernet (1000 Mbit)
405#
406
407#
408# Ethernet (10000 Mbit)
409#
410
411#
412# Token Ring devices
413#
414
415#
416# Wireless LAN (non-hamradio)
417#
418# CONFIG_NET_RADIO is not set
419
420#
421# Wan interfaces
422#
423# CONFIG_WAN is not set
424# CONFIG_PPP is not set
425# CONFIG_SLIP is not set
426# CONFIG_SHAPER is not set
427# CONFIG_NETCONSOLE is not set
428
429#
430# ISDN subsystem
431#
432# CONFIG_ISDN is not set
433
434#
435# Telephony Support
436#
437# CONFIG_PHONE is not set
438
439#
440# Input device support
441#
442CONFIG_INPUT=y
443
444#
445# Userland interfaces
446#
447CONFIG_INPUT_MOUSEDEV=y
448CONFIG_INPUT_MOUSEDEV_PSAUX=y
449CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
450CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
451# CONFIG_INPUT_JOYDEV is not set
452# CONFIG_INPUT_TSDEV is not set
453# CONFIG_INPUT_EVDEV is not set
454# CONFIG_INPUT_EVBUG is not set
455
456#
457# Input I/O drivers
458#
459# CONFIG_GAMEPORT is not set
460CONFIG_SOUND_GAMEPORT=y
461CONFIG_SERIO=y
462# CONFIG_SERIO_I8042 is not set
463CONFIG_SERIO_SERPORT=y
464# CONFIG_SERIO_CT82C710 is not set
465# CONFIG_SERIO_LIBPS2 is not set
466CONFIG_SERIO_RAW=m
467
468#
469# Input Device Drivers
470#
471# CONFIG_INPUT_KEYBOARD is not set
472# CONFIG_INPUT_MOUSE is not set
473# CONFIG_INPUT_JOYSTICK is not set
474# CONFIG_INPUT_TOUCHSCREEN is not set
475# CONFIG_INPUT_MISC is not set
476
477#
478# Character devices
479#
480CONFIG_VT=y
481CONFIG_VT_CONSOLE=y
482CONFIG_HW_CONSOLE=y
483# CONFIG_SERIAL_NONSTANDARD is not set
484# CONFIG_QTRONIX_KEYBOARD is not set
485# CONFIG_IT8172_SCR0 is not set
486# CONFIG_IT8172_SCR1 is not set
487# CONFIG_ITE_GPIO is not set
488
489#
490# Serial drivers
491#
492CONFIG_SERIAL_8250=y
493CONFIG_SERIAL_8250_CONSOLE=y
494CONFIG_SERIAL_8250_NR_UARTS=4
495# CONFIG_SERIAL_8250_EXTENDED is not set
496
497#
498# Non-8250 serial port support
499#
500CONFIG_SERIAL_CORE=y
501CONFIG_SERIAL_CORE_CONSOLE=y
502CONFIG_UNIX98_PTYS=y
503CONFIG_LEGACY_PTYS=y
504CONFIG_LEGACY_PTY_COUNT=256
505
506#
507# IPMI
508#
509# CONFIG_IPMI_HANDLER is not set
510
511#
512# Watchdog Cards
513#
514# CONFIG_WATCHDOG is not set
515# CONFIG_RTC is not set
516# CONFIG_GEN_RTC is not set
517# CONFIG_DTLK is not set
518# CONFIG_R3964 is not set
519
520#
521# Ftape, the floppy tape device driver
522#
523# CONFIG_DRM is not set
524# CONFIG_RAW_DRIVER is not set
525
526#
527# I2C support
528#
529# CONFIG_I2C is not set
530
531#
532# Dallas's 1-wire bus
533#
534# CONFIG_W1 is not set
535
536#
537# Misc devices
538#
539
540#
541# Multimedia devices
542#
543# CONFIG_VIDEO_DEV is not set
544
545#
546# Digital Video Broadcasting Devices
547#
548# CONFIG_DVB is not set
549
550#
551# Graphics support
552#
553# CONFIG_FB is not set
554
555#
556# Console display driver support
557#
558# CONFIG_VGA_CONSOLE is not set
559CONFIG_DUMMY_CONSOLE=y
560# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
561
562#
563# Sound
564#
565CONFIG_SOUND=y
566
567#
568# Advanced Linux Sound Architecture
569#
570# CONFIG_SND is not set
571
572#
573# Open Sound System
574#
575CONFIG_SOUND_PRIME=y
576# CONFIG_SOUND_BT878 is not set
577# CONFIG_SOUND_FUSION is not set
578# CONFIG_SOUND_CS4281 is not set
579# CONFIG_SOUND_SONICVIBES is not set
580CONFIG_SOUND_IT8172=y
581# CONFIG_SOUND_TRIDENT is not set
582# CONFIG_SOUND_MSNDCLAS is not set
583# CONFIG_SOUND_MSNDPIN is not set
584# CONFIG_SOUND_OSS is not set
585# CONFIG_SOUND_AD1980 is not set
586
587#
588# USB support
589#
590# CONFIG_USB_ARCH_HAS_HCD is not set
591# CONFIG_USB_ARCH_HAS_OHCI is not set
592
593#
594# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
595#
596
597#
598# USB Gadget Support
599#
600# CONFIG_USB_GADGET is not set
601
602#
603# MMC/SD Card support
604#
605# CONFIG_MMC is not set
606
607#
608# InfiniBand support
609#
610# CONFIG_INFINIBAND is not set
611
612#
613# File systems
614#
615CONFIG_EXT2_FS=y
616# CONFIG_EXT2_FS_XATTR is not set
617# CONFIG_EXT3_FS is not set
618# CONFIG_JBD is not set
619# CONFIG_REISERFS_FS is not set
620# CONFIG_JFS_FS is not set
621# CONFIG_XFS_FS is not set
622# CONFIG_MINIX_FS is not set
623# CONFIG_ROMFS_FS is not set
624# CONFIG_QUOTA is not set
625CONFIG_DNOTIFY=y
626# CONFIG_AUTOFS_FS is not set
627# CONFIG_AUTOFS4_FS is not set
628
629#
630# CD-ROM/DVD Filesystems
631#
632# CONFIG_ISO9660_FS is not set
633# CONFIG_UDF_FS is not set
634
635#
636# DOS/FAT/NT Filesystems
637#
638# CONFIG_MSDOS_FS is not set
639# CONFIG_VFAT_FS is not set
640# CONFIG_NTFS_FS is not set
641
642#
643# Pseudo filesystems
644#
645CONFIG_PROC_FS=y
646CONFIG_PROC_KCORE=y
647CONFIG_SYSFS=y
648# CONFIG_DEVFS_FS is not set
649CONFIG_DEVPTS_FS_XATTR=y
650CONFIG_DEVPTS_FS_SECURITY=y
651# CONFIG_TMPFS is not set
652# CONFIG_HUGETLB_PAGE is not set
653CONFIG_RAMFS=y
654
655#
656# Miscellaneous filesystems
657#
658# CONFIG_ADFS_FS is not set
659# CONFIG_AFFS_FS is not set
660# CONFIG_HFS_FS is not set
661# CONFIG_HFSPLUS_FS is not set
662# CONFIG_BEFS_FS is not set
663# CONFIG_BFS_FS is not set
664# CONFIG_EFS_FS is not set
665# CONFIG_JFFS_FS is not set
666# CONFIG_JFFS2_FS is not set
667# CONFIG_CRAMFS is not set
668# CONFIG_VXFS_FS is not set
669# CONFIG_HPFS_FS is not set
670# CONFIG_QNX4FS_FS is not set
671# CONFIG_SYSV_FS is not set
672# CONFIG_UFS_FS is not set
673
674#
675# Network File Systems
676#
677CONFIG_NFS_FS=y
678# CONFIG_NFS_V3 is not set
679# CONFIG_NFS_V4 is not set
680# CONFIG_NFS_DIRECTIO is not set
681# CONFIG_NFSD is not set
682CONFIG_ROOT_NFS=y
683CONFIG_LOCKD=y
684# CONFIG_EXPORTFS is not set
685CONFIG_SUNRPC=y
686# CONFIG_RPCSEC_GSS_KRB5 is not set
687# CONFIG_RPCSEC_GSS_SPKM3 is not set
688# CONFIG_SMB_FS is not set
689# CONFIG_CIFS is not set
690# CONFIG_NCP_FS is not set
691# CONFIG_CODA_FS is not set
692# CONFIG_AFS_FS is not set
693
694#
695# Partition Types
696#
697# CONFIG_PARTITION_ADVANCED is not set
698CONFIG_MSDOS_PARTITION=y
699
700#
701# Native Language Support
702#
703# CONFIG_NLS is not set
704
705#
706# Profiling support
707#
708# CONFIG_PROFILING is not set
709
710#
711# Kernel hacking
712#
713# CONFIG_DEBUG_KERNEL is not set
714CONFIG_CROSSCOMPILE=y
715CONFIG_CMDLINE=""
716
717#
718# Security options
719#
720CONFIG_KEYS=y
721CONFIG_KEYS_DEBUG_PROC_KEYS=y
722# CONFIG_SECURITY is not set
723
724#
725# Cryptographic options
726#
727# CONFIG_CRYPTO is not set
728
729#
730# Hardware crypto devices
731#
732
733#
734# Library routines
735#
736# CONFIG_CRC_CCITT is not set
737# CONFIG_CRC32 is not set
738CONFIG_LIBCRC32C=m
739CONFIG_GENERIC_HARDIRQS=y
740CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ivr_defconfig b/arch/mips/configs/ivr_defconfig
new file mode 100644
index 000000000000..c6eef708be1e
--- /dev/null
+++ b/arch/mips/configs/ivr_defconfig
@@ -0,0 +1,686 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:05 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25CONFIG_BSD_PROCESS_ACCT=y
26# CONFIG_BSD_PROCESS_ACCT_V3 is not set
27CONFIG_SYSCTL=y
28# CONFIG_AUDIT is not set
29CONFIG_LOG_BUF_SHIFT=14
30# CONFIG_HOTPLUG is not set
31CONFIG_KOBJECT_UEVENT=y
32# CONFIG_IKCONFIG is not set
33CONFIG_EMBEDDED=y
34CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_FUTEX=y
37CONFIG_EPOLL=y
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SHMEM=y
40CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0
44# CONFIG_TINY_SHMEM is not set
45
46#
47# Loadable module support
48#
49CONFIG_MODULES=y
50CONFIG_MODULE_UNLOAD=y
51# CONFIG_MODULE_FORCE_UNLOAD is not set
52CONFIG_OBSOLETE_MODPARM=y
53CONFIG_MODVERSIONS=y
54CONFIG_MODULE_SRCVERSION_ALL=y
55CONFIG_KMOD=y
56
57#
58# Machine selection
59#
60# CONFIG_MACH_JAZZ is not set
61# CONFIG_MACH_VR41XX is not set
62# CONFIG_TOSHIBA_JMR3927 is not set
63# CONFIG_MIPS_COBALT is not set
64# CONFIG_MACH_DECSTATION is not set
65# CONFIG_MIPS_EV64120 is not set
66# CONFIG_MIPS_EV96100 is not set
67CONFIG_MIPS_IVR=y
68# CONFIG_LASAT is not set
69# CONFIG_MIPS_ITE8172 is not set
70# CONFIG_MIPS_ATLAS is not set
71# CONFIG_MIPS_MALTA is not set
72# CONFIG_MIPS_SEAD is not set
73# CONFIG_MOMENCO_OCELOT is not set
74# CONFIG_MOMENCO_OCELOT_G is not set
75# CONFIG_MOMENCO_OCELOT_C is not set
76# CONFIG_MOMENCO_OCELOT_3 is not set
77# CONFIG_MOMENCO_JAGUAR_ATX is not set
78# CONFIG_PMC_YOSEMITE is not set
79# CONFIG_DDB5074 is not set
80# CONFIG_DDB5476 is not set
81# CONFIG_DDB5477 is not set
82# CONFIG_NEC_OSPREY is not set
83# CONFIG_SGI_IP22 is not set
84# CONFIG_SOC_AU1X00 is not set
85# CONFIG_SIBYTE_SB1xxx_SOC is not set
86# CONFIG_SNI_RM200_PCI is not set
87# CONFIG_TOSHIBA_RBTX4927 is not set
88CONFIG_RWSEM_GENERIC_SPINLOCK=y
89CONFIG_GENERIC_CALIBRATE_DELAY=y
90CONFIG_HAVE_DEC_LOCK=y
91CONFIG_DMA_NONCOHERENT=y
92CONFIG_CPU_LITTLE_ENDIAN=y
93CONFIG_ITE_BOARD_GEN=y
94CONFIG_IT8172_CIR=y
95CONFIG_MIPS_L1_CACHE_SHIFT=5
96
97#
98# CPU selection
99#
100# CONFIG_CPU_MIPS32 is not set
101# CONFIG_CPU_MIPS64 is not set
102# CONFIG_CPU_R3000 is not set
103# CONFIG_CPU_TX39XX is not set
104# CONFIG_CPU_VR41XX is not set
105# CONFIG_CPU_R4300 is not set
106# CONFIG_CPU_R4X00 is not set
107# CONFIG_CPU_TX49XX is not set
108# CONFIG_CPU_R5000 is not set
109# CONFIG_CPU_R5432 is not set
110# CONFIG_CPU_R6000 is not set
111CONFIG_CPU_NEVADA=y
112# CONFIG_CPU_R8000 is not set
113# CONFIG_CPU_R10000 is not set
114# CONFIG_CPU_RM7000 is not set
115# CONFIG_CPU_RM9000 is not set
116# CONFIG_CPU_SB1 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
121# CONFIG_CPU_ADVANCED is not set
122CONFIG_CPU_HAS_LLSC=y
123CONFIG_CPU_HAS_LLDSCD=y
124CONFIG_CPU_HAS_SYNC=y
125# CONFIG_PREEMPT is not set
126
127#
128# Bus options (PCI, PCMCIA, EISA, ISA, TC)
129#
130CONFIG_HW_HAS_PCI=y
131CONFIG_PCI=y
132CONFIG_PCI_LEGACY_PROC=y
133CONFIG_PCI_NAMES=y
134CONFIG_MMU=y
135
136#
137# PCCARD (PCMCIA/CardBus) support
138#
139# CONFIG_PCCARD is not set
140
141#
142# PC-card bridges
143#
144
145#
146# PCI Hotplug Support
147#
148# CONFIG_HOTPLUG_PCI is not set
149
150#
151# Executable file formats
152#
153CONFIG_BINFMT_ELF=y
154# CONFIG_BINFMT_MISC is not set
155CONFIG_TRAD_SIGNALS=y
156
157#
158# Device Drivers
159#
160
161#
162# Generic Driver Options
163#
164CONFIG_STANDALONE=y
165CONFIG_PREVENT_FIRMWARE_BUILD=y
166# CONFIG_FW_LOADER is not set
167
168#
169# Memory Technology Devices (MTD)
170#
171# CONFIG_MTD is not set
172
173#
174# Parallel port support
175#
176# CONFIG_PARPORT is not set
177
178#
179# Plug and Play support
180#
181
182#
183# Block devices
184#
185# CONFIG_BLK_DEV_FD is not set
186# CONFIG_BLK_CPQ_DA is not set
187# CONFIG_BLK_CPQ_CISS_DA is not set
188# CONFIG_BLK_DEV_DAC960 is not set
189# CONFIG_BLK_DEV_UMEM is not set
190# CONFIG_BLK_DEV_COW_COMMON is not set
191# CONFIG_BLK_DEV_LOOP is not set
192# CONFIG_BLK_DEV_NBD is not set
193# CONFIG_BLK_DEV_SX8 is not set
194# CONFIG_BLK_DEV_RAM is not set
195CONFIG_BLK_DEV_RAM_COUNT=16
196CONFIG_INITRAMFS_SOURCE=""
197# CONFIG_LBD is not set
198CONFIG_CDROM_PKTCDVD=m
199CONFIG_CDROM_PKTCDVD_BUFFERS=8
200# CONFIG_CDROM_PKTCDVD_WCACHE is not set
201
202#
203# IO Schedulers
204#
205CONFIG_IOSCHED_NOOP=y
206CONFIG_IOSCHED_AS=y
207CONFIG_IOSCHED_DEADLINE=y
208CONFIG_IOSCHED_CFQ=y
209CONFIG_ATA_OVER_ETH=m
210
211#
212# ATA/ATAPI/MFM/RLL support
213#
214CONFIG_IDE=y
215CONFIG_BLK_DEV_IDE=y
216
217#
218# Please see Documentation/ide.txt for help/info on IDE drives
219#
220# CONFIG_BLK_DEV_IDE_SATA is not set
221CONFIG_BLK_DEV_IDEDISK=y
222# CONFIG_IDEDISK_MULTI_MODE is not set
223# CONFIG_BLK_DEV_IDECD is not set
224# CONFIG_BLK_DEV_IDETAPE is not set
225# CONFIG_BLK_DEV_IDEFLOPPY is not set
226# CONFIG_IDE_TASK_IOCTL is not set
227
228#
229# IDE chipset support/bugfixes
230#
231CONFIG_IDE_GENERIC=y
232# CONFIG_BLK_DEV_IDEPCI is not set
233# CONFIG_IDE_ARM is not set
234# CONFIG_BLK_DEV_IDEDMA is not set
235# CONFIG_IDEDMA_AUTO is not set
236# CONFIG_BLK_DEV_HD is not set
237
238#
239# SCSI device support
240#
241# CONFIG_SCSI is not set
242
243#
244# Multi-device support (RAID and LVM)
245#
246# CONFIG_MD is not set
247
248#
249# Fusion MPT device support
250#
251
252#
253# IEEE 1394 (FireWire) support
254#
255# CONFIG_IEEE1394 is not set
256
257#
258# I2O device support
259#
260# CONFIG_I2O is not set
261
262#
263# Networking support
264#
265CONFIG_NET=y
266
267#
268# Networking options
269#
270CONFIG_PACKET=y
271CONFIG_PACKET_MMAP=y
272CONFIG_NETLINK_DEV=y
273CONFIG_UNIX=y
274CONFIG_NET_KEY=y
275CONFIG_INET=y
276# CONFIG_IP_MULTICAST is not set
277# CONFIG_IP_ADVANCED_ROUTER is not set
278CONFIG_IP_PNP=y
279# CONFIG_IP_PNP_DHCP is not set
280CONFIG_IP_PNP_BOOTP=y
281# CONFIG_IP_PNP_RARP is not set
282# CONFIG_NET_IPIP is not set
283# CONFIG_NET_IPGRE is not set
284# CONFIG_ARPD is not set
285# CONFIG_SYN_COOKIES is not set
286# CONFIG_INET_AH is not set
287# CONFIG_INET_ESP is not set
288# CONFIG_INET_IPCOMP is not set
289CONFIG_INET_TUNNEL=m
290CONFIG_IP_TCPDIAG=m
291# CONFIG_IP_TCPDIAG_IPV6 is not set
292# CONFIG_IPV6 is not set
293# CONFIG_NETFILTER is not set
294CONFIG_XFRM=y
295CONFIG_XFRM_USER=m
296
297#
298# SCTP Configuration (EXPERIMENTAL)
299#
300# CONFIG_IP_SCTP is not set
301# CONFIG_ATM is not set
302# CONFIG_BRIDGE is not set
303# CONFIG_VLAN_8021Q is not set
304# CONFIG_DECNET is not set
305# CONFIG_LLC2 is not set
306# CONFIG_IPX is not set
307# CONFIG_ATALK is not set
308# CONFIG_X25 is not set
309# CONFIG_LAPB is not set
310# CONFIG_NET_DIVERT is not set
311# CONFIG_ECONET is not set
312# CONFIG_WAN_ROUTER is not set
313
314#
315# QoS and/or fair queueing
316#
317# CONFIG_NET_SCHED is not set
318# CONFIG_NET_CLS_ROUTE is not set
319
320#
321# Network testing
322#
323# CONFIG_NET_PKTGEN is not set
324# CONFIG_NETPOLL is not set
325# CONFIG_NET_POLL_CONTROLLER is not set
326# CONFIG_HAMRADIO is not set
327# CONFIG_IRDA is not set
328# CONFIG_BT is not set
329CONFIG_NETDEVICES=y
330# CONFIG_DUMMY is not set
331# CONFIG_BONDING is not set
332# CONFIG_EQUALIZER is not set
333# CONFIG_TUN is not set
334# CONFIG_ETHERTAP is not set
335
336#
337# ARCnet devices
338#
339# CONFIG_ARCNET is not set
340
341#
342# Ethernet (10 or 100Mbit)
343#
344CONFIG_NET_ETHERNET=y
345# CONFIG_MII is not set
346# CONFIG_HAPPYMEAL is not set
347# CONFIG_SUNGEM is not set
348# CONFIG_NET_VENDOR_3COM is not set
349
350#
351# Tulip family network device support
352#
353# CONFIG_NET_TULIP is not set
354# CONFIG_HP100 is not set
355# CONFIG_NET_PCI is not set
356
357#
358# Ethernet (1000 Mbit)
359#
360# CONFIG_ACENIC is not set
361# CONFIG_DL2K is not set
362# CONFIG_E1000 is not set
363# CONFIG_NS83820 is not set
364# CONFIG_HAMACHI is not set
365# CONFIG_YELLOWFIN is not set
366# CONFIG_R8169 is not set
367# CONFIG_SK98LIN is not set
368# CONFIG_TIGON3 is not set
369
370#
371# Ethernet (10000 Mbit)
372#
373# CONFIG_IXGB is not set
374# CONFIG_S2IO is not set
375
376#
377# Token Ring devices
378#
379# CONFIG_TR is not set
380
381#
382# Wireless LAN (non-hamradio)
383#
384# CONFIG_NET_RADIO is not set
385
386#
387# Wan interfaces
388#
389# CONFIG_WAN is not set
390# CONFIG_FDDI is not set
391# CONFIG_HIPPI is not set
392# CONFIG_PPP is not set
393# CONFIG_SLIP is not set
394# CONFIG_SHAPER is not set
395# CONFIG_NETCONSOLE is not set
396
397#
398# ISDN subsystem
399#
400# CONFIG_ISDN is not set
401
402#
403# Telephony Support
404#
405# CONFIG_PHONE is not set
406
407#
408# Input device support
409#
410CONFIG_INPUT=y
411
412#
413# Userland interfaces
414#
415CONFIG_INPUT_MOUSEDEV=y
416CONFIG_INPUT_MOUSEDEV_PSAUX=y
417CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
418CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
419# CONFIG_INPUT_JOYDEV is not set
420# CONFIG_INPUT_TSDEV is not set
421# CONFIG_INPUT_EVDEV is not set
422# CONFIG_INPUT_EVBUG is not set
423
424#
425# Input I/O drivers
426#
427# CONFIG_GAMEPORT is not set
428CONFIG_SOUND_GAMEPORT=y
429CONFIG_SERIO=y
430# CONFIG_SERIO_I8042 is not set
431CONFIG_SERIO_SERPORT=y
432# CONFIG_SERIO_CT82C710 is not set
433# CONFIG_SERIO_PCIPS2 is not set
434# CONFIG_SERIO_LIBPS2 is not set
435CONFIG_SERIO_RAW=m
436
437#
438# Input Device Drivers
439#
440# CONFIG_INPUT_KEYBOARD is not set
441# CONFIG_INPUT_MOUSE is not set
442# CONFIG_INPUT_JOYSTICK is not set
443# CONFIG_INPUT_TOUCHSCREEN is not set
444# CONFIG_INPUT_MISC is not set
445
446#
447# Character devices
448#
449CONFIG_VT=y
450CONFIG_VT_CONSOLE=y
451CONFIG_HW_CONSOLE=y
452# CONFIG_SERIAL_NONSTANDARD is not set
453CONFIG_QTRONIX_KEYBOARD=y
454# CONFIG_IT8172_SCR0 is not set
455
456#
457# Serial drivers
458#
459CONFIG_SERIAL_8250=y
460CONFIG_SERIAL_8250_CONSOLE=y
461CONFIG_SERIAL_8250_NR_UARTS=4
462# CONFIG_SERIAL_8250_EXTENDED is not set
463
464#
465# Non-8250 serial port support
466#
467CONFIG_SERIAL_CORE=y
468CONFIG_SERIAL_CORE_CONSOLE=y
469CONFIG_UNIX98_PTYS=y
470CONFIG_LEGACY_PTYS=y
471CONFIG_LEGACY_PTY_COUNT=256
472
473#
474# IPMI
475#
476# CONFIG_IPMI_HANDLER is not set
477
478#
479# Watchdog Cards
480#
481# CONFIG_WATCHDOG is not set
482CONFIG_RTC=y
483# CONFIG_DTLK is not set
484# CONFIG_R3964 is not set
485# CONFIG_APPLICOM is not set
486
487#
488# Ftape, the floppy tape device driver
489#
490# CONFIG_DRM is not set
491# CONFIG_RAW_DRIVER is not set
492
493#
494# I2C support
495#
496# CONFIG_I2C is not set
497
498#
499# Dallas's 1-wire bus
500#
501# CONFIG_W1 is not set
502
503#
504# Misc devices
505#
506
507#
508# Multimedia devices
509#
510# CONFIG_VIDEO_DEV is not set
511
512#
513# Digital Video Broadcasting Devices
514#
515# CONFIG_DVB is not set
516
517#
518# Graphics support
519#
520# CONFIG_FB is not set
521
522#
523# Console display driver support
524#
525# CONFIG_VGA_CONSOLE is not set
526CONFIG_DUMMY_CONSOLE=y
527# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
528
529#
530# Sound
531#
532# CONFIG_SOUND is not set
533
534#
535# USB support
536#
537# CONFIG_USB is not set
538CONFIG_USB_ARCH_HAS_HCD=y
539CONFIG_USB_ARCH_HAS_OHCI=y
540
541#
542# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
543#
544
545#
546# USB Gadget Support
547#
548# CONFIG_USB_GADGET is not set
549
550#
551# MMC/SD Card support
552#
553# CONFIG_MMC is not set
554
555#
556# InfiniBand support
557#
558# CONFIG_INFINIBAND is not set
559
560#
561# File systems
562#
563CONFIG_EXT2_FS=y
564# CONFIG_EXT2_FS_XATTR is not set
565# CONFIG_EXT3_FS is not set
566# CONFIG_JBD is not set
567# CONFIG_REISERFS_FS is not set
568# CONFIG_JFS_FS is not set
569# CONFIG_XFS_FS is not set
570# CONFIG_MINIX_FS is not set
571# CONFIG_ROMFS_FS is not set
572# CONFIG_QUOTA is not set
573CONFIG_DNOTIFY=y
574# CONFIG_AUTOFS_FS is not set
575# CONFIG_AUTOFS4_FS is not set
576
577#
578# CD-ROM/DVD Filesystems
579#
580# CONFIG_ISO9660_FS is not set
581# CONFIG_UDF_FS is not set
582
583#
584# DOS/FAT/NT Filesystems
585#
586# CONFIG_MSDOS_FS is not set
587# CONFIG_VFAT_FS is not set
588# CONFIG_NTFS_FS is not set
589
590#
591# Pseudo filesystems
592#
593CONFIG_PROC_FS=y
594CONFIG_PROC_KCORE=y
595CONFIG_SYSFS=y
596# CONFIG_DEVFS_FS is not set
597CONFIG_DEVPTS_FS_XATTR=y
598CONFIG_DEVPTS_FS_SECURITY=y
599# CONFIG_TMPFS is not set
600# CONFIG_HUGETLB_PAGE is not set
601CONFIG_RAMFS=y
602
603#
604# Miscellaneous filesystems
605#
606# CONFIG_ADFS_FS is not set
607# CONFIG_AFFS_FS is not set
608# CONFIG_HFS_FS is not set
609# CONFIG_HFSPLUS_FS is not set
610# CONFIG_BEFS_FS is not set
611# CONFIG_BFS_FS is not set
612# CONFIG_EFS_FS is not set
613# CONFIG_CRAMFS is not set
614# CONFIG_VXFS_FS is not set
615# CONFIG_HPFS_FS is not set
616# CONFIG_QNX4FS_FS is not set
617# CONFIG_SYSV_FS is not set
618# CONFIG_UFS_FS is not set
619
620#
621# Network File Systems
622#
623CONFIG_NFS_FS=y
624# CONFIG_NFS_V3 is not set
625# CONFIG_NFS_V4 is not set
626# CONFIG_NFS_DIRECTIO is not set
627# CONFIG_NFSD is not set
628CONFIG_ROOT_NFS=y
629CONFIG_LOCKD=y
630# CONFIG_EXPORTFS is not set
631CONFIG_SUNRPC=y
632# CONFIG_RPCSEC_GSS_KRB5 is not set
633# CONFIG_RPCSEC_GSS_SPKM3 is not set
634# CONFIG_SMB_FS is not set
635# CONFIG_CIFS is not set
636# CONFIG_NCP_FS is not set
637# CONFIG_CODA_FS is not set
638# CONFIG_AFS_FS is not set
639
640#
641# Partition Types
642#
643# CONFIG_PARTITION_ADVANCED is not set
644CONFIG_MSDOS_PARTITION=y
645
646#
647# Native Language Support
648#
649# CONFIG_NLS is not set
650
651#
652# Profiling support
653#
654# CONFIG_PROFILING is not set
655
656#
657# Kernel hacking
658#
659# CONFIG_DEBUG_KERNEL is not set
660CONFIG_CROSSCOMPILE=y
661CONFIG_CMDLINE=""
662
663#
664# Security options
665#
666CONFIG_KEYS=y
667CONFIG_KEYS_DEBUG_PROC_KEYS=y
668# CONFIG_SECURITY is not set
669
670#
671# Cryptographic options
672#
673# CONFIG_CRYPTO is not set
674
675#
676# Hardware crypto devices
677#
678
679#
680# Library routines
681#
682# CONFIG_CRC_CCITT is not set
683# CONFIG_CRC32 is not set
684CONFIG_LIBCRC32C=m
685CONFIG_GENERIC_HARDIRQS=y
686CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/jaguar-atx_defconfig b/arch/mips/configs/jaguar-atx_defconfig
new file mode 100644
index 000000000000..757c4e88cc00
--- /dev/null
+++ b/arch/mips/configs/jaguar-atx_defconfig
@@ -0,0 +1,620 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:05 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14# CONFIG_EXPERIMENTAL is not set
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_LOG_BUF_SHIFT=14
28# CONFIG_HOTPLUG is not set
29CONFIG_KOBJECT_UEVENT=y
30CONFIG_IKCONFIG=y
31CONFIG_IKCONFIG_PROC=y
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50CONFIG_OBSOLETE_MODPARM=y
51CONFIG_MODULE_SRCVERSION_ALL=y
52CONFIG_KMOD=y
53
54#
55# Machine selection
56#
57# CONFIG_MACH_JAZZ is not set
58# CONFIG_MACH_VR41XX is not set
59# CONFIG_TOSHIBA_JMR3927 is not set
60# CONFIG_MACH_DECSTATION is not set
61# CONFIG_MIPS_IVR is not set
62# CONFIG_LASAT is not set
63# CONFIG_MIPS_ITE8172 is not set
64# CONFIG_MIPS_ATLAS is not set
65# CONFIG_MIPS_MALTA is not set
66# CONFIG_MOMENCO_OCELOT is not set
67# CONFIG_MOMENCO_OCELOT_G is not set
68# CONFIG_MOMENCO_OCELOT_C is not set
69# CONFIG_MOMENCO_OCELOT_3 is not set
70CONFIG_MOMENCO_JAGUAR_ATX=y
71CONFIG_JAGUAR_DMALOW=y
72# CONFIG_PMC_YOSEMITE is not set
73# CONFIG_DDB5476 is not set
74# CONFIG_DDB5477 is not set
75# CONFIG_NEC_OSPREY is not set
76# CONFIG_SGI_IP22 is not set
77# CONFIG_SOC_AU1X00 is not set
78# CONFIG_SNI_RM200_PCI is not set
79# CONFIG_TOSHIBA_RBTX4927 is not set
80CONFIG_RWSEM_GENERIC_SPINLOCK=y
81CONFIG_GENERIC_CALIBRATE_DELAY=y
82CONFIG_HAVE_DEC_LOCK=y
83CONFIG_DMA_NONCOHERENT=y
84CONFIG_LIMITED_DMA=y
85# CONFIG_CPU_LITTLE_ENDIAN is not set
86CONFIG_IRQ_CPU=y
87CONFIG_IRQ_CPU_RM7K=y
88CONFIG_IRQ_MV64340=y
89CONFIG_PCI_MARVELL=y
90CONFIG_SWAP_IO_SPACE=y
91CONFIG_BOOT_ELF32=y
92CONFIG_MIPS_L1_CACHE_SHIFT=5
93
94#
95# CPU selection
96#
97# CONFIG_CPU_MIPS32 is not set
98# CONFIG_CPU_MIPS64 is not set
99# CONFIG_CPU_R3000 is not set
100# CONFIG_CPU_TX39XX is not set
101# CONFIG_CPU_VR41XX is not set
102# CONFIG_CPU_R4300 is not set
103# CONFIG_CPU_R4X00 is not set
104# CONFIG_CPU_TX49XX is not set
105# CONFIG_CPU_R5000 is not set
106# CONFIG_CPU_R5432 is not set
107# CONFIG_CPU_R6000 is not set
108# CONFIG_CPU_NEVADA is not set
109# CONFIG_CPU_R8000 is not set
110# CONFIG_CPU_R10000 is not set
111# CONFIG_CPU_RM7000 is not set
112CONFIG_CPU_RM9000=y
113# CONFIG_CPU_SB1 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_BOARD_SCACHE=y
119CONFIG_RM7000_CPU_SCACHE=y
120CONFIG_CPU_HAS_PREFETCH=y
121# CONFIG_64BIT_PHYS_ADDR is not set
122# CONFIG_CPU_ADVANCED is not set
123CONFIG_CPU_HAS_LLSC=y
124CONFIG_CPU_HAS_LLDSCD=y
125CONFIG_CPU_HAS_SYNC=y
126CONFIG_HIGHMEM=y
127# CONFIG_SMP is not set
128# CONFIG_PREEMPT is not set
129
130#
131# Bus options (PCI, PCMCIA, EISA, ISA, TC)
132#
133CONFIG_HW_HAS_PCI=y
134CONFIG_PCI=y
135CONFIG_PCI_LEGACY_PROC=y
136CONFIG_PCI_NAMES=y
137CONFIG_MMU=y
138
139#
140# PCCARD (PCMCIA/CardBus) support
141#
142# CONFIG_PCCARD is not set
143
144#
145# PC-card bridges
146#
147
148#
149# PCI Hotplug Support
150#
151
152#
153# Executable file formats
154#
155CONFIG_BINFMT_ELF=y
156# CONFIG_BINFMT_MISC is not set
157CONFIG_TRAD_SIGNALS=y
158
159#
160# Device Drivers
161#
162
163#
164# Generic Driver Options
165#
166CONFIG_STANDALONE=y
167CONFIG_PREVENT_FIRMWARE_BUILD=y
168# CONFIG_FW_LOADER is not set
169
170#
171# Memory Technology Devices (MTD)
172#
173# CONFIG_MTD is not set
174
175#
176# Parallel port support
177#
178# CONFIG_PARPORT is not set
179
180#
181# Plug and Play support
182#
183
184#
185# Block devices
186#
187# CONFIG_BLK_DEV_FD is not set
188# CONFIG_BLK_CPQ_DA is not set
189# CONFIG_BLK_CPQ_CISS_DA is not set
190# CONFIG_BLK_DEV_DAC960 is not set
191# CONFIG_BLK_DEV_COW_COMMON is not set
192# CONFIG_BLK_DEV_LOOP is not set
193# CONFIG_BLK_DEV_NBD is not set
194# CONFIG_BLK_DEV_SX8 is not set
195# CONFIG_BLK_DEV_RAM is not set
196CONFIG_BLK_DEV_RAM_COUNT=16
197CONFIG_INITRAMFS_SOURCE=""
198# CONFIG_LBD is not set
199CONFIG_CDROM_PKTCDVD=m
200CONFIG_CDROM_PKTCDVD_BUFFERS=8
201# CONFIG_CDROM_PKTCDVD_WCACHE is not set
202
203#
204# IO Schedulers
205#
206CONFIG_IOSCHED_NOOP=y
207CONFIG_IOSCHED_AS=y
208CONFIG_IOSCHED_DEADLINE=y
209CONFIG_IOSCHED_CFQ=y
210CONFIG_ATA_OVER_ETH=m
211
212#
213# ATA/ATAPI/MFM/RLL support
214#
215# CONFIG_IDE is not set
216
217#
218# SCSI device support
219#
220# CONFIG_SCSI is not set
221
222#
223# Multi-device support (RAID and LVM)
224#
225# CONFIG_MD is not set
226
227#
228# Fusion MPT device support
229#
230
231#
232# IEEE 1394 (FireWire) support
233#
234# CONFIG_IEEE1394 is not set
235
236#
237# I2O device support
238#
239# CONFIG_I2O is not set
240
241#
242# Networking support
243#
244CONFIG_NET=y
245
246#
247# Networking options
248#
249# CONFIG_PACKET is not set
250# CONFIG_NETLINK_DEV is not set
251CONFIG_UNIX=y
252# CONFIG_NET_KEY is not set
253CONFIG_INET=y
254# CONFIG_IP_MULTICAST is not set
255# CONFIG_IP_ADVANCED_ROUTER is not set
256CONFIG_IP_PNP=y
257# CONFIG_IP_PNP_DHCP is not set
258CONFIG_IP_PNP_BOOTP=y
259# CONFIG_IP_PNP_RARP is not set
260# CONFIG_NET_IPIP is not set
261# CONFIG_NET_IPGRE is not set
262# CONFIG_SYN_COOKIES is not set
263# CONFIG_INET_AH is not set
264# CONFIG_INET_ESP is not set
265# CONFIG_INET_IPCOMP is not set
266CONFIG_INET_TUNNEL=m
267CONFIG_IP_TCPDIAG=m
268# CONFIG_IP_TCPDIAG_IPV6 is not set
269# CONFIG_NETFILTER is not set
270CONFIG_XFRM=y
271CONFIG_XFRM_USER=m
272# CONFIG_BRIDGE is not set
273# CONFIG_VLAN_8021Q is not set
274# CONFIG_DECNET is not set
275# CONFIG_LLC2 is not set
276# CONFIG_IPX is not set
277# CONFIG_ATALK is not set
278
279#
280# QoS and/or fair queueing
281#
282# CONFIG_NET_SCHED is not set
283# CONFIG_NET_CLS_ROUTE is not set
284
285#
286# Network testing
287#
288# CONFIG_NET_PKTGEN is not set
289# CONFIG_NETPOLL is not set
290# CONFIG_NET_POLL_CONTROLLER is not set
291# CONFIG_HAMRADIO is not set
292# CONFIG_IRDA is not set
293# CONFIG_BT is not set
294CONFIG_NETDEVICES=y
295# CONFIG_DUMMY is not set
296# CONFIG_BONDING is not set
297# CONFIG_EQUALIZER is not set
298# CONFIG_TUN is not set
299
300#
301# ARCnet devices
302#
303# CONFIG_ARCNET is not set
304
305#
306# Ethernet (10 or 100Mbit)
307#
308CONFIG_NET_ETHERNET=y
309CONFIG_MII=y
310# CONFIG_HAPPYMEAL is not set
311# CONFIG_SUNGEM is not set
312# CONFIG_NET_VENDOR_3COM is not set
313
314#
315# Tulip family network device support
316#
317# CONFIG_NET_TULIP is not set
318# CONFIG_HP100 is not set
319CONFIG_NET_PCI=y
320# CONFIG_PCNET32 is not set
321# CONFIG_AMD8111_ETH is not set
322# CONFIG_ADAPTEC_STARFIRE is not set
323# CONFIG_DGRS is not set
324CONFIG_EEPRO100=y
325# CONFIG_E100 is not set
326# CONFIG_FEALNX is not set
327# CONFIG_NATSEMI is not set
328# CONFIG_NE2K_PCI is not set
329# CONFIG_8139TOO is not set
330# CONFIG_SIS900 is not set
331# CONFIG_EPIC100 is not set
332# CONFIG_SUNDANCE is not set
333# CONFIG_TLAN is not set
334# CONFIG_VIA_RHINE is not set
335
336#
337# Ethernet (1000 Mbit)
338#
339# CONFIG_ACENIC is not set
340# CONFIG_DL2K is not set
341# CONFIG_E1000 is not set
342# CONFIG_NS83820 is not set
343# CONFIG_HAMACHI is not set
344# CONFIG_R8169 is not set
345# CONFIG_SK98LIN is not set
346# CONFIG_VIA_VELOCITY is not set
347# CONFIG_TIGON3 is not set
348CONFIG_MV643XX_ETH=y
349CONFIG_MV643XX_ETH_0=y
350CONFIG_MV643XX_ETH_1=y
351CONFIG_MV643XX_ETH_2=y
352
353#
354# Ethernet (10000 Mbit)
355#
356# CONFIG_IXGB is not set
357# CONFIG_S2IO is not set
358
359#
360# Token Ring devices
361#
362# CONFIG_TR is not set
363
364#
365# Wireless LAN (non-hamradio)
366#
367# CONFIG_NET_RADIO is not set
368
369#
370# Wan interfaces
371#
372# CONFIG_WAN is not set
373# CONFIG_FDDI is not set
374# CONFIG_PPP is not set
375# CONFIG_SLIP is not set
376
377#
378# ISDN subsystem
379#
380# CONFIG_ISDN is not set
381
382#
383# Telephony Support
384#
385# CONFIG_PHONE is not set
386
387#
388# Input device support
389#
390# CONFIG_INPUT is not set
391
392#
393# Userland interfaces
394#
395
396#
397# Input I/O drivers
398#
399# CONFIG_GAMEPORT is not set
400CONFIG_SOUND_GAMEPORT=y
401# CONFIG_SERIO is not set
402# CONFIG_SERIO_I8042 is not set
403
404#
405# Input Device Drivers
406#
407
408#
409# Character devices
410#
411# CONFIG_VT is not set
412# CONFIG_SERIAL_NONSTANDARD is not set
413
414#
415# Serial drivers
416#
417CONFIG_SERIAL_8250=y
418CONFIG_SERIAL_8250_CONSOLE=y
419CONFIG_SERIAL_8250_NR_UARTS=4
420# CONFIG_SERIAL_8250_EXTENDED is not set
421
422#
423# Non-8250 serial port support
424#
425CONFIG_SERIAL_CORE=y
426CONFIG_SERIAL_CORE_CONSOLE=y
427CONFIG_UNIX98_PTYS=y
428CONFIG_LEGACY_PTYS=y
429CONFIG_LEGACY_PTY_COUNT=256
430
431#
432# IPMI
433#
434# CONFIG_IPMI_HANDLER is not set
435
436#
437# Watchdog Cards
438#
439# CONFIG_WATCHDOG is not set
440# CONFIG_RTC is not set
441# CONFIG_GEN_RTC is not set
442# CONFIG_DTLK is not set
443# CONFIG_R3964 is not set
444# CONFIG_APPLICOM is not set
445
446#
447# Ftape, the floppy tape device driver
448#
449# CONFIG_DRM is not set
450# CONFIG_RAW_DRIVER is not set
451
452#
453# I2C support
454#
455# CONFIG_I2C is not set
456
457#
458# Dallas's 1-wire bus
459#
460# CONFIG_W1 is not set
461
462#
463# Misc devices
464#
465
466#
467# Multimedia devices
468#
469# CONFIG_VIDEO_DEV is not set
470
471#
472# Digital Video Broadcasting Devices
473#
474# CONFIG_DVB is not set
475
476#
477# Graphics support
478#
479# CONFIG_FB is not set
480# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
481
482#
483# Sound
484#
485# CONFIG_SOUND is not set
486
487#
488# USB support
489#
490# CONFIG_USB is not set
491CONFIG_USB_ARCH_HAS_HCD=y
492CONFIG_USB_ARCH_HAS_OHCI=y
493
494#
495# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
496#
497
498#
499# USB Gadget Support
500#
501# CONFIG_USB_GADGET is not set
502
503#
504# MMC/SD Card support
505#
506# CONFIG_MMC is not set
507
508#
509# InfiniBand support
510#
511# CONFIG_INFINIBAND is not set
512
513#
514# File systems
515#
516# CONFIG_EXT2_FS is not set
517# CONFIG_EXT3_FS is not set
518# CONFIG_JBD is not set
519# CONFIG_REISERFS_FS is not set
520# CONFIG_JFS_FS is not set
521# CONFIG_XFS_FS is not set
522# CONFIG_MINIX_FS is not set
523# CONFIG_ROMFS_FS is not set
524# CONFIG_QUOTA is not set
525CONFIG_DNOTIFY=y
526# CONFIG_AUTOFS_FS is not set
527# CONFIG_AUTOFS4_FS is not set
528
529#
530# CD-ROM/DVD Filesystems
531#
532# CONFIG_ISO9660_FS is not set
533# CONFIG_UDF_FS is not set
534
535#
536# DOS/FAT/NT Filesystems
537#
538# CONFIG_MSDOS_FS is not set
539# CONFIG_VFAT_FS is not set
540# CONFIG_NTFS_FS is not set
541
542#
543# Pseudo filesystems
544#
545CONFIG_PROC_FS=y
546CONFIG_PROC_KCORE=y
547CONFIG_SYSFS=y
548# CONFIG_DEVPTS_FS_XATTR is not set
549# CONFIG_TMPFS is not set
550# CONFIG_HUGETLB_PAGE is not set
551CONFIG_RAMFS=y
552
553#
554# Miscellaneous filesystems
555#
556# CONFIG_HFSPLUS_FS is not set
557# CONFIG_CRAMFS is not set
558# CONFIG_VXFS_FS is not set
559# CONFIG_HPFS_FS is not set
560# CONFIG_QNX4FS_FS is not set
561# CONFIG_SYSV_FS is not set
562# CONFIG_UFS_FS is not set
563
564#
565# Network File Systems
566#
567CONFIG_NFS_FS=y
568# CONFIG_NFS_V3 is not set
569# CONFIG_NFSD is not set
570CONFIG_ROOT_NFS=y
571CONFIG_LOCKD=y
572# CONFIG_EXPORTFS is not set
573CONFIG_SUNRPC=y
574# CONFIG_SMB_FS is not set
575# CONFIG_CIFS is not set
576# CONFIG_NCP_FS is not set
577# CONFIG_CODA_FS is not set
578
579#
580# Partition Types
581#
582# CONFIG_PARTITION_ADVANCED is not set
583CONFIG_MSDOS_PARTITION=y
584
585#
586# Native Language Support
587#
588# CONFIG_NLS is not set
589
590#
591# Kernel hacking
592#
593# CONFIG_DEBUG_KERNEL is not set
594CONFIG_CROSSCOMPILE=y
595CONFIG_CMDLINE=""
596
597#
598# Security options
599#
600CONFIG_KEYS=y
601CONFIG_KEYS_DEBUG_PROC_KEYS=y
602# CONFIG_SECURITY is not set
603
604#
605# Cryptographic options
606#
607# CONFIG_CRYPTO is not set
608
609#
610# Hardware crypto devices
611#
612
613#
614# Library routines
615#
616# CONFIG_CRC_CCITT is not set
617# CONFIG_CRC32 is not set
618# CONFIG_LIBCRC32C is not set
619CONFIG_GENERIC_HARDIRQS=y
620CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
new file mode 100644
index 000000000000..e5a613906554
--- /dev/null
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -0,0 +1,696 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:06 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48# CONFIG_MODULES is not set
49
50#
51# Machine selection
52#
53# CONFIG_MACH_JAZZ is not set
54# CONFIG_MACH_VR41XX is not set
55CONFIG_TOSHIBA_JMR3927=y
56# CONFIG_MIPS_COBALT is not set
57# CONFIG_MACH_DECSTATION is not set
58# CONFIG_MIPS_EV64120 is not set
59# CONFIG_MIPS_EV96100 is not set
60# CONFIG_MIPS_IVR is not set
61# CONFIG_LASAT is not set
62# CONFIG_MIPS_ITE8172 is not set
63# CONFIG_MIPS_ATLAS is not set
64# CONFIG_MIPS_MALTA is not set
65# CONFIG_MIPS_SEAD is not set
66# CONFIG_MOMENCO_OCELOT is not set
67# CONFIG_MOMENCO_OCELOT_G is not set
68# CONFIG_MOMENCO_OCELOT_C is not set
69# CONFIG_MOMENCO_OCELOT_3 is not set
70# CONFIG_MOMENCO_JAGUAR_ATX is not set
71# CONFIG_PMC_YOSEMITE is not set
72# CONFIG_DDB5074 is not set
73# CONFIG_DDB5476 is not set
74# CONFIG_DDB5477 is not set
75# CONFIG_NEC_OSPREY is not set
76# CONFIG_SGI_IP22 is not set
77# CONFIG_SOC_AU1X00 is not set
78# CONFIG_SIBYTE_SB1xxx_SOC is not set
79# CONFIG_SNI_RM200_PCI is not set
80# CONFIG_TOSHIBA_RBTX4927 is not set
81CONFIG_RWSEM_GENERIC_SPINLOCK=y
82CONFIG_GENERIC_CALIBRATE_DELAY=y
83CONFIG_HAVE_DEC_LOCK=y
84CONFIG_DMA_NONCOHERENT=y
85# CONFIG_CPU_LITTLE_ENDIAN is not set
86CONFIG_MIPS_TX3927=y
87CONFIG_SWAP_IO_SPACE=y
88CONFIG_MIPS_L1_CACHE_SHIFT=5
89CONFIG_TOSHIBA_BOARDS=y
90
91#
92# CPU selection
93#
94# CONFIG_CPU_MIPS32 is not set
95# CONFIG_CPU_MIPS64 is not set
96# CONFIG_CPU_R3000 is not set
97CONFIG_CPU_TX39XX=y
98# CONFIG_CPU_VR41XX is not set
99# CONFIG_CPU_R4300 is not set
100# CONFIG_CPU_R4X00 is not set
101# CONFIG_CPU_TX49XX is not set
102# CONFIG_CPU_R5000 is not set
103# CONFIG_CPU_R5432 is not set
104# CONFIG_CPU_R6000 is not set
105# CONFIG_CPU_NEVADA is not set
106# CONFIG_CPU_R8000 is not set
107# CONFIG_CPU_R10000 is not set
108# CONFIG_CPU_RM7000 is not set
109# CONFIG_CPU_RM9000 is not set
110# CONFIG_CPU_SB1 is not set
111CONFIG_PAGE_SIZE_4KB=y
112# CONFIG_PAGE_SIZE_8KB is not set
113# CONFIG_PAGE_SIZE_16KB is not set
114# CONFIG_PAGE_SIZE_64KB is not set
115# CONFIG_CPU_ADVANCED is not set
116CONFIG_CPU_HAS_SYNC=y
117# CONFIG_PREEMPT is not set
118CONFIG_RTC_DS1742=y
119
120#
121# Bus options (PCI, PCMCIA, EISA, ISA, TC)
122#
123CONFIG_HW_HAS_PCI=y
124CONFIG_PCI=y
125CONFIG_PCI_LEGACY_PROC=y
126CONFIG_PCI_NAMES=y
127CONFIG_MMU=y
128
129#
130# PCCARD (PCMCIA/CardBus) support
131#
132# CONFIG_PCCARD is not set
133
134#
135# PC-card bridges
136#
137
138#
139# PCI Hotplug Support
140#
141# CONFIG_HOTPLUG_PCI is not set
142
143#
144# Executable file formats
145#
146CONFIG_BINFMT_ELF=y
147# CONFIG_BINFMT_MISC is not set
148CONFIG_TRAD_SIGNALS=y
149
150#
151# Device Drivers
152#
153
154#
155# Generic Driver Options
156#
157CONFIG_STANDALONE=y
158CONFIG_PREVENT_FIRMWARE_BUILD=y
159# CONFIG_FW_LOADER is not set
160
161#
162# Memory Technology Devices (MTD)
163#
164# CONFIG_MTD is not set
165
166#
167# Parallel port support
168#
169# CONFIG_PARPORT is not set
170
171#
172# Plug and Play support
173#
174
175#
176# Block devices
177#
178# CONFIG_BLK_DEV_FD is not set
179# CONFIG_BLK_CPQ_DA is not set
180# CONFIG_BLK_CPQ_CISS_DA is not set
181# CONFIG_BLK_DEV_DAC960 is not set
182# CONFIG_BLK_DEV_UMEM is not set
183# CONFIG_BLK_DEV_COW_COMMON is not set
184# CONFIG_BLK_DEV_LOOP is not set
185# CONFIG_BLK_DEV_NBD is not set
186# CONFIG_BLK_DEV_SX8 is not set
187# CONFIG_BLK_DEV_RAM is not set
188CONFIG_BLK_DEV_RAM_COUNT=16
189CONFIG_INITRAMFS_SOURCE=""
190# CONFIG_LBD is not set
191CONFIG_CDROM_PKTCDVD=y
192CONFIG_CDROM_PKTCDVD_BUFFERS=8
193# CONFIG_CDROM_PKTCDVD_WCACHE is not set
194
195#
196# IO Schedulers
197#
198CONFIG_IOSCHED_NOOP=y
199CONFIG_IOSCHED_AS=y
200CONFIG_IOSCHED_DEADLINE=y
201CONFIG_IOSCHED_CFQ=y
202CONFIG_ATA_OVER_ETH=y
203
204#
205# ATA/ATAPI/MFM/RLL support
206#
207# CONFIG_IDE is not set
208
209#
210# SCSI device support
211#
212# CONFIG_SCSI is not set
213
214#
215# Multi-device support (RAID and LVM)
216#
217# CONFIG_MD is not set
218
219#
220# Fusion MPT device support
221#
222
223#
224# IEEE 1394 (FireWire) support
225#
226# CONFIG_IEEE1394 is not set
227
228#
229# I2O device support
230#
231# CONFIG_I2O is not set
232
233#
234# Networking support
235#
236CONFIG_NET=y
237
238#
239# Networking options
240#
241CONFIG_PACKET=y
242# CONFIG_PACKET_MMAP is not set
243CONFIG_NETLINK_DEV=y
244CONFIG_UNIX=y
245CONFIG_NET_KEY=y
246CONFIG_INET=y
247# CONFIG_IP_MULTICAST is not set
248# CONFIG_IP_ADVANCED_ROUTER is not set
249CONFIG_IP_PNP=y
250# CONFIG_IP_PNP_DHCP is not set
251CONFIG_IP_PNP_BOOTP=y
252# CONFIG_IP_PNP_RARP is not set
253# CONFIG_NET_IPIP is not set
254# CONFIG_NET_IPGRE is not set
255# CONFIG_ARPD is not set
256# CONFIG_SYN_COOKIES is not set
257# CONFIG_INET_AH is not set
258# CONFIG_INET_ESP is not set
259# CONFIG_INET_IPCOMP is not set
260CONFIG_INET_TUNNEL=y
261CONFIG_IP_TCPDIAG=y
262# CONFIG_IP_TCPDIAG_IPV6 is not set
263# CONFIG_IPV6 is not set
264# CONFIG_NETFILTER is not set
265CONFIG_XFRM=y
266CONFIG_XFRM_USER=y
267
268#
269# SCTP Configuration (EXPERIMENTAL)
270#
271# CONFIG_IP_SCTP is not set
272# CONFIG_ATM is not set
273# CONFIG_BRIDGE is not set
274# CONFIG_VLAN_8021Q is not set
275# CONFIG_DECNET is not set
276# CONFIG_LLC2 is not set
277# CONFIG_IPX is not set
278# CONFIG_ATALK is not set
279# CONFIG_X25 is not set
280# CONFIG_LAPB is not set
281# CONFIG_NET_DIVERT is not set
282# CONFIG_ECONET is not set
283# CONFIG_WAN_ROUTER is not set
284
285#
286# QoS and/or fair queueing
287#
288# CONFIG_NET_SCHED is not set
289# CONFIG_NET_CLS_ROUTE is not set
290
291#
292# Network testing
293#
294# CONFIG_NET_PKTGEN is not set
295# CONFIG_NETPOLL is not set
296# CONFIG_NET_POLL_CONTROLLER is not set
297# CONFIG_HAMRADIO is not set
298# CONFIG_IRDA is not set
299# CONFIG_BT is not set
300CONFIG_NETDEVICES=y
301# CONFIG_DUMMY is not set
302# CONFIG_BONDING is not set
303# CONFIG_EQUALIZER is not set
304# CONFIG_TUN is not set
305# CONFIG_ETHERTAP is not set
306
307#
308# ARCnet devices
309#
310# CONFIG_ARCNET is not set
311
312#
313# Ethernet (10 or 100Mbit)
314#
315CONFIG_NET_ETHERNET=y
316# CONFIG_MII is not set
317# CONFIG_HAPPYMEAL is not set
318# CONFIG_SUNGEM is not set
319# CONFIG_NET_VENDOR_3COM is not set
320
321#
322# Tulip family network device support
323#
324# CONFIG_NET_TULIP is not set
325# CONFIG_HP100 is not set
326# CONFIG_NET_PCI is not set
327
328#
329# Ethernet (1000 Mbit)
330#
331# CONFIG_ACENIC is not set
332# CONFIG_DL2K is not set
333# CONFIG_E1000 is not set
334# CONFIG_NS83820 is not set
335# CONFIG_HAMACHI is not set
336# CONFIG_YELLOWFIN is not set
337# CONFIG_R8169 is not set
338# CONFIG_SK98LIN is not set
339# CONFIG_TIGON3 is not set
340
341#
342# Ethernet (10000 Mbit)
343#
344# CONFIG_IXGB is not set
345# CONFIG_S2IO is not set
346
347#
348# Token Ring devices
349#
350# CONFIG_TR is not set
351
352#
353# Wireless LAN (non-hamradio)
354#
355# CONFIG_NET_RADIO is not set
356
357#
358# Wan interfaces
359#
360# CONFIG_WAN is not set
361# CONFIG_FDDI is not set
362# CONFIG_HIPPI is not set
363# CONFIG_PPP is not set
364# CONFIG_SLIP is not set
365# CONFIG_SHAPER is not set
366# CONFIG_NETCONSOLE is not set
367
368#
369# ISDN subsystem
370#
371# CONFIG_ISDN is not set
372
373#
374# Telephony Support
375#
376# CONFIG_PHONE is not set
377
378#
379# Input device support
380#
381CONFIG_INPUT=y
382
383#
384# Userland interfaces
385#
386CONFIG_INPUT_MOUSEDEV=y
387CONFIG_INPUT_MOUSEDEV_PSAUX=y
388CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
389CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
390# CONFIG_INPUT_JOYDEV is not set
391# CONFIG_INPUT_TSDEV is not set
392# CONFIG_INPUT_EVDEV is not set
393# CONFIG_INPUT_EVBUG is not set
394
395#
396# Input I/O drivers
397#
398# CONFIG_GAMEPORT is not set
399CONFIG_SOUND_GAMEPORT=y
400CONFIG_SERIO=y
401# CONFIG_SERIO_I8042 is not set
402CONFIG_SERIO_SERPORT=y
403# CONFIG_SERIO_CT82C710 is not set
404# CONFIG_SERIO_PCIPS2 is not set
405# CONFIG_SERIO_LIBPS2 is not set
406CONFIG_SERIO_RAW=y
407
408#
409# Input Device Drivers
410#
411# CONFIG_INPUT_KEYBOARD is not set
412# CONFIG_INPUT_MOUSE is not set
413# CONFIG_INPUT_JOYSTICK is not set
414# CONFIG_INPUT_TOUCHSCREEN is not set
415# CONFIG_INPUT_MISC is not set
416
417#
418# Character devices
419#
420CONFIG_VT=y
421CONFIG_VT_CONSOLE=y
422CONFIG_HW_CONSOLE=y
423CONFIG_SERIAL_NONSTANDARD=y
424# CONFIG_COMPUTONE is not set
425# CONFIG_ROCKETPORT is not set
426# CONFIG_CYCLADES is not set
427# CONFIG_DIGIEPCA is not set
428# CONFIG_DIGI is not set
429# CONFIG_MOXA_INTELLIO is not set
430# CONFIG_MOXA_SMARTIO is not set
431# CONFIG_ISI is not set
432# CONFIG_SYNCLINK is not set
433# CONFIG_SYNCLINKMP is not set
434# CONFIG_N_HDLC is not set
435# CONFIG_RISCOM8 is not set
436# CONFIG_SPECIALIX is not set
437# CONFIG_SX is not set
438# CONFIG_RIO is not set
439# CONFIG_STALDRV is not set
440# CONFIG_SERIAL_TX3912 is not set
441CONFIG_TXX927_SERIAL=y
442CONFIG_TXX927_SERIAL_CONSOLE=y
443# CONFIG_SERIAL_TXX9 is not set
444
445#
446# Serial drivers
447#
448# CONFIG_SERIAL_8250 is not set
449
450#
451# Non-8250 serial port support
452#
453# CONFIG_UNIX98_PTYS is not set
454CONFIG_LEGACY_PTYS=y
455CONFIG_LEGACY_PTY_COUNT=256
456
457#
458# IPMI
459#
460# CONFIG_IPMI_HANDLER is not set
461
462#
463# Watchdog Cards
464#
465# CONFIG_WATCHDOG is not set
466# CONFIG_RTC is not set
467# CONFIG_GEN_RTC is not set
468# CONFIG_DTLK is not set
469# CONFIG_R3964 is not set
470# CONFIG_APPLICOM is not set
471
472#
473# Ftape, the floppy tape device driver
474#
475# CONFIG_DRM is not set
476# CONFIG_RAW_DRIVER is not set
477
478#
479# I2C support
480#
481# CONFIG_I2C is not set
482
483#
484# Dallas's 1-wire bus
485#
486# CONFIG_W1 is not set
487
488#
489# Misc devices
490#
491
492#
493# Multimedia devices
494#
495# CONFIG_VIDEO_DEV is not set
496
497#
498# Digital Video Broadcasting Devices
499#
500# CONFIG_DVB is not set
501
502#
503# Graphics support
504#
505CONFIG_FB=y
506# CONFIG_FB_MODE_HELPERS is not set
507# CONFIG_FB_TILEBLITTING is not set
508# CONFIG_FB_CIRRUS is not set
509# CONFIG_FB_PM2 is not set
510# CONFIG_FB_CYBER2000 is not set
511# CONFIG_FB_ASILIANT is not set
512# CONFIG_FB_IMSTT is not set
513# CONFIG_FB_RIVA is not set
514# CONFIG_FB_MATROX is not set
515# CONFIG_FB_RADEON_OLD is not set
516# CONFIG_FB_RADEON is not set
517# CONFIG_FB_ATY128 is not set
518# CONFIG_FB_ATY is not set
519# CONFIG_FB_SAVAGE is not set
520# CONFIG_FB_SIS is not set
521# CONFIG_FB_NEOMAGIC is not set
522# CONFIG_FB_KYRO is not set
523# CONFIG_FB_3DFX is not set
524# CONFIG_FB_VOODOO1 is not set
525# CONFIG_FB_TRIDENT is not set
526# CONFIG_FB_E1356 is not set
527# CONFIG_FB_VIRTUAL is not set
528
529#
530# Console display driver support
531#
532# CONFIG_VGA_CONSOLE is not set
533CONFIG_DUMMY_CONSOLE=y
534# CONFIG_FRAMEBUFFER_CONSOLE is not set
535
536#
537# Logo configuration
538#
539# CONFIG_LOGO is not set
540# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
541
542#
543# Sound
544#
545# CONFIG_SOUND is not set
546
547#
548# USB support
549#
550# CONFIG_USB is not set
551CONFIG_USB_ARCH_HAS_HCD=y
552CONFIG_USB_ARCH_HAS_OHCI=y
553
554#
555# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
556#
557
558#
559# USB Gadget Support
560#
561# CONFIG_USB_GADGET is not set
562
563#
564# MMC/SD Card support
565#
566# CONFIG_MMC is not set
567
568#
569# InfiniBand support
570#
571# CONFIG_INFINIBAND is not set
572
573#
574# File systems
575#
576# CONFIG_EXT2_FS is not set
577# CONFIG_EXT3_FS is not set
578# CONFIG_JBD is not set
579# CONFIG_REISERFS_FS is not set
580# CONFIG_JFS_FS is not set
581# CONFIG_XFS_FS is not set
582# CONFIG_MINIX_FS is not set
583# CONFIG_ROMFS_FS is not set
584# CONFIG_QUOTA is not set
585CONFIG_DNOTIFY=y
586# CONFIG_AUTOFS_FS is not set
587# CONFIG_AUTOFS4_FS is not set
588
589#
590# CD-ROM/DVD Filesystems
591#
592# CONFIG_ISO9660_FS is not set
593# CONFIG_UDF_FS is not set
594
595#
596# DOS/FAT/NT Filesystems
597#
598# CONFIG_MSDOS_FS is not set
599# CONFIG_VFAT_FS is not set
600# CONFIG_NTFS_FS is not set
601
602#
603# Pseudo filesystems
604#
605CONFIG_PROC_FS=y
606CONFIG_PROC_KCORE=y
607CONFIG_SYSFS=y
608# CONFIG_DEVFS_FS is not set
609# CONFIG_TMPFS is not set
610# CONFIG_HUGETLB_PAGE is not set
611CONFIG_RAMFS=y
612
613#
614# Miscellaneous filesystems
615#
616# CONFIG_ADFS_FS is not set
617# CONFIG_AFFS_FS is not set
618# CONFIG_HFS_FS is not set
619# CONFIG_HFSPLUS_FS is not set
620# CONFIG_BEFS_FS is not set
621# CONFIG_BFS_FS is not set
622# CONFIG_EFS_FS is not set
623# CONFIG_CRAMFS is not set
624# CONFIG_VXFS_FS is not set
625# CONFIG_HPFS_FS is not set
626# CONFIG_QNX4FS_FS is not set
627# CONFIG_SYSV_FS is not set
628# CONFIG_UFS_FS is not set
629
630#
631# Network File Systems
632#
633CONFIG_NFS_FS=y
634# CONFIG_NFS_V3 is not set
635# CONFIG_NFS_V4 is not set
636# CONFIG_NFS_DIRECTIO is not set
637# CONFIG_NFSD is not set
638CONFIG_ROOT_NFS=y
639CONFIG_LOCKD=y
640# CONFIG_EXPORTFS is not set
641CONFIG_SUNRPC=y
642# CONFIG_RPCSEC_GSS_KRB5 is not set
643# CONFIG_RPCSEC_GSS_SPKM3 is not set
644# CONFIG_SMB_FS is not set
645# CONFIG_CIFS is not set
646# CONFIG_NCP_FS is not set
647# CONFIG_CODA_FS is not set
648# CONFIG_AFS_FS is not set
649
650#
651# Partition Types
652#
653# CONFIG_PARTITION_ADVANCED is not set
654CONFIG_MSDOS_PARTITION=y
655
656#
657# Native Language Support
658#
659# CONFIG_NLS is not set
660
661#
662# Profiling support
663#
664# CONFIG_PROFILING is not set
665
666#
667# Kernel hacking
668#
669# CONFIG_DEBUG_KERNEL is not set
670CONFIG_CROSSCOMPILE=y
671CONFIG_CMDLINE=""
672
673#
674# Security options
675#
676CONFIG_KEYS=y
677CONFIG_KEYS_DEBUG_PROC_KEYS=y
678# CONFIG_SECURITY is not set
679
680#
681# Cryptographic options
682#
683# CONFIG_CRYPTO is not set
684
685#
686# Hardware crypto devices
687#
688
689#
690# Library routines
691#
692# CONFIG_CRC_CCITT is not set
693# CONFIG_CRC32 is not set
694# CONFIG_LIBCRC32C is not set
695CONFIG_GENERIC_HARDIRQS=y
696CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/lasat200_defconfig b/arch/mips/configs/lasat200_defconfig
new file mode 100644
index 000000000000..1e7697834e90
--- /dev/null
+++ b/arch/mips/configs/lasat200_defconfig
@@ -0,0 +1,791 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:06 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67CONFIG_LASAT=y
68CONFIG_PICVUE=y
69CONFIG_PICVUE_PROC=y
70CONFIG_DS1603=y
71CONFIG_LASAT_SYSCTL=y
72# CONFIG_MIPS_ITE8172 is not set
73# CONFIG_MIPS_ATLAS is not set
74# CONFIG_MIPS_MALTA is not set
75# CONFIG_MIPS_SEAD is not set
76# CONFIG_MOMENCO_OCELOT is not set
77# CONFIG_MOMENCO_OCELOT_G is not set
78# CONFIG_MOMENCO_OCELOT_C is not set
79# CONFIG_MOMENCO_OCELOT_3 is not set
80# CONFIG_MOMENCO_JAGUAR_ATX is not set
81# CONFIG_PMC_YOSEMITE is not set
82# CONFIG_DDB5074 is not set
83# CONFIG_DDB5476 is not set
84# CONFIG_DDB5477 is not set
85# CONFIG_NEC_OSPREY is not set
86# CONFIG_SGI_IP22 is not set
87# CONFIG_SOC_AU1X00 is not set
88# CONFIG_SIBYTE_SB1xxx_SOC is not set
89# CONFIG_SNI_RM200_PCI is not set
90# CONFIG_TOSHIBA_RBTX4927 is not set
91CONFIG_RWSEM_GENERIC_SPINLOCK=y
92CONFIG_GENERIC_CALIBRATE_DELAY=y
93CONFIG_HAVE_DEC_LOCK=y
94CONFIG_DMA_NONCOHERENT=y
95CONFIG_MIPS_NILE4=y
96CONFIG_CPU_LITTLE_ENDIAN=y
97CONFIG_MIPS_GT64120=y
98CONFIG_MIPS_L1_CACHE_SHIFT=5
99
100#
101# CPU selection
102#
103# CONFIG_CPU_MIPS32 is not set
104# CONFIG_CPU_MIPS64 is not set
105# CONFIG_CPU_R3000 is not set
106# CONFIG_CPU_TX39XX is not set
107# CONFIG_CPU_VR41XX is not set
108# CONFIG_CPU_R4300 is not set
109# CONFIG_CPU_R4X00 is not set
110# CONFIG_CPU_TX49XX is not set
111CONFIG_CPU_R5000=y
112# CONFIG_CPU_R5432 is not set
113# CONFIG_CPU_R6000 is not set
114# CONFIG_CPU_NEVADA is not set
115# CONFIG_CPU_R8000 is not set
116# CONFIG_CPU_R10000 is not set
117# CONFIG_CPU_RM7000 is not set
118# CONFIG_CPU_RM9000 is not set
119# CONFIG_CPU_SB1 is not set
120CONFIG_PAGE_SIZE_4KB=y
121# CONFIG_PAGE_SIZE_8KB is not set
122# CONFIG_PAGE_SIZE_16KB is not set
123# CONFIG_PAGE_SIZE_64KB is not set
124CONFIG_BOARD_SCACHE=y
125CONFIG_R5000_CPU_SCACHE=y
126# CONFIG_64BIT_PHYS_ADDR is not set
127# CONFIG_CPU_ADVANCED is not set
128CONFIG_CPU_HAS_LLSC=y
129CONFIG_CPU_HAS_LLDSCD=y
130CONFIG_CPU_HAS_SYNC=y
131# CONFIG_PREEMPT is not set
132
133#
134# Bus options (PCI, PCMCIA, EISA, ISA, TC)
135#
136CONFIG_HW_HAS_PCI=y
137CONFIG_PCI=y
138CONFIG_PCI_LEGACY_PROC=y
139# CONFIG_PCI_NAMES is not set
140CONFIG_MMU=y
141
142#
143# PCCARD (PCMCIA/CardBus) support
144#
145# CONFIG_PCCARD is not set
146
147#
148# PC-card bridges
149#
150
151#
152# PCI Hotplug Support
153#
154# CONFIG_HOTPLUG_PCI is not set
155
156#
157# Executable file formats
158#
159CONFIG_BINFMT_ELF=y
160# CONFIG_BINFMT_MISC is not set
161CONFIG_TRAD_SIGNALS=y
162
163#
164# Device Drivers
165#
166
167#
168# Generic Driver Options
169#
170CONFIG_STANDALONE=y
171CONFIG_PREVENT_FIRMWARE_BUILD=y
172# CONFIG_FW_LOADER is not set
173
174#
175# Memory Technology Devices (MTD)
176#
177CONFIG_MTD=y
178# CONFIG_MTD_DEBUG is not set
179CONFIG_MTD_PARTITIONS=y
180# CONFIG_MTD_CONCAT is not set
181# CONFIG_MTD_REDBOOT_PARTS is not set
182# CONFIG_MTD_CMDLINE_PARTS is not set
183
184#
185# User Modules And Translation Layers
186#
187CONFIG_MTD_CHAR=y
188CONFIG_MTD_BLOCK=y
189# CONFIG_FTL is not set
190# CONFIG_NFTL is not set
191# CONFIG_INFTL is not set
192
193#
194# RAM/ROM/Flash chip drivers
195#
196CONFIG_MTD_CFI=y
197# CONFIG_MTD_JEDECPROBE is not set
198CONFIG_MTD_GEN_PROBE=y
199# CONFIG_MTD_CFI_ADV_OPTIONS is not set
200CONFIG_MTD_MAP_BANK_WIDTH_1=y
201CONFIG_MTD_MAP_BANK_WIDTH_2=y
202CONFIG_MTD_MAP_BANK_WIDTH_4=y
203# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
204# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
205# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
206CONFIG_MTD_CFI_I1=y
207CONFIG_MTD_CFI_I2=y
208# CONFIG_MTD_CFI_I4 is not set
209# CONFIG_MTD_CFI_I8 is not set
210# CONFIG_MTD_CFI_INTELEXT is not set
211CONFIG_MTD_CFI_AMDSTD=y
212CONFIG_MTD_CFI_AMDSTD_RETRY=0
213# CONFIG_MTD_CFI_STAA is not set
214CONFIG_MTD_CFI_UTIL=y
215# CONFIG_MTD_RAM is not set
216# CONFIG_MTD_ROM is not set
217# CONFIG_MTD_ABSENT is not set
218
219#
220# Mapping drivers for chip access
221#
222# CONFIG_MTD_COMPLEX_MAPPINGS is not set
223# CONFIG_MTD_PHYSMAP is not set
224CONFIG_MTD_LASAT=y
225
226#
227# Self-contained MTD device drivers
228#
229# CONFIG_MTD_PMC551 is not set
230# CONFIG_MTD_SLRAM is not set
231# CONFIG_MTD_PHRAM is not set
232# CONFIG_MTD_MTDRAM is not set
233# CONFIG_MTD_BLKMTD is not set
234# CONFIG_MTD_BLOCK2MTD is not set
235
236#
237# Disk-On-Chip Device Drivers
238#
239# CONFIG_MTD_DOC2000 is not set
240# CONFIG_MTD_DOC2001 is not set
241# CONFIG_MTD_DOC2001PLUS is not set
242
243#
244# NAND Flash Device Drivers
245#
246# CONFIG_MTD_NAND is not set
247
248#
249# Parallel port support
250#
251# CONFIG_PARPORT is not set
252
253#
254# Plug and Play support
255#
256
257#
258# Block devices
259#
260# CONFIG_BLK_DEV_FD is not set
261# CONFIG_BLK_CPQ_DA is not set
262# CONFIG_BLK_CPQ_CISS_DA is not set
263# CONFIG_BLK_DEV_DAC960 is not set
264# CONFIG_BLK_DEV_UMEM is not set
265# CONFIG_BLK_DEV_COW_COMMON is not set
266# CONFIG_BLK_DEV_LOOP is not set
267# CONFIG_BLK_DEV_NBD is not set
268# CONFIG_BLK_DEV_SX8 is not set
269# CONFIG_BLK_DEV_RAM is not set
270CONFIG_BLK_DEV_RAM_COUNT=16
271CONFIG_INITRAMFS_SOURCE=""
272# CONFIG_LBD is not set
273CONFIG_CDROM_PKTCDVD=m
274CONFIG_CDROM_PKTCDVD_BUFFERS=8
275# CONFIG_CDROM_PKTCDVD_WCACHE is not set
276
277#
278# IO Schedulers
279#
280CONFIG_IOSCHED_NOOP=y
281CONFIG_IOSCHED_AS=y
282CONFIG_IOSCHED_DEADLINE=y
283CONFIG_IOSCHED_CFQ=y
284CONFIG_ATA_OVER_ETH=m
285
286#
287# ATA/ATAPI/MFM/RLL support
288#
289CONFIG_IDE=y
290CONFIG_BLK_DEV_IDE=y
291
292#
293# Please see Documentation/ide.txt for help/info on IDE drives
294#
295# CONFIG_BLK_DEV_IDE_SATA is not set
296CONFIG_BLK_DEV_IDEDISK=y
297CONFIG_IDEDISK_MULTI_MODE=y
298# CONFIG_BLK_DEV_IDECD is not set
299# CONFIG_BLK_DEV_IDETAPE is not set
300# CONFIG_BLK_DEV_IDEFLOPPY is not set
301# CONFIG_IDE_TASK_IOCTL is not set
302
303#
304# IDE chipset support/bugfixes
305#
306CONFIG_IDE_GENERIC=y
307CONFIG_BLK_DEV_IDEPCI=y
308# CONFIG_IDEPCI_SHARE_IRQ is not set
309# CONFIG_BLK_DEV_OFFBOARD is not set
310CONFIG_BLK_DEV_GENERIC=y
311# CONFIG_BLK_DEV_OPTI621 is not set
312CONFIG_BLK_DEV_IDEDMA_PCI=y
313# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
314CONFIG_IDEDMA_PCI_AUTO=y
315# CONFIG_IDEDMA_ONLYDISK is not set
316# CONFIG_BLK_DEV_AEC62XX is not set
317# CONFIG_BLK_DEV_ALI15X3 is not set
318# CONFIG_BLK_DEV_AMD74XX is not set
319CONFIG_BLK_DEV_CMD64X=y
320# CONFIG_BLK_DEV_TRIFLEX is not set
321# CONFIG_BLK_DEV_CY82C693 is not set
322# CONFIG_BLK_DEV_CS5520 is not set
323# CONFIG_BLK_DEV_CS5530 is not set
324# CONFIG_BLK_DEV_HPT34X is not set
325# CONFIG_BLK_DEV_HPT366 is not set
326# CONFIG_BLK_DEV_SC1200 is not set
327# CONFIG_BLK_DEV_PIIX is not set
328# CONFIG_BLK_DEV_NS87415 is not set
329# CONFIG_BLK_DEV_PDC202XX_OLD is not set
330# CONFIG_BLK_DEV_PDC202XX_NEW is not set
331# CONFIG_BLK_DEV_SVWKS is not set
332# CONFIG_BLK_DEV_SIIMAGE is not set
333# CONFIG_BLK_DEV_SLC90E66 is not set
334# CONFIG_BLK_DEV_TRM290 is not set
335# CONFIG_BLK_DEV_VIA82CXXX is not set
336# CONFIG_IDE_ARM is not set
337CONFIG_BLK_DEV_IDEDMA=y
338# CONFIG_IDEDMA_IVB is not set
339CONFIG_IDEDMA_AUTO=y
340# CONFIG_BLK_DEV_HD is not set
341
342#
343# SCSI device support
344#
345# CONFIG_SCSI is not set
346
347#
348# Multi-device support (RAID and LVM)
349#
350# CONFIG_MD is not set
351
352#
353# Fusion MPT device support
354#
355
356#
357# IEEE 1394 (FireWire) support
358#
359# CONFIG_IEEE1394 is not set
360
361#
362# I2O device support
363#
364# CONFIG_I2O is not set
365
366#
367# Networking support
368#
369CONFIG_NET=y
370
371#
372# Networking options
373#
374# CONFIG_PACKET is not set
375# CONFIG_NETLINK_DEV is not set
376CONFIG_UNIX=y
377CONFIG_NET_KEY=y
378CONFIG_INET=y
379# CONFIG_IP_MULTICAST is not set
380# CONFIG_IP_ADVANCED_ROUTER is not set
381# CONFIG_IP_PNP is not set
382# CONFIG_NET_IPIP is not set
383# CONFIG_NET_IPGRE is not set
384# CONFIG_ARPD is not set
385# CONFIG_SYN_COOKIES is not set
386# CONFIG_INET_AH is not set
387# CONFIG_INET_ESP is not set
388# CONFIG_INET_IPCOMP is not set
389CONFIG_INET_TUNNEL=m
390CONFIG_IP_TCPDIAG=m
391# CONFIG_IP_TCPDIAG_IPV6 is not set
392# CONFIG_IPV6 is not set
393# CONFIG_NETFILTER is not set
394CONFIG_XFRM=y
395CONFIG_XFRM_USER=m
396
397#
398# SCTP Configuration (EXPERIMENTAL)
399#
400# CONFIG_IP_SCTP is not set
401# CONFIG_ATM is not set
402# CONFIG_BRIDGE is not set
403# CONFIG_VLAN_8021Q is not set
404# CONFIG_DECNET is not set
405# CONFIG_LLC2 is not set
406# CONFIG_IPX is not set
407# CONFIG_ATALK is not set
408# CONFIG_X25 is not set
409# CONFIG_LAPB is not set
410# CONFIG_NET_DIVERT is not set
411# CONFIG_ECONET is not set
412# CONFIG_WAN_ROUTER is not set
413
414#
415# QoS and/or fair queueing
416#
417# CONFIG_NET_SCHED is not set
418# CONFIG_NET_CLS_ROUTE is not set
419
420#
421# Network testing
422#
423# CONFIG_NET_PKTGEN is not set
424# CONFIG_NETPOLL is not set
425# CONFIG_NET_POLL_CONTROLLER is not set
426# CONFIG_HAMRADIO is not set
427# CONFIG_IRDA is not set
428# CONFIG_BT is not set
429CONFIG_NETDEVICES=y
430# CONFIG_DUMMY is not set
431# CONFIG_BONDING is not set
432# CONFIG_EQUALIZER is not set
433# CONFIG_TUN is not set
434
435#
436# ARCnet devices
437#
438# CONFIG_ARCNET is not set
439
440#
441# Ethernet (10 or 100Mbit)
442#
443CONFIG_NET_ETHERNET=y
444# CONFIG_MII is not set
445# CONFIG_HAPPYMEAL is not set
446# CONFIG_SUNGEM is not set
447# CONFIG_NET_VENDOR_3COM is not set
448
449#
450# Tulip family network device support
451#
452# CONFIG_NET_TULIP is not set
453# CONFIG_HP100 is not set
454# CONFIG_NET_PCI is not set
455
456#
457# Ethernet (1000 Mbit)
458#
459# CONFIG_ACENIC is not set
460# CONFIG_DL2K is not set
461# CONFIG_E1000 is not set
462# CONFIG_NS83820 is not set
463# CONFIG_HAMACHI is not set
464# CONFIG_YELLOWFIN is not set
465# CONFIG_R8169 is not set
466# CONFIG_SK98LIN is not set
467# CONFIG_TIGON3 is not set
468
469#
470# Ethernet (10000 Mbit)
471#
472# CONFIG_IXGB is not set
473# CONFIG_S2IO is not set
474
475#
476# Token Ring devices
477#
478# CONFIG_TR is not set
479
480#
481# Wireless LAN (non-hamradio)
482#
483# CONFIG_NET_RADIO is not set
484
485#
486# Wan interfaces
487#
488# CONFIG_WAN is not set
489# CONFIG_FDDI is not set
490# CONFIG_HIPPI is not set
491# CONFIG_PPP is not set
492# CONFIG_SLIP is not set
493# CONFIG_SHAPER is not set
494# CONFIG_NETCONSOLE is not set
495
496#
497# ISDN subsystem
498#
499# CONFIG_ISDN is not set
500
501#
502# Telephony Support
503#
504# CONFIG_PHONE is not set
505
506#
507# Input device support
508#
509CONFIG_INPUT=y
510
511#
512# Userland interfaces
513#
514CONFIG_INPUT_MOUSEDEV=y
515CONFIG_INPUT_MOUSEDEV_PSAUX=y
516CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
517CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
518# CONFIG_INPUT_JOYDEV is not set
519# CONFIG_INPUT_TSDEV is not set
520# CONFIG_INPUT_EVDEV is not set
521# CONFIG_INPUT_EVBUG is not set
522
523#
524# Input I/O drivers
525#
526# CONFIG_GAMEPORT is not set
527CONFIG_SOUND_GAMEPORT=y
528CONFIG_SERIO=y
529CONFIG_SERIO_I8042=y
530CONFIG_SERIO_SERPORT=y
531# CONFIG_SERIO_CT82C710 is not set
532# CONFIG_SERIO_PCIPS2 is not set
533# CONFIG_SERIO_LIBPS2 is not set
534CONFIG_SERIO_RAW=m
535
536#
537# Input Device Drivers
538#
539# CONFIG_INPUT_KEYBOARD is not set
540# CONFIG_INPUT_MOUSE is not set
541# CONFIG_INPUT_JOYSTICK is not set
542# CONFIG_INPUT_TOUCHSCREEN is not set
543# CONFIG_INPUT_MISC is not set
544
545#
546# Character devices
547#
548CONFIG_VT=y
549CONFIG_VT_CONSOLE=y
550CONFIG_HW_CONSOLE=y
551# CONFIG_SERIAL_NONSTANDARD is not set
552
553#
554# Serial drivers
555#
556CONFIG_SERIAL_8250=y
557CONFIG_SERIAL_8250_CONSOLE=y
558CONFIG_SERIAL_8250_NR_UARTS=4
559# CONFIG_SERIAL_8250_EXTENDED is not set
560
561#
562# Non-8250 serial port support
563#
564CONFIG_SERIAL_CORE=y
565CONFIG_SERIAL_CORE_CONSOLE=y
566CONFIG_UNIX98_PTYS=y
567CONFIG_LEGACY_PTYS=y
568CONFIG_LEGACY_PTY_COUNT=256
569
570#
571# IPMI
572#
573# CONFIG_IPMI_HANDLER is not set
574
575#
576# Watchdog Cards
577#
578# CONFIG_WATCHDOG is not set
579# CONFIG_RTC is not set
580# CONFIG_GEN_RTC is not set
581# CONFIG_DTLK is not set
582# CONFIG_R3964 is not set
583# CONFIG_APPLICOM is not set
584
585#
586# Ftape, the floppy tape device driver
587#
588# CONFIG_DRM is not set
589# CONFIG_RAW_DRIVER is not set
590
591#
592# I2C support
593#
594# CONFIG_I2C is not set
595
596#
597# Dallas's 1-wire bus
598#
599# CONFIG_W1 is not set
600
601#
602# Misc devices
603#
604
605#
606# Multimedia devices
607#
608# CONFIG_VIDEO_DEV is not set
609
610#
611# Digital Video Broadcasting Devices
612#
613# CONFIG_DVB is not set
614
615#
616# Graphics support
617#
618# CONFIG_FB is not set
619
620#
621# Console display driver support
622#
623# CONFIG_VGA_CONSOLE is not set
624CONFIG_DUMMY_CONSOLE=y
625# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
626
627#
628# Sound
629#
630# CONFIG_SOUND is not set
631
632#
633# USB support
634#
635# CONFIG_USB is not set
636CONFIG_USB_ARCH_HAS_HCD=y
637CONFIG_USB_ARCH_HAS_OHCI=y
638
639#
640# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
641#
642
643#
644# USB Gadget Support
645#
646# CONFIG_USB_GADGET is not set
647
648#
649# MMC/SD Card support
650#
651# CONFIG_MMC is not set
652
653#
654# InfiniBand support
655#
656# CONFIG_INFINIBAND is not set
657
658#
659# File systems
660#
661CONFIG_EXT2_FS=y
662# CONFIG_EXT2_FS_XATTR is not set
663CONFIG_EXT3_FS=y
664CONFIG_EXT3_FS_XATTR=y
665# CONFIG_EXT3_FS_POSIX_ACL is not set
666CONFIG_EXT3_FS_SECURITY=y
667CONFIG_JBD=y
668# CONFIG_JBD_DEBUG is not set
669CONFIG_FS_MBCACHE=y
670# CONFIG_REISERFS_FS is not set
671# CONFIG_JFS_FS is not set
672# CONFIG_XFS_FS is not set
673# CONFIG_MINIX_FS is not set
674# CONFIG_ROMFS_FS is not set
675# CONFIG_QUOTA is not set
676CONFIG_DNOTIFY=y
677# CONFIG_AUTOFS_FS is not set
678# CONFIG_AUTOFS4_FS is not set
679
680#
681# CD-ROM/DVD Filesystems
682#
683# CONFIG_ISO9660_FS is not set
684# CONFIG_UDF_FS is not set
685
686#
687# DOS/FAT/NT Filesystems
688#
689# CONFIG_MSDOS_FS is not set
690# CONFIG_VFAT_FS is not set
691# CONFIG_NTFS_FS is not set
692
693#
694# Pseudo filesystems
695#
696CONFIG_PROC_FS=y
697CONFIG_PROC_KCORE=y
698CONFIG_SYSFS=y
699# CONFIG_DEVFS_FS is not set
700CONFIG_DEVPTS_FS_XATTR=y
701CONFIG_DEVPTS_FS_SECURITY=y
702# CONFIG_TMPFS is not set
703# CONFIG_HUGETLB_PAGE is not set
704CONFIG_RAMFS=y
705
706#
707# Miscellaneous filesystems
708#
709# CONFIG_ADFS_FS is not set
710# CONFIG_AFFS_FS is not set
711# CONFIG_HFS_FS is not set
712# CONFIG_HFSPLUS_FS is not set
713# CONFIG_BEFS_FS is not set
714# CONFIG_BFS_FS is not set
715# CONFIG_EFS_FS is not set
716# CONFIG_JFFS_FS is not set
717# CONFIG_JFFS2_FS is not set
718# CONFIG_CRAMFS is not set
719# CONFIG_VXFS_FS is not set
720# CONFIG_HPFS_FS is not set
721# CONFIG_QNX4FS_FS is not set
722# CONFIG_SYSV_FS is not set
723# CONFIG_UFS_FS is not set
724
725#
726# Network File Systems
727#
728CONFIG_NFS_FS=y
729CONFIG_NFS_V3=y
730# CONFIG_NFS_V4 is not set
731# CONFIG_NFS_DIRECTIO is not set
732# CONFIG_NFSD is not set
733CONFIG_LOCKD=y
734CONFIG_LOCKD_V4=y
735# CONFIG_EXPORTFS is not set
736CONFIG_SUNRPC=y
737# CONFIG_RPCSEC_GSS_KRB5 is not set
738# CONFIG_RPCSEC_GSS_SPKM3 is not set
739# CONFIG_SMB_FS is not set
740# CONFIG_CIFS is not set
741# CONFIG_NCP_FS is not set
742# CONFIG_CODA_FS is not set
743# CONFIG_AFS_FS is not set
744
745#
746# Partition Types
747#
748# CONFIG_PARTITION_ADVANCED is not set
749CONFIG_MSDOS_PARTITION=y
750
751#
752# Native Language Support
753#
754# CONFIG_NLS is not set
755
756#
757# Profiling support
758#
759# CONFIG_PROFILING is not set
760
761#
762# Kernel hacking
763#
764# CONFIG_DEBUG_KERNEL is not set
765CONFIG_CROSSCOMPILE=y
766CONFIG_CMDLINE=""
767
768#
769# Security options
770#
771CONFIG_KEYS=y
772CONFIG_KEYS_DEBUG_PROC_KEYS=y
773# CONFIG_SECURITY is not set
774
775#
776# Cryptographic options
777#
778# CONFIG_CRYPTO is not set
779
780#
781# Hardware crypto devices
782#
783
784#
785# Library routines
786#
787# CONFIG_CRC_CCITT is not set
788CONFIG_CRC32=y
789CONFIG_LIBCRC32C=m
790CONFIG_GENERIC_HARDIRQS=y
791CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
new file mode 100644
index 000000000000..61fb9fb97e6e
--- /dev/null
+++ b/arch/mips/configs/malta_defconfig
@@ -0,0 +1,1132 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:53:14 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70CONFIG_MIPS_MALTA=y
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83# CONFIG_SOC_AU1X00 is not set
84# CONFIG_SIBYTE_SB1xxx_SOC is not set
85# CONFIG_SNI_RM200_PCI is not set
86# CONFIG_TOSHIBA_RBTX4927 is not set
87CONFIG_RWSEM_GENERIC_SPINLOCK=y
88CONFIG_GENERIC_CALIBRATE_DELAY=y
89CONFIG_HAVE_DEC_LOCK=y
90CONFIG_DMA_NONCOHERENT=y
91CONFIG_GENERIC_ISA_DMA=y
92CONFIG_I8259=y
93CONFIG_MIPS_BONITO64=y
94CONFIG_MIPS_MSC=y
95CONFIG_CPU_LITTLE_ENDIAN=y
96CONFIG_MIPS_BOARDS_GEN=y
97CONFIG_MIPS_GT64120=y
98CONFIG_SWAP_IO_SPACE=y
99CONFIG_BOOT_ELF32=y
100CONFIG_MIPS_L1_CACHE_SHIFT=5
101CONFIG_HAVE_STD_PC_SERIAL_PORT=y
102
103#
104# CPU selection
105#
106CONFIG_CPU_MIPS32=y
107# CONFIG_CPU_MIPS64 is not set
108# CONFIG_CPU_R3000 is not set
109# CONFIG_CPU_TX39XX is not set
110# CONFIG_CPU_VR41XX is not set
111# CONFIG_CPU_R4300 is not set
112# CONFIG_CPU_R4X00 is not set
113# CONFIG_CPU_TX49XX is not set
114# CONFIG_CPU_R5000 is not set
115# CONFIG_CPU_R5432 is not set
116# CONFIG_CPU_R6000 is not set
117# CONFIG_CPU_NEVADA is not set
118# CONFIG_CPU_R8000 is not set
119# CONFIG_CPU_R10000 is not set
120# CONFIG_CPU_RM7000 is not set
121# CONFIG_CPU_RM9000 is not set
122# CONFIG_CPU_SB1 is not set
123CONFIG_PAGE_SIZE_4KB=y
124# CONFIG_PAGE_SIZE_8KB is not set
125# CONFIG_PAGE_SIZE_16KB is not set
126# CONFIG_PAGE_SIZE_64KB is not set
127# CONFIG_64BIT_PHYS_ADDR is not set
128# CONFIG_CPU_ADVANCED is not set
129CONFIG_CPU_HAS_LLSC=y
130CONFIG_CPU_HAS_SYNC=y
131# CONFIG_PREEMPT is not set
132
133#
134# Bus options (PCI, PCMCIA, EISA, ISA, TC)
135#
136CONFIG_HW_HAS_PCI=y
137CONFIG_PCI=y
138CONFIG_PCI_LEGACY_PROC=y
139CONFIG_PCI_NAMES=y
140CONFIG_MMU=y
141
142#
143# PCCARD (PCMCIA/CardBus) support
144#
145# CONFIG_PCCARD is not set
146
147#
148# PC-card bridges
149#
150
151#
152# PCI Hotplug Support
153#
154# CONFIG_HOTPLUG_PCI is not set
155
156#
157# Executable file formats
158#
159CONFIG_BINFMT_ELF=y
160# CONFIG_BINFMT_MISC is not set
161CONFIG_TRAD_SIGNALS=y
162
163#
164# Device Drivers
165#
166
167#
168# Generic Driver Options
169#
170CONFIG_STANDALONE=y
171CONFIG_PREVENT_FIRMWARE_BUILD=y
172CONFIG_FW_LOADER=y
173
174#
175# Memory Technology Devices (MTD)
176#
177# CONFIG_MTD is not set
178
179#
180# Parallel port support
181#
182# CONFIG_PARPORT is not set
183
184#
185# Plug and Play support
186#
187
188#
189# Block devices
190#
191CONFIG_BLK_DEV_FD=m
192# CONFIG_BLK_CPQ_DA is not set
193# CONFIG_BLK_CPQ_CISS_DA is not set
194# CONFIG_BLK_DEV_DAC960 is not set
195CONFIG_BLK_DEV_UMEM=m
196# CONFIG_BLK_DEV_COW_COMMON is not set
197CONFIG_BLK_DEV_LOOP=m
198CONFIG_BLK_DEV_CRYPTOLOOP=m
199CONFIG_BLK_DEV_NBD=m
200# CONFIG_BLK_DEV_SX8 is not set
201CONFIG_BLK_DEV_RAM=y
202CONFIG_BLK_DEV_RAM_COUNT=16
203CONFIG_BLK_DEV_RAM_SIZE=4096
204# CONFIG_BLK_DEV_INITRD is not set
205CONFIG_INITRAMFS_SOURCE=""
206# CONFIG_LBD is not set
207CONFIG_CDROM_PKTCDVD=m
208CONFIG_CDROM_PKTCDVD_BUFFERS=8
209# CONFIG_CDROM_PKTCDVD_WCACHE is not set
210
211#
212# IO Schedulers
213#
214CONFIG_IOSCHED_NOOP=y
215CONFIG_IOSCHED_AS=y
216CONFIG_IOSCHED_DEADLINE=y
217CONFIG_IOSCHED_CFQ=y
218CONFIG_ATA_OVER_ETH=m
219
220#
221# ATA/ATAPI/MFM/RLL support
222#
223CONFIG_IDE=y
224CONFIG_BLK_DEV_IDE=y
225
226#
227# Please see Documentation/ide.txt for help/info on IDE drives
228#
229# CONFIG_BLK_DEV_IDE_SATA is not set
230CONFIG_BLK_DEV_IDEDISK=y
231# CONFIG_IDEDISK_MULTI_MODE is not set
232CONFIG_BLK_DEV_IDECD=y
233# CONFIG_BLK_DEV_IDETAPE is not set
234# CONFIG_BLK_DEV_IDEFLOPPY is not set
235# CONFIG_BLK_DEV_IDESCSI is not set
236# CONFIG_IDE_TASK_IOCTL is not set
237
238#
239# IDE chipset support/bugfixes
240#
241CONFIG_IDE_GENERIC=y
242CONFIG_BLK_DEV_IDEPCI=y
243# CONFIG_IDEPCI_SHARE_IRQ is not set
244# CONFIG_BLK_DEV_OFFBOARD is not set
245CONFIG_BLK_DEV_GENERIC=y
246# CONFIG_BLK_DEV_OPTI621 is not set
247CONFIG_BLK_DEV_IDEDMA_PCI=y
248# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
249CONFIG_IDEDMA_PCI_AUTO=y
250# CONFIG_IDEDMA_ONLYDISK is not set
251# CONFIG_BLK_DEV_AEC62XX is not set
252# CONFIG_BLK_DEV_ALI15X3 is not set
253# CONFIG_BLK_DEV_AMD74XX is not set
254# CONFIG_BLK_DEV_CMD64X is not set
255# CONFIG_BLK_DEV_TRIFLEX is not set
256# CONFIG_BLK_DEV_CY82C693 is not set
257# CONFIG_BLK_DEV_CS5520 is not set
258# CONFIG_BLK_DEV_CS5530 is not set
259# CONFIG_BLK_DEV_HPT34X is not set
260# CONFIG_BLK_DEV_HPT366 is not set
261# CONFIG_BLK_DEV_SC1200 is not set
262CONFIG_BLK_DEV_PIIX=y
263# CONFIG_BLK_DEV_NS87415 is not set
264# CONFIG_BLK_DEV_PDC202XX_OLD is not set
265# CONFIG_BLK_DEV_PDC202XX_NEW is not set
266# CONFIG_BLK_DEV_SVWKS is not set
267# CONFIG_BLK_DEV_SIIMAGE is not set
268# CONFIG_BLK_DEV_SLC90E66 is not set
269# CONFIG_BLK_DEV_TRM290 is not set
270# CONFIG_BLK_DEV_VIA82CXXX is not set
271# CONFIG_IDE_ARM is not set
272CONFIG_BLK_DEV_IDEDMA=y
273# CONFIG_IDEDMA_IVB is not set
274CONFIG_IDEDMA_AUTO=y
275# CONFIG_BLK_DEV_HD is not set
276
277#
278# SCSI device support
279#
280CONFIG_SCSI=m
281CONFIG_SCSI_PROC_FS=y
282
283#
284# SCSI support type (disk, tape, CD-ROM)
285#
286CONFIG_BLK_DEV_SD=m
287CONFIG_CHR_DEV_ST=m
288CONFIG_CHR_DEV_OSST=m
289CONFIG_BLK_DEV_SR=m
290CONFIG_BLK_DEV_SR_VENDOR=y
291CONFIG_CHR_DEV_SG=m
292
293#
294# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
295#
296CONFIG_SCSI_MULTI_LUN=y
297CONFIG_SCSI_CONSTANTS=y
298CONFIG_SCSI_LOGGING=y
299
300#
301# SCSI Transport Attributes
302#
303CONFIG_SCSI_SPI_ATTRS=m
304CONFIG_SCSI_FC_ATTRS=m
305CONFIG_SCSI_ISCSI_ATTRS=m
306
307#
308# SCSI low-level drivers
309#
310CONFIG_BLK_DEV_3W_XXXX_RAID=m
311CONFIG_SCSI_3W_9XXX=m
312CONFIG_SCSI_ACARD=m
313CONFIG_SCSI_AACRAID=m
314CONFIG_SCSI_AIC7XXX=m
315CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
316CONFIG_AIC7XXX_RESET_DELAY_MS=15000
317# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
318CONFIG_AIC7XXX_DEBUG_MASK=0
319CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
320# CONFIG_SCSI_AIC7XXX_OLD is not set
321# CONFIG_SCSI_AIC79XX is not set
322# CONFIG_SCSI_DPT_I2O is not set
323# CONFIG_MEGARAID_NEWGEN is not set
324# CONFIG_MEGARAID_LEGACY is not set
325# CONFIG_SCSI_SATA is not set
326# CONFIG_SCSI_BUSLOGIC is not set
327# CONFIG_SCSI_DMX3191D is not set
328# CONFIG_SCSI_EATA is not set
329# CONFIG_SCSI_EATA_PIO is not set
330# CONFIG_SCSI_FUTURE_DOMAIN is not set
331# CONFIG_SCSI_GDTH is not set
332# CONFIG_SCSI_IPS is not set
333# CONFIG_SCSI_INITIO is not set
334# CONFIG_SCSI_INIA100 is not set
335# CONFIG_SCSI_SYM53C8XX_2 is not set
336# CONFIG_SCSI_IPR is not set
337# CONFIG_SCSI_QLOGIC_ISP is not set
338# CONFIG_SCSI_QLOGIC_FC is not set
339# CONFIG_SCSI_QLOGIC_1280 is not set
340CONFIG_SCSI_QLA2XXX=m
341# CONFIG_SCSI_QLA21XX is not set
342# CONFIG_SCSI_QLA22XX is not set
343# CONFIG_SCSI_QLA2300 is not set
344# CONFIG_SCSI_QLA2322 is not set
345# CONFIG_SCSI_QLA6312 is not set
346# CONFIG_SCSI_DC395x is not set
347# CONFIG_SCSI_DC390T is not set
348# CONFIG_SCSI_NSP32 is not set
349# CONFIG_SCSI_DEBUG is not set
350
351#
352# Multi-device support (RAID and LVM)
353#
354CONFIG_MD=y
355CONFIG_BLK_DEV_MD=m
356CONFIG_MD_LINEAR=m
357CONFIG_MD_RAID0=m
358CONFIG_MD_RAID1=m
359CONFIG_MD_RAID10=m
360CONFIG_MD_RAID5=m
361CONFIG_MD_RAID6=m
362CONFIG_MD_MULTIPATH=m
363CONFIG_MD_FAULTY=m
364CONFIG_BLK_DEV_DM=m
365CONFIG_DM_CRYPT=m
366CONFIG_DM_SNAPSHOT=m
367CONFIG_DM_MIRROR=m
368CONFIG_DM_ZERO=m
369
370#
371# Fusion MPT device support
372#
373# CONFIG_FUSION is not set
374
375#
376# IEEE 1394 (FireWire) support
377#
378# CONFIG_IEEE1394 is not set
379
380#
381# I2O device support
382#
383# CONFIG_I2O is not set
384
385#
386# Networking support
387#
388CONFIG_NET=y
389
390#
391# Networking options
392#
393CONFIG_PACKET=y
394CONFIG_PACKET_MMAP=y
395CONFIG_NETLINK_DEV=y
396CONFIG_UNIX=y
397CONFIG_NET_KEY=y
398CONFIG_INET=y
399CONFIG_IP_MULTICAST=y
400CONFIG_IP_ADVANCED_ROUTER=y
401CONFIG_IP_MULTIPLE_TABLES=y
402CONFIG_IP_ROUTE_FWMARK=y
403CONFIG_IP_ROUTE_MULTIPATH=y
404CONFIG_IP_ROUTE_VERBOSE=y
405CONFIG_IP_PNP=y
406CONFIG_IP_PNP_DHCP=y
407CONFIG_IP_PNP_BOOTP=y
408# CONFIG_IP_PNP_RARP is not set
409CONFIG_NET_IPIP=m
410CONFIG_NET_IPGRE=m
411CONFIG_NET_IPGRE_BROADCAST=y
412CONFIG_IP_MROUTE=y
413CONFIG_IP_PIMSM_V1=y
414CONFIG_IP_PIMSM_V2=y
415# CONFIG_ARPD is not set
416CONFIG_SYN_COOKIES=y
417CONFIG_INET_AH=m
418CONFIG_INET_ESP=m
419CONFIG_INET_IPCOMP=m
420CONFIG_INET_TUNNEL=m
421CONFIG_IP_TCPDIAG=m
422CONFIG_IP_TCPDIAG_IPV6=y
423
424#
425# IP: Virtual Server Configuration
426#
427CONFIG_IP_VS=m
428# CONFIG_IP_VS_DEBUG is not set
429CONFIG_IP_VS_TAB_BITS=12
430
431#
432# IPVS transport protocol load balancing support
433#
434CONFIG_IP_VS_PROTO_TCP=y
435CONFIG_IP_VS_PROTO_UDP=y
436CONFIG_IP_VS_PROTO_ESP=y
437CONFIG_IP_VS_PROTO_AH=y
438
439#
440# IPVS scheduler
441#
442CONFIG_IP_VS_RR=m
443CONFIG_IP_VS_WRR=m
444CONFIG_IP_VS_LC=m
445CONFIG_IP_VS_WLC=m
446CONFIG_IP_VS_LBLC=m
447CONFIG_IP_VS_LBLCR=m
448CONFIG_IP_VS_DH=m
449CONFIG_IP_VS_SH=m
450CONFIG_IP_VS_SED=m
451CONFIG_IP_VS_NQ=m
452
453#
454# IPVS application helper
455#
456CONFIG_IP_VS_FTP=m
457CONFIG_IPV6=m
458CONFIG_IPV6_PRIVACY=y
459CONFIG_INET6_AH=m
460CONFIG_INET6_ESP=m
461CONFIG_INET6_IPCOMP=m
462CONFIG_INET6_TUNNEL=m
463CONFIG_IPV6_TUNNEL=m
464CONFIG_NETFILTER=y
465# CONFIG_NETFILTER_DEBUG is not set
466CONFIG_BRIDGE_NETFILTER=y
467
468#
469# IP: Netfilter Configuration
470#
471CONFIG_IP_NF_CONNTRACK=m
472CONFIG_IP_NF_CT_ACCT=y
473CONFIG_IP_NF_CONNTRACK_MARK=y
474CONFIG_IP_NF_CT_PROTO_SCTP=m
475CONFIG_IP_NF_FTP=m
476CONFIG_IP_NF_IRC=m
477CONFIG_IP_NF_TFTP=m
478CONFIG_IP_NF_AMANDA=m
479CONFIG_IP_NF_QUEUE=m
480CONFIG_IP_NF_IPTABLES=m
481CONFIG_IP_NF_MATCH_LIMIT=m
482CONFIG_IP_NF_MATCH_IPRANGE=m
483CONFIG_IP_NF_MATCH_MAC=m
484CONFIG_IP_NF_MATCH_PKTTYPE=m
485CONFIG_IP_NF_MATCH_MARK=m
486CONFIG_IP_NF_MATCH_MULTIPORT=m
487CONFIG_IP_NF_MATCH_TOS=m
488CONFIG_IP_NF_MATCH_RECENT=m
489CONFIG_IP_NF_MATCH_ECN=m
490CONFIG_IP_NF_MATCH_DSCP=m
491CONFIG_IP_NF_MATCH_AH_ESP=m
492CONFIG_IP_NF_MATCH_LENGTH=m
493CONFIG_IP_NF_MATCH_TTL=m
494CONFIG_IP_NF_MATCH_TCPMSS=m
495CONFIG_IP_NF_MATCH_HELPER=m
496CONFIG_IP_NF_MATCH_STATE=m
497CONFIG_IP_NF_MATCH_CONNTRACK=m
498CONFIG_IP_NF_MATCH_OWNER=m
499CONFIG_IP_NF_MATCH_PHYSDEV=m
500CONFIG_IP_NF_MATCH_ADDRTYPE=m
501CONFIG_IP_NF_MATCH_REALM=m
502CONFIG_IP_NF_MATCH_SCTP=m
503CONFIG_IP_NF_MATCH_COMMENT=m
504CONFIG_IP_NF_MATCH_CONNMARK=m
505CONFIG_IP_NF_MATCH_HASHLIMIT=m
506CONFIG_IP_NF_FILTER=m
507CONFIG_IP_NF_TARGET_REJECT=m
508CONFIG_IP_NF_TARGET_LOG=m
509CONFIG_IP_NF_TARGET_ULOG=m
510CONFIG_IP_NF_TARGET_TCPMSS=m
511CONFIG_IP_NF_NAT=m
512CONFIG_IP_NF_NAT_NEEDED=y
513CONFIG_IP_NF_TARGET_MASQUERADE=m
514CONFIG_IP_NF_TARGET_REDIRECT=m
515CONFIG_IP_NF_TARGET_NETMAP=m
516CONFIG_IP_NF_TARGET_SAME=m
517CONFIG_IP_NF_NAT_SNMP_BASIC=m
518CONFIG_IP_NF_NAT_IRC=m
519CONFIG_IP_NF_NAT_FTP=m
520CONFIG_IP_NF_NAT_TFTP=m
521CONFIG_IP_NF_NAT_AMANDA=m
522CONFIG_IP_NF_MANGLE=m
523CONFIG_IP_NF_TARGET_TOS=m
524CONFIG_IP_NF_TARGET_ECN=m
525CONFIG_IP_NF_TARGET_DSCP=m
526CONFIG_IP_NF_TARGET_MARK=m
527CONFIG_IP_NF_TARGET_CLASSIFY=m
528CONFIG_IP_NF_TARGET_CONNMARK=m
529CONFIG_IP_NF_TARGET_CLUSTERIP=m
530CONFIG_IP_NF_RAW=m
531CONFIG_IP_NF_TARGET_NOTRACK=m
532CONFIG_IP_NF_ARPTABLES=m
533CONFIG_IP_NF_ARPFILTER=m
534CONFIG_IP_NF_ARP_MANGLE=m
535
536#
537# IPv6: Netfilter Configuration
538#
539CONFIG_IP6_NF_QUEUE=m
540CONFIG_IP6_NF_IPTABLES=m
541CONFIG_IP6_NF_MATCH_LIMIT=m
542CONFIG_IP6_NF_MATCH_MAC=m
543CONFIG_IP6_NF_MATCH_RT=m
544CONFIG_IP6_NF_MATCH_OPTS=m
545CONFIG_IP6_NF_MATCH_FRAG=m
546CONFIG_IP6_NF_MATCH_HL=m
547CONFIG_IP6_NF_MATCH_MULTIPORT=m
548CONFIG_IP6_NF_MATCH_OWNER=m
549CONFIG_IP6_NF_MATCH_MARK=m
550CONFIG_IP6_NF_MATCH_IPV6HEADER=m
551CONFIG_IP6_NF_MATCH_AHESP=m
552CONFIG_IP6_NF_MATCH_LENGTH=m
553CONFIG_IP6_NF_MATCH_EUI64=m
554CONFIG_IP6_NF_MATCH_PHYSDEV=m
555CONFIG_IP6_NF_FILTER=m
556CONFIG_IP6_NF_TARGET_LOG=m
557CONFIG_IP6_NF_MANGLE=m
558CONFIG_IP6_NF_TARGET_MARK=m
559CONFIG_IP6_NF_RAW=m
560
561#
562# Bridge: Netfilter Configuration
563#
564CONFIG_BRIDGE_NF_EBTABLES=m
565CONFIG_BRIDGE_EBT_BROUTE=m
566CONFIG_BRIDGE_EBT_T_FILTER=m
567CONFIG_BRIDGE_EBT_T_NAT=m
568CONFIG_BRIDGE_EBT_802_3=m
569CONFIG_BRIDGE_EBT_AMONG=m
570CONFIG_BRIDGE_EBT_ARP=m
571CONFIG_BRIDGE_EBT_IP=m
572CONFIG_BRIDGE_EBT_LIMIT=m
573CONFIG_BRIDGE_EBT_MARK=m
574CONFIG_BRIDGE_EBT_PKTTYPE=m
575CONFIG_BRIDGE_EBT_STP=m
576CONFIG_BRIDGE_EBT_VLAN=m
577CONFIG_BRIDGE_EBT_ARPREPLY=m
578CONFIG_BRIDGE_EBT_DNAT=m
579CONFIG_BRIDGE_EBT_MARK_T=m
580CONFIG_BRIDGE_EBT_REDIRECT=m
581CONFIG_BRIDGE_EBT_SNAT=m
582CONFIG_BRIDGE_EBT_LOG=m
583CONFIG_BRIDGE_EBT_ULOG=m
584CONFIG_XFRM=y
585CONFIG_XFRM_USER=m
586
587#
588# SCTP Configuration (EXPERIMENTAL)
589#
590CONFIG_IP_SCTP=m
591# CONFIG_SCTP_DBG_MSG is not set
592# CONFIG_SCTP_DBG_OBJCNT is not set
593# CONFIG_SCTP_HMAC_NONE is not set
594# CONFIG_SCTP_HMAC_SHA1 is not set
595CONFIG_SCTP_HMAC_MD5=y
596# CONFIG_ATM is not set
597CONFIG_BRIDGE=m
598CONFIG_VLAN_8021Q=m
599# CONFIG_DECNET is not set
600CONFIG_LLC=m
601# CONFIG_LLC2 is not set
602# CONFIG_IPX is not set
603CONFIG_ATALK=m
604CONFIG_DEV_APPLETALK=y
605CONFIG_IPDDP=m
606CONFIG_IPDDP_ENCAP=y
607CONFIG_IPDDP_DECAP=y
608# CONFIG_X25 is not set
609# CONFIG_LAPB is not set
610CONFIG_NET_DIVERT=y
611# CONFIG_ECONET is not set
612# CONFIG_WAN_ROUTER is not set
613
614#
615# QoS and/or fair queueing
616#
617CONFIG_NET_SCHED=y
618CONFIG_NET_SCH_CLK_JIFFIES=y
619# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
620# CONFIG_NET_SCH_CLK_CPU is not set
621CONFIG_NET_SCH_CBQ=m
622CONFIG_NET_SCH_HTB=m
623CONFIG_NET_SCH_HFSC=m
624CONFIG_NET_SCH_PRIO=m
625CONFIG_NET_SCH_RED=m
626CONFIG_NET_SCH_SFQ=m
627CONFIG_NET_SCH_TEQL=m
628CONFIG_NET_SCH_TBF=m
629CONFIG_NET_SCH_GRED=m
630CONFIG_NET_SCH_DSMARK=m
631CONFIG_NET_SCH_NETEM=m
632CONFIG_NET_SCH_INGRESS=m
633CONFIG_NET_QOS=y
634CONFIG_NET_ESTIMATOR=y
635CONFIG_NET_CLS=y
636CONFIG_NET_CLS_TCINDEX=m
637CONFIG_NET_CLS_ROUTE4=m
638CONFIG_NET_CLS_ROUTE=y
639CONFIG_NET_CLS_FW=m
640CONFIG_NET_CLS_U32=m
641# CONFIG_CLS_U32_PERF is not set
642CONFIG_NET_CLS_IND=y
643# CONFIG_CLS_U32_MARK is not set
644CONFIG_NET_CLS_RSVP=m
645CONFIG_NET_CLS_RSVP6=m
646# CONFIG_NET_CLS_ACT is not set
647CONFIG_NET_CLS_POLICE=y
648
649#
650# Network testing
651#
652# CONFIG_NET_PKTGEN is not set
653# CONFIG_NETPOLL is not set
654# CONFIG_NET_POLL_CONTROLLER is not set
655# CONFIG_HAMRADIO is not set
656# CONFIG_IRDA is not set
657# CONFIG_BT is not set
658CONFIG_NETDEVICES=y
659CONFIG_DUMMY=m
660CONFIG_BONDING=m
661CONFIG_EQUALIZER=m
662CONFIG_TUN=m
663# CONFIG_ETHERTAP is not set
664
665#
666# ARCnet devices
667#
668# CONFIG_ARCNET is not set
669
670#
671# Ethernet (10 or 100Mbit)
672#
673CONFIG_NET_ETHERNET=y
674CONFIG_MII=y
675# CONFIG_HAPPYMEAL is not set
676# CONFIG_SUNGEM is not set
677# CONFIG_NET_VENDOR_3COM is not set
678
679#
680# Tulip family network device support
681#
682# CONFIG_NET_TULIP is not set
683# CONFIG_HP100 is not set
684CONFIG_NET_PCI=y
685CONFIG_PCNET32=y
686# CONFIG_AMD8111_ETH is not set
687# CONFIG_ADAPTEC_STARFIRE is not set
688# CONFIG_B44 is not set
689# CONFIG_FORCEDETH is not set
690# CONFIG_DGRS is not set
691# CONFIG_EEPRO100 is not set
692# CONFIG_E100 is not set
693# CONFIG_FEALNX is not set
694# CONFIG_NATSEMI is not set
695# CONFIG_NE2K_PCI is not set
696# CONFIG_8139CP is not set
697# CONFIG_8139TOO is not set
698# CONFIG_SIS900 is not set
699# CONFIG_EPIC100 is not set
700# CONFIG_SUNDANCE is not set
701# CONFIG_TLAN is not set
702# CONFIG_VIA_RHINE is not set
703# CONFIG_LAN_SAA9730 is not set
704
705#
706# Ethernet (1000 Mbit)
707#
708# CONFIG_ACENIC is not set
709# CONFIG_DL2K is not set
710# CONFIG_E1000 is not set
711# CONFIG_NS83820 is not set
712# CONFIG_HAMACHI is not set
713# CONFIG_YELLOWFIN is not set
714# CONFIG_R8169 is not set
715# CONFIG_SK98LIN is not set
716# CONFIG_VIA_VELOCITY is not set
717# CONFIG_TIGON3 is not set
718
719#
720# Ethernet (10000 Mbit)
721#
722# CONFIG_IXGB is not set
723# CONFIG_S2IO is not set
724
725#
726# Token Ring devices
727#
728# CONFIG_TR is not set
729
730#
731# Wireless LAN (non-hamradio)
732#
733# CONFIG_NET_RADIO is not set
734
735#
736# Wan interfaces
737#
738# CONFIG_WAN is not set
739# CONFIG_FDDI is not set
740# CONFIG_HIPPI is not set
741# CONFIG_PPP is not set
742# CONFIG_SLIP is not set
743# CONFIG_NET_FC is not set
744# CONFIG_SHAPER is not set
745# CONFIG_NETCONSOLE is not set
746
747#
748# ISDN subsystem
749#
750# CONFIG_ISDN is not set
751
752#
753# Telephony Support
754#
755# CONFIG_PHONE is not set
756
757#
758# Input device support
759#
760CONFIG_INPUT=y
761
762#
763# Userland interfaces
764#
765CONFIG_INPUT_MOUSEDEV=y
766CONFIG_INPUT_MOUSEDEV_PSAUX=y
767CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
768CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
769# CONFIG_INPUT_JOYDEV is not set
770# CONFIG_INPUT_TSDEV is not set
771# CONFIG_INPUT_EVDEV is not set
772# CONFIG_INPUT_EVBUG is not set
773
774#
775# Input I/O drivers
776#
777# CONFIG_GAMEPORT is not set
778CONFIG_SOUND_GAMEPORT=y
779CONFIG_SERIO=y
780# CONFIG_SERIO_I8042 is not set
781CONFIG_SERIO_SERPORT=y
782# CONFIG_SERIO_CT82C710 is not set
783# CONFIG_SERIO_PCIPS2 is not set
784# CONFIG_SERIO_LIBPS2 is not set
785# CONFIG_SERIO_RAW is not set
786
787#
788# Input Device Drivers
789#
790# CONFIG_INPUT_KEYBOARD is not set
791# CONFIG_INPUT_MOUSE is not set
792# CONFIG_INPUT_JOYSTICK is not set
793# CONFIG_INPUT_TOUCHSCREEN is not set
794# CONFIG_INPUT_MISC is not set
795
796#
797# Character devices
798#
799CONFIG_VT=y
800CONFIG_VT_CONSOLE=y
801CONFIG_HW_CONSOLE=y
802# CONFIG_SERIAL_NONSTANDARD is not set
803
804#
805# Serial drivers
806#
807CONFIG_SERIAL_8250=y
808CONFIG_SERIAL_8250_CONSOLE=y
809CONFIG_SERIAL_8250_NR_UARTS=4
810# CONFIG_SERIAL_8250_EXTENDED is not set
811
812#
813# Non-8250 serial port support
814#
815CONFIG_SERIAL_CORE=y
816CONFIG_SERIAL_CORE_CONSOLE=y
817CONFIG_UNIX98_PTYS=y
818CONFIG_LEGACY_PTYS=y
819CONFIG_LEGACY_PTY_COUNT=256
820
821#
822# IPMI
823#
824# CONFIG_IPMI_HANDLER is not set
825
826#
827# Watchdog Cards
828#
829# CONFIG_WATCHDOG is not set
830CONFIG_RTC=y
831# CONFIG_DTLK is not set
832# CONFIG_R3964 is not set
833# CONFIG_APPLICOM is not set
834
835#
836# Ftape, the floppy tape device driver
837#
838# CONFIG_DRM is not set
839# CONFIG_RAW_DRIVER is not set
840
841#
842# I2C support
843#
844# CONFIG_I2C is not set
845
846#
847# Dallas's 1-wire bus
848#
849# CONFIG_W1 is not set
850
851#
852# Misc devices
853#
854
855#
856# Multimedia devices
857#
858# CONFIG_VIDEO_DEV is not set
859
860#
861# Digital Video Broadcasting Devices
862#
863# CONFIG_DVB is not set
864
865#
866# Graphics support
867#
868# CONFIG_FB is not set
869
870#
871# Console display driver support
872#
873# CONFIG_VGA_CONSOLE is not set
874CONFIG_DUMMY_CONSOLE=y
875# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
876
877#
878# Sound
879#
880# CONFIG_SOUND is not set
881
882#
883# USB support
884#
885# CONFIG_USB is not set
886CONFIG_USB_ARCH_HAS_HCD=y
887CONFIG_USB_ARCH_HAS_OHCI=y
888
889#
890# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
891#
892
893#
894# USB Gadget Support
895#
896# CONFIG_USB_GADGET is not set
897
898#
899# MMC/SD Card support
900#
901# CONFIG_MMC is not set
902
903#
904# InfiniBand support
905#
906# CONFIG_INFINIBAND is not set
907
908#
909# File systems
910#
911CONFIG_EXT2_FS=y
912# CONFIG_EXT2_FS_XATTR is not set
913CONFIG_EXT3_FS=y
914CONFIG_EXT3_FS_XATTR=y
915# CONFIG_EXT3_FS_POSIX_ACL is not set
916# CONFIG_EXT3_FS_SECURITY is not set
917CONFIG_JBD=y
918# CONFIG_JBD_DEBUG is not set
919CONFIG_FS_MBCACHE=y
920CONFIG_REISERFS_FS=m
921# CONFIG_REISERFS_CHECK is not set
922CONFIG_REISERFS_PROC_INFO=y
923CONFIG_REISERFS_FS_XATTR=y
924CONFIG_REISERFS_FS_POSIX_ACL=y
925CONFIG_REISERFS_FS_SECURITY=y
926CONFIG_JFS_FS=m
927CONFIG_JFS_POSIX_ACL=y
928CONFIG_JFS_SECURITY=y
929# CONFIG_JFS_DEBUG is not set
930# CONFIG_JFS_STATISTICS is not set
931CONFIG_FS_POSIX_ACL=y
932CONFIG_XFS_FS=m
933# CONFIG_XFS_RT is not set
934CONFIG_XFS_QUOTA=y
935CONFIG_XFS_SECURITY=y
936CONFIG_XFS_POSIX_ACL=y
937CONFIG_MINIX_FS=m
938CONFIG_ROMFS_FS=m
939CONFIG_QUOTA=y
940# CONFIG_QFMT_V1 is not set
941CONFIG_QFMT_V2=y
942CONFIG_QUOTACTL=y
943CONFIG_DNOTIFY=y
944CONFIG_AUTOFS_FS=y
945# CONFIG_AUTOFS4_FS is not set
946
947#
948# CD-ROM/DVD Filesystems
949#
950CONFIG_ISO9660_FS=m
951CONFIG_JOLIET=y
952CONFIG_ZISOFS=y
953CONFIG_ZISOFS_FS=m
954CONFIG_UDF_FS=m
955CONFIG_UDF_NLS=y
956
957#
958# DOS/FAT/NT Filesystems
959#
960CONFIG_FAT_FS=m
961CONFIG_MSDOS_FS=m
962CONFIG_VFAT_FS=m
963CONFIG_FAT_DEFAULT_CODEPAGE=437
964CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
965# CONFIG_NTFS_FS is not set
966
967#
968# Pseudo filesystems
969#
970CONFIG_PROC_FS=y
971CONFIG_PROC_KCORE=y
972CONFIG_SYSFS=y
973# CONFIG_DEVFS_FS is not set
974CONFIG_DEVPTS_FS_XATTR=y
975CONFIG_DEVPTS_FS_SECURITY=y
976# CONFIG_TMPFS is not set
977# CONFIG_HUGETLB_PAGE is not set
978CONFIG_RAMFS=y
979
980#
981# Miscellaneous filesystems
982#
983# CONFIG_ADFS_FS is not set
984CONFIG_AFFS_FS=m
985CONFIG_HFS_FS=m
986CONFIG_HFSPLUS_FS=m
987CONFIG_BEFS_FS=m
988# CONFIG_BEFS_DEBUG is not set
989CONFIG_BFS_FS=m
990CONFIG_EFS_FS=m
991CONFIG_CRAMFS=m
992CONFIG_VXFS_FS=m
993# CONFIG_HPFS_FS is not set
994# CONFIG_QNX4FS_FS is not set
995CONFIG_SYSV_FS=m
996CONFIG_UFS_FS=m
997# CONFIG_UFS_FS_WRITE is not set
998
999#
1000# Network File Systems
1001#
1002CONFIG_NFS_FS=y
1003CONFIG_NFS_V3=y
1004# CONFIG_NFS_V4 is not set
1005# CONFIG_NFS_DIRECTIO is not set
1006CONFIG_NFSD=y
1007CONFIG_NFSD_V3=y
1008# CONFIG_NFSD_V4 is not set
1009# CONFIG_NFSD_TCP is not set
1010CONFIG_ROOT_NFS=y
1011CONFIG_LOCKD=y
1012CONFIG_LOCKD_V4=y
1013CONFIG_EXPORTFS=y
1014CONFIG_SUNRPC=y
1015# CONFIG_RPCSEC_GSS_KRB5 is not set
1016# CONFIG_RPCSEC_GSS_SPKM3 is not set
1017# CONFIG_SMB_FS is not set
1018# CONFIG_CIFS is not set
1019# CONFIG_NCP_FS is not set
1020# CONFIG_CODA_FS is not set
1021# CONFIG_AFS_FS is not set
1022
1023#
1024# Partition Types
1025#
1026# CONFIG_PARTITION_ADVANCED is not set
1027CONFIG_MSDOS_PARTITION=y
1028
1029#
1030# Native Language Support
1031#
1032CONFIG_NLS=m
1033CONFIG_NLS_DEFAULT="iso8859-1"
1034CONFIG_NLS_CODEPAGE_437=m
1035CONFIG_NLS_CODEPAGE_737=m
1036CONFIG_NLS_CODEPAGE_775=m
1037CONFIG_NLS_CODEPAGE_850=m
1038CONFIG_NLS_CODEPAGE_852=m
1039CONFIG_NLS_CODEPAGE_855=m
1040CONFIG_NLS_CODEPAGE_857=m
1041CONFIG_NLS_CODEPAGE_860=m
1042CONFIG_NLS_CODEPAGE_861=m
1043CONFIG_NLS_CODEPAGE_862=m
1044CONFIG_NLS_CODEPAGE_863=m
1045CONFIG_NLS_CODEPAGE_864=m
1046CONFIG_NLS_CODEPAGE_865=m
1047CONFIG_NLS_CODEPAGE_866=m
1048CONFIG_NLS_CODEPAGE_869=m
1049CONFIG_NLS_CODEPAGE_936=m
1050CONFIG_NLS_CODEPAGE_950=m
1051CONFIG_NLS_CODEPAGE_932=m
1052CONFIG_NLS_CODEPAGE_949=m
1053CONFIG_NLS_CODEPAGE_874=m
1054CONFIG_NLS_ISO8859_8=m
1055CONFIG_NLS_CODEPAGE_1250=m
1056CONFIG_NLS_CODEPAGE_1251=m
1057CONFIG_NLS_ASCII=m
1058CONFIG_NLS_ISO8859_1=m
1059CONFIG_NLS_ISO8859_2=m
1060CONFIG_NLS_ISO8859_3=m
1061CONFIG_NLS_ISO8859_4=m
1062CONFIG_NLS_ISO8859_5=m
1063CONFIG_NLS_ISO8859_6=m
1064CONFIG_NLS_ISO8859_7=m
1065CONFIG_NLS_ISO8859_9=m
1066CONFIG_NLS_ISO8859_13=m
1067CONFIG_NLS_ISO8859_14=m
1068CONFIG_NLS_ISO8859_15=m
1069CONFIG_NLS_KOI8_R=m
1070CONFIG_NLS_KOI8_U=m
1071CONFIG_NLS_UTF8=m
1072
1073#
1074# Profiling support
1075#
1076# CONFIG_PROFILING is not set
1077
1078#
1079# Kernel hacking
1080#
1081# CONFIG_DEBUG_KERNEL is not set
1082CONFIG_CROSSCOMPILE=y
1083CONFIG_CMDLINE=""
1084
1085#
1086# Security options
1087#
1088# CONFIG_KEYS is not set
1089# CONFIG_SECURITY is not set
1090
1091#
1092# Cryptographic options
1093#
1094CONFIG_CRYPTO=y
1095CONFIG_CRYPTO_HMAC=y
1096CONFIG_CRYPTO_NULL=m
1097CONFIG_CRYPTO_MD4=m
1098CONFIG_CRYPTO_MD5=m
1099CONFIG_CRYPTO_SHA1=m
1100CONFIG_CRYPTO_SHA256=m
1101CONFIG_CRYPTO_SHA512=m
1102CONFIG_CRYPTO_WP512=m
1103CONFIG_CRYPTO_DES=m
1104CONFIG_CRYPTO_BLOWFISH=m
1105CONFIG_CRYPTO_TWOFISH=m
1106CONFIG_CRYPTO_SERPENT=m
1107CONFIG_CRYPTO_AES=m
1108CONFIG_CRYPTO_CAST5=m
1109CONFIG_CRYPTO_CAST6=m
1110CONFIG_CRYPTO_TEA=m
1111CONFIG_CRYPTO_ARC4=m
1112CONFIG_CRYPTO_KHAZAD=m
1113CONFIG_CRYPTO_ANUBIS=m
1114CONFIG_CRYPTO_DEFLATE=m
1115CONFIG_CRYPTO_MICHAEL_MIC=m
1116CONFIG_CRYPTO_CRC32C=m
1117# CONFIG_CRYPTO_TEST is not set
1118
1119#
1120# Hardware crypto devices
1121#
1122
1123#
1124# Library routines
1125#
1126# CONFIG_CRC_CCITT is not set
1127CONFIG_CRC32=y
1128CONFIG_LIBCRC32C=m
1129CONFIG_ZLIB_INFLATE=m
1130CONFIG_ZLIB_DEFLATE=m
1131CONFIG_GENERIC_HARDIRQS=y
1132CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
new file mode 100644
index 000000000000..31b8f2ad7338
--- /dev/null
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -0,0 +1,694 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:07 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60CONFIG_MACH_VR41XX=y
61# CONFIG_NEC_CMBVR4133 is not set
62# CONFIG_CASIO_E55 is not set
63# CONFIG_IBM_WORKPAD is not set
64# CONFIG_TANBAC_TB0226 is not set
65# CONFIG_TANBAC_TB0229 is not set
66CONFIG_VICTOR_MPC30X=y
67# CONFIG_ZAO_CAPCELLA is not set
68CONFIG_PCI_VR41XX=y
69CONFIG_VRC4173=y
70# CONFIG_TOSHIBA_JMR3927 is not set
71# CONFIG_MIPS_COBALT is not set
72# CONFIG_MACH_DECSTATION is not set
73# CONFIG_MIPS_EV64120 is not set
74# CONFIG_MIPS_EV96100 is not set
75# CONFIG_MIPS_IVR is not set
76# CONFIG_LASAT is not set
77# CONFIG_MIPS_ITE8172 is not set
78# CONFIG_MIPS_ATLAS is not set
79# CONFIG_MIPS_MALTA is not set
80# CONFIG_MIPS_SEAD is not set
81# CONFIG_MOMENCO_OCELOT is not set
82# CONFIG_MOMENCO_OCELOT_G is not set
83# CONFIG_MOMENCO_OCELOT_C is not set
84# CONFIG_MOMENCO_OCELOT_3 is not set
85# CONFIG_MOMENCO_JAGUAR_ATX is not set
86# CONFIG_PMC_YOSEMITE is not set
87# CONFIG_DDB5074 is not set
88# CONFIG_DDB5476 is not set
89# CONFIG_DDB5477 is not set
90# CONFIG_NEC_OSPREY is not set
91# CONFIG_SGI_IP22 is not set
92# CONFIG_SOC_AU1X00 is not set
93# CONFIG_SIBYTE_SB1xxx_SOC is not set
94# CONFIG_SNI_RM200_PCI is not set
95# CONFIG_TOSHIBA_RBTX4927 is not set
96CONFIG_RWSEM_GENERIC_SPINLOCK=y
97CONFIG_GENERIC_CALIBRATE_DELAY=y
98CONFIG_HAVE_DEC_LOCK=y
99CONFIG_DMA_NONCOHERENT=y
100CONFIG_CPU_LITTLE_ENDIAN=y
101CONFIG_IRQ_CPU=y
102CONFIG_MIPS_L1_CACHE_SHIFT=5
103
104#
105# CPU selection
106#
107# CONFIG_CPU_MIPS32 is not set
108# CONFIG_CPU_MIPS64 is not set
109# CONFIG_CPU_R3000 is not set
110# CONFIG_CPU_TX39XX is not set
111CONFIG_CPU_VR41XX=y
112# CONFIG_CPU_R4300 is not set
113# CONFIG_CPU_R4X00 is not set
114# CONFIG_CPU_TX49XX is not set
115# CONFIG_CPU_R5000 is not set
116# CONFIG_CPU_R5432 is not set
117# CONFIG_CPU_R6000 is not set
118# CONFIG_CPU_NEVADA is not set
119# CONFIG_CPU_R8000 is not set
120# CONFIG_CPU_R10000 is not set
121# CONFIG_CPU_RM7000 is not set
122# CONFIG_CPU_RM9000 is not set
123# CONFIG_CPU_SB1 is not set
124CONFIG_PAGE_SIZE_4KB=y
125# CONFIG_PAGE_SIZE_8KB is not set
126# CONFIG_PAGE_SIZE_16KB is not set
127# CONFIG_PAGE_SIZE_64KB is not set
128# CONFIG_CPU_ADVANCED is not set
129CONFIG_CPU_HAS_SYNC=y
130# CONFIG_PREEMPT is not set
131
132#
133# Bus options (PCI, PCMCIA, EISA, ISA, TC)
134#
135CONFIG_HW_HAS_PCI=y
136CONFIG_PCI=y
137CONFIG_PCI_LEGACY_PROC=y
138CONFIG_PCI_NAMES=y
139CONFIG_MMU=y
140
141#
142# PCCARD (PCMCIA/CardBus) support
143#
144# CONFIG_PCCARD is not set
145
146#
147# PC-card bridges
148#
149
150#
151# PCI Hotplug Support
152#
153# CONFIG_HOTPLUG_PCI is not set
154
155#
156# Executable file formats
157#
158CONFIG_BINFMT_ELF=y
159# CONFIG_BINFMT_MISC is not set
160CONFIG_TRAD_SIGNALS=y
161
162#
163# Device Drivers
164#
165
166#
167# Generic Driver Options
168#
169CONFIG_STANDALONE=y
170CONFIG_PREVENT_FIRMWARE_BUILD=y
171# CONFIG_FW_LOADER is not set
172
173#
174# Memory Technology Devices (MTD)
175#
176# CONFIG_MTD is not set
177
178#
179# Parallel port support
180#
181# CONFIG_PARPORT is not set
182
183#
184# Plug and Play support
185#
186
187#
188# Block devices
189#
190# CONFIG_BLK_DEV_FD is not set
191# CONFIG_BLK_CPQ_DA is not set
192# CONFIG_BLK_CPQ_CISS_DA is not set
193# CONFIG_BLK_DEV_DAC960 is not set
194# CONFIG_BLK_DEV_UMEM is not set
195# CONFIG_BLK_DEV_COW_COMMON is not set
196# CONFIG_BLK_DEV_LOOP is not set
197# CONFIG_BLK_DEV_NBD is not set
198# CONFIG_BLK_DEV_SX8 is not set
199# CONFIG_BLK_DEV_RAM is not set
200CONFIG_BLK_DEV_RAM_COUNT=16
201CONFIG_INITRAMFS_SOURCE=""
202# CONFIG_LBD is not set
203CONFIG_CDROM_PKTCDVD=m
204CONFIG_CDROM_PKTCDVD_BUFFERS=8
205# CONFIG_CDROM_PKTCDVD_WCACHE is not set
206
207#
208# IO Schedulers
209#
210CONFIG_IOSCHED_NOOP=y
211CONFIG_IOSCHED_AS=y
212CONFIG_IOSCHED_DEADLINE=y
213CONFIG_IOSCHED_CFQ=y
214CONFIG_ATA_OVER_ETH=m
215
216#
217# ATA/ATAPI/MFM/RLL support
218#
219# CONFIG_IDE is not set
220
221#
222# SCSI device support
223#
224# CONFIG_SCSI is not set
225
226#
227# Multi-device support (RAID and LVM)
228#
229# CONFIG_MD is not set
230
231#
232# Fusion MPT device support
233#
234
235#
236# IEEE 1394 (FireWire) support
237#
238# CONFIG_IEEE1394 is not set
239
240#
241# I2O device support
242#
243# CONFIG_I2O is not set
244
245#
246# Networking support
247#
248CONFIG_NET=y
249
250#
251# Networking options
252#
253CONFIG_PACKET=y
254CONFIG_PACKET_MMAP=y
255CONFIG_NETLINK_DEV=y
256CONFIG_UNIX=y
257CONFIG_NET_KEY=y
258CONFIG_INET=y
259CONFIG_IP_MULTICAST=y
260# CONFIG_IP_ADVANCED_ROUTER is not set
261CONFIG_IP_PNP=y
262# CONFIG_IP_PNP_DHCP is not set
263CONFIG_IP_PNP_BOOTP=y
264# CONFIG_IP_PNP_RARP is not set
265# CONFIG_NET_IPIP is not set
266# CONFIG_NET_IPGRE is not set
267# CONFIG_IP_MROUTE is not set
268# CONFIG_ARPD is not set
269# CONFIG_SYN_COOKIES is not set
270# CONFIG_INET_AH is not set
271# CONFIG_INET_ESP is not set
272# CONFIG_INET_IPCOMP is not set
273CONFIG_INET_TUNNEL=m
274CONFIG_IP_TCPDIAG=m
275# CONFIG_IP_TCPDIAG_IPV6 is not set
276# CONFIG_IPV6 is not set
277# CONFIG_NETFILTER is not set
278CONFIG_XFRM=y
279CONFIG_XFRM_USER=m
280
281#
282# SCTP Configuration (EXPERIMENTAL)
283#
284# CONFIG_IP_SCTP is not set
285# CONFIG_ATM is not set
286# CONFIG_BRIDGE is not set
287# CONFIG_VLAN_8021Q is not set
288# CONFIG_DECNET is not set
289# CONFIG_LLC2 is not set
290# CONFIG_IPX is not set
291# CONFIG_ATALK is not set
292# CONFIG_X25 is not set
293# CONFIG_LAPB is not set
294# CONFIG_NET_DIVERT is not set
295# CONFIG_ECONET is not set
296# CONFIG_WAN_ROUTER is not set
297
298#
299# QoS and/or fair queueing
300#
301# CONFIG_NET_SCHED is not set
302# CONFIG_NET_CLS_ROUTE is not set
303
304#
305# Network testing
306#
307# CONFIG_NET_PKTGEN is not set
308# CONFIG_NETPOLL is not set
309# CONFIG_NET_POLL_CONTROLLER is not set
310# CONFIG_HAMRADIO is not set
311# CONFIG_IRDA is not set
312# CONFIG_BT is not set
313CONFIG_NETDEVICES=y
314# CONFIG_DUMMY is not set
315# CONFIG_BONDING is not set
316# CONFIG_EQUALIZER is not set
317# CONFIG_TUN is not set
318# CONFIG_ETHERTAP is not set
319
320#
321# ARCnet devices
322#
323# CONFIG_ARCNET is not set
324
325#
326# Ethernet (10 or 100Mbit)
327#
328CONFIG_NET_ETHERNET=y
329# CONFIG_MII is not set
330# CONFIG_HAPPYMEAL is not set
331# CONFIG_SUNGEM is not set
332# CONFIG_NET_VENDOR_3COM is not set
333
334#
335# Tulip family network device support
336#
337# CONFIG_NET_TULIP is not set
338# CONFIG_HP100 is not set
339# CONFIG_NET_PCI is not set
340
341#
342# Ethernet (1000 Mbit)
343#
344# CONFIG_ACENIC is not set
345# CONFIG_DL2K is not set
346# CONFIG_E1000 is not set
347# CONFIG_NS83820 is not set
348# CONFIG_HAMACHI is not set
349# CONFIG_YELLOWFIN is not set
350# CONFIG_R8169 is not set
351# CONFIG_SK98LIN is not set
352# CONFIG_TIGON3 is not set
353
354#
355# Ethernet (10000 Mbit)
356#
357# CONFIG_IXGB is not set
358# CONFIG_S2IO is not set
359
360#
361# Token Ring devices
362#
363# CONFIG_TR is not set
364
365#
366# Wireless LAN (non-hamradio)
367#
368# CONFIG_NET_RADIO is not set
369
370#
371# Wan interfaces
372#
373# CONFIG_WAN is not set
374# CONFIG_FDDI is not set
375# CONFIG_HIPPI is not set
376# CONFIG_PPP is not set
377# CONFIG_SLIP is not set
378# CONFIG_SHAPER is not set
379# CONFIG_NETCONSOLE is not set
380
381#
382# ISDN subsystem
383#
384# CONFIG_ISDN is not set
385
386#
387# Telephony Support
388#
389# CONFIG_PHONE is not set
390
391#
392# Input device support
393#
394CONFIG_INPUT=y
395
396#
397# Userland interfaces
398#
399CONFIG_INPUT_MOUSEDEV=y
400CONFIG_INPUT_MOUSEDEV_PSAUX=y
401CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
402CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
403# CONFIG_INPUT_JOYDEV is not set
404# CONFIG_INPUT_TSDEV is not set
405# CONFIG_INPUT_EVDEV is not set
406# CONFIG_INPUT_EVBUG is not set
407
408#
409# Input I/O drivers
410#
411# CONFIG_GAMEPORT is not set
412CONFIG_SOUND_GAMEPORT=y
413CONFIG_SERIO=y
414CONFIG_SERIO_I8042=y
415CONFIG_SERIO_SERPORT=y
416# CONFIG_SERIO_CT82C710 is not set
417# CONFIG_SERIO_PCIPS2 is not set
418# CONFIG_SERIO_LIBPS2 is not set
419CONFIG_SERIO_RAW=m
420
421#
422# Input Device Drivers
423#
424# CONFIG_INPUT_KEYBOARD is not set
425# CONFIG_INPUT_MOUSE is not set
426# CONFIG_INPUT_JOYSTICK is not set
427# CONFIG_INPUT_TOUCHSCREEN is not set
428# CONFIG_INPUT_MISC is not set
429
430#
431# Character devices
432#
433CONFIG_VT=y
434CONFIG_VT_CONSOLE=y
435CONFIG_HW_CONSOLE=y
436# CONFIG_SERIAL_NONSTANDARD is not set
437
438#
439# Serial drivers
440#
441CONFIG_SERIAL_8250=y
442CONFIG_SERIAL_8250_CONSOLE=y
443CONFIG_SERIAL_8250_NR_UARTS=4
444# CONFIG_SERIAL_8250_EXTENDED is not set
445
446#
447# Non-8250 serial port support
448#
449CONFIG_SERIAL_CORE=y
450CONFIG_SERIAL_CORE_CONSOLE=y
451CONFIG_UNIX98_PTYS=y
452CONFIG_LEGACY_PTYS=y
453CONFIG_LEGACY_PTY_COUNT=256
454
455#
456# IPMI
457#
458# CONFIG_IPMI_HANDLER is not set
459
460#
461# Watchdog Cards
462#
463# CONFIG_WATCHDOG is not set
464# CONFIG_RTC is not set
465# CONFIG_GEN_RTC is not set
466# CONFIG_DTLK is not set
467# CONFIG_R3964 is not set
468# CONFIG_APPLICOM is not set
469
470#
471# Ftape, the floppy tape device driver
472#
473# CONFIG_DRM is not set
474# CONFIG_RAW_DRIVER is not set
475
476#
477# I2C support
478#
479# CONFIG_I2C is not set
480
481#
482# Dallas's 1-wire bus
483#
484# CONFIG_W1 is not set
485
486#
487# Misc devices
488#
489
490#
491# Multimedia devices
492#
493# CONFIG_VIDEO_DEV is not set
494
495#
496# Digital Video Broadcasting Devices
497#
498# CONFIG_DVB is not set
499
500#
501# Graphics support
502#
503# CONFIG_FB is not set
504
505#
506# Console display driver support
507#
508# CONFIG_VGA_CONSOLE is not set
509CONFIG_DUMMY_CONSOLE=y
510# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
511
512#
513# Sound
514#
515# CONFIG_SOUND is not set
516
517#
518# USB support
519#
520# CONFIG_USB is not set
521CONFIG_USB_ARCH_HAS_HCD=y
522CONFIG_USB_ARCH_HAS_OHCI=y
523
524#
525# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
526#
527
528#
529# USB Gadget Support
530#
531# CONFIG_USB_GADGET is not set
532
533#
534# MMC/SD Card support
535#
536# CONFIG_MMC is not set
537
538#
539# InfiniBand support
540#
541# CONFIG_INFINIBAND is not set
542
543#
544# File systems
545#
546CONFIG_EXT2_FS=y
547# CONFIG_EXT2_FS_XATTR is not set
548# CONFIG_EXT3_FS is not set
549# CONFIG_JBD is not set
550# CONFIG_REISERFS_FS is not set
551# CONFIG_JFS_FS is not set
552# CONFIG_XFS_FS is not set
553# CONFIG_MINIX_FS is not set
554# CONFIG_ROMFS_FS is not set
555# CONFIG_QUOTA is not set
556CONFIG_DNOTIFY=y
557CONFIG_AUTOFS_FS=y
558CONFIG_AUTOFS4_FS=y
559
560#
561# CD-ROM/DVD Filesystems
562#
563# CONFIG_ISO9660_FS is not set
564# CONFIG_UDF_FS is not set
565
566#
567# DOS/FAT/NT Filesystems
568#
569# CONFIG_MSDOS_FS is not set
570# CONFIG_VFAT_FS is not set
571# CONFIG_NTFS_FS is not set
572
573#
574# Pseudo filesystems
575#
576CONFIG_PROC_FS=y
577CONFIG_PROC_KCORE=y
578CONFIG_SYSFS=y
579# CONFIG_DEVFS_FS is not set
580CONFIG_DEVPTS_FS_XATTR=y
581CONFIG_DEVPTS_FS_SECURITY=y
582# CONFIG_TMPFS is not set
583# CONFIG_HUGETLB_PAGE is not set
584CONFIG_RAMFS=y
585
586#
587# Miscellaneous filesystems
588#
589# CONFIG_ADFS_FS is not set
590# CONFIG_AFFS_FS is not set
591# CONFIG_HFS_FS is not set
592# CONFIG_HFSPLUS_FS is not set
593# CONFIG_BEFS_FS is not set
594# CONFIG_BFS_FS is not set
595# CONFIG_EFS_FS is not set
596# CONFIG_CRAMFS is not set
597# CONFIG_VXFS_FS is not set
598# CONFIG_HPFS_FS is not set
599# CONFIG_QNX4FS_FS is not set
600# CONFIG_SYSV_FS is not set
601# CONFIG_UFS_FS is not set
602
603#
604# Network File Systems
605#
606CONFIG_NFS_FS=y
607# CONFIG_NFS_V3 is not set
608# CONFIG_NFS_V4 is not set
609# CONFIG_NFS_DIRECTIO is not set
610# CONFIG_NFSD is not set
611CONFIG_ROOT_NFS=y
612CONFIG_LOCKD=y
613# CONFIG_EXPORTFS is not set
614CONFIG_SUNRPC=y
615# CONFIG_RPCSEC_GSS_KRB5 is not set
616# CONFIG_RPCSEC_GSS_SPKM3 is not set
617# CONFIG_SMB_FS is not set
618# CONFIG_CIFS is not set
619# CONFIG_NCP_FS is not set
620# CONFIG_CODA_FS is not set
621# CONFIG_AFS_FS is not set
622
623#
624# Partition Types
625#
626# CONFIG_PARTITION_ADVANCED is not set
627CONFIG_MSDOS_PARTITION=y
628
629#
630# Native Language Support
631#
632# CONFIG_NLS is not set
633
634#
635# Profiling support
636#
637# CONFIG_PROFILING is not set
638
639#
640# Kernel hacking
641#
642# CONFIG_DEBUG_KERNEL is not set
643CONFIG_CROSSCOMPILE=y
644CONFIG_CMDLINE=""
645
646#
647# Security options
648#
649CONFIG_KEYS=y
650CONFIG_KEYS_DEBUG_PROC_KEYS=y
651# CONFIG_SECURITY is not set
652
653#
654# Cryptographic options
655#
656CONFIG_CRYPTO=y
657CONFIG_CRYPTO_HMAC=y
658CONFIG_CRYPTO_NULL=y
659# CONFIG_CRYPTO_MD4 is not set
660# CONFIG_CRYPTO_MD5 is not set
661# CONFIG_CRYPTO_SHA1 is not set
662# CONFIG_CRYPTO_SHA256 is not set
663CONFIG_CRYPTO_SHA512=y
664CONFIG_CRYPTO_WP512=m
665# CONFIG_CRYPTO_DES is not set
666# CONFIG_CRYPTO_BLOWFISH is not set
667CONFIG_CRYPTO_TWOFISH=y
668# CONFIG_CRYPTO_SERPENT is not set
669CONFIG_CRYPTO_AES=m
670# CONFIG_CRYPTO_CAST5 is not set
671# CONFIG_CRYPTO_CAST6 is not set
672CONFIG_CRYPTO_TEA=m
673# CONFIG_CRYPTO_ARC4 is not set
674CONFIG_CRYPTO_KHAZAD=m
675CONFIG_CRYPTO_ANUBIS=m
676CONFIG_CRYPTO_DEFLATE=y
677CONFIG_CRYPTO_MICHAEL_MIC=y
678CONFIG_CRYPTO_CRC32C=m
679# CONFIG_CRYPTO_TEST is not set
680
681#
682# Hardware crypto devices
683#
684
685#
686# Library routines
687#
688# CONFIG_CRC_CCITT is not set
689# CONFIG_CRC32 is not set
690CONFIG_LIBCRC32C=m
691CONFIG_ZLIB_INFLATE=y
692CONFIG_ZLIB_DEFLATE=y
693CONFIG_GENERIC_HARDIRQS=y
694CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ocelot_3_defconfig b/arch/mips/configs/ocelot_3_defconfig
new file mode 100644
index 000000000000..2cce682fffcf
--- /dev/null
+++ b/arch/mips/configs/ocelot_3_defconfig
@@ -0,0 +1,886 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:07 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31CONFIG_IKCONFIG=y
32CONFIG_IKCONFIG_PROC=y
33CONFIG_EMBEDDED=y
34CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_FUTEX=y
37CONFIG_EPOLL=y
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SHMEM=y
40CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0
44# CONFIG_TINY_SHMEM is not set
45
46#
47# Loadable module support
48#
49CONFIG_MODULES=y
50CONFIG_MODULE_UNLOAD=y
51# CONFIG_MODULE_FORCE_UNLOAD is not set
52CONFIG_OBSOLETE_MODPARM=y
53CONFIG_MODVERSIONS=y
54# CONFIG_MODULE_SRCVERSION_ALL is not set
55CONFIG_KMOD=y
56
57#
58# Machine selection
59#
60# CONFIG_MACH_JAZZ is not set
61# CONFIG_MACH_VR41XX is not set
62# CONFIG_TOSHIBA_JMR3927 is not set
63# CONFIG_MIPS_COBALT is not set
64# CONFIG_MACH_DECSTATION is not set
65# CONFIG_MIPS_EV64120 is not set
66# CONFIG_MIPS_EV96100 is not set
67# CONFIG_MIPS_IVR is not set
68# CONFIG_LASAT is not set
69# CONFIG_MIPS_ITE8172 is not set
70# CONFIG_MIPS_ATLAS is not set
71# CONFIG_MIPS_MALTA is not set
72# CONFIG_MIPS_SEAD is not set
73# CONFIG_MOMENCO_OCELOT is not set
74# CONFIG_MOMENCO_OCELOT_G is not set
75# CONFIG_MOMENCO_OCELOT_C is not set
76CONFIG_MOMENCO_OCELOT_3=y
77# CONFIG_MOMENCO_JAGUAR_ATX is not set
78# CONFIG_PMC_YOSEMITE is not set
79# CONFIG_DDB5074 is not set
80# CONFIG_DDB5476 is not set
81# CONFIG_DDB5477 is not set
82# CONFIG_NEC_OSPREY is not set
83# CONFIG_SGI_IP22 is not set
84# CONFIG_SOC_AU1X00 is not set
85# CONFIG_SIBYTE_SB1xxx_SOC is not set
86# CONFIG_SNI_RM200_PCI is not set
87# CONFIG_TOSHIBA_RBTX4927 is not set
88CONFIG_RWSEM_GENERIC_SPINLOCK=y
89CONFIG_GENERIC_CALIBRATE_DELAY=y
90CONFIG_HAVE_DEC_LOCK=y
91CONFIG_DMA_NONCOHERENT=y
92# CONFIG_CPU_LITTLE_ENDIAN is not set
93CONFIG_IRQ_CPU=y
94CONFIG_IRQ_CPU_RM7K=y
95CONFIG_IRQ_MV64340=y
96CONFIG_PCI_MARVELL=y
97CONFIG_SWAP_IO_SPACE=y
98CONFIG_BOOT_ELF32=y
99CONFIG_MIPS_L1_CACHE_SHIFT=5
100
101#
102# CPU selection
103#
104# CONFIG_CPU_MIPS32 is not set
105# CONFIG_CPU_MIPS64 is not set
106# CONFIG_CPU_R3000 is not set
107# CONFIG_CPU_TX39XX is not set
108# CONFIG_CPU_VR41XX is not set
109# CONFIG_CPU_R4300 is not set
110# CONFIG_CPU_R4X00 is not set
111# CONFIG_CPU_TX49XX is not set
112# CONFIG_CPU_R5000 is not set
113# CONFIG_CPU_R5432 is not set
114# CONFIG_CPU_R6000 is not set
115# CONFIG_CPU_NEVADA is not set
116# CONFIG_CPU_R8000 is not set
117# CONFIG_CPU_R10000 is not set
118# CONFIG_CPU_RM7000 is not set
119CONFIG_CPU_RM9000=y
120# CONFIG_CPU_SB1 is not set
121CONFIG_PAGE_SIZE_4KB=y
122# CONFIG_PAGE_SIZE_8KB is not set
123# CONFIG_PAGE_SIZE_16KB is not set
124# CONFIG_PAGE_SIZE_64KB is not set
125CONFIG_BOARD_SCACHE=y
126CONFIG_RM7000_CPU_SCACHE=y
127CONFIG_CPU_HAS_PREFETCH=y
128# CONFIG_64BIT_PHYS_ADDR is not set
129# CONFIG_CPU_ADVANCED is not set
130CONFIG_CPU_HAS_LLSC=y
131CONFIG_CPU_HAS_LLDSCD=y
132CONFIG_CPU_HAS_SYNC=y
133# CONFIG_HIGHMEM is not set
134# CONFIG_SMP is not set
135# CONFIG_PREEMPT is not set
136
137#
138# Bus options (PCI, PCMCIA, EISA, ISA, TC)
139#
140CONFIG_HW_HAS_PCI=y
141CONFIG_PCI=y
142CONFIG_PCI_LEGACY_PROC=y
143CONFIG_PCI_NAMES=y
144CONFIG_MMU=y
145
146#
147# PCCARD (PCMCIA/CardBus) support
148#
149# CONFIG_PCCARD is not set
150
151#
152# PC-card bridges
153#
154
155#
156# PCI Hotplug Support
157#
158# CONFIG_HOTPLUG_PCI is not set
159
160#
161# Executable file formats
162#
163CONFIG_BINFMT_ELF=y
164# CONFIG_BINFMT_MISC is not set
165CONFIG_TRAD_SIGNALS=y
166
167#
168# Device Drivers
169#
170
171#
172# Generic Driver Options
173#
174CONFIG_STANDALONE=y
175CONFIG_PREVENT_FIRMWARE_BUILD=y
176# CONFIG_FW_LOADER is not set
177
178#
179# Memory Technology Devices (MTD)
180#
181# CONFIG_MTD is not set
182
183#
184# Parallel port support
185#
186# CONFIG_PARPORT is not set
187
188#
189# Plug and Play support
190#
191
192#
193# Block devices
194#
195# CONFIG_BLK_DEV_FD is not set
196# CONFIG_BLK_CPQ_DA is not set
197# CONFIG_BLK_CPQ_CISS_DA is not set
198# CONFIG_BLK_DEV_DAC960 is not set
199# CONFIG_BLK_DEV_UMEM is not set
200# CONFIG_BLK_DEV_COW_COMMON is not set
201CONFIG_BLK_DEV_LOOP=y
202# CONFIG_BLK_DEV_CRYPTOLOOP is not set
203# CONFIG_BLK_DEV_NBD is not set
204# CONFIG_BLK_DEV_SX8 is not set
205# CONFIG_BLK_DEV_RAM is not set
206CONFIG_BLK_DEV_RAM_COUNT=16
207CONFIG_INITRAMFS_SOURCE=""
208# CONFIG_LBD is not set
209# CONFIG_CDROM_PKTCDVD is not set
210
211#
212# IO Schedulers
213#
214CONFIG_IOSCHED_NOOP=y
215CONFIG_IOSCHED_AS=y
216CONFIG_IOSCHED_DEADLINE=y
217CONFIG_IOSCHED_CFQ=y
218CONFIG_ATA_OVER_ETH=m
219
220#
221# ATA/ATAPI/MFM/RLL support
222#
223# CONFIG_IDE is not set
224
225#
226# SCSI device support
227#
228CONFIG_SCSI=m
229CONFIG_SCSI_PROC_FS=y
230
231#
232# SCSI support type (disk, tape, CD-ROM)
233#
234# CONFIG_BLK_DEV_SD is not set
235# CONFIG_CHR_DEV_ST is not set
236# CONFIG_CHR_DEV_OSST is not set
237# CONFIG_BLK_DEV_SR is not set
238# CONFIG_CHR_DEV_SG is not set
239
240#
241# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
242#
243# CONFIG_SCSI_MULTI_LUN is not set
244# CONFIG_SCSI_CONSTANTS is not set
245# CONFIG_SCSI_LOGGING is not set
246
247#
248# SCSI Transport Attributes
249#
250# CONFIG_SCSI_SPI_ATTRS is not set
251# CONFIG_SCSI_FC_ATTRS is not set
252# CONFIG_SCSI_ISCSI_ATTRS is not set
253
254#
255# SCSI low-level drivers
256#
257# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
258# CONFIG_SCSI_3W_9XXX is not set
259# CONFIG_SCSI_ACARD is not set
260# CONFIG_SCSI_AACRAID is not set
261# CONFIG_SCSI_AIC7XXX is not set
262# CONFIG_SCSI_AIC7XXX_OLD is not set
263# CONFIG_SCSI_AIC79XX is not set
264# CONFIG_SCSI_DPT_I2O is not set
265# CONFIG_MEGARAID_NEWGEN is not set
266# CONFIG_MEGARAID_LEGACY is not set
267# CONFIG_SCSI_SATA is not set
268# CONFIG_SCSI_BUSLOGIC is not set
269# CONFIG_SCSI_DMX3191D is not set
270# CONFIG_SCSI_EATA is not set
271# CONFIG_SCSI_EATA_PIO is not set
272# CONFIG_SCSI_FUTURE_DOMAIN is not set
273# CONFIG_SCSI_GDTH is not set
274# CONFIG_SCSI_IPS is not set
275# CONFIG_SCSI_INITIO is not set
276# CONFIG_SCSI_INIA100 is not set
277# CONFIG_SCSI_SYM53C8XX_2 is not set
278# CONFIG_SCSI_IPR is not set
279# CONFIG_SCSI_QLOGIC_ISP is not set
280# CONFIG_SCSI_QLOGIC_FC is not set
281# CONFIG_SCSI_QLOGIC_1280 is not set
282CONFIG_SCSI_QLA2XXX=m
283# CONFIG_SCSI_QLA21XX is not set
284# CONFIG_SCSI_QLA22XX is not set
285# CONFIG_SCSI_QLA2300 is not set
286# CONFIG_SCSI_QLA2322 is not set
287# CONFIG_SCSI_QLA6312 is not set
288# CONFIG_SCSI_DC395x is not set
289# CONFIG_SCSI_DC390T is not set
290# CONFIG_SCSI_NSP32 is not set
291# CONFIG_SCSI_DEBUG is not set
292
293#
294# Multi-device support (RAID and LVM)
295#
296# CONFIG_MD is not set
297
298#
299# Fusion MPT device support
300#
301# CONFIG_FUSION is not set
302
303#
304# IEEE 1394 (FireWire) support
305#
306# CONFIG_IEEE1394 is not set
307
308#
309# I2O device support
310#
311# CONFIG_I2O is not set
312
313#
314# Networking support
315#
316CONFIG_NET=y
317
318#
319# Networking options
320#
321CONFIG_PACKET=y
322# CONFIG_PACKET_MMAP is not set
323CONFIG_NETLINK_DEV=y
324CONFIG_UNIX=y
325CONFIG_NET_KEY=y
326CONFIG_INET=y
327# CONFIG_IP_MULTICAST is not set
328# CONFIG_IP_ADVANCED_ROUTER is not set
329CONFIG_IP_PNP=y
330CONFIG_IP_PNP_DHCP=y
331CONFIG_IP_PNP_BOOTP=y
332# CONFIG_IP_PNP_RARP is not set
333# CONFIG_NET_IPIP is not set
334# CONFIG_NET_IPGRE is not set
335# CONFIG_ARPD is not set
336# CONFIG_SYN_COOKIES is not set
337# CONFIG_INET_AH is not set
338# CONFIG_INET_ESP is not set
339# CONFIG_INET_IPCOMP is not set
340# CONFIG_INET_TUNNEL is not set
341CONFIG_IP_TCPDIAG=m
342CONFIG_IP_TCPDIAG_IPV6=y
343
344#
345# IP: Virtual Server Configuration
346#
347# CONFIG_IP_VS is not set
348CONFIG_IPV6=m
349# CONFIG_IPV6_PRIVACY is not set
350# CONFIG_INET6_AH is not set
351# CONFIG_INET6_ESP is not set
352# CONFIG_INET6_IPCOMP is not set
353# CONFIG_INET6_TUNNEL is not set
354# CONFIG_IPV6_TUNNEL is not set
355CONFIG_NETFILTER=y
356# CONFIG_NETFILTER_DEBUG is not set
357
358#
359# IP: Netfilter Configuration
360#
361# CONFIG_IP_NF_CONNTRACK is not set
362# CONFIG_IP_NF_CONNTRACK_MARK is not set
363# CONFIG_IP_NF_QUEUE is not set
364# CONFIG_IP_NF_IPTABLES is not set
365# CONFIG_IP_NF_ARPTABLES is not set
366
367#
368# IPv6: Netfilter Configuration
369#
370# CONFIG_IP6_NF_QUEUE is not set
371# CONFIG_IP6_NF_IPTABLES is not set
372CONFIG_XFRM=y
373# CONFIG_XFRM_USER is not set
374
375#
376# SCTP Configuration (EXPERIMENTAL)
377#
378# CONFIG_IP_SCTP is not set
379# CONFIG_ATM is not set
380# CONFIG_BRIDGE is not set
381# CONFIG_VLAN_8021Q is not set
382# CONFIG_DECNET is not set
383# CONFIG_LLC2 is not set
384# CONFIG_IPX is not set
385# CONFIG_ATALK is not set
386# CONFIG_X25 is not set
387# CONFIG_LAPB is not set
388# CONFIG_NET_DIVERT is not set
389# CONFIG_ECONET is not set
390# CONFIG_WAN_ROUTER is not set
391
392#
393# QoS and/or fair queueing
394#
395# CONFIG_NET_SCHED is not set
396# CONFIG_NET_CLS_ROUTE is not set
397
398#
399# Network testing
400#
401# CONFIG_NET_PKTGEN is not set
402# CONFIG_NETPOLL is not set
403# CONFIG_NET_POLL_CONTROLLER is not set
404# CONFIG_HAMRADIO is not set
405# CONFIG_IRDA is not set
406# CONFIG_BT is not set
407CONFIG_NETDEVICES=y
408# CONFIG_DUMMY is not set
409# CONFIG_BONDING is not set
410# CONFIG_EQUALIZER is not set
411CONFIG_TUN=m
412# CONFIG_ETHERTAP is not set
413
414#
415# ARCnet devices
416#
417# CONFIG_ARCNET is not set
418
419#
420# Ethernet (10 or 100Mbit)
421#
422CONFIG_NET_ETHERNET=y
423CONFIG_MII=y
424# CONFIG_HAPPYMEAL is not set
425# CONFIG_SUNGEM is not set
426# CONFIG_NET_VENDOR_3COM is not set
427
428#
429# Tulip family network device support
430#
431# CONFIG_NET_TULIP is not set
432# CONFIG_HP100 is not set
433CONFIG_NET_PCI=y
434# CONFIG_PCNET32 is not set
435# CONFIG_AMD8111_ETH is not set
436# CONFIG_ADAPTEC_STARFIRE is not set
437# CONFIG_B44 is not set
438# CONFIG_FORCEDETH is not set
439# CONFIG_DGRS is not set
440# CONFIG_EEPRO100 is not set
441CONFIG_E100=y
442# CONFIG_E100_NAPI is not set
443# CONFIG_FEALNX is not set
444# CONFIG_NATSEMI is not set
445# CONFIG_NE2K_PCI is not set
446# CONFIG_8139CP is not set
447# CONFIG_8139TOO is not set
448# CONFIG_SIS900 is not set
449# CONFIG_EPIC100 is not set
450# CONFIG_SUNDANCE is not set
451# CONFIG_TLAN is not set
452# CONFIG_VIA_RHINE is not set
453# CONFIG_LAN_SAA9730 is not set
454
455#
456# Ethernet (1000 Mbit)
457#
458# CONFIG_ACENIC is not set
459# CONFIG_DL2K is not set
460# CONFIG_E1000 is not set
461# CONFIG_NS83820 is not set
462# CONFIG_HAMACHI is not set
463# CONFIG_YELLOWFIN is not set
464# CONFIG_R8169 is not set
465# CONFIG_SK98LIN is not set
466# CONFIG_VIA_VELOCITY is not set
467# CONFIG_TIGON3 is not set
468CONFIG_MV643XX_ETH=y
469CONFIG_MV643XX_ETH_0=y
470CONFIG_MV643XX_ETH_1=y
471CONFIG_MV643XX_ETH_2=y
472
473#
474# Ethernet (10000 Mbit)
475#
476# CONFIG_IXGB is not set
477# CONFIG_S2IO is not set
478
479#
480# Token Ring devices
481#
482# CONFIG_TR is not set
483
484#
485# Wireless LAN (non-hamradio)
486#
487# CONFIG_NET_RADIO is not set
488
489#
490# Wan interfaces
491#
492# CONFIG_WAN is not set
493# CONFIG_FDDI is not set
494# CONFIG_HIPPI is not set
495CONFIG_PPP=m
496# CONFIG_PPP_MULTILINK is not set
497# CONFIG_PPP_FILTER is not set
498CONFIG_PPP_ASYNC=m
499CONFIG_PPP_SYNC_TTY=m
500CONFIG_PPP_DEFLATE=m
501# CONFIG_PPP_BSDCOMP is not set
502CONFIG_PPPOE=m
503# CONFIG_SLIP is not set
504# CONFIG_NET_FC is not set
505# CONFIG_SHAPER is not set
506# CONFIG_NETCONSOLE is not set
507
508#
509# ISDN subsystem
510#
511# CONFIG_ISDN is not set
512
513#
514# Telephony Support
515#
516# CONFIG_PHONE is not set
517
518#
519# Input device support
520#
521CONFIG_INPUT=y
522
523#
524# Userland interfaces
525#
526# CONFIG_INPUT_MOUSEDEV is not set
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 I/O drivers
534#
535# CONFIG_GAMEPORT is not set
536CONFIG_SOUND_GAMEPORT=y
537CONFIG_SERIO=y
538# CONFIG_SERIO_I8042 is not set
539# CONFIG_SERIO_SERPORT is not set
540# CONFIG_SERIO_CT82C710 is not set
541# CONFIG_SERIO_PCIPS2 is not set
542# CONFIG_SERIO_LIBPS2 is not set
543# CONFIG_SERIO_RAW is not set
544
545#
546# Input Device Drivers
547#
548# CONFIG_INPUT_KEYBOARD is not set
549# CONFIG_INPUT_MOUSE is not set
550# CONFIG_INPUT_JOYSTICK is not set
551# CONFIG_INPUT_TOUCHSCREEN is not set
552# CONFIG_INPUT_MISC is not set
553
554#
555# Character devices
556#
557CONFIG_VT=y
558CONFIG_VT_CONSOLE=y
559CONFIG_HW_CONSOLE=y
560# CONFIG_SERIAL_NONSTANDARD is not set
561
562#
563# Serial drivers
564#
565CONFIG_SERIAL_8250=y
566CONFIG_SERIAL_8250_CONSOLE=y
567CONFIG_SERIAL_8250_NR_UARTS=4
568# CONFIG_SERIAL_8250_EXTENDED is not set
569
570#
571# Non-8250 serial port support
572#
573CONFIG_SERIAL_CORE=y
574CONFIG_SERIAL_CORE_CONSOLE=y
575CONFIG_UNIX98_PTYS=y
576CONFIG_LEGACY_PTYS=y
577CONFIG_LEGACY_PTY_COUNT=256
578
579#
580# IPMI
581#
582# CONFIG_IPMI_HANDLER is not set
583
584#
585# Watchdog Cards
586#
587# CONFIG_WATCHDOG is not set
588CONFIG_RTC=y
589# CONFIG_DTLK is not set
590# CONFIG_R3964 is not set
591# CONFIG_APPLICOM is not set
592
593#
594# Ftape, the floppy tape device driver
595#
596# CONFIG_DRM is not set
597# CONFIG_RAW_DRIVER is not set
598
599#
600# I2C support
601#
602# CONFIG_I2C is not set
603
604#
605# Dallas's 1-wire bus
606#
607# CONFIG_W1 is not set
608
609#
610# Misc devices
611#
612
613#
614# Multimedia devices
615#
616# CONFIG_VIDEO_DEV is not set
617
618#
619# Digital Video Broadcasting Devices
620#
621# CONFIG_DVB is not set
622
623#
624# Graphics support
625#
626CONFIG_FB=y
627CONFIG_FB_MODE_HELPERS=y
628# CONFIG_FB_TILEBLITTING is not set
629# CONFIG_FB_CIRRUS is not set
630# CONFIG_FB_PM2 is not set
631# CONFIG_FB_CYBER2000 is not set
632# CONFIG_FB_ASILIANT is not set
633# CONFIG_FB_IMSTT is not set
634# CONFIG_FB_RIVA is not set
635# CONFIG_FB_MATROX is not set
636# CONFIG_FB_RADEON_OLD is not set
637# CONFIG_FB_RADEON is not set
638# CONFIG_FB_ATY128 is not set
639# CONFIG_FB_ATY is not set
640# CONFIG_FB_SAVAGE is not set
641# CONFIG_FB_SIS is not set
642# CONFIG_FB_NEOMAGIC is not set
643# CONFIG_FB_KYRO is not set
644# CONFIG_FB_3DFX is not set
645# CONFIG_FB_VOODOO1 is not set
646# CONFIG_FB_TRIDENT is not set
647# CONFIG_FB_E1356 is not set
648# CONFIG_FB_VIRTUAL is not set
649
650#
651# Console display driver support
652#
653# CONFIG_VGA_CONSOLE is not set
654CONFIG_DUMMY_CONSOLE=y
655CONFIG_FRAMEBUFFER_CONSOLE=y
656# CONFIG_FONTS is not set
657CONFIG_FONT_8x8=y
658CONFIG_FONT_8x16=y
659
660#
661# Logo configuration
662#
663CONFIG_LOGO=y
664CONFIG_LOGO_LINUX_MONO=y
665CONFIG_LOGO_LINUX_VGA16=y
666CONFIG_LOGO_LINUX_CLUT224=y
667# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
668
669#
670# Sound
671#
672# CONFIG_SOUND is not set
673
674#
675# USB support
676#
677# CONFIG_USB is not set
678CONFIG_USB_ARCH_HAS_HCD=y
679CONFIG_USB_ARCH_HAS_OHCI=y
680
681#
682# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
683#
684
685#
686# USB Gadget Support
687#
688# CONFIG_USB_GADGET is not set
689
690#
691# MMC/SD Card support
692#
693# CONFIG_MMC is not set
694
695#
696# InfiniBand support
697#
698# CONFIG_INFINIBAND is not set
699
700#
701# File systems
702#
703CONFIG_EXT2_FS=y
704# CONFIG_EXT2_FS_XATTR is not set
705CONFIG_EXT3_FS=m
706CONFIG_EXT3_FS_XATTR=y
707# CONFIG_EXT3_FS_POSIX_ACL is not set
708# CONFIG_EXT3_FS_SECURITY is not set
709CONFIG_JBD=m
710# CONFIG_JBD_DEBUG is not set
711CONFIG_FS_MBCACHE=y
712CONFIG_REISERFS_FS=m
713# CONFIG_REISERFS_CHECK is not set
714# CONFIG_REISERFS_PROC_INFO is not set
715# CONFIG_REISERFS_FS_XATTR is not set
716# CONFIG_JFS_FS is not set
717CONFIG_XFS_FS=m
718# CONFIG_XFS_RT is not set
719# CONFIG_XFS_QUOTA is not set
720# CONFIG_XFS_SECURITY is not set
721# CONFIG_XFS_POSIX_ACL is not set
722# CONFIG_MINIX_FS is not set
723# CONFIG_ROMFS_FS is not set
724# CONFIG_QUOTA is not set
725CONFIG_DNOTIFY=y
726CONFIG_AUTOFS_FS=y
727CONFIG_AUTOFS4_FS=m
728
729#
730# CD-ROM/DVD Filesystems
731#
732# CONFIG_ISO9660_FS is not set
733# CONFIG_UDF_FS is not set
734
735#
736# DOS/FAT/NT Filesystems
737#
738# CONFIG_MSDOS_FS is not set
739# CONFIG_VFAT_FS is not set
740# CONFIG_NTFS_FS is not set
741
742#
743# Pseudo filesystems
744#
745CONFIG_PROC_FS=y
746CONFIG_PROC_KCORE=y
747CONFIG_SYSFS=y
748CONFIG_DEVFS_FS=y
749CONFIG_DEVFS_MOUNT=y
750# CONFIG_DEVFS_DEBUG is not set
751CONFIG_DEVPTS_FS_XATTR=y
752CONFIG_DEVPTS_FS_SECURITY=y
753CONFIG_TMPFS=y
754# CONFIG_TMPFS_XATTR is not set
755# CONFIG_HUGETLB_PAGE is not set
756CONFIG_RAMFS=y
757
758#
759# Miscellaneous filesystems
760#
761# CONFIG_ADFS_FS is not set
762# CONFIG_AFFS_FS is not set
763# CONFIG_HFS_FS is not set
764# CONFIG_HFSPLUS_FS is not set
765# CONFIG_BEFS_FS is not set
766# CONFIG_BFS_FS is not set
767CONFIG_EFS_FS=y
768CONFIG_CRAMFS=y
769# CONFIG_VXFS_FS is not set
770# CONFIG_HPFS_FS is not set
771# CONFIG_QNX4FS_FS is not set
772# CONFIG_SYSV_FS is not set
773# CONFIG_UFS_FS is not set
774
775#
776# Network File Systems
777#
778CONFIG_NFS_FS=y
779CONFIG_NFS_V3=y
780# CONFIG_NFS_V4 is not set
781# CONFIG_NFS_DIRECTIO is not set
782CONFIG_NFSD=y
783CONFIG_NFSD_V3=y
784# CONFIG_NFSD_V4 is not set
785# CONFIG_NFSD_TCP is not set
786CONFIG_ROOT_NFS=y
787CONFIG_LOCKD=y
788CONFIG_LOCKD_V4=y
789CONFIG_EXPORTFS=y
790CONFIG_SUNRPC=y
791# CONFIG_RPCSEC_GSS_KRB5 is not set
792# CONFIG_RPCSEC_GSS_SPKM3 is not set
793CONFIG_SMB_FS=m
794# CONFIG_SMB_NLS_DEFAULT is not set
795# CONFIG_CIFS is not set
796# CONFIG_NCP_FS is not set
797# CONFIG_CODA_FS is not set
798# CONFIG_AFS_FS is not set
799
800#
801# Partition Types
802#
803# CONFIG_PARTITION_ADVANCED is not set
804CONFIG_MSDOS_PARTITION=y
805
806#
807# Native Language Support
808#
809CONFIG_NLS=m
810CONFIG_NLS_DEFAULT="iso8859-1"
811# CONFIG_NLS_CODEPAGE_437 is not set
812# CONFIG_NLS_CODEPAGE_737 is not set
813# CONFIG_NLS_CODEPAGE_775 is not set
814# CONFIG_NLS_CODEPAGE_850 is not set
815# CONFIG_NLS_CODEPAGE_852 is not set
816# CONFIG_NLS_CODEPAGE_855 is not set
817# CONFIG_NLS_CODEPAGE_857 is not set
818# CONFIG_NLS_CODEPAGE_860 is not set
819# CONFIG_NLS_CODEPAGE_861 is not set
820# CONFIG_NLS_CODEPAGE_862 is not set
821# CONFIG_NLS_CODEPAGE_863 is not set
822# CONFIG_NLS_CODEPAGE_864 is not set
823# CONFIG_NLS_CODEPAGE_865 is not set
824# CONFIG_NLS_CODEPAGE_866 is not set
825# CONFIG_NLS_CODEPAGE_869 is not set
826# CONFIG_NLS_CODEPAGE_936 is not set
827# CONFIG_NLS_CODEPAGE_950 is not set
828# CONFIG_NLS_CODEPAGE_932 is not set
829# CONFIG_NLS_CODEPAGE_949 is not set
830# CONFIG_NLS_CODEPAGE_874 is not set
831# CONFIG_NLS_ISO8859_8 is not set
832# CONFIG_NLS_CODEPAGE_1250 is not set
833# CONFIG_NLS_CODEPAGE_1251 is not set
834# CONFIG_NLS_ASCII is not set
835# CONFIG_NLS_ISO8859_1 is not set
836# CONFIG_NLS_ISO8859_2 is not set
837# CONFIG_NLS_ISO8859_3 is not set
838# CONFIG_NLS_ISO8859_4 is not set
839# CONFIG_NLS_ISO8859_5 is not set
840# CONFIG_NLS_ISO8859_6 is not set
841# CONFIG_NLS_ISO8859_7 is not set
842# CONFIG_NLS_ISO8859_9 is not set
843# CONFIG_NLS_ISO8859_13 is not set
844# CONFIG_NLS_ISO8859_14 is not set
845# CONFIG_NLS_ISO8859_15 is not set
846# CONFIG_NLS_KOI8_R is not set
847# CONFIG_NLS_KOI8_U is not set
848# CONFIG_NLS_UTF8 is not set
849
850#
851# Profiling support
852#
853# CONFIG_PROFILING is not set
854
855#
856# Kernel hacking
857#
858# CONFIG_DEBUG_KERNEL is not set
859CONFIG_CROSSCOMPILE=y
860CONFIG_CMDLINE="ip=any root=nfs"
861
862#
863# Security options
864#
865# CONFIG_KEYS is not set
866# CONFIG_SECURITY is not set
867
868#
869# Cryptographic options
870#
871# CONFIG_CRYPTO is not set
872
873#
874# Hardware crypto devices
875#
876
877#
878# Library routines
879#
880CONFIG_CRC_CCITT=m
881CONFIG_CRC32=y
882CONFIG_LIBCRC32C=m
883CONFIG_ZLIB_INFLATE=y
884CONFIG_ZLIB_DEFLATE=m
885CONFIG_GENERIC_HARDIRQS=y
886CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ocelot_c_defconfig b/arch/mips/configs/ocelot_c_defconfig
new file mode 100644
index 000000000000..0cbf48a62e02
--- /dev/null
+++ b/arch/mips/configs/ocelot_c_defconfig
@@ -0,0 +1,664 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:07 2005
5#
6CONFIG_MIPS=y
7CONFIG_MIPS64=y
8CONFIG_64BIT=y
9
10#
11# Code maturity level options
12#
13CONFIG_EXPERIMENTAL=y
14CONFIG_CLEAN_COMPILE=y
15CONFIG_BROKEN_ON_SMP=y
16
17#
18# General setup
19#
20CONFIG_LOCALVERSION=""
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_LOG_BUF_SHIFT=14
28# CONFIG_HOTPLUG is not set
29CONFIG_KOBJECT_UEVENT=y
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_FUTEX=y
35CONFIG_EPOLL=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37CONFIG_SHMEM=y
38CONFIG_CC_ALIGN_FUNCTIONS=0
39CONFIG_CC_ALIGN_LABELS=0
40CONFIG_CC_ALIGN_LOOPS=0
41CONFIG_CC_ALIGN_JUMPS=0
42# CONFIG_TINY_SHMEM is not set
43
44#
45# Loadable module support
46#
47# CONFIG_MODULES is not set
48
49#
50# Machine selection
51#
52# CONFIG_MACH_JAZZ is not set
53# CONFIG_MACH_VR41XX is not set
54# CONFIG_MIPS_COBALT is not set
55# CONFIG_MACH_DECSTATION is not set
56# CONFIG_MIPS_EV64120 is not set
57# CONFIG_MIPS_EV96100 is not set
58# CONFIG_MIPS_IVR is not set
59# CONFIG_LASAT is not set
60# CONFIG_MIPS_ITE8172 is not set
61# CONFIG_MIPS_ATLAS is not set
62# CONFIG_MIPS_MALTA is not set
63# CONFIG_MIPS_SEAD is not set
64# CONFIG_MOMENCO_OCELOT is not set
65# CONFIG_MOMENCO_OCELOT_G is not set
66CONFIG_MOMENCO_OCELOT_C=y
67# CONFIG_MOMENCO_OCELOT_3 is not set
68# CONFIG_MOMENCO_JAGUAR_ATX is not set
69# CONFIG_PMC_YOSEMITE is not set
70# CONFIG_DDB5074 is not set
71# CONFIG_DDB5476 is not set
72# CONFIG_DDB5477 is not set
73# CONFIG_NEC_OSPREY is not set
74# CONFIG_SGI_IP22 is not set
75# CONFIG_SGI_IP27 is not set
76# CONFIG_SGI_IP32 is not set
77# CONFIG_SIBYTE_SB1xxx_SOC is not set
78# CONFIG_SNI_RM200_PCI is not set
79CONFIG_RWSEM_GENERIC_SPINLOCK=y
80CONFIG_GENERIC_CALIBRATE_DELAY=y
81CONFIG_HAVE_DEC_LOCK=y
82CONFIG_DMA_NONCOHERENT=y
83# CONFIG_CPU_LITTLE_ENDIAN is not set
84CONFIG_IRQ_CPU=y
85CONFIG_IRQ_MV64340=y
86CONFIG_PCI_MARVELL=y
87CONFIG_SWAP_IO_SPACE=y
88CONFIG_MIPS_L1_CACHE_SHIFT=5
89
90#
91# CPU selection
92#
93# CONFIG_CPU_MIPS32 is not set
94# CONFIG_CPU_MIPS64 is not set
95# CONFIG_CPU_R3000 is not set
96# CONFIG_CPU_TX39XX is not set
97# CONFIG_CPU_VR41XX is not set
98# CONFIG_CPU_R4300 is not set
99# CONFIG_CPU_R4X00 is not set
100# CONFIG_CPU_TX49XX is not set
101# CONFIG_CPU_R5000 is not set
102# CONFIG_CPU_R5432 is not set
103# CONFIG_CPU_R6000 is not set
104# CONFIG_CPU_NEVADA is not set
105# CONFIG_CPU_R8000 is not set
106# CONFIG_CPU_R10000 is not set
107CONFIG_CPU_RM7000=y
108# CONFIG_CPU_RM9000 is not set
109# CONFIG_CPU_SB1 is not set
110CONFIG_PAGE_SIZE_4KB=y
111# CONFIG_PAGE_SIZE_8KB is not set
112# CONFIG_PAGE_SIZE_16KB is not set
113# CONFIG_PAGE_SIZE_64KB is not set
114CONFIG_BOARD_SCACHE=y
115CONFIG_RM7000_CPU_SCACHE=y
116CONFIG_CPU_HAS_PREFETCH=y
117CONFIG_CPU_HAS_LLSC=y
118CONFIG_CPU_HAS_LLDSCD=y
119CONFIG_CPU_HAS_SYNC=y
120# CONFIG_PREEMPT is not set
121
122#
123# Bus options (PCI, PCMCIA, EISA, ISA, TC)
124#
125CONFIG_HW_HAS_PCI=y
126CONFIG_PCI=y
127CONFIG_PCI_LEGACY_PROC=y
128CONFIG_PCI_NAMES=y
129CONFIG_MMU=y
130
131#
132# PCCARD (PCMCIA/CardBus) support
133#
134# CONFIG_PCCARD is not set
135
136#
137# PC-card bridges
138#
139
140#
141# PCI Hotplug Support
142#
143# CONFIG_HOTPLUG_PCI is not set
144
145#
146# Executable file formats
147#
148CONFIG_BINFMT_ELF=y
149# CONFIG_BINFMT_MISC is not set
150# CONFIG_BUILD_ELF64 is not set
151CONFIG_MIPS32_COMPAT=y
152CONFIG_COMPAT=y
153CONFIG_MIPS32_O32=y
154CONFIG_MIPS32_N32=y
155CONFIG_BINFMT_ELF32=y
156
157#
158# Device Drivers
159#
160
161#
162# Generic Driver Options
163#
164CONFIG_STANDALONE=y
165CONFIG_PREVENT_FIRMWARE_BUILD=y
166# CONFIG_FW_LOADER is not set
167
168#
169# Memory Technology Devices (MTD)
170#
171# CONFIG_MTD is not set
172
173#
174# Parallel port support
175#
176# CONFIG_PARPORT is not set
177
178#
179# Plug and Play support
180#
181
182#
183# Block devices
184#
185# CONFIG_BLK_DEV_FD is not set
186# CONFIG_BLK_CPQ_DA is not set
187# CONFIG_BLK_CPQ_CISS_DA is not set
188# CONFIG_BLK_DEV_DAC960 is not set
189# CONFIG_BLK_DEV_UMEM is not set
190# CONFIG_BLK_DEV_COW_COMMON is not set
191# CONFIG_BLK_DEV_LOOP is not set
192# CONFIG_BLK_DEV_NBD is not set
193# CONFIG_BLK_DEV_SX8 is not set
194# CONFIG_BLK_DEV_RAM is not set
195CONFIG_BLK_DEV_RAM_COUNT=16
196CONFIG_INITRAMFS_SOURCE=""
197CONFIG_CDROM_PKTCDVD=y
198CONFIG_CDROM_PKTCDVD_BUFFERS=8
199# CONFIG_CDROM_PKTCDVD_WCACHE is not set
200
201#
202# IO Schedulers
203#
204CONFIG_IOSCHED_NOOP=y
205CONFIG_IOSCHED_AS=y
206CONFIG_IOSCHED_DEADLINE=y
207CONFIG_IOSCHED_CFQ=y
208CONFIG_ATA_OVER_ETH=y
209
210#
211# ATA/ATAPI/MFM/RLL support
212#
213# CONFIG_IDE is not set
214
215#
216# SCSI device support
217#
218# CONFIG_SCSI is not set
219
220#
221# Multi-device support (RAID and LVM)
222#
223# CONFIG_MD is not set
224
225#
226# Fusion MPT device support
227#
228
229#
230# IEEE 1394 (FireWire) support
231#
232# CONFIG_IEEE1394 is not set
233
234#
235# I2O device support
236#
237# CONFIG_I2O is not set
238
239#
240# Networking support
241#
242CONFIG_NET=y
243
244#
245# Networking options
246#
247# CONFIG_PACKET is not set
248CONFIG_NETLINK_DEV=y
249CONFIG_UNIX=y
250CONFIG_NET_KEY=y
251CONFIG_INET=y
252# CONFIG_IP_MULTICAST is not set
253# CONFIG_IP_ADVANCED_ROUTER is not set
254CONFIG_IP_PNP=y
255CONFIG_IP_PNP_DHCP=y
256# CONFIG_IP_PNP_BOOTP is not set
257# CONFIG_IP_PNP_RARP is not set
258# CONFIG_NET_IPIP is not set
259# CONFIG_NET_IPGRE is not set
260# CONFIG_ARPD is not set
261# CONFIG_SYN_COOKIES is not set
262# CONFIG_INET_AH is not set
263# CONFIG_INET_ESP is not set
264# CONFIG_INET_IPCOMP is not set
265CONFIG_INET_TUNNEL=y
266CONFIG_IP_TCPDIAG=y
267# CONFIG_IP_TCPDIAG_IPV6 is not set
268# CONFIG_IPV6 is not set
269# CONFIG_NETFILTER is not set
270CONFIG_XFRM=y
271CONFIG_XFRM_USER=y
272
273#
274# SCTP Configuration (EXPERIMENTAL)
275#
276# CONFIG_IP_SCTP is not set
277# CONFIG_ATM is not set
278# CONFIG_BRIDGE is not set
279# CONFIG_VLAN_8021Q is not set
280# CONFIG_DECNET is not set
281# CONFIG_LLC2 is not set
282# CONFIG_IPX is not set
283# CONFIG_ATALK is not set
284# CONFIG_X25 is not set
285# CONFIG_LAPB is not set
286# CONFIG_NET_DIVERT is not set
287# CONFIG_ECONET is not set
288# CONFIG_WAN_ROUTER is not set
289
290#
291# QoS and/or fair queueing
292#
293# CONFIG_NET_SCHED is not set
294# CONFIG_NET_CLS_ROUTE is not set
295
296#
297# Network testing
298#
299# CONFIG_NET_PKTGEN is not set
300# CONFIG_NETPOLL is not set
301# CONFIG_NET_POLL_CONTROLLER is not set
302# CONFIG_HAMRADIO is not set
303# CONFIG_IRDA is not set
304# CONFIG_BT is not set
305CONFIG_NETDEVICES=y
306# CONFIG_DUMMY is not set
307# CONFIG_BONDING is not set
308# CONFIG_EQUALIZER is not set
309# CONFIG_TUN is not set
310# CONFIG_ETHERTAP is not set
311
312#
313# ARCnet devices
314#
315# CONFIG_ARCNET is not set
316
317#
318# Ethernet (10 or 100Mbit)
319#
320CONFIG_NET_ETHERNET=y
321# CONFIG_MII is not set
322# CONFIG_HAPPYMEAL is not set
323# CONFIG_SUNGEM is not set
324# CONFIG_NET_VENDOR_3COM is not set
325
326#
327# Tulip family network device support
328#
329# CONFIG_NET_TULIP is not set
330# CONFIG_HP100 is not set
331# CONFIG_NET_PCI is not set
332
333#
334# Ethernet (1000 Mbit)
335#
336# CONFIG_ACENIC is not set
337# CONFIG_DL2K is not set
338# CONFIG_E1000 is not set
339# CONFIG_NS83820 is not set
340# CONFIG_HAMACHI is not set
341# CONFIG_YELLOWFIN is not set
342# CONFIG_R8169 is not set
343# CONFIG_SK98LIN is not set
344# CONFIG_TIGON3 is not set
345# CONFIG_MV643XX_ETH is not set
346
347#
348# Ethernet (10000 Mbit)
349#
350# CONFIG_IXGB is not set
351# CONFIG_S2IO is not set
352
353#
354# Token Ring devices
355#
356# CONFIG_TR is not set
357
358#
359# Wireless LAN (non-hamradio)
360#
361# CONFIG_NET_RADIO is not set
362
363#
364# Wan interfaces
365#
366# CONFIG_WAN is not set
367# CONFIG_FDDI is not set
368# CONFIG_HIPPI is not set
369# CONFIG_PPP is not set
370# CONFIG_SLIP is not set
371# CONFIG_SHAPER is not set
372# CONFIG_NETCONSOLE is not set
373
374#
375# ISDN subsystem
376#
377# CONFIG_ISDN is not set
378
379#
380# Telephony Support
381#
382# CONFIG_PHONE is not set
383
384#
385# Input device support
386#
387CONFIG_INPUT=y
388
389#
390# Userland interfaces
391#
392CONFIG_INPUT_MOUSEDEV=y
393CONFIG_INPUT_MOUSEDEV_PSAUX=y
394CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
395CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
396# CONFIG_INPUT_JOYDEV is not set
397# CONFIG_INPUT_TSDEV is not set
398# CONFIG_INPUT_EVDEV is not set
399# CONFIG_INPUT_EVBUG is not set
400
401#
402# Input I/O drivers
403#
404# CONFIG_GAMEPORT is not set
405CONFIG_SOUND_GAMEPORT=y
406CONFIG_SERIO=y
407# CONFIG_SERIO_I8042 is not set
408CONFIG_SERIO_SERPORT=y
409# CONFIG_SERIO_CT82C710 is not set
410# CONFIG_SERIO_PCIPS2 is not set
411# CONFIG_SERIO_LIBPS2 is not set
412CONFIG_SERIO_RAW=y
413
414#
415# Input Device Drivers
416#
417# CONFIG_INPUT_KEYBOARD is not set
418# CONFIG_INPUT_MOUSE is not set
419# CONFIG_INPUT_JOYSTICK is not set
420# CONFIG_INPUT_TOUCHSCREEN is not set
421# CONFIG_INPUT_MISC is not set
422
423#
424# Character devices
425#
426CONFIG_VT=y
427CONFIG_VT_CONSOLE=y
428CONFIG_HW_CONSOLE=y
429# CONFIG_SERIAL_NONSTANDARD is not set
430
431#
432# Serial drivers
433#
434CONFIG_SERIAL_8250=y
435CONFIG_SERIAL_8250_CONSOLE=y
436CONFIG_SERIAL_8250_NR_UARTS=4
437# CONFIG_SERIAL_8250_EXTENDED is not set
438
439#
440# Non-8250 serial port support
441#
442CONFIG_SERIAL_CORE=y
443CONFIG_SERIAL_CORE_CONSOLE=y
444CONFIG_UNIX98_PTYS=y
445CONFIG_LEGACY_PTYS=y
446CONFIG_LEGACY_PTY_COUNT=256
447
448#
449# IPMI
450#
451# CONFIG_IPMI_HANDLER is not set
452
453#
454# Watchdog Cards
455#
456# CONFIG_WATCHDOG is not set
457# CONFIG_RTC is not set
458# CONFIG_GEN_RTC is not set
459# CONFIG_DTLK is not set
460# CONFIG_R3964 is not set
461# CONFIG_APPLICOM is not set
462
463#
464# Ftape, the floppy tape device driver
465#
466# CONFIG_DRM is not set
467# CONFIG_RAW_DRIVER is not set
468
469#
470# I2C support
471#
472# CONFIG_I2C is not set
473
474#
475# Dallas's 1-wire bus
476#
477# CONFIG_W1 is not set
478
479#
480# Misc devices
481#
482
483#
484# Multimedia devices
485#
486# CONFIG_VIDEO_DEV is not set
487
488#
489# Digital Video Broadcasting Devices
490#
491# CONFIG_DVB is not set
492
493#
494# Graphics support
495#
496# CONFIG_FB is not set
497
498#
499# Console display driver support
500#
501# CONFIG_VGA_CONSOLE is not set
502CONFIG_DUMMY_CONSOLE=y
503# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
504
505#
506# Sound
507#
508# CONFIG_SOUND is not set
509
510#
511# USB support
512#
513# CONFIG_USB is not set
514CONFIG_USB_ARCH_HAS_HCD=y
515CONFIG_USB_ARCH_HAS_OHCI=y
516
517#
518# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
519#
520
521#
522# USB Gadget Support
523#
524# CONFIG_USB_GADGET is not set
525
526#
527# MMC/SD Card support
528#
529# CONFIG_MMC is not set
530
531#
532# InfiniBand support
533#
534# CONFIG_INFINIBAND is not set
535
536#
537# File systems
538#
539CONFIG_EXT2_FS=y
540# CONFIG_EXT2_FS_XATTR is not set
541# CONFIG_EXT3_FS is not set
542# CONFIG_JBD is not set
543# CONFIG_REISERFS_FS is not set
544# CONFIG_JFS_FS is not set
545# CONFIG_XFS_FS is not set
546# CONFIG_MINIX_FS is not set
547# CONFIG_ROMFS_FS is not set
548# CONFIG_QUOTA is not set
549CONFIG_DNOTIFY=y
550# CONFIG_AUTOFS_FS is not set
551# CONFIG_AUTOFS4_FS is not set
552
553#
554# CD-ROM/DVD Filesystems
555#
556# CONFIG_ISO9660_FS is not set
557# CONFIG_UDF_FS is not set
558
559#
560# DOS/FAT/NT Filesystems
561#
562# CONFIG_MSDOS_FS is not set
563# CONFIG_VFAT_FS is not set
564# CONFIG_NTFS_FS is not set
565
566#
567# Pseudo filesystems
568#
569CONFIG_PROC_FS=y
570CONFIG_PROC_KCORE=y
571CONFIG_SYSFS=y
572# CONFIG_DEVFS_FS is not set
573CONFIG_DEVPTS_FS_XATTR=y
574CONFIG_DEVPTS_FS_SECURITY=y
575# CONFIG_TMPFS is not set
576# CONFIG_HUGETLB_PAGE is not set
577CONFIG_RAMFS=y
578
579#
580# Miscellaneous filesystems
581#
582# CONFIG_ADFS_FS is not set
583# CONFIG_AFFS_FS is not set
584# CONFIG_HFS_FS is not set
585# CONFIG_HFSPLUS_FS is not set
586# CONFIG_BEFS_FS is not set
587# CONFIG_BFS_FS is not set
588# CONFIG_EFS_FS is not set
589# CONFIG_CRAMFS is not set
590# CONFIG_VXFS_FS is not set
591# CONFIG_HPFS_FS is not set
592# CONFIG_QNX4FS_FS is not set
593# CONFIG_SYSV_FS is not set
594# CONFIG_UFS_FS is not set
595
596#
597# Network File Systems
598#
599CONFIG_NFS_FS=y
600# CONFIG_NFS_V3 is not set
601# CONFIG_NFS_V4 is not set
602# CONFIG_NFS_DIRECTIO is not set
603CONFIG_NFSD=y
604# CONFIG_NFSD_V3 is not set
605# CONFIG_NFSD_TCP is not set
606CONFIG_ROOT_NFS=y
607CONFIG_LOCKD=y
608CONFIG_EXPORTFS=y
609CONFIG_SUNRPC=y
610# CONFIG_RPCSEC_GSS_KRB5 is not set
611# CONFIG_RPCSEC_GSS_SPKM3 is not set
612# CONFIG_SMB_FS is not set
613# CONFIG_CIFS is not set
614# CONFIG_NCP_FS is not set
615# CONFIG_CODA_FS is not set
616# CONFIG_AFS_FS is not set
617
618#
619# Partition Types
620#
621# CONFIG_PARTITION_ADVANCED is not set
622CONFIG_MSDOS_PARTITION=y
623
624#
625# Native Language Support
626#
627# CONFIG_NLS is not set
628
629#
630# Profiling support
631#
632# CONFIG_PROFILING is not set
633
634#
635# Kernel hacking
636#
637# CONFIG_DEBUG_KERNEL is not set
638CONFIG_CROSSCOMPILE=y
639CONFIG_CMDLINE=""
640
641#
642# Security options
643#
644CONFIG_KEYS=y
645CONFIG_KEYS_DEBUG_PROC_KEYS=y
646# CONFIG_SECURITY is not set
647
648#
649# Cryptographic options
650#
651# CONFIG_CRYPTO is not set
652
653#
654# Hardware crypto devices
655#
656
657#
658# Library routines
659#
660# CONFIG_CRC_CCITT is not set
661# CONFIG_CRC32 is not set
662# CONFIG_LIBCRC32C is not set
663CONFIG_GENERIC_HARDIRQS=y
664CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ocelot_defconfig b/arch/mips/configs/ocelot_defconfig
new file mode 100644
index 000000000000..4043950d360a
--- /dev/null
+++ b/arch/mips/configs/ocelot_defconfig
@@ -0,0 +1,624 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:08 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48# CONFIG_MODULES is not set
49
50#
51# Machine selection
52#
53# CONFIG_MACH_JAZZ is not set
54# CONFIG_MACH_VR41XX is not set
55# CONFIG_TOSHIBA_JMR3927 is not set
56# CONFIG_MIPS_COBALT is not set
57# CONFIG_MACH_DECSTATION is not set
58# CONFIG_MIPS_EV64120 is not set
59# CONFIG_MIPS_EV96100 is not set
60# CONFIG_MIPS_IVR is not set
61# CONFIG_LASAT is not set
62# CONFIG_MIPS_ITE8172 is not set
63# CONFIG_MIPS_ATLAS is not set
64# CONFIG_MIPS_MALTA is not set
65# CONFIG_MIPS_SEAD is not set
66CONFIG_MOMENCO_OCELOT=y
67# CONFIG_MOMENCO_OCELOT_G is not set
68# CONFIG_MOMENCO_OCELOT_C is not set
69# CONFIG_MOMENCO_OCELOT_3 is not set
70# CONFIG_MOMENCO_JAGUAR_ATX is not set
71# CONFIG_PMC_YOSEMITE is not set
72# CONFIG_DDB5074 is not set
73# CONFIG_DDB5476 is not set
74# CONFIG_DDB5477 is not set
75# CONFIG_NEC_OSPREY is not set
76# CONFIG_SGI_IP22 is not set
77# CONFIG_SOC_AU1X00 is not set
78# CONFIG_SIBYTE_SB1xxx_SOC is not set
79# CONFIG_SNI_RM200_PCI is not set
80# CONFIG_TOSHIBA_RBTX4927 is not set
81CONFIG_RWSEM_GENERIC_SPINLOCK=y
82CONFIG_GENERIC_CALIBRATE_DELAY=y
83CONFIG_HAVE_DEC_LOCK=y
84CONFIG_DMA_NONCOHERENT=y
85# CONFIG_CPU_LITTLE_ENDIAN is not set
86CONFIG_IRQ_CPU=y
87CONFIG_IRQ_CPU_RM7K=y
88CONFIG_MIPS_GT64120=y
89CONFIG_SWAP_IO_SPACE=y
90# CONFIG_SYSCLK_75 is not set
91# CONFIG_SYSCLK_83 is not set
92CONFIG_SYSCLK_100=y
93CONFIG_MIPS_L1_CACHE_SHIFT=5
94
95#
96# CPU selection
97#
98# CONFIG_CPU_MIPS32 is not set
99# CONFIG_CPU_MIPS64 is not set
100# CONFIG_CPU_R3000 is not set
101# CONFIG_CPU_TX39XX is not set
102# CONFIG_CPU_VR41XX is not set
103# CONFIG_CPU_R4300 is not set
104# CONFIG_CPU_R4X00 is not set
105# CONFIG_CPU_TX49XX is not set
106# CONFIG_CPU_R5000 is not set
107# CONFIG_CPU_R5432 is not set
108# CONFIG_CPU_R6000 is not set
109# CONFIG_CPU_NEVADA is not set
110# CONFIG_CPU_R8000 is not set
111# CONFIG_CPU_R10000 is not set
112CONFIG_CPU_RM7000=y
113# CONFIG_CPU_RM9000 is not set
114# CONFIG_CPU_SB1 is not set
115CONFIG_PAGE_SIZE_4KB=y
116# CONFIG_PAGE_SIZE_8KB is not set
117# CONFIG_PAGE_SIZE_16KB is not set
118# CONFIG_PAGE_SIZE_64KB is not set
119CONFIG_BOARD_SCACHE=y
120CONFIG_RM7000_CPU_SCACHE=y
121CONFIG_CPU_HAS_PREFETCH=y
122# CONFIG_64BIT_PHYS_ADDR is not set
123# CONFIG_CPU_ADVANCED is not set
124CONFIG_CPU_HAS_LLSC=y
125CONFIG_CPU_HAS_LLDSCD=y
126CONFIG_CPU_HAS_SYNC=y
127# CONFIG_PREEMPT is not set
128
129#
130# Bus options (PCI, PCMCIA, EISA, ISA, TC)
131#
132CONFIG_HW_HAS_PCI=y
133# CONFIG_PCI is not set
134CONFIG_MMU=y
135
136#
137# PCCARD (PCMCIA/CardBus) support
138#
139# CONFIG_PCCARD is not set
140
141#
142# PC-card bridges
143#
144
145#
146# PCI Hotplug Support
147#
148
149#
150# Executable file formats
151#
152CONFIG_BINFMT_ELF=y
153# CONFIG_BINFMT_MISC is not set
154CONFIG_TRAD_SIGNALS=y
155
156#
157# Device Drivers
158#
159
160#
161# Generic Driver Options
162#
163CONFIG_STANDALONE=y
164CONFIG_PREVENT_FIRMWARE_BUILD=y
165# CONFIG_FW_LOADER is not set
166
167#
168# Memory Technology Devices (MTD)
169#
170# CONFIG_MTD is not set
171
172#
173# Parallel port support
174#
175# CONFIG_PARPORT is not set
176
177#
178# Plug and Play support
179#
180
181#
182# Block devices
183#
184# CONFIG_BLK_DEV_FD is not set
185# CONFIG_BLK_DEV_COW_COMMON is not set
186# CONFIG_BLK_DEV_LOOP is not set
187# CONFIG_BLK_DEV_NBD is not set
188# CONFIG_BLK_DEV_RAM is not set
189CONFIG_BLK_DEV_RAM_COUNT=16
190CONFIG_INITRAMFS_SOURCE=""
191# CONFIG_LBD is not set
192CONFIG_CDROM_PKTCDVD=y
193CONFIG_CDROM_PKTCDVD_BUFFERS=8
194# CONFIG_CDROM_PKTCDVD_WCACHE is not set
195
196#
197# IO Schedulers
198#
199CONFIG_IOSCHED_NOOP=y
200CONFIG_IOSCHED_AS=y
201CONFIG_IOSCHED_DEADLINE=y
202CONFIG_IOSCHED_CFQ=y
203CONFIG_ATA_OVER_ETH=y
204
205#
206# ATA/ATAPI/MFM/RLL support
207#
208# CONFIG_IDE is not set
209
210#
211# SCSI device support
212#
213# CONFIG_SCSI is not set
214
215#
216# Multi-device support (RAID and LVM)
217#
218# CONFIG_MD is not set
219
220#
221# Fusion MPT device support
222#
223
224#
225# IEEE 1394 (FireWire) support
226#
227
228#
229# I2O device support
230#
231
232#
233# Networking support
234#
235CONFIG_NET=y
236
237#
238# Networking options
239#
240# CONFIG_PACKET is not set
241CONFIG_NETLINK_DEV=y
242CONFIG_UNIX=y
243CONFIG_NET_KEY=y
244CONFIG_INET=y
245# CONFIG_IP_MULTICAST is not set
246# CONFIG_IP_ADVANCED_ROUTER is not set
247CONFIG_IP_PNP=y
248# CONFIG_IP_PNP_DHCP is not set
249CONFIG_IP_PNP_BOOTP=y
250# CONFIG_IP_PNP_RARP is not set
251# CONFIG_NET_IPIP is not set
252# CONFIG_NET_IPGRE is not set
253# CONFIG_ARPD is not set
254# CONFIG_SYN_COOKIES is not set
255# CONFIG_INET_AH is not set
256# CONFIG_INET_ESP is not set
257# CONFIG_INET_IPCOMP is not set
258CONFIG_INET_TUNNEL=y
259CONFIG_IP_TCPDIAG=y
260# CONFIG_IP_TCPDIAG_IPV6 is not set
261# CONFIG_IPV6 is not set
262# CONFIG_NETFILTER is not set
263CONFIG_XFRM=y
264CONFIG_XFRM_USER=y
265
266#
267# SCTP Configuration (EXPERIMENTAL)
268#
269# CONFIG_IP_SCTP is not set
270# CONFIG_ATM is not set
271# CONFIG_BRIDGE is not set
272# CONFIG_VLAN_8021Q is not set
273# CONFIG_DECNET is not set
274# CONFIG_LLC2 is not set
275# CONFIG_IPX is not set
276# CONFIG_ATALK is not set
277# CONFIG_X25 is not set
278# CONFIG_LAPB is not set
279# CONFIG_NET_DIVERT is not set
280# CONFIG_ECONET is not set
281# CONFIG_WAN_ROUTER is not set
282
283#
284# QoS and/or fair queueing
285#
286# CONFIG_NET_SCHED is not set
287# CONFIG_NET_CLS_ROUTE is not set
288
289#
290# Network testing
291#
292# CONFIG_NET_PKTGEN is not set
293# CONFIG_NETPOLL is not set
294# CONFIG_NET_POLL_CONTROLLER is not set
295# CONFIG_HAMRADIO is not set
296# CONFIG_IRDA is not set
297# CONFIG_BT is not set
298CONFIG_NETDEVICES=y
299# CONFIG_DUMMY is not set
300# CONFIG_BONDING is not set
301# CONFIG_EQUALIZER is not set
302# CONFIG_TUN is not set
303# CONFIG_ETHERTAP is not set
304
305#
306# Ethernet (10 or 100Mbit)
307#
308CONFIG_NET_ETHERNET=y
309# CONFIG_MII is not set
310
311#
312# Ethernet (1000 Mbit)
313#
314
315#
316# Ethernet (10000 Mbit)
317#
318
319#
320# Token Ring devices
321#
322
323#
324# Wireless LAN (non-hamradio)
325#
326# CONFIG_NET_RADIO is not set
327
328#
329# Wan interfaces
330#
331# CONFIG_WAN is not set
332# CONFIG_PPP is not set
333# CONFIG_SLIP is not set
334# CONFIG_SHAPER is not set
335# CONFIG_NETCONSOLE is not set
336
337#
338# ISDN subsystem
339#
340# CONFIG_ISDN is not set
341
342#
343# Telephony Support
344#
345# CONFIG_PHONE is not set
346
347#
348# Input device support
349#
350CONFIG_INPUT=y
351
352#
353# Userland interfaces
354#
355CONFIG_INPUT_MOUSEDEV=y
356CONFIG_INPUT_MOUSEDEV_PSAUX=y
357CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
358CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
359# CONFIG_INPUT_JOYDEV is not set
360# CONFIG_INPUT_TSDEV is not set
361# CONFIG_INPUT_EVDEV is not set
362# CONFIG_INPUT_EVBUG is not set
363
364#
365# Input I/O drivers
366#
367# CONFIG_GAMEPORT is not set
368CONFIG_SOUND_GAMEPORT=y
369CONFIG_SERIO=y
370# CONFIG_SERIO_I8042 is not set
371CONFIG_SERIO_SERPORT=y
372# CONFIG_SERIO_CT82C710 is not set
373# CONFIG_SERIO_LIBPS2 is not set
374CONFIG_SERIO_RAW=y
375
376#
377# Input Device Drivers
378#
379# CONFIG_INPUT_KEYBOARD is not set
380# CONFIG_INPUT_MOUSE is not set
381# CONFIG_INPUT_JOYSTICK is not set
382# CONFIG_INPUT_TOUCHSCREEN is not set
383# CONFIG_INPUT_MISC is not set
384
385#
386# Character devices
387#
388CONFIG_VT=y
389CONFIG_VT_CONSOLE=y
390CONFIG_HW_CONSOLE=y
391# CONFIG_SERIAL_NONSTANDARD is not set
392
393#
394# Serial drivers
395#
396CONFIG_SERIAL_8250=y
397CONFIG_SERIAL_8250_CONSOLE=y
398CONFIG_SERIAL_8250_NR_UARTS=4
399# CONFIG_SERIAL_8250_EXTENDED is not set
400
401#
402# Non-8250 serial port support
403#
404CONFIG_SERIAL_CORE=y
405CONFIG_SERIAL_CORE_CONSOLE=y
406CONFIG_UNIX98_PTYS=y
407CONFIG_LEGACY_PTYS=y
408CONFIG_LEGACY_PTY_COUNT=256
409
410#
411# IPMI
412#
413# CONFIG_IPMI_HANDLER is not set
414
415#
416# Watchdog Cards
417#
418# CONFIG_WATCHDOG is not set
419# CONFIG_RTC is not set
420# CONFIG_GEN_RTC is not set
421# CONFIG_DTLK is not set
422# CONFIG_R3964 is not set
423
424#
425# Ftape, the floppy tape device driver
426#
427# CONFIG_DRM is not set
428# CONFIG_RAW_DRIVER is not set
429
430#
431# I2C support
432#
433# CONFIG_I2C is not set
434
435#
436# Dallas's 1-wire bus
437#
438# CONFIG_W1 is not set
439
440#
441# Misc devices
442#
443
444#
445# Multimedia devices
446#
447# CONFIG_VIDEO_DEV is not set
448
449#
450# Digital Video Broadcasting Devices
451#
452# CONFIG_DVB is not set
453
454#
455# Graphics support
456#
457# CONFIG_FB is not set
458
459#
460# Console display driver support
461#
462# CONFIG_VGA_CONSOLE is not set
463CONFIG_DUMMY_CONSOLE=y
464# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
465
466#
467# Sound
468#
469# CONFIG_SOUND is not set
470
471#
472# USB support
473#
474# CONFIG_USB_ARCH_HAS_HCD is not set
475# CONFIG_USB_ARCH_HAS_OHCI is not set
476
477#
478# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
479#
480
481#
482# USB Gadget Support
483#
484# CONFIG_USB_GADGET is not set
485
486#
487# MMC/SD Card support
488#
489# CONFIG_MMC is not set
490
491#
492# InfiniBand support
493#
494# CONFIG_INFINIBAND is not set
495
496#
497# File systems
498#
499CONFIG_EXT2_FS=y
500# CONFIG_EXT2_FS_XATTR is not set
501# CONFIG_EXT3_FS is not set
502# CONFIG_JBD is not set
503# CONFIG_REISERFS_FS is not set
504# CONFIG_JFS_FS is not set
505# CONFIG_XFS_FS is not set
506# CONFIG_MINIX_FS is not set
507# CONFIG_ROMFS_FS is not set
508# CONFIG_QUOTA is not set
509CONFIG_DNOTIFY=y
510# CONFIG_AUTOFS_FS is not set
511# CONFIG_AUTOFS4_FS is not set
512
513#
514# CD-ROM/DVD Filesystems
515#
516# CONFIG_ISO9660_FS is not set
517# CONFIG_UDF_FS is not set
518
519#
520# DOS/FAT/NT Filesystems
521#
522# CONFIG_MSDOS_FS is not set
523# CONFIG_VFAT_FS is not set
524# CONFIG_NTFS_FS is not set
525
526#
527# Pseudo filesystems
528#
529CONFIG_PROC_FS=y
530CONFIG_PROC_KCORE=y
531CONFIG_SYSFS=y
532# CONFIG_DEVFS_FS is not set
533CONFIG_DEVPTS_FS_XATTR=y
534CONFIG_DEVPTS_FS_SECURITY=y
535# CONFIG_TMPFS is not set
536# CONFIG_HUGETLB_PAGE is not set
537CONFIG_RAMFS=y
538
539#
540# Miscellaneous filesystems
541#
542# CONFIG_ADFS_FS is not set
543# CONFIG_AFFS_FS is not set
544# CONFIG_HFS_FS is not set
545# CONFIG_HFSPLUS_FS is not set
546# CONFIG_BEFS_FS is not set
547# CONFIG_BFS_FS is not set
548# CONFIG_EFS_FS is not set
549# CONFIG_CRAMFS is not set
550# CONFIG_VXFS_FS is not set
551# CONFIG_HPFS_FS is not set
552# CONFIG_QNX4FS_FS is not set
553# CONFIG_SYSV_FS is not set
554# CONFIG_UFS_FS is not set
555
556#
557# Network File Systems
558#
559CONFIG_NFS_FS=y
560# CONFIG_NFS_V3 is not set
561# CONFIG_NFS_V4 is not set
562# CONFIG_NFS_DIRECTIO is not set
563CONFIG_NFSD=y
564# CONFIG_NFSD_V3 is not set
565# CONFIG_NFSD_TCP is not set
566CONFIG_ROOT_NFS=y
567CONFIG_LOCKD=y
568CONFIG_EXPORTFS=y
569CONFIG_SUNRPC=y
570# CONFIG_RPCSEC_GSS_KRB5 is not set
571# CONFIG_RPCSEC_GSS_SPKM3 is not set
572# CONFIG_SMB_FS is not set
573# CONFIG_CIFS is not set
574# CONFIG_NCP_FS is not set
575# CONFIG_CODA_FS is not set
576# CONFIG_AFS_FS is not set
577
578#
579# Partition Types
580#
581# CONFIG_PARTITION_ADVANCED is not set
582CONFIG_MSDOS_PARTITION=y
583
584#
585# Native Language Support
586#
587# CONFIG_NLS is not set
588
589#
590# Profiling support
591#
592# CONFIG_PROFILING is not set
593
594#
595# Kernel hacking
596#
597# CONFIG_DEBUG_KERNEL is not set
598CONFIG_CROSSCOMPILE=y
599CONFIG_CMDLINE=""
600
601#
602# Security options
603#
604CONFIG_KEYS=y
605CONFIG_KEYS_DEBUG_PROC_KEYS=y
606# CONFIG_SECURITY is not set
607
608#
609# Cryptographic options
610#
611# CONFIG_CRYPTO is not set
612
613#
614# Hardware crypto devices
615#
616
617#
618# Library routines
619#
620# CONFIG_CRC_CCITT is not set
621# CONFIG_CRC32 is not set
622# CONFIG_LIBCRC32C is not set
623CONFIG_GENERIC_HARDIRQS=y
624CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/ocelot_g_defconfig b/arch/mips/configs/ocelot_g_defconfig
new file mode 100644
index 000000000000..3870af4537ad
--- /dev/null
+++ b/arch/mips/configs/ocelot_g_defconfig
@@ -0,0 +1,667 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:08 2005
5#
6CONFIG_MIPS=y
7CONFIG_MIPS64=y
8CONFIG_64BIT=y
9
10#
11# Code maturity level options
12#
13CONFIG_EXPERIMENTAL=y
14CONFIG_CLEAN_COMPILE=y
15CONFIG_BROKEN_ON_SMP=y
16
17#
18# General setup
19#
20CONFIG_LOCALVERSION=""
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_LOG_BUF_SHIFT=14
28# CONFIG_HOTPLUG is not set
29CONFIG_KOBJECT_UEVENT=y
30# CONFIG_IKCONFIG is not set
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_FUTEX=y
35CONFIG_EPOLL=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37CONFIG_SHMEM=y
38CONFIG_CC_ALIGN_FUNCTIONS=0
39CONFIG_CC_ALIGN_LABELS=0
40CONFIG_CC_ALIGN_LOOPS=0
41CONFIG_CC_ALIGN_JUMPS=0
42# CONFIG_TINY_SHMEM is not set
43
44#
45# Loadable module support
46#
47# CONFIG_MODULES is not set
48
49#
50# Machine selection
51#
52# CONFIG_MACH_JAZZ is not set
53# CONFIG_MACH_VR41XX is not set
54# CONFIG_MIPS_COBALT is not set
55# CONFIG_MACH_DECSTATION is not set
56# CONFIG_MIPS_EV64120 is not set
57# CONFIG_MIPS_EV96100 is not set
58# CONFIG_MIPS_IVR is not set
59# CONFIG_LASAT is not set
60# CONFIG_MIPS_ITE8172 is not set
61# CONFIG_MIPS_ATLAS is not set
62# CONFIG_MIPS_MALTA is not set
63# CONFIG_MIPS_SEAD is not set
64# CONFIG_MOMENCO_OCELOT is not set
65CONFIG_MOMENCO_OCELOT_G=y
66# CONFIG_MOMENCO_OCELOT_C is not set
67# CONFIG_MOMENCO_OCELOT_3 is not set
68# CONFIG_MOMENCO_JAGUAR_ATX is not set
69# CONFIG_PMC_YOSEMITE is not set
70# CONFIG_DDB5074 is not set
71# CONFIG_DDB5476 is not set
72# CONFIG_DDB5477 is not set
73# CONFIG_NEC_OSPREY is not set
74# CONFIG_SGI_IP22 is not set
75# CONFIG_SGI_IP27 is not set
76# CONFIG_SGI_IP32 is not set
77# CONFIG_SIBYTE_SB1xxx_SOC is not set
78# CONFIG_SNI_RM200_PCI is not set
79CONFIG_RWSEM_GENERIC_SPINLOCK=y
80CONFIG_GENERIC_CALIBRATE_DELAY=y
81CONFIG_HAVE_DEC_LOCK=y
82CONFIG_DMA_NONCOHERENT=y
83# CONFIG_CPU_LITTLE_ENDIAN is not set
84CONFIG_IRQ_CPU=y
85CONFIG_IRQ_CPU_RM7K=y
86CONFIG_PCI_MARVELL=y
87CONFIG_SWAP_IO_SPACE=y
88# CONFIG_SYSCLK_75 is not set
89# CONFIG_SYSCLK_83 is not set
90CONFIG_SYSCLK_100=y
91CONFIG_MIPS_L1_CACHE_SHIFT=5
92
93#
94# CPU selection
95#
96# CONFIG_CPU_MIPS32 is not set
97# CONFIG_CPU_MIPS64 is not set
98# CONFIG_CPU_R3000 is not set
99# CONFIG_CPU_TX39XX is not set
100# CONFIG_CPU_VR41XX is not set
101# CONFIG_CPU_R4300 is not set
102# CONFIG_CPU_R4X00 is not set
103# CONFIG_CPU_TX49XX is not set
104# CONFIG_CPU_R5000 is not set
105# CONFIG_CPU_R5432 is not set
106# CONFIG_CPU_R6000 is not set
107# CONFIG_CPU_NEVADA is not set
108# CONFIG_CPU_R8000 is not set
109# CONFIG_CPU_R10000 is not set
110CONFIG_CPU_RM7000=y
111# CONFIG_CPU_RM9000 is not set
112# CONFIG_CPU_SB1 is not set
113CONFIG_PAGE_SIZE_4KB=y
114# CONFIG_PAGE_SIZE_8KB is not set
115# CONFIG_PAGE_SIZE_16KB is not set
116# CONFIG_PAGE_SIZE_64KB is not set
117CONFIG_BOARD_SCACHE=y
118CONFIG_RM7000_CPU_SCACHE=y
119CONFIG_CPU_HAS_PREFETCH=y
120CONFIG_CPU_HAS_LLSC=y
121CONFIG_CPU_HAS_LLDSCD=y
122CONFIG_CPU_HAS_SYNC=y
123# CONFIG_PREEMPT is not set
124
125#
126# Bus options (PCI, PCMCIA, EISA, ISA, TC)
127#
128CONFIG_HW_HAS_PCI=y
129CONFIG_PCI=y
130CONFIG_PCI_LEGACY_PROC=y
131CONFIG_PCI_NAMES=y
132CONFIG_MMU=y
133
134#
135# PCCARD (PCMCIA/CardBus) support
136#
137# CONFIG_PCCARD is not set
138
139#
140# PC-card bridges
141#
142
143#
144# PCI Hotplug Support
145#
146# CONFIG_HOTPLUG_PCI is not set
147
148#
149# Executable file formats
150#
151CONFIG_BINFMT_ELF=y
152# CONFIG_BINFMT_MISC is not set
153# CONFIG_BUILD_ELF64 is not set
154CONFIG_MIPS32_COMPAT=y
155CONFIG_COMPAT=y
156CONFIG_MIPS32_O32=y
157CONFIG_MIPS32_N32=y
158CONFIG_BINFMT_ELF32=y
159
160#
161# Device Drivers
162#
163
164#
165# Generic Driver Options
166#
167CONFIG_STANDALONE=y
168CONFIG_PREVENT_FIRMWARE_BUILD=y
169# CONFIG_FW_LOADER is not set
170
171#
172# Memory Technology Devices (MTD)
173#
174# CONFIG_MTD is not set
175
176#
177# Parallel port support
178#
179# CONFIG_PARPORT is not set
180
181#
182# Plug and Play support
183#
184
185#
186# Block devices
187#
188# CONFIG_BLK_DEV_FD is not set
189# CONFIG_BLK_CPQ_DA is not set
190# CONFIG_BLK_CPQ_CISS_DA is not set
191# CONFIG_BLK_DEV_DAC960 is not set
192# CONFIG_BLK_DEV_UMEM is not set
193# CONFIG_BLK_DEV_COW_COMMON is not set
194# CONFIG_BLK_DEV_LOOP is not set
195# CONFIG_BLK_DEV_NBD is not set
196# CONFIG_BLK_DEV_SX8 is not set
197# CONFIG_BLK_DEV_RAM is not set
198CONFIG_BLK_DEV_RAM_COUNT=16
199CONFIG_INITRAMFS_SOURCE=""
200CONFIG_CDROM_PKTCDVD=y
201CONFIG_CDROM_PKTCDVD_BUFFERS=8
202# CONFIG_CDROM_PKTCDVD_WCACHE is not set
203
204#
205# IO Schedulers
206#
207CONFIG_IOSCHED_NOOP=y
208CONFIG_IOSCHED_AS=y
209CONFIG_IOSCHED_DEADLINE=y
210CONFIG_IOSCHED_CFQ=y
211CONFIG_ATA_OVER_ETH=y
212
213#
214# ATA/ATAPI/MFM/RLL support
215#
216# CONFIG_IDE is not set
217
218#
219# SCSI device support
220#
221# CONFIG_SCSI is not set
222
223#
224# Multi-device support (RAID and LVM)
225#
226# CONFIG_MD is not set
227
228#
229# Fusion MPT device support
230#
231
232#
233# IEEE 1394 (FireWire) support
234#
235# CONFIG_IEEE1394 is not set
236
237#
238# I2O device support
239#
240# CONFIG_I2O is not set
241
242#
243# Networking support
244#
245CONFIG_NET=y
246
247#
248# Networking options
249#
250# CONFIG_PACKET is not set
251CONFIG_NETLINK_DEV=y
252CONFIG_UNIX=y
253CONFIG_NET_KEY=y
254CONFIG_INET=y
255# CONFIG_IP_MULTICAST is not set
256# CONFIG_IP_ADVANCED_ROUTER is not set
257CONFIG_IP_PNP=y
258CONFIG_IP_PNP_DHCP=y
259# CONFIG_IP_PNP_BOOTP is not set
260# CONFIG_IP_PNP_RARP is not set
261# CONFIG_NET_IPIP is not set
262# CONFIG_NET_IPGRE is not set
263# CONFIG_ARPD is not set
264# CONFIG_SYN_COOKIES is not set
265# CONFIG_INET_AH is not set
266# CONFIG_INET_ESP is not set
267# CONFIG_INET_IPCOMP is not set
268CONFIG_INET_TUNNEL=y
269CONFIG_IP_TCPDIAG=y
270# CONFIG_IP_TCPDIAG_IPV6 is not set
271# CONFIG_IPV6 is not set
272# CONFIG_NETFILTER is not set
273CONFIG_XFRM=y
274CONFIG_XFRM_USER=y
275
276#
277# SCTP Configuration (EXPERIMENTAL)
278#
279# CONFIG_IP_SCTP is not set
280# CONFIG_ATM is not set
281# CONFIG_BRIDGE is not set
282# CONFIG_VLAN_8021Q is not set
283# CONFIG_DECNET is not set
284# CONFIG_LLC2 is not set
285# CONFIG_IPX is not set
286# CONFIG_ATALK is not set
287# CONFIG_X25 is not set
288# CONFIG_LAPB is not set
289# CONFIG_NET_DIVERT is not set
290# CONFIG_ECONET is not set
291# CONFIG_WAN_ROUTER is not set
292
293#
294# QoS and/or fair queueing
295#
296# CONFIG_NET_SCHED is not set
297# CONFIG_NET_CLS_ROUTE is not set
298
299#
300# Network testing
301#
302# CONFIG_NET_PKTGEN is not set
303# CONFIG_NETPOLL is not set
304# CONFIG_NET_POLL_CONTROLLER is not set
305# CONFIG_HAMRADIO is not set
306# CONFIG_IRDA is not set
307# CONFIG_BT is not set
308CONFIG_NETDEVICES=y
309# CONFIG_DUMMY is not set
310# CONFIG_BONDING is not set
311# CONFIG_EQUALIZER is not set
312# CONFIG_TUN is not set
313# CONFIG_ETHERTAP is not set
314
315#
316# ARCnet devices
317#
318# CONFIG_ARCNET is not set
319
320#
321# Ethernet (10 or 100Mbit)
322#
323CONFIG_NET_ETHERNET=y
324CONFIG_MII=y
325CONFIG_GALILEO_64240_ETH=y
326# CONFIG_HAPPYMEAL is not set
327# CONFIG_SUNGEM is not set
328# CONFIG_NET_VENDOR_3COM is not set
329
330#
331# Tulip family network device support
332#
333# CONFIG_NET_TULIP is not set
334# CONFIG_HP100 is not set
335# CONFIG_NET_PCI is not set
336
337#
338# Ethernet (1000 Mbit)
339#
340# CONFIG_ACENIC is not set
341# CONFIG_DL2K is not set
342# CONFIG_E1000 is not set
343# CONFIG_NS83820 is not set
344# CONFIG_HAMACHI is not set
345# CONFIG_YELLOWFIN is not set
346# CONFIG_R8169 is not set
347# CONFIG_SK98LIN is not set
348# CONFIG_TIGON3 is not set
349
350#
351# Ethernet (10000 Mbit)
352#
353# CONFIG_IXGB is not set
354# CONFIG_S2IO is not set
355
356#
357# Token Ring devices
358#
359# CONFIG_TR is not set
360
361#
362# Wireless LAN (non-hamradio)
363#
364# CONFIG_NET_RADIO is not set
365
366#
367# Wan interfaces
368#
369# CONFIG_WAN is not set
370# CONFIG_FDDI is not set
371# CONFIG_HIPPI is not set
372# CONFIG_PPP is not set
373# CONFIG_SLIP is not set
374# CONFIG_SHAPER is not set
375# CONFIG_NETCONSOLE is not set
376
377#
378# ISDN subsystem
379#
380# CONFIG_ISDN is not set
381
382#
383# Telephony Support
384#
385# CONFIG_PHONE is not set
386
387#
388# Input device support
389#
390CONFIG_INPUT=y
391
392#
393# Userland interfaces
394#
395CONFIG_INPUT_MOUSEDEV=y
396CONFIG_INPUT_MOUSEDEV_PSAUX=y
397CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
398CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
399# CONFIG_INPUT_JOYDEV is not set
400# CONFIG_INPUT_TSDEV is not set
401# CONFIG_INPUT_EVDEV is not set
402# CONFIG_INPUT_EVBUG is not set
403
404#
405# Input I/O drivers
406#
407# CONFIG_GAMEPORT is not set
408CONFIG_SOUND_GAMEPORT=y
409CONFIG_SERIO=y
410# CONFIG_SERIO_I8042 is not set
411CONFIG_SERIO_SERPORT=y
412# CONFIG_SERIO_CT82C710 is not set
413# CONFIG_SERIO_PCIPS2 is not set
414# CONFIG_SERIO_LIBPS2 is not set
415CONFIG_SERIO_RAW=y
416
417#
418# Input Device Drivers
419#
420# CONFIG_INPUT_KEYBOARD is not set
421# CONFIG_INPUT_MOUSE is not set
422# CONFIG_INPUT_JOYSTICK is not set
423# CONFIG_INPUT_TOUCHSCREEN is not set
424# CONFIG_INPUT_MISC is not set
425
426#
427# Character devices
428#
429CONFIG_VT=y
430CONFIG_VT_CONSOLE=y
431CONFIG_HW_CONSOLE=y
432# CONFIG_SERIAL_NONSTANDARD is not set
433
434#
435# Serial drivers
436#
437CONFIG_SERIAL_8250=y
438CONFIG_SERIAL_8250_CONSOLE=y
439CONFIG_SERIAL_8250_NR_UARTS=4
440# CONFIG_SERIAL_8250_EXTENDED is not set
441
442#
443# Non-8250 serial port support
444#
445CONFIG_SERIAL_CORE=y
446CONFIG_SERIAL_CORE_CONSOLE=y
447CONFIG_UNIX98_PTYS=y
448CONFIG_LEGACY_PTYS=y
449CONFIG_LEGACY_PTY_COUNT=256
450
451#
452# IPMI
453#
454# CONFIG_IPMI_HANDLER is not set
455
456#
457# Watchdog Cards
458#
459# CONFIG_WATCHDOG is not set
460# CONFIG_RTC is not set
461# CONFIG_GEN_RTC is not set
462# CONFIG_DTLK is not set
463# CONFIG_R3964 is not set
464# CONFIG_APPLICOM is not set
465
466#
467# Ftape, the floppy tape device driver
468#
469# CONFIG_DRM is not set
470# CONFIG_RAW_DRIVER is not set
471
472#
473# I2C support
474#
475# CONFIG_I2C is not set
476
477#
478# Dallas's 1-wire bus
479#
480# CONFIG_W1 is not set
481
482#
483# Misc devices
484#
485
486#
487# Multimedia devices
488#
489# CONFIG_VIDEO_DEV is not set
490
491#
492# Digital Video Broadcasting Devices
493#
494# CONFIG_DVB is not set
495
496#
497# Graphics support
498#
499# CONFIG_FB is not set
500
501#
502# Console display driver support
503#
504# CONFIG_VGA_CONSOLE is not set
505CONFIG_DUMMY_CONSOLE=y
506# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
507
508#
509# Sound
510#
511# CONFIG_SOUND is not set
512
513#
514# USB support
515#
516# CONFIG_USB is not set
517CONFIG_USB_ARCH_HAS_HCD=y
518CONFIG_USB_ARCH_HAS_OHCI=y
519
520#
521# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
522#
523
524#
525# USB Gadget Support
526#
527# CONFIG_USB_GADGET is not set
528
529#
530# MMC/SD Card support
531#
532# CONFIG_MMC is not set
533
534#
535# InfiniBand support
536#
537# CONFIG_INFINIBAND is not set
538
539#
540# File systems
541#
542CONFIG_EXT2_FS=y
543# CONFIG_EXT2_FS_XATTR is not set
544# CONFIG_EXT3_FS is not set
545# CONFIG_JBD is not set
546# CONFIG_REISERFS_FS is not set
547# CONFIG_JFS_FS is not set
548# CONFIG_XFS_FS is not set
549# CONFIG_MINIX_FS is not set
550# CONFIG_ROMFS_FS is not set
551# CONFIG_QUOTA is not set
552CONFIG_DNOTIFY=y
553# CONFIG_AUTOFS_FS is not set
554# CONFIG_AUTOFS4_FS is not set
555
556#
557# CD-ROM/DVD Filesystems
558#
559# CONFIG_ISO9660_FS is not set
560# CONFIG_UDF_FS is not set
561
562#
563# DOS/FAT/NT Filesystems
564#
565# CONFIG_MSDOS_FS is not set
566# CONFIG_VFAT_FS is not set
567# CONFIG_NTFS_FS is not set
568
569#
570# Pseudo filesystems
571#
572CONFIG_PROC_FS=y
573CONFIG_PROC_KCORE=y
574CONFIG_SYSFS=y
575# CONFIG_DEVFS_FS is not set
576CONFIG_DEVPTS_FS_XATTR=y
577CONFIG_DEVPTS_FS_SECURITY=y
578# CONFIG_TMPFS is not set
579# CONFIG_HUGETLB_PAGE is not set
580CONFIG_RAMFS=y
581
582#
583# Miscellaneous filesystems
584#
585# CONFIG_ADFS_FS is not set
586# CONFIG_AFFS_FS is not set
587# CONFIG_HFS_FS is not set
588# CONFIG_HFSPLUS_FS is not set
589# CONFIG_BEFS_FS is not set
590# CONFIG_BFS_FS is not set
591# CONFIG_EFS_FS is not set
592# CONFIG_CRAMFS is not set
593# CONFIG_VXFS_FS is not set
594# CONFIG_HPFS_FS is not set
595# CONFIG_QNX4FS_FS is not set
596# CONFIG_SYSV_FS is not set
597# CONFIG_UFS_FS is not set
598
599#
600# Network File Systems
601#
602CONFIG_NFS_FS=y
603# CONFIG_NFS_V3 is not set
604# CONFIG_NFS_V4 is not set
605# CONFIG_NFS_DIRECTIO is not set
606CONFIG_NFSD=y
607# CONFIG_NFSD_V3 is not set
608# CONFIG_NFSD_TCP is not set
609CONFIG_ROOT_NFS=y
610CONFIG_LOCKD=y
611CONFIG_EXPORTFS=y
612CONFIG_SUNRPC=y
613# CONFIG_RPCSEC_GSS_KRB5 is not set
614# CONFIG_RPCSEC_GSS_SPKM3 is not set
615# CONFIG_SMB_FS is not set
616# CONFIG_CIFS is not set
617# CONFIG_NCP_FS is not set
618# CONFIG_CODA_FS is not set
619# CONFIG_AFS_FS is not set
620
621#
622# Partition Types
623#
624# CONFIG_PARTITION_ADVANCED is not set
625CONFIG_MSDOS_PARTITION=y
626
627#
628# Native Language Support
629#
630# CONFIG_NLS is not set
631
632#
633# Profiling support
634#
635# CONFIG_PROFILING is not set
636
637#
638# Kernel hacking
639#
640# CONFIG_DEBUG_KERNEL is not set
641CONFIG_CROSSCOMPILE=y
642CONFIG_CMDLINE=""
643
644#
645# Security options
646#
647CONFIG_KEYS=y
648CONFIG_KEYS_DEBUG_PROC_KEYS=y
649# CONFIG_SECURITY is not set
650
651#
652# Cryptographic options
653#
654# CONFIG_CRYPTO is not set
655
656#
657# Hardware crypto devices
658#
659
660#
661# Library routines
662#
663# CONFIG_CRC_CCITT is not set
664# CONFIG_CRC32 is not set
665# CONFIG_LIBCRC32C is not set
666CONFIG_GENERIC_HARDIRQS=y
667CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/osprey_defconfig b/arch/mips/configs/osprey_defconfig
new file mode 100644
index 000000000000..989cb9e7ae83
--- /dev/null
+++ b/arch/mips/configs/osprey_defconfig
@@ -0,0 +1,618 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:08 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81CONFIG_NEC_OSPREY=y
82# CONFIG_SGI_IP22 is not set
83# CONFIG_SOC_AU1X00 is not set
84# CONFIG_SIBYTE_SB1xxx_SOC is not set
85# CONFIG_SNI_RM200_PCI is not set
86# CONFIG_TOSHIBA_RBTX4927 is not set
87CONFIG_RWSEM_GENERIC_SPINLOCK=y
88CONFIG_GENERIC_CALIBRATE_DELAY=y
89CONFIG_HAVE_DEC_LOCK=y
90CONFIG_DMA_NONCOHERENT=y
91CONFIG_CPU_LITTLE_ENDIAN=y
92CONFIG_IRQ_CPU=y
93CONFIG_MIPS_L1_CACHE_SHIFT=5
94CONFIG_VR4181=y
95
96#
97# CPU selection
98#
99# CONFIG_CPU_MIPS32 is not set
100# CONFIG_CPU_MIPS64 is not set
101# CONFIG_CPU_R3000 is not set
102# CONFIG_CPU_TX39XX is not set
103CONFIG_CPU_VR41XX=y
104# CONFIG_CPU_R4300 is not set
105# CONFIG_CPU_R4X00 is not set
106# CONFIG_CPU_TX49XX is not set
107# CONFIG_CPU_R5000 is not set
108# CONFIG_CPU_R5432 is not set
109# CONFIG_CPU_R6000 is not set
110# CONFIG_CPU_NEVADA is not set
111# CONFIG_CPU_R8000 is not set
112# CONFIG_CPU_R10000 is not set
113# CONFIG_CPU_RM7000 is not set
114# CONFIG_CPU_RM9000 is not set
115# CONFIG_CPU_SB1 is not set
116CONFIG_PAGE_SIZE_4KB=y
117# CONFIG_PAGE_SIZE_8KB is not set
118# CONFIG_PAGE_SIZE_16KB is not set
119# CONFIG_PAGE_SIZE_64KB is not set
120# CONFIG_CPU_ADVANCED is not set
121CONFIG_CPU_HAS_SYNC=y
122# CONFIG_PREEMPT is not set
123
124#
125# Bus options (PCI, PCMCIA, EISA, ISA, TC)
126#
127CONFIG_MMU=y
128
129#
130# PCCARD (PCMCIA/CardBus) support
131#
132# CONFIG_PCCARD is not set
133
134#
135# PC-card bridges
136#
137
138#
139# PCI Hotplug Support
140#
141
142#
143# Executable file formats
144#
145CONFIG_BINFMT_ELF=y
146# CONFIG_BINFMT_MISC is not set
147CONFIG_TRAD_SIGNALS=y
148
149#
150# Device Drivers
151#
152
153#
154# Generic Driver Options
155#
156CONFIG_STANDALONE=y
157CONFIG_PREVENT_FIRMWARE_BUILD=y
158# CONFIG_FW_LOADER is not set
159
160#
161# Memory Technology Devices (MTD)
162#
163# CONFIG_MTD is not set
164
165#
166# Parallel port support
167#
168# CONFIG_PARPORT is not set
169
170#
171# Plug and Play support
172#
173
174#
175# Block devices
176#
177# CONFIG_BLK_DEV_FD is not set
178# CONFIG_BLK_DEV_COW_COMMON is not set
179# CONFIG_BLK_DEV_LOOP is not set
180# CONFIG_BLK_DEV_NBD is not set
181# CONFIG_BLK_DEV_RAM is not set
182CONFIG_BLK_DEV_RAM_COUNT=16
183CONFIG_INITRAMFS_SOURCE=""
184# CONFIG_LBD is not set
185CONFIG_CDROM_PKTCDVD=m
186CONFIG_CDROM_PKTCDVD_BUFFERS=8
187# CONFIG_CDROM_PKTCDVD_WCACHE is not set
188
189#
190# IO Schedulers
191#
192CONFIG_IOSCHED_NOOP=y
193CONFIG_IOSCHED_AS=y
194CONFIG_IOSCHED_DEADLINE=y
195CONFIG_IOSCHED_CFQ=y
196CONFIG_ATA_OVER_ETH=m
197
198#
199# ATA/ATAPI/MFM/RLL support
200#
201# CONFIG_IDE is not set
202
203#
204# SCSI device support
205#
206# CONFIG_SCSI is not set
207
208#
209# Multi-device support (RAID and LVM)
210#
211# CONFIG_MD is not set
212
213#
214# Fusion MPT device support
215#
216
217#
218# IEEE 1394 (FireWire) support
219#
220
221#
222# I2O device support
223#
224
225#
226# Networking support
227#
228CONFIG_NET=y
229
230#
231# Networking options
232#
233CONFIG_PACKET=y
234# CONFIG_PACKET_MMAP is not set
235CONFIG_NETLINK_DEV=y
236CONFIG_UNIX=y
237CONFIG_NET_KEY=y
238CONFIG_INET=y
239# CONFIG_IP_MULTICAST is not set
240# CONFIG_IP_ADVANCED_ROUTER is not set
241CONFIG_IP_PNP=y
242# CONFIG_IP_PNP_DHCP is not set
243CONFIG_IP_PNP_BOOTP=y
244# CONFIG_IP_PNP_RARP is not set
245# CONFIG_NET_IPIP is not set
246# CONFIG_NET_IPGRE is not set
247# CONFIG_ARPD is not set
248# CONFIG_SYN_COOKIES is not set
249# CONFIG_INET_AH is not set
250# CONFIG_INET_ESP is not set
251# CONFIG_INET_IPCOMP is not set
252CONFIG_INET_TUNNEL=m
253CONFIG_IP_TCPDIAG=m
254# CONFIG_IP_TCPDIAG_IPV6 is not set
255# CONFIG_IPV6 is not set
256# CONFIG_NETFILTER is not set
257CONFIG_XFRM=y
258CONFIG_XFRM_USER=m
259
260#
261# SCTP Configuration (EXPERIMENTAL)
262#
263# CONFIG_IP_SCTP is not set
264# CONFIG_ATM is not set
265# CONFIG_BRIDGE is not set
266# CONFIG_VLAN_8021Q is not set
267# CONFIG_DECNET is not set
268# CONFIG_LLC2 is not set
269# CONFIG_IPX is not set
270# CONFIG_ATALK is not set
271# CONFIG_X25 is not set
272# CONFIG_LAPB is not set
273# CONFIG_NET_DIVERT is not set
274# CONFIG_ECONET is not set
275# CONFIG_WAN_ROUTER is not set
276
277#
278# QoS and/or fair queueing
279#
280# CONFIG_NET_SCHED is not set
281# CONFIG_NET_CLS_ROUTE is not set
282
283#
284# Network testing
285#
286# CONFIG_NET_PKTGEN is not set
287# CONFIG_NETPOLL is not set
288# CONFIG_NET_POLL_CONTROLLER is not set
289# CONFIG_HAMRADIO is not set
290# CONFIG_IRDA is not set
291# CONFIG_BT is not set
292CONFIG_NETDEVICES=y
293# CONFIG_DUMMY is not set
294# CONFIG_BONDING is not set
295# CONFIG_EQUALIZER is not set
296# CONFIG_TUN is not set
297# CONFIG_ETHERTAP is not set
298
299#
300# Ethernet (10 or 100Mbit)
301#
302CONFIG_NET_ETHERNET=y
303# CONFIG_MII is not set
304
305#
306# Ethernet (1000 Mbit)
307#
308
309#
310# Ethernet (10000 Mbit)
311#
312
313#
314# Token Ring devices
315#
316
317#
318# Wireless LAN (non-hamradio)
319#
320# CONFIG_NET_RADIO is not set
321
322#
323# Wan interfaces
324#
325# CONFIG_WAN is not set
326# CONFIG_PPP is not set
327# CONFIG_SLIP is not set
328# CONFIG_SHAPER is not set
329# CONFIG_NETCONSOLE is not set
330
331#
332# ISDN subsystem
333#
334# CONFIG_ISDN is not set
335
336#
337# Telephony Support
338#
339# CONFIG_PHONE is not set
340
341#
342# Input device support
343#
344CONFIG_INPUT=y
345
346#
347# Userland interfaces
348#
349CONFIG_INPUT_MOUSEDEV=y
350CONFIG_INPUT_MOUSEDEV_PSAUX=y
351CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
352CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
353# CONFIG_INPUT_JOYDEV is not set
354# CONFIG_INPUT_TSDEV is not set
355# CONFIG_INPUT_EVDEV is not set
356# CONFIG_INPUT_EVBUG is not set
357
358#
359# Input I/O drivers
360#
361# CONFIG_GAMEPORT is not set
362CONFIG_SOUND_GAMEPORT=y
363CONFIG_SERIO=y
364# CONFIG_SERIO_I8042 is not set
365CONFIG_SERIO_SERPORT=y
366# CONFIG_SERIO_CT82C710 is not set
367# CONFIG_SERIO_LIBPS2 is not set
368CONFIG_SERIO_RAW=m
369
370#
371# Input Device Drivers
372#
373# CONFIG_INPUT_KEYBOARD is not set
374# CONFIG_INPUT_MOUSE is not set
375# CONFIG_INPUT_JOYSTICK is not set
376# CONFIG_INPUT_TOUCHSCREEN is not set
377# CONFIG_INPUT_MISC is not set
378
379#
380# Character devices
381#
382CONFIG_VT=y
383CONFIG_VT_CONSOLE=y
384CONFIG_HW_CONSOLE=y
385# CONFIG_SERIAL_NONSTANDARD is not set
386
387#
388# Serial drivers
389#
390CONFIG_SERIAL_8250=y
391CONFIG_SERIAL_8250_CONSOLE=y
392CONFIG_SERIAL_8250_NR_UARTS=4
393# CONFIG_SERIAL_8250_EXTENDED is not set
394
395#
396# Non-8250 serial port support
397#
398CONFIG_SERIAL_CORE=y
399CONFIG_SERIAL_CORE_CONSOLE=y
400CONFIG_UNIX98_PTYS=y
401CONFIG_LEGACY_PTYS=y
402CONFIG_LEGACY_PTY_COUNT=256
403
404#
405# IPMI
406#
407# CONFIG_IPMI_HANDLER is not set
408
409#
410# Watchdog Cards
411#
412# CONFIG_WATCHDOG is not set
413# CONFIG_RTC is not set
414# CONFIG_GEN_RTC is not set
415# CONFIG_DTLK is not set
416# CONFIG_R3964 is not set
417
418#
419# Ftape, the floppy tape device driver
420#
421# CONFIG_DRM is not set
422# CONFIG_RAW_DRIVER is not set
423
424#
425# I2C support
426#
427# CONFIG_I2C is not set
428
429#
430# Dallas's 1-wire bus
431#
432# CONFIG_W1 is not set
433
434#
435# Misc devices
436#
437
438#
439# Multimedia devices
440#
441# CONFIG_VIDEO_DEV is not set
442
443#
444# Digital Video Broadcasting Devices
445#
446# CONFIG_DVB is not set
447
448#
449# Graphics support
450#
451# CONFIG_FB is not set
452
453#
454# Console display driver support
455#
456# CONFIG_VGA_CONSOLE is not set
457CONFIG_DUMMY_CONSOLE=y
458# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
459
460#
461# Sound
462#
463# CONFIG_SOUND is not set
464
465#
466# USB support
467#
468# CONFIG_USB_ARCH_HAS_HCD is not set
469# CONFIG_USB_ARCH_HAS_OHCI is not set
470
471#
472# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
473#
474
475#
476# USB Gadget Support
477#
478# CONFIG_USB_GADGET is not set
479
480#
481# MMC/SD Card support
482#
483# CONFIG_MMC is not set
484
485#
486# InfiniBand support
487#
488# CONFIG_INFINIBAND is not set
489
490#
491# File systems
492#
493CONFIG_EXT2_FS=y
494# CONFIG_EXT2_FS_XATTR is not set
495# CONFIG_EXT3_FS is not set
496# CONFIG_JBD is not set
497# CONFIG_REISERFS_FS is not set
498# CONFIG_JFS_FS is not set
499# CONFIG_XFS_FS is not set
500# CONFIG_MINIX_FS is not set
501# CONFIG_ROMFS_FS is not set
502# CONFIG_QUOTA is not set
503CONFIG_DNOTIFY=y
504# CONFIG_AUTOFS_FS is not set
505# CONFIG_AUTOFS4_FS is not set
506
507#
508# CD-ROM/DVD Filesystems
509#
510# CONFIG_ISO9660_FS is not set
511# CONFIG_UDF_FS is not set
512
513#
514# DOS/FAT/NT Filesystems
515#
516# CONFIG_MSDOS_FS is not set
517# CONFIG_VFAT_FS is not set
518# CONFIG_NTFS_FS is not set
519
520#
521# Pseudo filesystems
522#
523CONFIG_PROC_FS=y
524CONFIG_PROC_KCORE=y
525CONFIG_SYSFS=y
526# CONFIG_DEVFS_FS is not set
527CONFIG_DEVPTS_FS_XATTR=y
528CONFIG_DEVPTS_FS_SECURITY=y
529# CONFIG_TMPFS is not set
530# CONFIG_HUGETLB_PAGE is not set
531CONFIG_RAMFS=y
532
533#
534# Miscellaneous filesystems
535#
536# CONFIG_ADFS_FS is not set
537# CONFIG_AFFS_FS is not set
538# CONFIG_HFS_FS is not set
539# CONFIG_HFSPLUS_FS is not set
540# CONFIG_BEFS_FS is not set
541# CONFIG_BFS_FS is not set
542# CONFIG_EFS_FS is not set
543# CONFIG_CRAMFS is not set
544# CONFIG_VXFS_FS is not set
545# CONFIG_HPFS_FS is not set
546# CONFIG_QNX4FS_FS is not set
547# CONFIG_SYSV_FS is not set
548# CONFIG_UFS_FS is not set
549
550#
551# Network File Systems
552#
553CONFIG_NFS_FS=y
554# CONFIG_NFS_V3 is not set
555# CONFIG_NFS_V4 is not set
556# CONFIG_NFS_DIRECTIO is not set
557CONFIG_NFSD=y
558# CONFIG_NFSD_V3 is not set
559# CONFIG_NFSD_TCP is not set
560CONFIG_ROOT_NFS=y
561CONFIG_LOCKD=y
562CONFIG_EXPORTFS=y
563CONFIG_SUNRPC=y
564# CONFIG_RPCSEC_GSS_KRB5 is not set
565# CONFIG_RPCSEC_GSS_SPKM3 is not set
566# CONFIG_SMB_FS is not set
567# CONFIG_CIFS is not set
568# CONFIG_NCP_FS is not set
569# CONFIG_CODA_FS is not set
570# CONFIG_AFS_FS is not set
571
572#
573# Partition Types
574#
575# CONFIG_PARTITION_ADVANCED is not set
576CONFIG_MSDOS_PARTITION=y
577
578#
579# Native Language Support
580#
581# CONFIG_NLS is not set
582
583#
584# Profiling support
585#
586# CONFIG_PROFILING is not set
587
588#
589# Kernel hacking
590#
591# CONFIG_DEBUG_KERNEL is not set
592CONFIG_CROSSCOMPILE=y
593CONFIG_CMDLINE="ip=bootp ether=46,0x03fe0300,eth0"
594
595#
596# Security options
597#
598CONFIG_KEYS=y
599CONFIG_KEYS_DEBUG_PROC_KEYS=y
600# CONFIG_SECURITY is not set
601
602#
603# Cryptographic options
604#
605# CONFIG_CRYPTO is not set
606
607#
608# Hardware crypto devices
609#
610
611#
612# Library routines
613#
614# CONFIG_CRC_CCITT is not set
615# CONFIG_CRC32 is not set
616CONFIG_LIBCRC32C=m
617CONFIG_GENERIC_HARDIRQS=y
618CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
new file mode 100644
index 000000000000..6cdabd550300
--- /dev/null
+++ b/arch/mips/configs/pb1100_defconfig
@@ -0,0 +1,826 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:08 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83CONFIG_SOC_AU1X00=y
84# CONFIG_SOC_AU1000 is not set
85CONFIG_SOC_AU1100=y
86# CONFIG_SOC_AU1500 is not set
87# CONFIG_SOC_AU1550 is not set
88# CONFIG_MIPS_PB1000 is not set
89CONFIG_MIPS_PB1100=y
90# CONFIG_MIPS_PB1500 is not set
91# CONFIG_MIPS_PB1550 is not set
92# CONFIG_MIPS_DB1000 is not set
93# CONFIG_MIPS_DB1100 is not set
94# CONFIG_MIPS_DB1500 is not set
95# CONFIG_MIPS_DB1550 is not set
96# CONFIG_MIPS_BOSPORUS is not set
97# CONFIG_MIPS_MIRAGE is not set
98# CONFIG_MIPS_XXS1500 is not set
99# CONFIG_MIPS_MTX1 is not set
100# CONFIG_SIBYTE_SB1xxx_SOC is not set
101# CONFIG_SNI_RM200_PCI is not set
102# CONFIG_TOSHIBA_RBTX4927 is not set
103CONFIG_RWSEM_GENERIC_SPINLOCK=y
104CONFIG_GENERIC_CALIBRATE_DELAY=y
105CONFIG_HAVE_DEC_LOCK=y
106CONFIG_DMA_NONCOHERENT=y
107CONFIG_CPU_LITTLE_ENDIAN=y
108CONFIG_SWAP_IO_SPACE=y
109# CONFIG_AU1X00_USB_DEVICE is not set
110CONFIG_MIPS_L1_CACHE_SHIFT=5
111
112#
113# CPU selection
114#
115CONFIG_CPU_MIPS32=y
116# CONFIG_CPU_MIPS64 is not set
117# CONFIG_CPU_R3000 is not set
118# CONFIG_CPU_TX39XX is not set
119# CONFIG_CPU_VR41XX is not set
120# CONFIG_CPU_R4300 is not set
121# CONFIG_CPU_R4X00 is not set
122# CONFIG_CPU_TX49XX is not set
123# CONFIG_CPU_R5000 is not set
124# CONFIG_CPU_R5432 is not set
125# CONFIG_CPU_R6000 is not set
126# CONFIG_CPU_NEVADA is not set
127# CONFIG_CPU_R8000 is not set
128# CONFIG_CPU_R10000 is not set
129# CONFIG_CPU_RM7000 is not set
130# CONFIG_CPU_RM9000 is not set
131# CONFIG_CPU_SB1 is not set
132CONFIG_PAGE_SIZE_4KB=y
133# CONFIG_PAGE_SIZE_8KB is not set
134# CONFIG_PAGE_SIZE_16KB is not set
135# CONFIG_PAGE_SIZE_64KB is not set
136CONFIG_CPU_HAS_PREFETCH=y
137# CONFIG_64BIT_PHYS_ADDR is not set
138# CONFIG_CPU_ADVANCED is not set
139CONFIG_CPU_HAS_LLSC=y
140CONFIG_CPU_HAS_SYNC=y
141# CONFIG_PREEMPT is not set
142
143#
144# Bus options (PCI, PCMCIA, EISA, ISA, TC)
145#
146CONFIG_HW_HAS_PCI=y
147# CONFIG_PCI is not set
148CONFIG_MMU=y
149
150#
151# PCCARD (PCMCIA/CardBus) support
152#
153CONFIG_PCCARD=m
154# CONFIG_PCMCIA_DEBUG is not set
155CONFIG_PCMCIA=m
156
157#
158# PC-card bridges
159#
160# CONFIG_TCIC is not set
161# CONFIG_PCMCIA_AU1X00 is not set
162
163#
164# PCI Hotplug Support
165#
166
167#
168# Executable file formats
169#
170CONFIG_BINFMT_ELF=y
171# CONFIG_BINFMT_MISC is not set
172CONFIG_TRAD_SIGNALS=y
173
174#
175# Device Drivers
176#
177
178#
179# Generic Driver Options
180#
181CONFIG_STANDALONE=y
182CONFIG_PREVENT_FIRMWARE_BUILD=y
183# CONFIG_FW_LOADER is not set
184
185#
186# Memory Technology Devices (MTD)
187#
188CONFIG_MTD=y
189# CONFIG_MTD_DEBUG is not set
190CONFIG_MTD_PARTITIONS=y
191# CONFIG_MTD_CONCAT is not set
192# CONFIG_MTD_REDBOOT_PARTS is not set
193# CONFIG_MTD_CMDLINE_PARTS is not set
194
195#
196# User Modules And Translation Layers
197#
198CONFIG_MTD_CHAR=y
199CONFIG_MTD_BLOCK=y
200# CONFIG_FTL is not set
201# CONFIG_NFTL is not set
202# CONFIG_INFTL is not set
203
204#
205# RAM/ROM/Flash chip drivers
206#
207CONFIG_MTD_CFI=y
208# CONFIG_MTD_JEDECPROBE is not set
209CONFIG_MTD_GEN_PROBE=y
210# CONFIG_MTD_CFI_ADV_OPTIONS is not set
211CONFIG_MTD_MAP_BANK_WIDTH_1=y
212CONFIG_MTD_MAP_BANK_WIDTH_2=y
213CONFIG_MTD_MAP_BANK_WIDTH_4=y
214# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
215# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
216# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
217CONFIG_MTD_CFI_I1=y
218CONFIG_MTD_CFI_I2=y
219# CONFIG_MTD_CFI_I4 is not set
220# CONFIG_MTD_CFI_I8 is not set
221# CONFIG_MTD_CFI_INTELEXT is not set
222CONFIG_MTD_CFI_AMDSTD=y
223CONFIG_MTD_CFI_AMDSTD_RETRY=0
224# CONFIG_MTD_CFI_STAA is not set
225CONFIG_MTD_CFI_UTIL=y
226# CONFIG_MTD_RAM is not set
227# CONFIG_MTD_ROM is not set
228# CONFIG_MTD_ABSENT is not set
229
230#
231# Mapping drivers for chip access
232#
233# CONFIG_MTD_COMPLEX_MAPPINGS is not set
234# CONFIG_MTD_PHYSMAP is not set
235CONFIG_MTD_PB1100=y
236CONFIG_MTD_PB1500_BOOT=y
237CONFIG_MTD_PB1500_USER=y
238
239#
240# Self-contained MTD device drivers
241#
242# CONFIG_MTD_SLRAM is not set
243# CONFIG_MTD_PHRAM is not set
244# CONFIG_MTD_MTDRAM is not set
245# CONFIG_MTD_BLKMTD is not set
246# CONFIG_MTD_BLOCK2MTD is not set
247
248#
249# Disk-On-Chip Device Drivers
250#
251# CONFIG_MTD_DOC2000 is not set
252# CONFIG_MTD_DOC2001 is not set
253# CONFIG_MTD_DOC2001PLUS is not set
254
255#
256# NAND Flash Device Drivers
257#
258# CONFIG_MTD_NAND is not set
259
260#
261# Parallel port support
262#
263# CONFIG_PARPORT is not set
264
265#
266# Plug and Play support
267#
268
269#
270# Block devices
271#
272# CONFIG_BLK_DEV_FD is not set
273# CONFIG_BLK_DEV_COW_COMMON is not set
274CONFIG_BLK_DEV_LOOP=y
275# CONFIG_BLK_DEV_CRYPTOLOOP is not set
276# CONFIG_BLK_DEV_NBD is not set
277# CONFIG_BLK_DEV_RAM is not set
278CONFIG_BLK_DEV_RAM_COUNT=16
279CONFIG_INITRAMFS_SOURCE=""
280# CONFIG_LBD is not set
281CONFIG_CDROM_PKTCDVD=m
282CONFIG_CDROM_PKTCDVD_BUFFERS=8
283# CONFIG_CDROM_PKTCDVD_WCACHE is not set
284
285#
286# IO Schedulers
287#
288CONFIG_IOSCHED_NOOP=y
289CONFIG_IOSCHED_AS=y
290CONFIG_IOSCHED_DEADLINE=y
291CONFIG_IOSCHED_CFQ=y
292CONFIG_ATA_OVER_ETH=m
293
294#
295# ATA/ATAPI/MFM/RLL support
296#
297# CONFIG_IDE is not set
298
299#
300# SCSI device support
301#
302# CONFIG_SCSI is not set
303
304#
305# Multi-device support (RAID and LVM)
306#
307# CONFIG_MD is not set
308
309#
310# Fusion MPT device support
311#
312
313#
314# IEEE 1394 (FireWire) support
315#
316
317#
318# I2O device support
319#
320
321#
322# Networking support
323#
324CONFIG_NET=y
325
326#
327# Networking options
328#
329CONFIG_PACKET=y
330# CONFIG_PACKET_MMAP is not set
331CONFIG_NETLINK_DEV=y
332CONFIG_UNIX=y
333CONFIG_NET_KEY=y
334CONFIG_INET=y
335CONFIG_IP_MULTICAST=y
336# CONFIG_IP_ADVANCED_ROUTER is not set
337CONFIG_IP_PNP=y
338# CONFIG_IP_PNP_DHCP is not set
339CONFIG_IP_PNP_BOOTP=y
340# CONFIG_IP_PNP_RARP is not set
341# CONFIG_NET_IPIP is not set
342# CONFIG_NET_IPGRE is not set
343# CONFIG_IP_MROUTE is not set
344# CONFIG_ARPD is not set
345# CONFIG_SYN_COOKIES is not set
346# CONFIG_INET_AH is not set
347# CONFIG_INET_ESP is not set
348# CONFIG_INET_IPCOMP is not set
349CONFIG_INET_TUNNEL=m
350CONFIG_IP_TCPDIAG=m
351# CONFIG_IP_TCPDIAG_IPV6 is not set
352
353#
354# IP: Virtual Server Configuration
355#
356# CONFIG_IP_VS is not set
357# CONFIG_IPV6 is not set
358CONFIG_NETFILTER=y
359# CONFIG_NETFILTER_DEBUG is not set
360
361#
362# IP: Netfilter Configuration
363#
364# CONFIG_IP_NF_CONNTRACK is not set
365CONFIG_IP_NF_CONNTRACK_MARK=y
366# CONFIG_IP_NF_QUEUE is not set
367# CONFIG_IP_NF_IPTABLES is not set
368# CONFIG_IP_NF_ARPTABLES is not set
369CONFIG_XFRM=y
370CONFIG_XFRM_USER=m
371
372#
373# SCTP Configuration (EXPERIMENTAL)
374#
375# CONFIG_IP_SCTP is not set
376# CONFIG_ATM is not set
377# CONFIG_BRIDGE is not set
378# CONFIG_VLAN_8021Q is not set
379# CONFIG_DECNET is not set
380# CONFIG_LLC2 is not set
381# CONFIG_IPX is not set
382# CONFIG_ATALK is not set
383# CONFIG_X25 is not set
384# CONFIG_LAPB is not set
385# CONFIG_NET_DIVERT is not set
386# CONFIG_ECONET is not set
387# CONFIG_WAN_ROUTER is not set
388
389#
390# QoS and/or fair queueing
391#
392# CONFIG_NET_SCHED is not set
393# CONFIG_NET_CLS_ROUTE is not set
394
395#
396# Network testing
397#
398# CONFIG_NET_PKTGEN is not set
399# CONFIG_NETPOLL is not set
400# CONFIG_NET_POLL_CONTROLLER is not set
401# CONFIG_HAMRADIO is not set
402# CONFIG_IRDA is not set
403# CONFIG_BT is not set
404CONFIG_NETDEVICES=y
405# CONFIG_DUMMY is not set
406# CONFIG_BONDING is not set
407# CONFIG_EQUALIZER is not set
408# CONFIG_TUN is not set
409# CONFIG_ETHERTAP is not set
410
411#
412# Ethernet (10 or 100Mbit)
413#
414CONFIG_NET_ETHERNET=y
415# CONFIG_MII is not set
416# CONFIG_MIPS_AU1X00_ENET is not set
417
418#
419# Ethernet (1000 Mbit)
420#
421
422#
423# Ethernet (10000 Mbit)
424#
425
426#
427# Token Ring devices
428#
429
430#
431# Wireless LAN (non-hamradio)
432#
433# CONFIG_NET_RADIO is not set
434
435#
436# PCMCIA network device support
437#
438# CONFIG_NET_PCMCIA is not set
439
440#
441# Wan interfaces
442#
443# CONFIG_WAN is not set
444CONFIG_PPP=m
445CONFIG_PPP_MULTILINK=y
446# CONFIG_PPP_FILTER is not set
447CONFIG_PPP_ASYNC=m
448# CONFIG_PPP_SYNC_TTY is not set
449CONFIG_PPP_DEFLATE=m
450# CONFIG_PPP_BSDCOMP is not set
451CONFIG_PPPOE=m
452# CONFIG_SLIP is not set
453# CONFIG_SHAPER is not set
454# CONFIG_NETCONSOLE is not set
455
456#
457# ISDN subsystem
458#
459# CONFIG_ISDN is not set
460
461#
462# Telephony Support
463#
464# CONFIG_PHONE is not set
465
466#
467# Input device support
468#
469CONFIG_INPUT=y
470
471#
472# Userland interfaces
473#
474CONFIG_INPUT_MOUSEDEV=y
475CONFIG_INPUT_MOUSEDEV_PSAUX=y
476CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
477CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
478# CONFIG_INPUT_JOYDEV is not set
479# CONFIG_INPUT_TSDEV is not set
480CONFIG_INPUT_EVDEV=y
481# CONFIG_INPUT_EVBUG is not set
482
483#
484# Input I/O drivers
485#
486# CONFIG_GAMEPORT is not set
487CONFIG_SOUND_GAMEPORT=y
488CONFIG_SERIO=y
489# CONFIG_SERIO_I8042 is not set
490CONFIG_SERIO_SERPORT=y
491# CONFIG_SERIO_CT82C710 is not set
492# CONFIG_SERIO_LIBPS2 is not set
493CONFIG_SERIO_RAW=m
494
495#
496# Input Device Drivers
497#
498# CONFIG_INPUT_KEYBOARD is not set
499# CONFIG_INPUT_MOUSE is not set
500# CONFIG_INPUT_JOYSTICK is not set
501# CONFIG_INPUT_TOUCHSCREEN is not set
502# CONFIG_INPUT_MISC is not set
503
504#
505# Character devices
506#
507CONFIG_VT=y
508CONFIG_VT_CONSOLE=y
509CONFIG_HW_CONSOLE=y
510# CONFIG_SERIAL_NONSTANDARD is not set
511# CONFIG_AU1X00_GPIO is not set
512# CONFIG_TS_AU1X00_ADS7846 is not set
513
514#
515# Serial drivers
516#
517# CONFIG_SERIAL_8250 is not set
518
519#
520# Non-8250 serial port support
521#
522# CONFIG_SERIAL_AU1X00 is not set
523CONFIG_UNIX98_PTYS=y
524CONFIG_LEGACY_PTYS=y
525CONFIG_LEGACY_PTY_COUNT=256
526
527#
528# IPMI
529#
530# CONFIG_IPMI_HANDLER is not set
531
532#
533# Watchdog Cards
534#
535# CONFIG_WATCHDOG is not set
536CONFIG_RTC=y
537# CONFIG_DTLK is not set
538# CONFIG_R3964 is not set
539
540#
541# Ftape, the floppy tape device driver
542#
543# CONFIG_DRM is not set
544
545#
546# PCMCIA character devices
547#
548CONFIG_SYNCLINK_CS=m
549# CONFIG_RAW_DRIVER is not set
550
551#
552# I2C support
553#
554# CONFIG_I2C is not set
555
556#
557# Dallas's 1-wire bus
558#
559# CONFIG_W1 is not set
560
561#
562# Misc devices
563#
564
565#
566# Multimedia devices
567#
568# CONFIG_VIDEO_DEV is not set
569
570#
571# Digital Video Broadcasting Devices
572#
573# CONFIG_DVB is not set
574
575#
576# Graphics support
577#
578# CONFIG_FB is not set
579
580#
581# Console display driver support
582#
583# CONFIG_VGA_CONSOLE is not set
584CONFIG_DUMMY_CONSOLE=y
585# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
586
587#
588# Sound
589#
590# CONFIG_SOUND is not set
591
592#
593# USB support
594#
595# CONFIG_USB_ARCH_HAS_HCD is not set
596# CONFIG_USB_ARCH_HAS_OHCI is not set
597
598#
599# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
600#
601
602#
603# USB Gadget Support
604#
605# CONFIG_USB_GADGET is not set
606
607#
608# MMC/SD Card support
609#
610# CONFIG_MMC is not set
611
612#
613# InfiniBand support
614#
615# CONFIG_INFINIBAND is not set
616
617#
618# File systems
619#
620CONFIG_EXT2_FS=y
621CONFIG_EXT2_FS_XATTR=y
622CONFIG_EXT2_FS_POSIX_ACL=y
623# CONFIG_EXT2_FS_SECURITY is not set
624CONFIG_EXT3_FS=y
625CONFIG_EXT3_FS_XATTR=y
626CONFIG_EXT3_FS_POSIX_ACL=y
627CONFIG_EXT3_FS_SECURITY=y
628CONFIG_JBD=y
629# CONFIG_JBD_DEBUG is not set
630CONFIG_FS_MBCACHE=y
631CONFIG_REISERFS_FS=m
632# CONFIG_REISERFS_CHECK is not set
633# CONFIG_REISERFS_PROC_INFO is not set
634CONFIG_REISERFS_FS_XATTR=y
635CONFIG_REISERFS_FS_POSIX_ACL=y
636CONFIG_REISERFS_FS_SECURITY=y
637# CONFIG_JFS_FS is not set
638CONFIG_FS_POSIX_ACL=y
639# CONFIG_XFS_FS is not set
640# CONFIG_MINIX_FS is not set
641# CONFIG_ROMFS_FS is not set
642# CONFIG_QUOTA is not set
643CONFIG_DNOTIFY=y
644CONFIG_AUTOFS_FS=m
645CONFIG_AUTOFS4_FS=m
646
647#
648# CD-ROM/DVD Filesystems
649#
650# CONFIG_ISO9660_FS is not set
651# CONFIG_UDF_FS is not set
652
653#
654# DOS/FAT/NT Filesystems
655#
656# CONFIG_MSDOS_FS is not set
657# CONFIG_VFAT_FS is not set
658# CONFIG_NTFS_FS is not set
659
660#
661# Pseudo filesystems
662#
663CONFIG_PROC_FS=y
664CONFIG_PROC_KCORE=y
665CONFIG_SYSFS=y
666# CONFIG_DEVFS_FS is not set
667CONFIG_DEVPTS_FS_XATTR=y
668CONFIG_DEVPTS_FS_SECURITY=y
669CONFIG_TMPFS=y
670# CONFIG_TMPFS_XATTR is not set
671# CONFIG_HUGETLB_PAGE is not set
672CONFIG_RAMFS=y
673
674#
675# Miscellaneous filesystems
676#
677# CONFIG_ADFS_FS is not set
678# CONFIG_AFFS_FS is not set
679# CONFIG_HFS_FS is not set
680# CONFIG_HFSPLUS_FS is not set
681# CONFIG_BEFS_FS is not set
682# CONFIG_BFS_FS is not set
683# CONFIG_EFS_FS is not set
684# CONFIG_JFFS_FS is not set
685# CONFIG_JFFS2_FS is not set
686CONFIG_CRAMFS=m
687# CONFIG_VXFS_FS is not set
688# CONFIG_HPFS_FS is not set
689# CONFIG_QNX4FS_FS is not set
690# CONFIG_SYSV_FS is not set
691# CONFIG_UFS_FS is not set
692
693#
694# Network File Systems
695#
696CONFIG_NFS_FS=y
697# CONFIG_NFS_V3 is not set
698# CONFIG_NFS_V4 is not set
699# CONFIG_NFS_DIRECTIO is not set
700CONFIG_NFSD=m
701# CONFIG_NFSD_V3 is not set
702# CONFIG_NFSD_TCP is not set
703CONFIG_ROOT_NFS=y
704CONFIG_LOCKD=y
705CONFIG_EXPORTFS=m
706CONFIG_SUNRPC=y
707# CONFIG_RPCSEC_GSS_KRB5 is not set
708# CONFIG_RPCSEC_GSS_SPKM3 is not set
709CONFIG_SMB_FS=m
710# CONFIG_SMB_NLS_DEFAULT is not set
711# CONFIG_CIFS is not set
712# CONFIG_NCP_FS is not set
713# CONFIG_CODA_FS is not set
714# CONFIG_AFS_FS is not set
715
716#
717# Partition Types
718#
719# CONFIG_PARTITION_ADVANCED is not set
720CONFIG_MSDOS_PARTITION=y
721
722#
723# Native Language Support
724#
725CONFIG_NLS=m
726CONFIG_NLS_DEFAULT="iso8859-1"
727# CONFIG_NLS_CODEPAGE_437 is not set
728# CONFIG_NLS_CODEPAGE_737 is not set
729# CONFIG_NLS_CODEPAGE_775 is not set
730# CONFIG_NLS_CODEPAGE_850 is not set
731# CONFIG_NLS_CODEPAGE_852 is not set
732# CONFIG_NLS_CODEPAGE_855 is not set
733# CONFIG_NLS_CODEPAGE_857 is not set
734# CONFIG_NLS_CODEPAGE_860 is not set
735# CONFIG_NLS_CODEPAGE_861 is not set
736# CONFIG_NLS_CODEPAGE_862 is not set
737# CONFIG_NLS_CODEPAGE_863 is not set
738# CONFIG_NLS_CODEPAGE_864 is not set
739# CONFIG_NLS_CODEPAGE_865 is not set
740# CONFIG_NLS_CODEPAGE_866 is not set
741# CONFIG_NLS_CODEPAGE_869 is not set
742# CONFIG_NLS_CODEPAGE_936 is not set
743# CONFIG_NLS_CODEPAGE_950 is not set
744# CONFIG_NLS_CODEPAGE_932 is not set
745# CONFIG_NLS_CODEPAGE_949 is not set
746# CONFIG_NLS_CODEPAGE_874 is not set
747# CONFIG_NLS_ISO8859_8 is not set
748# CONFIG_NLS_CODEPAGE_1250 is not set
749# CONFIG_NLS_CODEPAGE_1251 is not set
750# CONFIG_NLS_ASCII is not set
751# CONFIG_NLS_ISO8859_1 is not set
752# CONFIG_NLS_ISO8859_2 is not set
753# CONFIG_NLS_ISO8859_3 is not set
754# CONFIG_NLS_ISO8859_4 is not set
755# CONFIG_NLS_ISO8859_5 is not set
756# CONFIG_NLS_ISO8859_6 is not set
757# CONFIG_NLS_ISO8859_7 is not set
758# CONFIG_NLS_ISO8859_9 is not set
759# CONFIG_NLS_ISO8859_13 is not set
760# CONFIG_NLS_ISO8859_14 is not set
761# CONFIG_NLS_ISO8859_15 is not set
762# CONFIG_NLS_KOI8_R is not set
763# CONFIG_NLS_KOI8_U is not set
764# CONFIG_NLS_UTF8 is not set
765
766#
767# Profiling support
768#
769# CONFIG_PROFILING is not set
770
771#
772# Kernel hacking
773#
774# CONFIG_DEBUG_KERNEL is not set
775CONFIG_CROSSCOMPILE=y
776CONFIG_CMDLINE=""
777
778#
779# Security options
780#
781CONFIG_KEYS=y
782CONFIG_KEYS_DEBUG_PROC_KEYS=y
783# CONFIG_SECURITY is not set
784
785#
786# Cryptographic options
787#
788CONFIG_CRYPTO=y
789CONFIG_CRYPTO_HMAC=y
790CONFIG_CRYPTO_NULL=y
791# CONFIG_CRYPTO_MD4 is not set
792# CONFIG_CRYPTO_MD5 is not set
793# CONFIG_CRYPTO_SHA1 is not set
794# CONFIG_CRYPTO_SHA256 is not set
795CONFIG_CRYPTO_SHA512=y
796CONFIG_CRYPTO_WP512=m
797# CONFIG_CRYPTO_DES is not set
798# CONFIG_CRYPTO_BLOWFISH is not set
799CONFIG_CRYPTO_TWOFISH=y
800# CONFIG_CRYPTO_SERPENT is not set
801CONFIG_CRYPTO_AES=m
802# CONFIG_CRYPTO_CAST5 is not set
803# CONFIG_CRYPTO_CAST6 is not set
804CONFIG_CRYPTO_TEA=m
805# CONFIG_CRYPTO_ARC4 is not set
806CONFIG_CRYPTO_KHAZAD=m
807CONFIG_CRYPTO_ANUBIS=m
808CONFIG_CRYPTO_DEFLATE=y
809CONFIG_CRYPTO_MICHAEL_MIC=y
810CONFIG_CRYPTO_CRC32C=m
811# CONFIG_CRYPTO_TEST is not set
812
813#
814# Hardware crypto devices
815#
816
817#
818# Library routines
819#
820CONFIG_CRC_CCITT=m
821CONFIG_CRC32=y
822CONFIG_LIBCRC32C=m
823CONFIG_ZLIB_INFLATE=y
824CONFIG_ZLIB_DEFLATE=y
825CONFIG_GENERIC_HARDIRQS=y
826CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
new file mode 100644
index 000000000000..2aebbd2e82b3
--- /dev/null
+++ b/arch/mips/configs/pb1500_defconfig
@@ -0,0 +1,855 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:09 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83CONFIG_SOC_AU1X00=y
84# CONFIG_SOC_AU1000 is not set
85# CONFIG_SOC_AU1100 is not set
86CONFIG_SOC_AU1500=y
87# CONFIG_SOC_AU1550 is not set
88# CONFIG_MIPS_PB1000 is not set
89# CONFIG_MIPS_PB1100 is not set
90CONFIG_MIPS_PB1500=y
91# CONFIG_MIPS_PB1550 is not set
92# CONFIG_MIPS_DB1000 is not set
93# CONFIG_MIPS_DB1100 is not set
94# CONFIG_MIPS_DB1500 is not set
95# CONFIG_MIPS_DB1550 is not set
96# CONFIG_MIPS_BOSPORUS is not set
97# CONFIG_MIPS_MIRAGE is not set
98# CONFIG_MIPS_XXS1500 is not set
99# CONFIG_MIPS_MTX1 is not set
100# CONFIG_SIBYTE_SB1xxx_SOC is not set
101# CONFIG_SNI_RM200_PCI is not set
102# CONFIG_TOSHIBA_RBTX4927 is not set
103CONFIG_RWSEM_GENERIC_SPINLOCK=y
104CONFIG_GENERIC_CALIBRATE_DELAY=y
105CONFIG_HAVE_DEC_LOCK=y
106CONFIG_DMA_COHERENT=y
107CONFIG_CPU_LITTLE_ENDIAN=y
108# CONFIG_AU1X00_USB_DEVICE is not set
109CONFIG_MIPS_L1_CACHE_SHIFT=5
110
111#
112# CPU selection
113#
114CONFIG_CPU_MIPS32=y
115# CONFIG_CPU_MIPS64 is not set
116# CONFIG_CPU_R3000 is not set
117# CONFIG_CPU_TX39XX is not set
118# CONFIG_CPU_VR41XX is not set
119# CONFIG_CPU_R4300 is not set
120# CONFIG_CPU_R4X00 is not set
121# CONFIG_CPU_TX49XX is not set
122# CONFIG_CPU_R5000 is not set
123# CONFIG_CPU_R5432 is not set
124# CONFIG_CPU_R6000 is not set
125# CONFIG_CPU_NEVADA is not set
126# CONFIG_CPU_R8000 is not set
127# CONFIG_CPU_R10000 is not set
128# CONFIG_CPU_RM7000 is not set
129# CONFIG_CPU_RM9000 is not set
130# CONFIG_CPU_SB1 is not set
131CONFIG_PAGE_SIZE_4KB=y
132# CONFIG_PAGE_SIZE_8KB is not set
133# CONFIG_PAGE_SIZE_16KB is not set
134# CONFIG_PAGE_SIZE_64KB is not set
135CONFIG_CPU_HAS_PREFETCH=y
136CONFIG_64BIT_PHYS_ADDR=y
137# CONFIG_CPU_ADVANCED is not set
138CONFIG_CPU_HAS_LLSC=y
139CONFIG_CPU_HAS_SYNC=y
140# CONFIG_PREEMPT is not set
141
142#
143# Bus options (PCI, PCMCIA, EISA, ISA, TC)
144#
145CONFIG_HW_HAS_PCI=y
146CONFIG_PCI=y
147CONFIG_PCI_LEGACY_PROC=y
148CONFIG_PCI_NAMES=y
149CONFIG_MMU=y
150
151#
152# PCCARD (PCMCIA/CardBus) support
153#
154CONFIG_PCCARD=m
155# CONFIG_PCMCIA_DEBUG is not set
156CONFIG_PCMCIA=m
157CONFIG_CARDBUS=y
158
159#
160# PC-card bridges
161#
162# CONFIG_YENTA is not set
163CONFIG_PD6729=m
164# CONFIG_I82092 is not set
165# CONFIG_TCIC is not set
166# CONFIG_PCMCIA_AU1X00 is not set
167CONFIG_PCCARD_NONSTATIC=m
168
169#
170# PCI Hotplug Support
171#
172# CONFIG_HOTPLUG_PCI is not set
173
174#
175# Executable file formats
176#
177CONFIG_BINFMT_ELF=y
178# CONFIG_BINFMT_MISC is not set
179CONFIG_TRAD_SIGNALS=y
180
181#
182# Device Drivers
183#
184
185#
186# Generic Driver Options
187#
188CONFIG_STANDALONE=y
189CONFIG_PREVENT_FIRMWARE_BUILD=y
190# CONFIG_FW_LOADER is not set
191
192#
193# Memory Technology Devices (MTD)
194#
195# CONFIG_MTD is not set
196
197#
198# Parallel port support
199#
200# CONFIG_PARPORT is not set
201
202#
203# Plug and Play support
204#
205
206#
207# Block devices
208#
209# CONFIG_BLK_DEV_FD is not set
210# CONFIG_BLK_CPQ_DA is not set
211# CONFIG_BLK_CPQ_CISS_DA is not set
212# CONFIG_BLK_DEV_DAC960 is not set
213# CONFIG_BLK_DEV_UMEM is not set
214# CONFIG_BLK_DEV_COW_COMMON is not set
215CONFIG_BLK_DEV_LOOP=y
216# CONFIG_BLK_DEV_CRYPTOLOOP is not set
217# CONFIG_BLK_DEV_NBD is not set
218# CONFIG_BLK_DEV_SX8 is not set
219# CONFIG_BLK_DEV_RAM is not set
220CONFIG_BLK_DEV_RAM_COUNT=16
221CONFIG_INITRAMFS_SOURCE=""
222# CONFIG_LBD is not set
223CONFIG_CDROM_PKTCDVD=m
224CONFIG_CDROM_PKTCDVD_BUFFERS=8
225# CONFIG_CDROM_PKTCDVD_WCACHE is not set
226
227#
228# IO Schedulers
229#
230CONFIG_IOSCHED_NOOP=y
231CONFIG_IOSCHED_AS=y
232CONFIG_IOSCHED_DEADLINE=y
233CONFIG_IOSCHED_CFQ=y
234CONFIG_ATA_OVER_ETH=m
235
236#
237# ATA/ATAPI/MFM/RLL support
238#
239CONFIG_IDE=y
240CONFIG_BLK_DEV_IDE=y
241
242#
243# Please see Documentation/ide.txt for help/info on IDE drives
244#
245# CONFIG_BLK_DEV_IDE_SATA is not set
246CONFIG_BLK_DEV_IDEDISK=y
247# CONFIG_IDEDISK_MULTI_MODE is not set
248CONFIG_BLK_DEV_IDECS=m
249# CONFIG_BLK_DEV_IDECD is not set
250# CONFIG_BLK_DEV_IDETAPE is not set
251# CONFIG_BLK_DEV_IDEFLOPPY is not set
252# CONFIG_IDE_TASK_IOCTL is not set
253
254#
255# IDE chipset support/bugfixes
256#
257CONFIG_IDE_GENERIC=y
258CONFIG_BLK_DEV_IDEPCI=y
259# CONFIG_IDEPCI_SHARE_IRQ is not set
260# CONFIG_BLK_DEV_OFFBOARD is not set
261CONFIG_BLK_DEV_GENERIC=y
262# CONFIG_BLK_DEV_OPTI621 is not set
263CONFIG_BLK_DEV_IDEDMA_PCI=y
264# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
265# CONFIG_IDEDMA_PCI_AUTO is not set
266# CONFIG_BLK_DEV_AEC62XX is not set
267# CONFIG_BLK_DEV_ALI15X3 is not set
268# CONFIG_BLK_DEV_AMD74XX is not set
269# CONFIG_BLK_DEV_CMD64X is not set
270# CONFIG_BLK_DEV_TRIFLEX is not set
271# CONFIG_BLK_DEV_CY82C693 is not set
272# CONFIG_BLK_DEV_CS5520 is not set
273# CONFIG_BLK_DEV_CS5530 is not set
274# CONFIG_BLK_DEV_HPT34X is not set
275CONFIG_BLK_DEV_HPT366=y
276# CONFIG_BLK_DEV_SC1200 is not set
277# CONFIG_BLK_DEV_PIIX is not set
278# CONFIG_BLK_DEV_NS87415 is not set
279# CONFIG_BLK_DEV_PDC202XX_OLD is not set
280# CONFIG_BLK_DEV_PDC202XX_NEW is not set
281# CONFIG_BLK_DEV_SVWKS is not set
282# CONFIG_BLK_DEV_SIIMAGE is not set
283# CONFIG_BLK_DEV_SLC90E66 is not set
284# CONFIG_BLK_DEV_TRM290 is not set
285# CONFIG_BLK_DEV_VIA82CXXX is not set
286# CONFIG_IDE_ARM is not set
287CONFIG_BLK_DEV_IDEDMA=y
288# CONFIG_IDEDMA_IVB is not set
289# CONFIG_IDEDMA_AUTO is not set
290# CONFIG_BLK_DEV_HD is not set
291
292#
293# SCSI device support
294#
295# CONFIG_SCSI is not set
296
297#
298# Multi-device support (RAID and LVM)
299#
300# CONFIG_MD is not set
301
302#
303# Fusion MPT device support
304#
305
306#
307# IEEE 1394 (FireWire) support
308#
309# CONFIG_IEEE1394 is not set
310
311#
312# I2O device support
313#
314# CONFIG_I2O is not set
315
316#
317# Networking support
318#
319CONFIG_NET=y
320
321#
322# Networking options
323#
324CONFIG_PACKET=y
325# CONFIG_PACKET_MMAP is not set
326CONFIG_NETLINK_DEV=y
327CONFIG_UNIX=y
328CONFIG_NET_KEY=y
329CONFIG_INET=y
330CONFIG_IP_MULTICAST=y
331# CONFIG_IP_ADVANCED_ROUTER is not set
332CONFIG_IP_PNP=y
333# CONFIG_IP_PNP_DHCP is not set
334CONFIG_IP_PNP_BOOTP=y
335# CONFIG_IP_PNP_RARP is not set
336# CONFIG_NET_IPIP is not set
337# CONFIG_NET_IPGRE is not set
338# CONFIG_IP_MROUTE is not set
339# CONFIG_ARPD is not set
340# CONFIG_SYN_COOKIES is not set
341# CONFIG_INET_AH is not set
342# CONFIG_INET_ESP is not set
343# CONFIG_INET_IPCOMP is not set
344CONFIG_INET_TUNNEL=m
345CONFIG_IP_TCPDIAG=m
346# CONFIG_IP_TCPDIAG_IPV6 is not set
347
348#
349# IP: Virtual Server Configuration
350#
351# CONFIG_IP_VS is not set
352# CONFIG_IPV6 is not set
353CONFIG_NETFILTER=y
354# CONFIG_NETFILTER_DEBUG is not set
355
356#
357# IP: Netfilter Configuration
358#
359# CONFIG_IP_NF_CONNTRACK is not set
360CONFIG_IP_NF_CONNTRACK_MARK=y
361# CONFIG_IP_NF_QUEUE is not set
362# CONFIG_IP_NF_IPTABLES is not set
363# CONFIG_IP_NF_ARPTABLES is not set
364CONFIG_XFRM=y
365CONFIG_XFRM_USER=m
366
367#
368# SCTP Configuration (EXPERIMENTAL)
369#
370# CONFIG_IP_SCTP is not set
371# CONFIG_ATM is not set
372# CONFIG_BRIDGE is not set
373# CONFIG_VLAN_8021Q is not set
374# CONFIG_DECNET is not set
375# CONFIG_LLC2 is not set
376# CONFIG_IPX is not set
377# CONFIG_ATALK is not set
378# CONFIG_X25 is not set
379# CONFIG_LAPB is not set
380# CONFIG_NET_DIVERT is not set
381# CONFIG_ECONET is not set
382# CONFIG_WAN_ROUTER is not set
383
384#
385# QoS and/or fair queueing
386#
387# CONFIG_NET_SCHED is not set
388# CONFIG_NET_CLS_ROUTE is not set
389
390#
391# Network testing
392#
393# CONFIG_NET_PKTGEN is not set
394# CONFIG_NETPOLL is not set
395# CONFIG_NET_POLL_CONTROLLER is not set
396# CONFIG_HAMRADIO is not set
397# CONFIG_IRDA is not set
398# CONFIG_BT is not set
399CONFIG_NETDEVICES=y
400# CONFIG_DUMMY is not set
401# CONFIG_BONDING is not set
402# CONFIG_EQUALIZER is not set
403# CONFIG_TUN is not set
404# CONFIG_ETHERTAP is not set
405
406#
407# ARCnet devices
408#
409# CONFIG_ARCNET is not set
410
411#
412# Ethernet (10 or 100Mbit)
413#
414CONFIG_NET_ETHERNET=y
415CONFIG_MII=m
416CONFIG_MIPS_AU1X00_ENET=y
417# CONFIG_HAPPYMEAL is not set
418# CONFIG_SUNGEM is not set
419# CONFIG_NET_VENDOR_3COM is not set
420
421#
422# Tulip family network device support
423#
424# CONFIG_NET_TULIP is not set
425# CONFIG_HP100 is not set
426# CONFIG_NET_PCI is not set
427
428#
429# Ethernet (1000 Mbit)
430#
431# CONFIG_ACENIC is not set
432# CONFIG_DL2K is not set
433# CONFIG_E1000 is not set
434# CONFIG_NS83820 is not set
435# CONFIG_HAMACHI is not set
436# CONFIG_YELLOWFIN is not set
437# CONFIG_R8169 is not set
438# CONFIG_SK98LIN is not set
439# CONFIG_TIGON3 is not set
440
441#
442# Ethernet (10000 Mbit)
443#
444# CONFIG_IXGB is not set
445# CONFIG_S2IO is not set
446
447#
448# Token Ring devices
449#
450# CONFIG_TR is not set
451
452#
453# Wireless LAN (non-hamradio)
454#
455# CONFIG_NET_RADIO is not set
456
457#
458# PCMCIA network device support
459#
460CONFIG_NET_PCMCIA=y
461CONFIG_PCMCIA_3C589=m
462CONFIG_PCMCIA_3C574=m
463CONFIG_PCMCIA_FMVJ18X=m
464CONFIG_PCMCIA_PCNET=m
465CONFIG_PCMCIA_NMCLAN=m
466CONFIG_PCMCIA_SMC91C92=m
467CONFIG_PCMCIA_XIRC2PS=m
468CONFIG_PCMCIA_AXNET=m
469
470#
471# Wan interfaces
472#
473# CONFIG_WAN is not set
474# CONFIG_FDDI is not set
475# CONFIG_HIPPI is not set
476CONFIG_PPP=m
477CONFIG_PPP_MULTILINK=y
478# CONFIG_PPP_FILTER is not set
479CONFIG_PPP_ASYNC=m
480# CONFIG_PPP_SYNC_TTY is not set
481CONFIG_PPP_DEFLATE=m
482# CONFIG_PPP_BSDCOMP is not set
483CONFIG_PPPOE=m
484# CONFIG_SLIP is not set
485# CONFIG_SHAPER is not set
486# CONFIG_NETCONSOLE is not set
487
488#
489# ISDN subsystem
490#
491# CONFIG_ISDN is not set
492
493#
494# Telephony Support
495#
496# CONFIG_PHONE is not set
497
498#
499# Input device support
500#
501CONFIG_INPUT=y
502
503#
504# Userland interfaces
505#
506CONFIG_INPUT_MOUSEDEV=y
507CONFIG_INPUT_MOUSEDEV_PSAUX=y
508CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
509CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
510# CONFIG_INPUT_JOYDEV is not set
511# CONFIG_INPUT_TSDEV is not set
512CONFIG_INPUT_EVDEV=y
513# CONFIG_INPUT_EVBUG is not set
514
515#
516# Input I/O drivers
517#
518# CONFIG_GAMEPORT is not set
519CONFIG_SOUND_GAMEPORT=y
520CONFIG_SERIO=y
521# CONFIG_SERIO_I8042 is not set
522CONFIG_SERIO_SERPORT=y
523# CONFIG_SERIO_CT82C710 is not set
524# CONFIG_SERIO_PCIPS2 is not set
525# CONFIG_SERIO_LIBPS2 is not set
526CONFIG_SERIO_RAW=m
527
528#
529# Input Device Drivers
530#
531# CONFIG_INPUT_KEYBOARD is not set
532# CONFIG_INPUT_MOUSE is not set
533# CONFIG_INPUT_JOYSTICK is not set
534# CONFIG_INPUT_TOUCHSCREEN is not set
535# CONFIG_INPUT_MISC is not set
536
537#
538# Character devices
539#
540# CONFIG_VT is not set
541# CONFIG_SERIAL_NONSTANDARD is not set
542# CONFIG_AU1X00_GPIO is not set
543# CONFIG_TS_AU1X00_ADS7846 is not set
544
545#
546# Serial drivers
547#
548# CONFIG_SERIAL_8250 is not set
549
550#
551# Non-8250 serial port support
552#
553CONFIG_SERIAL_AU1X00=y
554CONFIG_SERIAL_AU1X00_CONSOLE=y
555CONFIG_SERIAL_CORE=y
556CONFIG_SERIAL_CORE_CONSOLE=y
557CONFIG_UNIX98_PTYS=y
558CONFIG_LEGACY_PTYS=y
559CONFIG_LEGACY_PTY_COUNT=256
560
561#
562# IPMI
563#
564# CONFIG_IPMI_HANDLER is not set
565
566#
567# Watchdog Cards
568#
569# CONFIG_WATCHDOG is not set
570# CONFIG_RTC is not set
571# CONFIG_GEN_RTC is not set
572# CONFIG_DTLK is not set
573# CONFIG_R3964 is not set
574# CONFIG_APPLICOM is not set
575
576#
577# Ftape, the floppy tape device driver
578#
579# CONFIG_DRM is not set
580
581#
582# PCMCIA character devices
583#
584CONFIG_SYNCLINK_CS=m
585# CONFIG_RAW_DRIVER is not set
586
587#
588# I2C support
589#
590# CONFIG_I2C is not set
591
592#
593# Dallas's 1-wire bus
594#
595# CONFIG_W1 is not set
596
597#
598# Misc devices
599#
600
601#
602# Multimedia devices
603#
604# CONFIG_VIDEO_DEV is not set
605
606#
607# Digital Video Broadcasting Devices
608#
609# CONFIG_DVB is not set
610
611#
612# Graphics support
613#
614# CONFIG_FB is not set
615# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
616
617#
618# Sound
619#
620# CONFIG_SOUND is not set
621
622#
623# USB support
624#
625# CONFIG_USB is not set
626CONFIG_USB_ARCH_HAS_HCD=y
627CONFIG_USB_ARCH_HAS_OHCI=y
628
629#
630# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
631#
632
633#
634# USB Gadget Support
635#
636# CONFIG_USB_GADGET is not set
637
638#
639# MMC/SD Card support
640#
641# CONFIG_MMC is not set
642
643#
644# InfiniBand support
645#
646# CONFIG_INFINIBAND is not set
647
648#
649# File systems
650#
651CONFIG_EXT2_FS=y
652CONFIG_EXT2_FS_XATTR=y
653CONFIG_EXT2_FS_POSIX_ACL=y
654# CONFIG_EXT2_FS_SECURITY is not set
655CONFIG_EXT3_FS=y
656CONFIG_EXT3_FS_XATTR=y
657CONFIG_EXT3_FS_POSIX_ACL=y
658CONFIG_EXT3_FS_SECURITY=y
659CONFIG_JBD=y
660# CONFIG_JBD_DEBUG is not set
661CONFIG_FS_MBCACHE=y
662CONFIG_REISERFS_FS=m
663# CONFIG_REISERFS_CHECK is not set
664# CONFIG_REISERFS_PROC_INFO is not set
665CONFIG_REISERFS_FS_XATTR=y
666CONFIG_REISERFS_FS_POSIX_ACL=y
667CONFIG_REISERFS_FS_SECURITY=y
668# CONFIG_JFS_FS is not set
669CONFIG_FS_POSIX_ACL=y
670# CONFIG_XFS_FS is not set
671# CONFIG_MINIX_FS is not set
672# CONFIG_ROMFS_FS is not set
673# CONFIG_QUOTA is not set
674CONFIG_DNOTIFY=y
675CONFIG_AUTOFS_FS=m
676CONFIG_AUTOFS4_FS=m
677
678#
679# CD-ROM/DVD Filesystems
680#
681# CONFIG_ISO9660_FS is not set
682# CONFIG_UDF_FS is not set
683
684#
685# DOS/FAT/NT Filesystems
686#
687# CONFIG_MSDOS_FS is not set
688# CONFIG_VFAT_FS is not set
689# CONFIG_NTFS_FS is not set
690
691#
692# Pseudo filesystems
693#
694CONFIG_PROC_FS=y
695CONFIG_PROC_KCORE=y
696CONFIG_SYSFS=y
697# CONFIG_DEVFS_FS is not set
698CONFIG_DEVPTS_FS_XATTR=y
699CONFIG_DEVPTS_FS_SECURITY=y
700CONFIG_TMPFS=y
701# CONFIG_TMPFS_XATTR is not set
702# CONFIG_HUGETLB_PAGE is not set
703CONFIG_RAMFS=y
704
705#
706# Miscellaneous filesystems
707#
708# CONFIG_ADFS_FS is not set
709# CONFIG_AFFS_FS is not set
710# CONFIG_HFS_FS is not set
711# CONFIG_HFSPLUS_FS is not set
712# CONFIG_BEFS_FS is not set
713# CONFIG_BFS_FS is not set
714# CONFIG_EFS_FS is not set
715CONFIG_CRAMFS=m
716# CONFIG_VXFS_FS is not set
717# CONFIG_HPFS_FS is not set
718# CONFIG_QNX4FS_FS is not set
719# CONFIG_SYSV_FS is not set
720# CONFIG_UFS_FS is not set
721
722#
723# Network File Systems
724#
725CONFIG_NFS_FS=y
726# CONFIG_NFS_V3 is not set
727# CONFIG_NFS_V4 is not set
728# CONFIG_NFS_DIRECTIO is not set
729CONFIG_NFSD=m
730# CONFIG_NFSD_V3 is not set
731# CONFIG_NFSD_TCP is not set
732CONFIG_ROOT_NFS=y
733CONFIG_LOCKD=y
734CONFIG_EXPORTFS=m
735CONFIG_SUNRPC=y
736# CONFIG_RPCSEC_GSS_KRB5 is not set
737# CONFIG_RPCSEC_GSS_SPKM3 is not set
738CONFIG_SMB_FS=m
739# CONFIG_SMB_NLS_DEFAULT is not set
740# CONFIG_CIFS is not set
741# CONFIG_NCP_FS is not set
742# CONFIG_CODA_FS is not set
743# CONFIG_AFS_FS is not set
744
745#
746# Partition Types
747#
748# CONFIG_PARTITION_ADVANCED is not set
749CONFIG_MSDOS_PARTITION=y
750
751#
752# Native Language Support
753#
754CONFIG_NLS=m
755CONFIG_NLS_DEFAULT="iso8859-1"
756# CONFIG_NLS_CODEPAGE_437 is not set
757# CONFIG_NLS_CODEPAGE_737 is not set
758# CONFIG_NLS_CODEPAGE_775 is not set
759# CONFIG_NLS_CODEPAGE_850 is not set
760# CONFIG_NLS_CODEPAGE_852 is not set
761# CONFIG_NLS_CODEPAGE_855 is not set
762# CONFIG_NLS_CODEPAGE_857 is not set
763# CONFIG_NLS_CODEPAGE_860 is not set
764# CONFIG_NLS_CODEPAGE_861 is not set
765# CONFIG_NLS_CODEPAGE_862 is not set
766# CONFIG_NLS_CODEPAGE_863 is not set
767# CONFIG_NLS_CODEPAGE_864 is not set
768# CONFIG_NLS_CODEPAGE_865 is not set
769# CONFIG_NLS_CODEPAGE_866 is not set
770# CONFIG_NLS_CODEPAGE_869 is not set
771# CONFIG_NLS_CODEPAGE_936 is not set
772# CONFIG_NLS_CODEPAGE_950 is not set
773# CONFIG_NLS_CODEPAGE_932 is not set
774# CONFIG_NLS_CODEPAGE_949 is not set
775# CONFIG_NLS_CODEPAGE_874 is not set
776# CONFIG_NLS_ISO8859_8 is not set
777# CONFIG_NLS_CODEPAGE_1250 is not set
778# CONFIG_NLS_CODEPAGE_1251 is not set
779# CONFIG_NLS_ASCII is not set
780# CONFIG_NLS_ISO8859_1 is not set
781# CONFIG_NLS_ISO8859_2 is not set
782# CONFIG_NLS_ISO8859_3 is not set
783# CONFIG_NLS_ISO8859_4 is not set
784# CONFIG_NLS_ISO8859_5 is not set
785# CONFIG_NLS_ISO8859_6 is not set
786# CONFIG_NLS_ISO8859_7 is not set
787# CONFIG_NLS_ISO8859_9 is not set
788# CONFIG_NLS_ISO8859_13 is not set
789# CONFIG_NLS_ISO8859_14 is not set
790# CONFIG_NLS_ISO8859_15 is not set
791# CONFIG_NLS_KOI8_R is not set
792# CONFIG_NLS_KOI8_U is not set
793# CONFIG_NLS_UTF8 is not set
794
795#
796# Profiling support
797#
798# CONFIG_PROFILING is not set
799
800#
801# Kernel hacking
802#
803# CONFIG_DEBUG_KERNEL is not set
804CONFIG_CROSSCOMPILE=y
805CONFIG_CMDLINE=""
806
807#
808# Security options
809#
810CONFIG_KEYS=y
811CONFIG_KEYS_DEBUG_PROC_KEYS=y
812# CONFIG_SECURITY is not set
813
814#
815# Cryptographic options
816#
817CONFIG_CRYPTO=y
818CONFIG_CRYPTO_HMAC=y
819CONFIG_CRYPTO_NULL=y
820# CONFIG_CRYPTO_MD4 is not set
821# CONFIG_CRYPTO_MD5 is not set
822# CONFIG_CRYPTO_SHA1 is not set
823# CONFIG_CRYPTO_SHA256 is not set
824CONFIG_CRYPTO_SHA512=y
825CONFIG_CRYPTO_WP512=m
826# CONFIG_CRYPTO_DES is not set
827# CONFIG_CRYPTO_BLOWFISH is not set
828CONFIG_CRYPTO_TWOFISH=y
829# CONFIG_CRYPTO_SERPENT is not set
830CONFIG_CRYPTO_AES=m
831# CONFIG_CRYPTO_CAST5 is not set
832# CONFIG_CRYPTO_CAST6 is not set
833CONFIG_CRYPTO_TEA=m
834# CONFIG_CRYPTO_ARC4 is not set
835CONFIG_CRYPTO_KHAZAD=m
836CONFIG_CRYPTO_ANUBIS=m
837CONFIG_CRYPTO_DEFLATE=y
838CONFIG_CRYPTO_MICHAEL_MIC=y
839# CONFIG_CRYPTO_CRC32C is not set
840# CONFIG_CRYPTO_TEST is not set
841
842#
843# Hardware crypto devices
844#
845
846#
847# Library routines
848#
849CONFIG_CRC_CCITT=m
850CONFIG_CRC32=y
851# CONFIG_LIBCRC32C is not set
852CONFIG_ZLIB_INFLATE=y
853CONFIG_ZLIB_DEFLATE=y
854CONFIG_GENERIC_HARDIRQS=y
855CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
new file mode 100644
index 000000000000..9e21edc28280
--- /dev/null
+++ b/arch/mips/configs/pb1550_defconfig
@@ -0,0 +1,847 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:09 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29CONFIG_HOTPLUG=y
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MIPS_COBALT is not set
63# CONFIG_MACH_DECSTATION is not set
64# CONFIG_MIPS_EV64120 is not set
65# CONFIG_MIPS_EV96100 is not set
66# CONFIG_MIPS_IVR is not set
67# CONFIG_LASAT is not set
68# CONFIG_MIPS_ITE8172 is not set
69# CONFIG_MIPS_ATLAS is not set
70# CONFIG_MIPS_MALTA is not set
71# CONFIG_MIPS_SEAD is not set
72# CONFIG_MOMENCO_OCELOT is not set
73# CONFIG_MOMENCO_OCELOT_G is not set
74# CONFIG_MOMENCO_OCELOT_C is not set
75# CONFIG_MOMENCO_OCELOT_3 is not set
76# CONFIG_MOMENCO_JAGUAR_ATX is not set
77# CONFIG_PMC_YOSEMITE is not set
78# CONFIG_DDB5074 is not set
79# CONFIG_DDB5476 is not set
80# CONFIG_DDB5477 is not set
81# CONFIG_NEC_OSPREY is not set
82# CONFIG_SGI_IP22 is not set
83CONFIG_SOC_AU1X00=y
84# CONFIG_SOC_AU1000 is not set
85# CONFIG_SOC_AU1100 is not set
86# CONFIG_SOC_AU1500 is not set
87CONFIG_SOC_AU1550=y
88# CONFIG_MIPS_PB1000 is not set
89# CONFIG_MIPS_PB1100 is not set
90# CONFIG_MIPS_PB1500 is not set
91CONFIG_MIPS_PB1550=y
92# CONFIG_MIPS_DB1000 is not set
93# CONFIG_MIPS_DB1100 is not set
94# CONFIG_MIPS_DB1500 is not set
95# CONFIG_MIPS_DB1550 is not set
96# CONFIG_MIPS_BOSPORUS is not set
97# CONFIG_MIPS_MIRAGE is not set
98# CONFIG_MIPS_XXS1500 is not set
99# CONFIG_MIPS_MTX1 is not set
100# CONFIG_SIBYTE_SB1xxx_SOC is not set
101# CONFIG_SNI_RM200_PCI is not set
102# CONFIG_TOSHIBA_RBTX4927 is not set
103CONFIG_RWSEM_GENERIC_SPINLOCK=y
104CONFIG_GENERIC_CALIBRATE_DELAY=y
105CONFIG_HAVE_DEC_LOCK=y
106CONFIG_DMA_COHERENT=y
107CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
108CONFIG_CPU_LITTLE_ENDIAN=y
109CONFIG_MIPS_L1_CACHE_SHIFT=5
110
111#
112# CPU selection
113#
114CONFIG_CPU_MIPS32=y
115# CONFIG_CPU_MIPS64 is not set
116# CONFIG_CPU_R3000 is not set
117# CONFIG_CPU_TX39XX is not set
118# CONFIG_CPU_VR41XX is not set
119# CONFIG_CPU_R4300 is not set
120# CONFIG_CPU_R4X00 is not set
121# CONFIG_CPU_TX49XX is not set
122# CONFIG_CPU_R5000 is not set
123# CONFIG_CPU_R5432 is not set
124# CONFIG_CPU_R6000 is not set
125# CONFIG_CPU_NEVADA is not set
126# CONFIG_CPU_R8000 is not set
127# CONFIG_CPU_R10000 is not set
128# CONFIG_CPU_RM7000 is not set
129# CONFIG_CPU_RM9000 is not set
130# CONFIG_CPU_SB1 is not set
131CONFIG_PAGE_SIZE_4KB=y
132# CONFIG_PAGE_SIZE_8KB is not set
133# CONFIG_PAGE_SIZE_16KB is not set
134# CONFIG_PAGE_SIZE_64KB is not set
135CONFIG_CPU_HAS_PREFETCH=y
136CONFIG_64BIT_PHYS_ADDR=y
137# CONFIG_CPU_ADVANCED is not set
138CONFIG_CPU_HAS_LLSC=y
139CONFIG_CPU_HAS_SYNC=y
140# CONFIG_PREEMPT is not set
141
142#
143# Bus options (PCI, PCMCIA, EISA, ISA, TC)
144#
145CONFIG_HW_HAS_PCI=y
146CONFIG_PCI=y
147CONFIG_PCI_LEGACY_PROC=y
148CONFIG_PCI_NAMES=y
149CONFIG_MMU=y
150
151#
152# PCCARD (PCMCIA/CardBus) support
153#
154CONFIG_PCCARD=m
155# CONFIG_PCMCIA_DEBUG is not set
156CONFIG_PCMCIA=m
157CONFIG_CARDBUS=y
158
159#
160# PC-card bridges
161#
162# CONFIG_YENTA is not set
163CONFIG_PD6729=m
164# CONFIG_I82092 is not set
165# CONFIG_TCIC is not set
166# CONFIG_PCMCIA_AU1X00 is not set
167CONFIG_PCCARD_NONSTATIC=m
168
169#
170# PCI Hotplug Support
171#
172# CONFIG_HOTPLUG_PCI is not set
173
174#
175# Executable file formats
176#
177CONFIG_BINFMT_ELF=y
178# CONFIG_BINFMT_MISC is not set
179CONFIG_TRAD_SIGNALS=y
180
181#
182# Device Drivers
183#
184
185#
186# Generic Driver Options
187#
188CONFIG_STANDALONE=y
189CONFIG_PREVENT_FIRMWARE_BUILD=y
190# CONFIG_FW_LOADER is not set
191
192#
193# Memory Technology Devices (MTD)
194#
195# CONFIG_MTD is not set
196
197#
198# Parallel port support
199#
200# CONFIG_PARPORT is not set
201
202#
203# Plug and Play support
204#
205
206#
207# Block devices
208#
209# CONFIG_BLK_DEV_FD is not set
210# CONFIG_BLK_CPQ_DA is not set
211# CONFIG_BLK_CPQ_CISS_DA is not set
212# CONFIG_BLK_DEV_DAC960 is not set
213# CONFIG_BLK_DEV_UMEM is not set
214# CONFIG_BLK_DEV_COW_COMMON is not set
215CONFIG_BLK_DEV_LOOP=y
216# CONFIG_BLK_DEV_CRYPTOLOOP is not set
217# CONFIG_BLK_DEV_NBD is not set
218# CONFIG_BLK_DEV_SX8 is not set
219# CONFIG_BLK_DEV_RAM is not set
220CONFIG_BLK_DEV_RAM_COUNT=16
221CONFIG_INITRAMFS_SOURCE=""
222# CONFIG_LBD is not set
223CONFIG_CDROM_PKTCDVD=m
224CONFIG_CDROM_PKTCDVD_BUFFERS=8
225# CONFIG_CDROM_PKTCDVD_WCACHE is not set
226
227#
228# IO Schedulers
229#
230CONFIG_IOSCHED_NOOP=y
231CONFIG_IOSCHED_AS=y
232CONFIG_IOSCHED_DEADLINE=y
233CONFIG_IOSCHED_CFQ=y
234CONFIG_ATA_OVER_ETH=m
235
236#
237# ATA/ATAPI/MFM/RLL support
238#
239CONFIG_IDE=y
240CONFIG_BLK_DEV_IDE=y
241
242#
243# Please see Documentation/ide.txt for help/info on IDE drives
244#
245# CONFIG_BLK_DEV_IDE_SATA is not set
246CONFIG_BLK_DEV_IDEDISK=y
247# CONFIG_IDEDISK_MULTI_MODE is not set
248CONFIG_BLK_DEV_IDECS=m
249# CONFIG_BLK_DEV_IDECD is not set
250# CONFIG_BLK_DEV_IDETAPE is not set
251# CONFIG_BLK_DEV_IDEFLOPPY is not set
252# CONFIG_IDE_TASK_IOCTL is not set
253
254#
255# IDE chipset support/bugfixes
256#
257CONFIG_IDE_GENERIC=y
258CONFIG_BLK_DEV_IDEPCI=y
259# CONFIG_IDEPCI_SHARE_IRQ is not set
260# CONFIG_BLK_DEV_OFFBOARD is not set
261CONFIG_BLK_DEV_GENERIC=y
262# CONFIG_BLK_DEV_OPTI621 is not set
263CONFIG_BLK_DEV_IDEDMA_PCI=y
264# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
265# CONFIG_IDEDMA_PCI_AUTO is not set
266# CONFIG_BLK_DEV_AEC62XX is not set
267# CONFIG_BLK_DEV_ALI15X3 is not set
268# CONFIG_BLK_DEV_AMD74XX is not set
269# CONFIG_BLK_DEV_CMD64X is not set
270# CONFIG_BLK_DEV_TRIFLEX is not set
271# CONFIG_BLK_DEV_CY82C693 is not set
272# CONFIG_BLK_DEV_CS5520 is not set
273# CONFIG_BLK_DEV_CS5530 is not set
274# CONFIG_BLK_DEV_HPT34X is not set
275CONFIG_BLK_DEV_HPT366=y
276# CONFIG_BLK_DEV_SC1200 is not set
277# CONFIG_BLK_DEV_PIIX is not set
278# CONFIG_BLK_DEV_NS87415 is not set
279# CONFIG_BLK_DEV_PDC202XX_OLD is not set
280# CONFIG_BLK_DEV_PDC202XX_NEW is not set
281# CONFIG_BLK_DEV_SVWKS is not set
282# CONFIG_BLK_DEV_SIIMAGE is not set
283# CONFIG_BLK_DEV_SLC90E66 is not set
284# CONFIG_BLK_DEV_TRM290 is not set
285# CONFIG_BLK_DEV_VIA82CXXX is not set
286# CONFIG_IDE_ARM is not set
287CONFIG_BLK_DEV_IDEDMA=y
288# CONFIG_IDEDMA_IVB is not set
289# CONFIG_IDEDMA_AUTO is not set
290# CONFIG_BLK_DEV_HD is not set
291
292#
293# SCSI device support
294#
295# CONFIG_SCSI is not set
296
297#
298# Multi-device support (RAID and LVM)
299#
300# CONFIG_MD is not set
301
302#
303# Fusion MPT device support
304#
305
306#
307# IEEE 1394 (FireWire) support
308#
309# CONFIG_IEEE1394 is not set
310
311#
312# I2O device support
313#
314# CONFIG_I2O is not set
315
316#
317# Networking support
318#
319CONFIG_NET=y
320
321#
322# Networking options
323#
324CONFIG_PACKET=y
325# CONFIG_PACKET_MMAP is not set
326CONFIG_NETLINK_DEV=y
327CONFIG_UNIX=y
328CONFIG_NET_KEY=y
329CONFIG_INET=y
330CONFIG_IP_MULTICAST=y
331# CONFIG_IP_ADVANCED_ROUTER is not set
332CONFIG_IP_PNP=y
333# CONFIG_IP_PNP_DHCP is not set
334CONFIG_IP_PNP_BOOTP=y
335# CONFIG_IP_PNP_RARP is not set
336# CONFIG_NET_IPIP is not set
337# CONFIG_NET_IPGRE is not set
338# CONFIG_IP_MROUTE is not set
339# CONFIG_ARPD is not set
340# CONFIG_SYN_COOKIES is not set
341# CONFIG_INET_AH is not set
342# CONFIG_INET_ESP is not set
343# CONFIG_INET_IPCOMP is not set
344CONFIG_INET_TUNNEL=m
345CONFIG_IP_TCPDIAG=m
346# CONFIG_IP_TCPDIAG_IPV6 is not set
347
348#
349# IP: Virtual Server Configuration
350#
351# CONFIG_IP_VS is not set
352# CONFIG_IPV6 is not set
353CONFIG_NETFILTER=y
354# CONFIG_NETFILTER_DEBUG is not set
355
356#
357# IP: Netfilter Configuration
358#
359# CONFIG_IP_NF_CONNTRACK is not set
360CONFIG_IP_NF_CONNTRACK_MARK=y
361# CONFIG_IP_NF_QUEUE is not set
362# CONFIG_IP_NF_IPTABLES is not set
363# CONFIG_IP_NF_ARPTABLES is not set
364CONFIG_XFRM=y
365CONFIG_XFRM_USER=m
366
367#
368# SCTP Configuration (EXPERIMENTAL)
369#
370# CONFIG_IP_SCTP is not set
371# CONFIG_ATM is not set
372# CONFIG_BRIDGE is not set
373# CONFIG_VLAN_8021Q is not set
374# CONFIG_DECNET is not set
375# CONFIG_LLC2 is not set
376# CONFIG_IPX is not set
377# CONFIG_ATALK is not set
378# CONFIG_X25 is not set
379# CONFIG_LAPB is not set
380# CONFIG_NET_DIVERT is not set
381# CONFIG_ECONET is not set
382# CONFIG_WAN_ROUTER is not set
383
384#
385# QoS and/or fair queueing
386#
387# CONFIG_NET_SCHED is not set
388# CONFIG_NET_CLS_ROUTE is not set
389
390#
391# Network testing
392#
393# CONFIG_NET_PKTGEN is not set
394# CONFIG_NETPOLL is not set
395# CONFIG_NET_POLL_CONTROLLER is not set
396# CONFIG_HAMRADIO is not set
397# CONFIG_IRDA is not set
398# CONFIG_BT is not set
399CONFIG_NETDEVICES=y
400# CONFIG_DUMMY is not set
401# CONFIG_BONDING is not set
402# CONFIG_EQUALIZER is not set
403# CONFIG_TUN is not set
404# CONFIG_ETHERTAP is not set
405
406#
407# ARCnet devices
408#
409# CONFIG_ARCNET is not set
410
411#
412# Ethernet (10 or 100Mbit)
413#
414CONFIG_NET_ETHERNET=y
415# CONFIG_MII is not set
416CONFIG_MIPS_AU1X00_ENET=y
417# CONFIG_HAPPYMEAL is not set
418# CONFIG_SUNGEM is not set
419# CONFIG_NET_VENDOR_3COM is not set
420
421#
422# Tulip family network device support
423#
424# CONFIG_NET_TULIP is not set
425# CONFIG_HP100 is not set
426# CONFIG_NET_PCI is not set
427
428#
429# Ethernet (1000 Mbit)
430#
431# CONFIG_ACENIC is not set
432# CONFIG_DL2K is not set
433# CONFIG_E1000 is not set
434# CONFIG_NS83820 is not set
435# CONFIG_HAMACHI is not set
436# CONFIG_YELLOWFIN is not set
437# CONFIG_R8169 is not set
438# CONFIG_SK98LIN is not set
439# CONFIG_TIGON3 is not set
440
441#
442# Ethernet (10000 Mbit)
443#
444# CONFIG_IXGB is not set
445# CONFIG_S2IO is not set
446
447#
448# Token Ring devices
449#
450# CONFIG_TR is not set
451
452#
453# Wireless LAN (non-hamradio)
454#
455# CONFIG_NET_RADIO is not set
456
457#
458# PCMCIA network device support
459#
460# CONFIG_NET_PCMCIA is not set
461
462#
463# Wan interfaces
464#
465# CONFIG_WAN is not set
466# CONFIG_FDDI is not set
467# CONFIG_HIPPI is not set
468CONFIG_PPP=m
469CONFIG_PPP_MULTILINK=y
470# CONFIG_PPP_FILTER is not set
471CONFIG_PPP_ASYNC=m
472# CONFIG_PPP_SYNC_TTY is not set
473CONFIG_PPP_DEFLATE=m
474# CONFIG_PPP_BSDCOMP is not set
475CONFIG_PPPOE=m
476# CONFIG_SLIP is not set
477# CONFIG_SHAPER is not set
478# CONFIG_NETCONSOLE is not set
479
480#
481# ISDN subsystem
482#
483# CONFIG_ISDN is not set
484
485#
486# Telephony Support
487#
488# CONFIG_PHONE is not set
489
490#
491# Input device support
492#
493CONFIG_INPUT=y
494
495#
496# Userland interfaces
497#
498CONFIG_INPUT_MOUSEDEV=y
499CONFIG_INPUT_MOUSEDEV_PSAUX=y
500CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
501CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
502# CONFIG_INPUT_JOYDEV is not set
503# CONFIG_INPUT_TSDEV is not set
504CONFIG_INPUT_EVDEV=y
505# CONFIG_INPUT_EVBUG is not set
506
507#
508# Input I/O drivers
509#
510# CONFIG_GAMEPORT is not set
511CONFIG_SOUND_GAMEPORT=y
512CONFIG_SERIO=y
513# CONFIG_SERIO_I8042 is not set
514CONFIG_SERIO_SERPORT=y
515# CONFIG_SERIO_CT82C710 is not set
516# CONFIG_SERIO_PCIPS2 is not set
517# CONFIG_SERIO_LIBPS2 is not set
518CONFIG_SERIO_RAW=m
519
520#
521# Input Device Drivers
522#
523# CONFIG_INPUT_KEYBOARD is not set
524# CONFIG_INPUT_MOUSE is not set
525# CONFIG_INPUT_JOYSTICK is not set
526# CONFIG_INPUT_TOUCHSCREEN is not set
527# CONFIG_INPUT_MISC is not set
528
529#
530# Character devices
531#
532# CONFIG_VT is not set
533# CONFIG_SERIAL_NONSTANDARD is not set
534# CONFIG_AU1X00_GPIO is not set
535# CONFIG_TS_AU1X00_ADS7846 is not set
536
537#
538# Serial drivers
539#
540# CONFIG_SERIAL_8250 is not set
541
542#
543# Non-8250 serial port support
544#
545CONFIG_SERIAL_AU1X00=y
546CONFIG_SERIAL_AU1X00_CONSOLE=y
547CONFIG_SERIAL_CORE=y
548CONFIG_SERIAL_CORE_CONSOLE=y
549CONFIG_UNIX98_PTYS=y
550CONFIG_LEGACY_PTYS=y
551CONFIG_LEGACY_PTY_COUNT=256
552
553#
554# IPMI
555#
556# CONFIG_IPMI_HANDLER is not set
557
558#
559# Watchdog Cards
560#
561# CONFIG_WATCHDOG is not set
562# CONFIG_RTC is not set
563# CONFIG_GEN_RTC is not set
564# CONFIG_DTLK is not set
565# CONFIG_R3964 is not set
566# CONFIG_APPLICOM is not set
567
568#
569# Ftape, the floppy tape device driver
570#
571# CONFIG_DRM is not set
572
573#
574# PCMCIA character devices
575#
576CONFIG_SYNCLINK_CS=m
577# CONFIG_RAW_DRIVER is not set
578
579#
580# I2C support
581#
582# CONFIG_I2C is not set
583
584#
585# Dallas's 1-wire bus
586#
587# CONFIG_W1 is not set
588
589#
590# Misc devices
591#
592
593#
594# Multimedia devices
595#
596# CONFIG_VIDEO_DEV is not set
597
598#
599# Digital Video Broadcasting Devices
600#
601# CONFIG_DVB is not set
602
603#
604# Graphics support
605#
606# CONFIG_FB is not set
607# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
608
609#
610# Sound
611#
612# CONFIG_SOUND is not set
613
614#
615# USB support
616#
617# CONFIG_USB is not set
618CONFIG_USB_ARCH_HAS_HCD=y
619CONFIG_USB_ARCH_HAS_OHCI=y
620
621#
622# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
623#
624
625#
626# USB Gadget Support
627#
628# CONFIG_USB_GADGET is not set
629
630#
631# MMC/SD Card support
632#
633# CONFIG_MMC is not set
634
635#
636# InfiniBand support
637#
638# CONFIG_INFINIBAND is not set
639
640#
641# File systems
642#
643CONFIG_EXT2_FS=y
644CONFIG_EXT2_FS_XATTR=y
645CONFIG_EXT2_FS_POSIX_ACL=y
646# CONFIG_EXT2_FS_SECURITY is not set
647CONFIG_EXT3_FS=y
648CONFIG_EXT3_FS_XATTR=y
649CONFIG_EXT3_FS_POSIX_ACL=y
650CONFIG_EXT3_FS_SECURITY=y
651CONFIG_JBD=y
652# CONFIG_JBD_DEBUG is not set
653CONFIG_FS_MBCACHE=y
654CONFIG_REISERFS_FS=m
655# CONFIG_REISERFS_CHECK is not set
656# CONFIG_REISERFS_PROC_INFO is not set
657CONFIG_REISERFS_FS_XATTR=y
658CONFIG_REISERFS_FS_POSIX_ACL=y
659CONFIG_REISERFS_FS_SECURITY=y
660# CONFIG_JFS_FS is not set
661CONFIG_FS_POSIX_ACL=y
662# CONFIG_XFS_FS is not set
663# CONFIG_MINIX_FS is not set
664# CONFIG_ROMFS_FS is not set
665# CONFIG_QUOTA is not set
666CONFIG_DNOTIFY=y
667CONFIG_AUTOFS_FS=m
668CONFIG_AUTOFS4_FS=m
669
670#
671# CD-ROM/DVD Filesystems
672#
673# CONFIG_ISO9660_FS is not set
674# CONFIG_UDF_FS is not set
675
676#
677# DOS/FAT/NT Filesystems
678#
679# CONFIG_MSDOS_FS is not set
680# CONFIG_VFAT_FS is not set
681# CONFIG_NTFS_FS is not set
682
683#
684# Pseudo filesystems
685#
686CONFIG_PROC_FS=y
687CONFIG_PROC_KCORE=y
688CONFIG_SYSFS=y
689# CONFIG_DEVFS_FS is not set
690CONFIG_DEVPTS_FS_XATTR=y
691CONFIG_DEVPTS_FS_SECURITY=y
692CONFIG_TMPFS=y
693# CONFIG_TMPFS_XATTR is not set
694# CONFIG_HUGETLB_PAGE is not set
695CONFIG_RAMFS=y
696
697#
698# Miscellaneous filesystems
699#
700# CONFIG_ADFS_FS is not set
701# CONFIG_AFFS_FS is not set
702# CONFIG_HFS_FS is not set
703# CONFIG_HFSPLUS_FS is not set
704# CONFIG_BEFS_FS is not set
705# CONFIG_BFS_FS is not set
706# CONFIG_EFS_FS is not set
707CONFIG_CRAMFS=m
708# CONFIG_VXFS_FS is not set
709# CONFIG_HPFS_FS is not set
710# CONFIG_QNX4FS_FS is not set
711# CONFIG_SYSV_FS is not set
712# CONFIG_UFS_FS is not set
713
714#
715# Network File Systems
716#
717CONFIG_NFS_FS=y
718# CONFIG_NFS_V3 is not set
719# CONFIG_NFS_V4 is not set
720# CONFIG_NFS_DIRECTIO is not set
721CONFIG_NFSD=m
722# CONFIG_NFSD_V3 is not set
723# CONFIG_NFSD_TCP is not set
724CONFIG_ROOT_NFS=y
725CONFIG_LOCKD=y
726CONFIG_EXPORTFS=m
727CONFIG_SUNRPC=y
728# CONFIG_RPCSEC_GSS_KRB5 is not set
729# CONFIG_RPCSEC_GSS_SPKM3 is not set
730CONFIG_SMB_FS=m
731# CONFIG_SMB_NLS_DEFAULT is not set
732# CONFIG_CIFS is not set
733# CONFIG_NCP_FS is not set
734# CONFIG_CODA_FS is not set
735# CONFIG_AFS_FS is not set
736
737#
738# Partition Types
739#
740# CONFIG_PARTITION_ADVANCED is not set
741CONFIG_MSDOS_PARTITION=y
742
743#
744# Native Language Support
745#
746CONFIG_NLS=m
747CONFIG_NLS_DEFAULT="iso8859-1"
748# CONFIG_NLS_CODEPAGE_437 is not set
749# CONFIG_NLS_CODEPAGE_737 is not set
750# CONFIG_NLS_CODEPAGE_775 is not set
751# CONFIG_NLS_CODEPAGE_850 is not set
752# CONFIG_NLS_CODEPAGE_852 is not set
753# CONFIG_NLS_CODEPAGE_855 is not set
754# CONFIG_NLS_CODEPAGE_857 is not set
755# CONFIG_NLS_CODEPAGE_860 is not set
756# CONFIG_NLS_CODEPAGE_861 is not set
757# CONFIG_NLS_CODEPAGE_862 is not set
758# CONFIG_NLS_CODEPAGE_863 is not set
759# CONFIG_NLS_CODEPAGE_864 is not set
760# CONFIG_NLS_CODEPAGE_865 is not set
761# CONFIG_NLS_CODEPAGE_866 is not set
762# CONFIG_NLS_CODEPAGE_869 is not set
763# CONFIG_NLS_CODEPAGE_936 is not set
764# CONFIG_NLS_CODEPAGE_950 is not set
765# CONFIG_NLS_CODEPAGE_932 is not set
766# CONFIG_NLS_CODEPAGE_949 is not set
767# CONFIG_NLS_CODEPAGE_874 is not set
768# CONFIG_NLS_ISO8859_8 is not set
769# CONFIG_NLS_CODEPAGE_1250 is not set
770# CONFIG_NLS_CODEPAGE_1251 is not set
771# CONFIG_NLS_ASCII is not set
772# CONFIG_NLS_ISO8859_1 is not set
773# CONFIG_NLS_ISO8859_2 is not set
774# CONFIG_NLS_ISO8859_3 is not set
775# CONFIG_NLS_ISO8859_4 is not set
776# CONFIG_NLS_ISO8859_5 is not set
777# CONFIG_NLS_ISO8859_6 is not set
778# CONFIG_NLS_ISO8859_7 is not set
779# CONFIG_NLS_ISO8859_9 is not set
780# CONFIG_NLS_ISO8859_13 is not set
781# CONFIG_NLS_ISO8859_14 is not set
782# CONFIG_NLS_ISO8859_15 is not set
783# CONFIG_NLS_KOI8_R is not set
784# CONFIG_NLS_KOI8_U is not set
785# CONFIG_NLS_UTF8 is not set
786
787#
788# Profiling support
789#
790# CONFIG_PROFILING is not set
791
792#
793# Kernel hacking
794#
795# CONFIG_DEBUG_KERNEL is not set
796CONFIG_CROSSCOMPILE=y
797CONFIG_CMDLINE=""
798
799#
800# Security options
801#
802CONFIG_KEYS=y
803CONFIG_KEYS_DEBUG_PROC_KEYS=y
804# CONFIG_SECURITY is not set
805
806#
807# Cryptographic options
808#
809CONFIG_CRYPTO=y
810CONFIG_CRYPTO_HMAC=y
811CONFIG_CRYPTO_NULL=y
812# CONFIG_CRYPTO_MD4 is not set
813# CONFIG_CRYPTO_MD5 is not set
814# CONFIG_CRYPTO_SHA1 is not set
815# CONFIG_CRYPTO_SHA256 is not set
816CONFIG_CRYPTO_SHA512=y
817CONFIG_CRYPTO_WP512=m
818# CONFIG_CRYPTO_DES is not set
819# CONFIG_CRYPTO_BLOWFISH is not set
820CONFIG_CRYPTO_TWOFISH=y
821# CONFIG_CRYPTO_SERPENT is not set
822CONFIG_CRYPTO_AES=m
823# CONFIG_CRYPTO_CAST5 is not set
824# CONFIG_CRYPTO_CAST6 is not set
825CONFIG_CRYPTO_TEA=m
826# CONFIG_CRYPTO_ARC4 is not set
827CONFIG_CRYPTO_KHAZAD=m
828CONFIG_CRYPTO_ANUBIS=m
829CONFIG_CRYPTO_DEFLATE=y
830CONFIG_CRYPTO_MICHAEL_MIC=y
831CONFIG_CRYPTO_CRC32C=m
832# CONFIG_CRYPTO_TEST is not set
833
834#
835# Hardware crypto devices
836#
837
838#
839# Library routines
840#
841CONFIG_CRC_CCITT=m
842CONFIG_CRC32=y
843CONFIG_LIBCRC32C=m
844CONFIG_ZLIB_INFLATE=y
845CONFIG_ZLIB_DEFLATE=y
846CONFIG_GENERIC_HARDIRQS=y
847CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
new file mode 100644
index 000000000000..d0c85a4009d6
--- /dev/null
+++ b/arch/mips/configs/rm200_defconfig
@@ -0,0 +1,1383 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:09 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24CONFIG_POSIX_MQUEUE=y
25CONFIG_BSD_PROCESS_ACCT=y
26# CONFIG_BSD_PROCESS_ACCT_V3 is not set
27CONFIG_SYSCTL=y
28# CONFIG_AUDIT is not set
29CONFIG_LOG_BUF_SHIFT=14
30# CONFIG_HOTPLUG is not set
31CONFIG_KOBJECT_UEVENT=y
32CONFIG_IKCONFIG=y
33CONFIG_IKCONFIG_PROC=y
34CONFIG_EMBEDDED=y
35CONFIG_KALLSYMS=y
36# CONFIG_KALLSYMS_EXTRA_PASS is not set
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46
47#
48# Loadable module support
49#
50CONFIG_MODULES=y
51CONFIG_MODULE_UNLOAD=y
52# CONFIG_MODULE_FORCE_UNLOAD is not set
53CONFIG_OBSOLETE_MODPARM=y
54CONFIG_MODVERSIONS=y
55# CONFIG_MODULE_SRCVERSION_ALL is not set
56CONFIG_KMOD=y
57
58#
59# Machine selection
60#
61# CONFIG_MACH_JAZZ is not set
62# CONFIG_MACH_VR41XX is not set
63# CONFIG_TOSHIBA_JMR3927 is not set
64# CONFIG_MIPS_COBALT is not set
65# CONFIG_MACH_DECSTATION is not set
66# CONFIG_MIPS_EV64120 is not set
67# CONFIG_MIPS_EV96100 is not set
68# CONFIG_MIPS_IVR is not set
69# CONFIG_LASAT is not set
70# CONFIG_MIPS_ITE8172 is not set
71# CONFIG_MIPS_ATLAS is not set
72# CONFIG_MIPS_MALTA is not set
73# CONFIG_MIPS_SEAD is not set
74# CONFIG_MOMENCO_OCELOT is not set
75# CONFIG_MOMENCO_OCELOT_G is not set
76# CONFIG_MOMENCO_OCELOT_C is not set
77# CONFIG_MOMENCO_OCELOT_3 is not set
78# CONFIG_MOMENCO_JAGUAR_ATX is not set
79# CONFIG_PMC_YOSEMITE is not set
80# CONFIG_DDB5074 is not set
81# CONFIG_DDB5476 is not set
82# CONFIG_DDB5477 is not set
83# CONFIG_NEC_OSPREY is not set
84# CONFIG_SGI_IP22 is not set
85# CONFIG_SOC_AU1X00 is not set
86# CONFIG_SIBYTE_SB1xxx_SOC is not set
87CONFIG_SNI_RM200_PCI=y
88# CONFIG_TOSHIBA_RBTX4927 is not set
89CONFIG_RWSEM_GENERIC_SPINLOCK=y
90CONFIG_GENERIC_CALIBRATE_DELAY=y
91CONFIG_HAVE_DEC_LOCK=y
92CONFIG_ARC=y
93CONFIG_DMA_NONCOHERENT=y
94CONFIG_GENERIC_ISA_DMA=y
95CONFIG_I8259=y
96CONFIG_CPU_LITTLE_ENDIAN=y
97CONFIG_ARC32=y
98CONFIG_BOOT_ELF32=y
99CONFIG_MIPS_L1_CACHE_SHIFT=5
100CONFIG_HAVE_STD_PC_SERIAL_PORT=y
101CONFIG_ARC_CONSOLE=y
102CONFIG_ARC_MEMORY=y
103CONFIG_ARC_PROMLIB=y
104
105#
106# CPU selection
107#
108# CONFIG_CPU_MIPS32 is not set
109# CONFIG_CPU_MIPS64 is not set
110# CONFIG_CPU_R3000 is not set
111# CONFIG_CPU_TX39XX is not set
112# CONFIG_CPU_VR41XX is not set
113# CONFIG_CPU_R4300 is not set
114CONFIG_CPU_R4X00=y
115# CONFIG_CPU_TX49XX is not set
116# CONFIG_CPU_R5000 is not set
117# CONFIG_CPU_R5432 is not set
118# CONFIG_CPU_R6000 is not set
119# CONFIG_CPU_NEVADA is not set
120# CONFIG_CPU_R8000 is not set
121# CONFIG_CPU_R10000 is not set
122# CONFIG_CPU_RM7000 is not set
123# CONFIG_CPU_RM9000 is not set
124# CONFIG_CPU_SB1 is not set
125CONFIG_PAGE_SIZE_4KB=y
126# CONFIG_PAGE_SIZE_8KB is not set
127# CONFIG_PAGE_SIZE_16KB is not set
128# CONFIG_PAGE_SIZE_64KB is not set
129# CONFIG_64BIT_PHYS_ADDR is not set
130# CONFIG_CPU_ADVANCED is not set
131CONFIG_CPU_HAS_LLSC=y
132CONFIG_CPU_HAS_LLDSCD=y
133CONFIG_CPU_HAS_SYNC=y
134# CONFIG_PREEMPT is not set
135
136#
137# Bus options (PCI, PCMCIA, EISA, ISA, TC)
138#
139CONFIG_HW_HAS_PCI=y
140CONFIG_PCI=y
141CONFIG_PCI_LEGACY_PROC=y
142# CONFIG_PCI_NAMES is not set
143CONFIG_ISA=y
144# CONFIG_EISA is not set
145CONFIG_MMU=y
146
147#
148# PCCARD (PCMCIA/CardBus) support
149#
150# CONFIG_PCCARD is not set
151
152#
153# PC-card bridges
154#
155CONFIG_PCMCIA_PROBE=y
156
157#
158# PCI Hotplug Support
159#
160# CONFIG_HOTPLUG_PCI is not set
161
162#
163# Executable file formats
164#
165CONFIG_BINFMT_ELF=y
166CONFIG_BINFMT_MISC=m
167CONFIG_TRAD_SIGNALS=y
168
169#
170# Device Drivers
171#
172
173#
174# Generic Driver Options
175#
176CONFIG_STANDALONE=y
177CONFIG_PREVENT_FIRMWARE_BUILD=y
178# CONFIG_FW_LOADER is not set
179
180#
181# Memory Technology Devices (MTD)
182#
183# CONFIG_MTD is not set
184
185#
186# Parallel port support
187#
188CONFIG_PARPORT=m
189CONFIG_PARPORT_PC=m
190CONFIG_PARPORT_PC_CML1=m
191CONFIG_PARPORT_SERIAL=m
192# CONFIG_PARPORT_PC_FIFO is not set
193# CONFIG_PARPORT_PC_SUPERIO is not set
194# CONFIG_PARPORT_OTHER is not set
195CONFIG_PARPORT_1284=y
196
197#
198# Plug and Play support
199#
200# CONFIG_PNP is not set
201
202#
203# Block devices
204#
205CONFIG_BLK_DEV_FD=m
206# CONFIG_BLK_DEV_XD is not set
207CONFIG_PARIDE=m
208CONFIG_PARIDE_PARPORT=m
209
210#
211# Parallel IDE high-level drivers
212#
213CONFIG_PARIDE_PD=m
214CONFIG_PARIDE_PCD=m
215CONFIG_PARIDE_PF=m
216CONFIG_PARIDE_PT=m
217CONFIG_PARIDE_PG=m
218
219#
220# Parallel IDE protocol modules
221#
222CONFIG_PARIDE_ATEN=m
223CONFIG_PARIDE_BPCK=m
224CONFIG_PARIDE_BPCK6=m
225CONFIG_PARIDE_COMM=m
226CONFIG_PARIDE_DSTR=m
227CONFIG_PARIDE_FIT2=m
228CONFIG_PARIDE_FIT3=m
229CONFIG_PARIDE_EPAT=m
230# CONFIG_PARIDE_EPATC8 is not set
231CONFIG_PARIDE_EPIA=m
232CONFIG_PARIDE_FRIQ=m
233CONFIG_PARIDE_FRPW=m
234CONFIG_PARIDE_KBIC=m
235CONFIG_PARIDE_KTTI=m
236CONFIG_PARIDE_ON20=m
237CONFIG_PARIDE_ON26=m
238# CONFIG_BLK_CPQ_DA is not set
239# CONFIG_BLK_CPQ_CISS_DA is not set
240# CONFIG_BLK_DEV_DAC960 is not set
241# CONFIG_BLK_DEV_UMEM is not set
242# CONFIG_BLK_DEV_COW_COMMON is not set
243CONFIG_BLK_DEV_LOOP=m
244CONFIG_BLK_DEV_CRYPTOLOOP=m
245CONFIG_BLK_DEV_NBD=m
246CONFIG_BLK_DEV_SX8=m
247CONFIG_BLK_DEV_UB=m
248CONFIG_BLK_DEV_RAM=m
249CONFIG_BLK_DEV_RAM_COUNT=16
250CONFIG_BLK_DEV_RAM_SIZE=4096
251CONFIG_INITRAMFS_SOURCE=""
252# CONFIG_LBD is not set
253CONFIG_CDROM_PKTCDVD=m
254CONFIG_CDROM_PKTCDVD_BUFFERS=8
255# CONFIG_CDROM_PKTCDVD_WCACHE is not set
256
257#
258# IO Schedulers
259#
260CONFIG_IOSCHED_NOOP=y
261CONFIG_IOSCHED_AS=y
262CONFIG_IOSCHED_DEADLINE=y
263CONFIG_IOSCHED_CFQ=y
264CONFIG_ATA_OVER_ETH=m
265
266#
267# ATA/ATAPI/MFM/RLL support
268#
269# CONFIG_IDE is not set
270
271#
272# SCSI device support
273#
274CONFIG_SCSI=y
275CONFIG_SCSI_PROC_FS=y
276
277#
278# SCSI support type (disk, tape, CD-ROM)
279#
280CONFIG_BLK_DEV_SD=y
281CONFIG_CHR_DEV_ST=m
282# CONFIG_CHR_DEV_OSST is not set
283CONFIG_BLK_DEV_SR=m
284CONFIG_BLK_DEV_SR_VENDOR=y
285# CONFIG_CHR_DEV_SG is not set
286
287#
288# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
289#
290# CONFIG_SCSI_MULTI_LUN is not set
291CONFIG_SCSI_CONSTANTS=y
292# CONFIG_SCSI_LOGGING is not set
293
294#
295# SCSI Transport Attributes
296#
297CONFIG_SCSI_SPI_ATTRS=y
298# CONFIG_SCSI_FC_ATTRS is not set
299# CONFIG_SCSI_ISCSI_ATTRS is not set
300
301#
302# SCSI low-level drivers
303#
304# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
305# CONFIG_SCSI_3W_9XXX is not set
306# CONFIG_SCSI_7000FASST is not set
307# CONFIG_SCSI_ACARD is not set
308# CONFIG_SCSI_AHA152X is not set
309# CONFIG_SCSI_AHA1542 is not set
310# CONFIG_SCSI_AACRAID is not set
311# CONFIG_SCSI_AIC7XXX is not set
312# CONFIG_SCSI_AIC7XXX_OLD is not set
313# CONFIG_SCSI_AIC79XX is not set
314# CONFIG_SCSI_DPT_I2O is not set
315# CONFIG_SCSI_IN2000 is not set
316CONFIG_MEGARAID_NEWGEN=y
317CONFIG_MEGARAID_MM=m
318CONFIG_MEGARAID_MAILBOX=m
319# CONFIG_SCSI_SATA is not set
320# CONFIG_SCSI_BUSLOGIC is not set
321# CONFIG_SCSI_DMX3191D is not set
322# CONFIG_SCSI_DTC3280 is not set
323# CONFIG_SCSI_EATA is not set
324# CONFIG_SCSI_EATA_PIO is not set
325# CONFIG_SCSI_FUTURE_DOMAIN is not set
326# CONFIG_SCSI_GDTH is not set
327# CONFIG_SCSI_GENERIC_NCR5380 is not set
328# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
329# CONFIG_SCSI_IPS is not set
330# CONFIG_SCSI_INITIO is not set
331# CONFIG_SCSI_INIA100 is not set
332CONFIG_SCSI_PPA=m
333CONFIG_SCSI_IMM=m
334# CONFIG_SCSI_IZIP_EPP16 is not set
335# CONFIG_SCSI_IZIP_SLOW_CTR is not set
336# CONFIG_SCSI_NCR53C406A is not set
337CONFIG_SCSI_SYM53C8XX_2=y
338CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
339CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
340CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
341# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
342# CONFIG_SCSI_IPR is not set
343# CONFIG_SCSI_PAS16 is not set
344# CONFIG_SCSI_PSI240I is not set
345# CONFIG_SCSI_QLOGIC_FAS is not set
346# CONFIG_SCSI_QLOGIC_ISP is not set
347# CONFIG_SCSI_QLOGIC_FC is not set
348# CONFIG_SCSI_QLOGIC_1280 is not set
349CONFIG_SCSI_QLA2XXX=y
350# CONFIG_SCSI_QLA21XX is not set
351# CONFIG_SCSI_QLA22XX is not set
352# CONFIG_SCSI_QLA2300 is not set
353# CONFIG_SCSI_QLA2322 is not set
354# CONFIG_SCSI_QLA6312 is not set
355# CONFIG_SCSI_SYM53C416 is not set
356# CONFIG_SCSI_DC395x is not set
357# CONFIG_SCSI_DC390T is not set
358# CONFIG_SCSI_T128 is not set
359# CONFIG_SCSI_U14_34F is not set
360# CONFIG_SCSI_NSP32 is not set
361# CONFIG_SCSI_DEBUG is not set
362
363#
364# Old CD-ROM drivers (not SCSI, not IDE)
365#
366# CONFIG_CD_NO_IDESCSI is not set
367
368#
369# Multi-device support (RAID and LVM)
370#
371CONFIG_MD=y
372CONFIG_BLK_DEV_MD=m
373CONFIG_MD_LINEAR=m
374CONFIG_MD_RAID0=m
375CONFIG_MD_RAID1=m
376CONFIG_MD_RAID10=m
377CONFIG_MD_RAID5=m
378# CONFIG_MD_RAID6 is not set
379CONFIG_MD_MULTIPATH=m
380CONFIG_MD_FAULTY=m
381CONFIG_BLK_DEV_DM=m
382# CONFIG_DM_CRYPT is not set
383CONFIG_DM_SNAPSHOT=m
384CONFIG_DM_MIRROR=m
385CONFIG_DM_ZERO=m
386
387#
388# Fusion MPT device support
389#
390# CONFIG_FUSION is not set
391
392#
393# IEEE 1394 (FireWire) support
394#
395# CONFIG_IEEE1394 is not set
396
397#
398# I2O device support
399#
400# CONFIG_I2O is not set
401
402#
403# Networking support
404#
405CONFIG_NET=y
406
407#
408# Networking options
409#
410CONFIG_PACKET=m
411CONFIG_PACKET_MMAP=y
412CONFIG_NETLINK_DEV=m
413CONFIG_UNIX=y
414CONFIG_NET_KEY=m
415CONFIG_INET=y
416CONFIG_IP_MULTICAST=y
417# CONFIG_IP_ADVANCED_ROUTER is not set
418# CONFIG_IP_PNP is not set
419CONFIG_NET_IPIP=m
420CONFIG_NET_IPGRE=m
421CONFIG_NET_IPGRE_BROADCAST=y
422CONFIG_IP_MROUTE=y
423CONFIG_IP_PIMSM_V1=y
424CONFIG_IP_PIMSM_V2=y
425# CONFIG_ARPD is not set
426# CONFIG_SYN_COOKIES is not set
427# CONFIG_INET_AH is not set
428# CONFIG_INET_ESP is not set
429# CONFIG_INET_IPCOMP is not set
430CONFIG_INET_TUNNEL=m
431CONFIG_IP_TCPDIAG=m
432CONFIG_IP_TCPDIAG_IPV6=y
433
434#
435# IP: Virtual Server Configuration
436#
437# CONFIG_IP_VS is not set
438CONFIG_IPV6=m
439CONFIG_IPV6_PRIVACY=y
440CONFIG_INET6_AH=m
441CONFIG_INET6_ESP=m
442CONFIG_INET6_IPCOMP=m
443CONFIG_INET6_TUNNEL=m
444CONFIG_IPV6_TUNNEL=m
445CONFIG_NETFILTER=y
446# CONFIG_NETFILTER_DEBUG is not set
447CONFIG_BRIDGE_NETFILTER=y
448
449#
450# IP: Netfilter Configuration
451#
452CONFIG_IP_NF_CONNTRACK=m
453# CONFIG_IP_NF_CT_ACCT is not set
454CONFIG_IP_NF_CONNTRACK_MARK=y
455CONFIG_IP_NF_CT_PROTO_SCTP=m
456CONFIG_IP_NF_FTP=m
457CONFIG_IP_NF_IRC=m
458CONFIG_IP_NF_TFTP=m
459CONFIG_IP_NF_AMANDA=m
460CONFIG_IP_NF_QUEUE=m
461CONFIG_IP_NF_IPTABLES=m
462CONFIG_IP_NF_MATCH_LIMIT=m
463CONFIG_IP_NF_MATCH_IPRANGE=m
464CONFIG_IP_NF_MATCH_MAC=m
465CONFIG_IP_NF_MATCH_PKTTYPE=m
466CONFIG_IP_NF_MATCH_MARK=m
467CONFIG_IP_NF_MATCH_MULTIPORT=m
468CONFIG_IP_NF_MATCH_TOS=m
469CONFIG_IP_NF_MATCH_RECENT=m
470CONFIG_IP_NF_MATCH_ECN=m
471CONFIG_IP_NF_MATCH_DSCP=m
472CONFIG_IP_NF_MATCH_AH_ESP=m
473CONFIG_IP_NF_MATCH_LENGTH=m
474CONFIG_IP_NF_MATCH_TTL=m
475CONFIG_IP_NF_MATCH_TCPMSS=m
476CONFIG_IP_NF_MATCH_HELPER=m
477CONFIG_IP_NF_MATCH_STATE=m
478CONFIG_IP_NF_MATCH_CONNTRACK=m
479CONFIG_IP_NF_MATCH_OWNER=m
480CONFIG_IP_NF_MATCH_PHYSDEV=m
481CONFIG_IP_NF_MATCH_ADDRTYPE=m
482CONFIG_IP_NF_MATCH_REALM=m
483CONFIG_IP_NF_MATCH_SCTP=m
484CONFIG_IP_NF_MATCH_COMMENT=m
485CONFIG_IP_NF_MATCH_CONNMARK=m
486CONFIG_IP_NF_MATCH_HASHLIMIT=m
487CONFIG_IP_NF_FILTER=m
488CONFIG_IP_NF_TARGET_REJECT=m
489CONFIG_IP_NF_TARGET_LOG=m
490CONFIG_IP_NF_TARGET_ULOG=m
491CONFIG_IP_NF_TARGET_TCPMSS=m
492CONFIG_IP_NF_NAT=m
493CONFIG_IP_NF_NAT_NEEDED=y
494CONFIG_IP_NF_TARGET_MASQUERADE=m
495CONFIG_IP_NF_TARGET_REDIRECT=m
496CONFIG_IP_NF_TARGET_NETMAP=m
497CONFIG_IP_NF_TARGET_SAME=m
498CONFIG_IP_NF_NAT_SNMP_BASIC=m
499CONFIG_IP_NF_NAT_IRC=m
500CONFIG_IP_NF_NAT_FTP=m
501CONFIG_IP_NF_NAT_TFTP=m
502CONFIG_IP_NF_NAT_AMANDA=m
503CONFIG_IP_NF_MANGLE=m
504CONFIG_IP_NF_TARGET_TOS=m
505CONFIG_IP_NF_TARGET_ECN=m
506CONFIG_IP_NF_TARGET_DSCP=m
507CONFIG_IP_NF_TARGET_MARK=m
508CONFIG_IP_NF_TARGET_CLASSIFY=m
509CONFIG_IP_NF_TARGET_CONNMARK=m
510CONFIG_IP_NF_TARGET_CLUSTERIP=m
511CONFIG_IP_NF_RAW=m
512CONFIG_IP_NF_TARGET_NOTRACK=m
513CONFIG_IP_NF_ARPTABLES=m
514CONFIG_IP_NF_ARPFILTER=m
515CONFIG_IP_NF_ARP_MANGLE=m
516
517#
518# IPv6: Netfilter Configuration
519#
520CONFIG_IP6_NF_QUEUE=m
521CONFIG_IP6_NF_IPTABLES=m
522CONFIG_IP6_NF_MATCH_LIMIT=m
523CONFIG_IP6_NF_MATCH_MAC=m
524CONFIG_IP6_NF_MATCH_RT=m
525CONFIG_IP6_NF_MATCH_OPTS=m
526CONFIG_IP6_NF_MATCH_FRAG=m
527CONFIG_IP6_NF_MATCH_HL=m
528CONFIG_IP6_NF_MATCH_MULTIPORT=m
529CONFIG_IP6_NF_MATCH_OWNER=m
530CONFIG_IP6_NF_MATCH_MARK=m
531CONFIG_IP6_NF_MATCH_IPV6HEADER=m
532CONFIG_IP6_NF_MATCH_AHESP=m
533CONFIG_IP6_NF_MATCH_LENGTH=m
534CONFIG_IP6_NF_MATCH_EUI64=m
535CONFIG_IP6_NF_MATCH_PHYSDEV=m
536CONFIG_IP6_NF_FILTER=m
537CONFIG_IP6_NF_TARGET_LOG=m
538CONFIG_IP6_NF_MANGLE=m
539CONFIG_IP6_NF_TARGET_MARK=m
540CONFIG_IP6_NF_RAW=m
541
542#
543# DECnet: Netfilter Configuration
544#
545CONFIG_DECNET_NF_GRABULATOR=m
546
547#
548# Bridge: Netfilter Configuration
549#
550CONFIG_BRIDGE_NF_EBTABLES=m
551CONFIG_BRIDGE_EBT_BROUTE=m
552CONFIG_BRIDGE_EBT_T_FILTER=m
553CONFIG_BRIDGE_EBT_T_NAT=m
554CONFIG_BRIDGE_EBT_802_3=m
555CONFIG_BRIDGE_EBT_AMONG=m
556CONFIG_BRIDGE_EBT_ARP=m
557CONFIG_BRIDGE_EBT_IP=m
558CONFIG_BRIDGE_EBT_LIMIT=m
559CONFIG_BRIDGE_EBT_MARK=m
560CONFIG_BRIDGE_EBT_PKTTYPE=m
561CONFIG_BRIDGE_EBT_STP=m
562CONFIG_BRIDGE_EBT_VLAN=m
563CONFIG_BRIDGE_EBT_ARPREPLY=m
564CONFIG_BRIDGE_EBT_DNAT=m
565CONFIG_BRIDGE_EBT_MARK_T=m
566CONFIG_BRIDGE_EBT_REDIRECT=m
567CONFIG_BRIDGE_EBT_SNAT=m
568CONFIG_BRIDGE_EBT_LOG=m
569# CONFIG_BRIDGE_EBT_ULOG is not set
570CONFIG_XFRM=y
571# CONFIG_XFRM_USER is not set
572
573#
574# SCTP Configuration (EXPERIMENTAL)
575#
576# CONFIG_IP_SCTP is not set
577# CONFIG_ATM is not set
578CONFIG_BRIDGE=m
579# CONFIG_VLAN_8021Q is not set
580CONFIG_DECNET=m
581# CONFIG_DECNET_ROUTER is not set
582# CONFIG_LLC2 is not set
583# CONFIG_IPX is not set
584# CONFIG_ATALK is not set
585# CONFIG_X25 is not set
586# CONFIG_LAPB is not set
587# CONFIG_NET_DIVERT is not set
588# CONFIG_ECONET is not set
589# CONFIG_WAN_ROUTER is not set
590
591#
592# QoS and/or fair queueing
593#
594CONFIG_NET_SCHED=y
595CONFIG_NET_SCH_CLK_JIFFIES=y
596# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
597# CONFIG_NET_SCH_CLK_CPU is not set
598CONFIG_NET_SCH_CBQ=m
599CONFIG_NET_SCH_HTB=m
600CONFIG_NET_SCH_HFSC=m
601CONFIG_NET_SCH_PRIO=m
602CONFIG_NET_SCH_RED=m
603CONFIG_NET_SCH_SFQ=m
604CONFIG_NET_SCH_TEQL=m
605CONFIG_NET_SCH_TBF=m
606CONFIG_NET_SCH_GRED=m
607CONFIG_NET_SCH_DSMARK=m
608CONFIG_NET_SCH_NETEM=m
609CONFIG_NET_SCH_INGRESS=m
610CONFIG_NET_QOS=y
611CONFIG_NET_ESTIMATOR=y
612CONFIG_NET_CLS=y
613CONFIG_NET_CLS_TCINDEX=m
614CONFIG_NET_CLS_ROUTE4=m
615CONFIG_NET_CLS_ROUTE=y
616CONFIG_NET_CLS_FW=m
617CONFIG_NET_CLS_U32=m
618# CONFIG_CLS_U32_PERF is not set
619# CONFIG_NET_CLS_IND is not set
620# CONFIG_CLS_U32_MARK is not set
621CONFIG_NET_CLS_RSVP=m
622CONFIG_NET_CLS_RSVP6=m
623# CONFIG_NET_CLS_ACT is not set
624CONFIG_NET_CLS_POLICE=y
625
626#
627# Network testing
628#
629# CONFIG_NET_PKTGEN is not set
630# CONFIG_NETPOLL is not set
631# CONFIG_NET_POLL_CONTROLLER is not set
632CONFIG_HAMRADIO=y
633
634#
635# Packet Radio protocols
636#
637CONFIG_AX25=m
638CONFIG_AX25_DAMA_SLAVE=y
639CONFIG_NETROM=m
640CONFIG_ROSE=m
641
642#
643# AX.25 network device drivers
644#
645CONFIG_MKISS=m
646CONFIG_6PACK=m
647CONFIG_BPQETHER=m
648# CONFIG_DMASCC is not set
649# CONFIG_SCC is not set
650# CONFIG_BAYCOM_SER_FDX is not set
651# CONFIG_BAYCOM_SER_HDX is not set
652# CONFIG_BAYCOM_PAR is not set
653# CONFIG_BAYCOM_EPP is not set
654# CONFIG_YAM is not set
655# CONFIG_IRDA is not set
656# CONFIG_BT is not set
657CONFIG_NETDEVICES=y
658CONFIG_DUMMY=m
659CONFIG_BONDING=m
660CONFIG_EQUALIZER=m
661CONFIG_TUN=m
662CONFIG_ETHERTAP=m
663
664#
665# ARCnet devices
666#
667# CONFIG_ARCNET is not set
668
669#
670# Ethernet (10 or 100Mbit)
671#
672CONFIG_NET_ETHERNET=y
673CONFIG_MII=y
674# CONFIG_HAPPYMEAL is not set
675# CONFIG_SUNGEM is not set
676# CONFIG_NET_VENDOR_3COM is not set
677# CONFIG_LANCE is not set
678# CONFIG_NET_VENDOR_SMC is not set
679# CONFIG_NET_VENDOR_RACAL is not set
680
681#
682# Tulip family network device support
683#
684# CONFIG_NET_TULIP is not set
685# CONFIG_AT1700 is not set
686# CONFIG_DEPCA is not set
687# CONFIG_HP100 is not set
688CONFIG_NET_ISA=y
689# CONFIG_E2100 is not set
690# CONFIG_EWRK3 is not set
691# CONFIG_EEXPRESS is not set
692# CONFIG_EEXPRESS_PRO is not set
693# CONFIG_HPLAN_PLUS is not set
694# CONFIG_HPLAN is not set
695# CONFIG_LP486E is not set
696# CONFIG_ETH16I is not set
697CONFIG_NE2000=m
698# CONFIG_ZNET is not set
699# CONFIG_SEEQ8005 is not set
700CONFIG_NET_PCI=y
701CONFIG_PCNET32=y
702# CONFIG_AMD8111_ETH is not set
703# CONFIG_ADAPTEC_STARFIRE is not set
704# CONFIG_AC3200 is not set
705# CONFIG_APRICOT is not set
706# CONFIG_B44 is not set
707# CONFIG_FORCEDETH is not set
708# CONFIG_CS89x0 is not set
709# CONFIG_DGRS is not set
710CONFIG_EEPRO100=m
711# CONFIG_E100 is not set
712# CONFIG_FEALNX is not set
713# CONFIG_NATSEMI is not set
714# CONFIG_NE2K_PCI is not set
715# CONFIG_8139CP is not set
716# CONFIG_8139TOO is not set
717# CONFIG_SIS900 is not set
718# CONFIG_EPIC100 is not set
719# CONFIG_SUNDANCE is not set
720# CONFIG_TLAN is not set
721# CONFIG_VIA_RHINE is not set
722# CONFIG_LAN_SAA9730 is not set
723# CONFIG_NET_POCKET is not set
724
725#
726# Ethernet (1000 Mbit)
727#
728# CONFIG_ACENIC is not set
729# CONFIG_DL2K is not set
730# CONFIG_E1000 is not set
731# CONFIG_NS83820 is not set
732# CONFIG_HAMACHI is not set
733# CONFIG_YELLOWFIN is not set
734# CONFIG_R8169 is not set
735# CONFIG_SK98LIN is not set
736CONFIG_VIA_VELOCITY=m
737# CONFIG_TIGON3 is not set
738
739#
740# Ethernet (10000 Mbit)
741#
742# CONFIG_IXGB is not set
743# CONFIG_S2IO is not set
744
745#
746# Token Ring devices
747#
748# CONFIG_TR is not set
749
750#
751# Wireless LAN (non-hamradio)
752#
753# CONFIG_NET_RADIO is not set
754
755#
756# Wan interfaces
757#
758# CONFIG_WAN is not set
759# CONFIG_FDDI is not set
760# CONFIG_HIPPI is not set
761CONFIG_PLIP=m
762# CONFIG_PPP is not set
763# CONFIG_SLIP is not set
764# CONFIG_NET_FC is not set
765# CONFIG_SHAPER is not set
766# CONFIG_NETCONSOLE is not set
767
768#
769# ISDN subsystem
770#
771# CONFIG_ISDN is not set
772
773#
774# Telephony Support
775#
776# CONFIG_PHONE is not set
777
778#
779# Input device support
780#
781CONFIG_INPUT=y
782
783#
784# Userland interfaces
785#
786CONFIG_INPUT_MOUSEDEV=y
787CONFIG_INPUT_MOUSEDEV_PSAUX=y
788CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
789CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
790# CONFIG_INPUT_JOYDEV is not set
791# CONFIG_INPUT_TSDEV is not set
792# CONFIG_INPUT_EVDEV is not set
793# CONFIG_INPUT_EVBUG is not set
794
795#
796# Input I/O drivers
797#
798# CONFIG_GAMEPORT is not set
799CONFIG_SOUND_GAMEPORT=y
800CONFIG_SERIO=y
801CONFIG_SERIO_I8042=y
802CONFIG_SERIO_SERPORT=y
803# CONFIG_SERIO_CT82C710 is not set
804CONFIG_SERIO_PARKBD=m
805# CONFIG_SERIO_PCIPS2 is not set
806CONFIG_SERIO_LIBPS2=y
807CONFIG_SERIO_RAW=m
808
809#
810# Input Device Drivers
811#
812CONFIG_INPUT_KEYBOARD=y
813CONFIG_KEYBOARD_ATKBD=y
814# CONFIG_KEYBOARD_SUNKBD is not set
815# CONFIG_KEYBOARD_LKKBD is not set
816# CONFIG_KEYBOARD_XTKBD is not set
817# CONFIG_KEYBOARD_NEWTON is not set
818CONFIG_INPUT_MOUSE=y
819CONFIG_MOUSE_PS2=y
820# CONFIG_MOUSE_SERIAL is not set
821# CONFIG_MOUSE_INPORT is not set
822# CONFIG_MOUSE_LOGIBM is not set
823# CONFIG_MOUSE_PC110PAD is not set
824# CONFIG_MOUSE_VSXXXAA is not set
825# CONFIG_INPUT_JOYSTICK is not set
826# CONFIG_INPUT_TOUCHSCREEN is not set
827# CONFIG_INPUT_MISC is not set
828
829#
830# Character devices
831#
832CONFIG_VT=y
833CONFIG_VT_CONSOLE=y
834CONFIG_HW_CONSOLE=y
835# CONFIG_SERIAL_NONSTANDARD is not set
836
837#
838# Serial drivers
839#
840CONFIG_SERIAL_8250=m
841CONFIG_SERIAL_8250_NR_UARTS=4
842CONFIG_SERIAL_8250_EXTENDED=y
843# CONFIG_SERIAL_8250_MANY_PORTS is not set
844CONFIG_SERIAL_8250_SHARE_IRQ=y
845CONFIG_SERIAL_8250_DETECT_IRQ=y
846CONFIG_SERIAL_8250_MULTIPORT=y
847CONFIG_SERIAL_8250_RSA=y
848
849#
850# Non-8250 serial port support
851#
852CONFIG_SERIAL_CORE=m
853CONFIG_UNIX98_PTYS=y
854CONFIG_LEGACY_PTYS=y
855CONFIG_LEGACY_PTY_COUNT=256
856CONFIG_PRINTER=m
857# CONFIG_LP_CONSOLE is not set
858CONFIG_PPDEV=m
859CONFIG_TIPAR=m
860
861#
862# IPMI
863#
864# CONFIG_IPMI_HANDLER is not set
865
866#
867# Watchdog Cards
868#
869# CONFIG_WATCHDOG is not set
870CONFIG_RTC=m
871# CONFIG_GEN_RTC is not set
872# CONFIG_DTLK is not set
873# CONFIG_R3964 is not set
874# CONFIG_APPLICOM is not set
875
876#
877# Ftape, the floppy tape device driver
878#
879# CONFIG_DRM is not set
880# CONFIG_RAW_DRIVER is not set
881
882#
883# I2C support
884#
885# CONFIG_I2C is not set
886
887#
888# Dallas's 1-wire bus
889#
890CONFIG_W1=m
891CONFIG_W1_MATROX=m
892CONFIG_W1_DS9490=m
893CONFIG_W1_DS9490_BRIDGE=m
894CONFIG_W1_THERM=m
895CONFIG_W1_SMEM=m
896
897#
898# Misc devices
899#
900
901#
902# Multimedia devices
903#
904# CONFIG_VIDEO_DEV is not set
905
906#
907# Digital Video Broadcasting Devices
908#
909# CONFIG_DVB is not set
910
911#
912# Graphics support
913#
914# CONFIG_FB is not set
915
916#
917# Console display driver support
918#
919CONFIG_VGA_CONSOLE=y
920# CONFIG_MDA_CONSOLE is not set
921CONFIG_DUMMY_CONSOLE=y
922# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
923
924#
925# Sound
926#
927# CONFIG_SOUND is not set
928
929#
930# USB support
931#
932CONFIG_USB=m
933# CONFIG_USB_DEBUG is not set
934
935#
936# Miscellaneous USB options
937#
938CONFIG_USB_DEVICEFS=y
939# CONFIG_USB_BANDWIDTH is not set
940# CONFIG_USB_DYNAMIC_MINORS is not set
941# CONFIG_USB_OTG is not set
942CONFIG_USB_ARCH_HAS_HCD=y
943CONFIG_USB_ARCH_HAS_OHCI=y
944
945#
946# USB Host Controller Drivers
947#
948CONFIG_USB_EHCI_HCD=m
949# CONFIG_USB_EHCI_SPLIT_ISO is not set
950# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
951CONFIG_USB_OHCI_HCD=m
952CONFIG_USB_UHCI_HCD=m
953# CONFIG_USB_SL811_HCD is not set
954
955#
956# USB Device Class drivers
957#
958CONFIG_USB_BLUETOOTH_TTY=m
959CONFIG_USB_ACM=m
960CONFIG_USB_PRINTER=m
961
962#
963# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
964#
965CONFIG_USB_STORAGE=m
966# CONFIG_USB_STORAGE_DEBUG is not set
967# CONFIG_USB_STORAGE_RW_DETECT is not set
968CONFIG_USB_STORAGE_DATAFAB=y
969CONFIG_USB_STORAGE_FREECOM=y
970CONFIG_USB_STORAGE_DPCM=y
971CONFIG_USB_STORAGE_HP8200e=y
972CONFIG_USB_STORAGE_SDDR09=y
973CONFIG_USB_STORAGE_SDDR55=y
974CONFIG_USB_STORAGE_JUMPSHOT=y
975
976#
977# USB Input Devices
978#
979CONFIG_USB_HID=m
980CONFIG_USB_HIDINPUT=y
981CONFIG_HID_FF=y
982CONFIG_HID_PID=y
983CONFIG_LOGITECH_FF=y
984CONFIG_THRUSTMASTER_FF=y
985CONFIG_USB_HIDDEV=y
986
987#
988# USB HID Boot Protocol drivers
989#
990CONFIG_USB_KBD=m
991CONFIG_USB_MOUSE=m
992CONFIG_USB_AIPTEK=m
993CONFIG_USB_WACOM=m
994CONFIG_USB_KBTAB=m
995CONFIG_USB_POWERMATE=m
996# CONFIG_USB_MTOUCH is not set
997CONFIG_USB_EGALAX=m
998CONFIG_USB_XPAD=m
999# CONFIG_USB_ATI_REMOTE is not set
1000
1001#
1002# USB Imaging devices
1003#
1004CONFIG_USB_MDC800=m
1005CONFIG_USB_MICROTEK=m
1006
1007#
1008# USB Multimedia devices
1009#
1010CONFIG_USB_DABUSB=m
1011
1012#
1013# Video4Linux support is needed for USB Multimedia device support
1014#
1015
1016#
1017# USB Network Adapters
1018#
1019CONFIG_USB_CATC=m
1020CONFIG_USB_KAWETH=m
1021CONFIG_USB_PEGASUS=m
1022CONFIG_USB_RTL8150=m
1023CONFIG_USB_USBNET=m
1024
1025#
1026# USB Host-to-Host Cables
1027#
1028CONFIG_USB_ALI_M5632=y
1029CONFIG_USB_AN2720=y
1030CONFIG_USB_BELKIN=y
1031CONFIG_USB_GENESYS=y
1032CONFIG_USB_NET1080=y
1033CONFIG_USB_PL2301=y
1034CONFIG_USB_KC2190=y
1035
1036#
1037# Intelligent USB Devices/Gadgets
1038#
1039CONFIG_USB_ARMLINUX=y
1040CONFIG_USB_EPSON2888=y
1041CONFIG_USB_ZAURUS=y
1042CONFIG_USB_CDCETHER=y
1043
1044#
1045# USB Network Adapters
1046#
1047CONFIG_USB_AX8817X=y
1048
1049#
1050# USB port drivers
1051#
1052CONFIG_USB_USS720=m
1053
1054#
1055# USB Serial Converter support
1056#
1057CONFIG_USB_SERIAL=m
1058CONFIG_USB_SERIAL_GENERIC=y
1059CONFIG_USB_SERIAL_BELKIN=m
1060CONFIG_USB_SERIAL_WHITEHEAT=m
1061CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1062CONFIG_USB_SERIAL_CYPRESS_M8=m
1063CONFIG_USB_SERIAL_EMPEG=m
1064CONFIG_USB_SERIAL_FTDI_SIO=m
1065CONFIG_USB_SERIAL_VISOR=m
1066CONFIG_USB_SERIAL_IPAQ=m
1067CONFIG_USB_SERIAL_IR=m
1068CONFIG_USB_SERIAL_EDGEPORT=m
1069CONFIG_USB_SERIAL_EDGEPORT_TI=m
1070# CONFIG_USB_SERIAL_GARMIN is not set
1071# CONFIG_USB_SERIAL_IPW is not set
1072CONFIG_USB_SERIAL_KEYSPAN_PDA=m
1073CONFIG_USB_SERIAL_KEYSPAN=m
1074CONFIG_USB_SERIAL_KEYSPAN_MPR=y
1075# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set
1076CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
1077CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
1078CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
1079# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set
1080# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set
1081CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
1082CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
1083CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
1084CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
1085CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1086CONFIG_USB_SERIAL_KLSI=m
1087CONFIG_USB_SERIAL_KOBIL_SCT=m
1088CONFIG_USB_SERIAL_MCT_U232=m
1089CONFIG_USB_SERIAL_PL2303=m
1090CONFIG_USB_SERIAL_SAFE=m
1091CONFIG_USB_SERIAL_SAFE_PADDED=y
1092# CONFIG_USB_SERIAL_TI is not set
1093CONFIG_USB_SERIAL_CYBERJACK=m
1094CONFIG_USB_SERIAL_XIRCOM=m
1095CONFIG_USB_SERIAL_OMNINET=m
1096CONFIG_USB_EZUSB=y
1097
1098#
1099# USB Miscellaneous drivers
1100#
1101# CONFIG_USB_EMI62 is not set
1102# CONFIG_USB_EMI26 is not set
1103CONFIG_USB_AUERSWALD=m
1104CONFIG_USB_RIO500=m
1105CONFIG_USB_LEGOTOWER=m
1106CONFIG_USB_LCD=m
1107CONFIG_USB_LED=m
1108CONFIG_USB_CYTHERM=m
1109CONFIG_USB_PHIDGETKIT=m
1110CONFIG_USB_PHIDGETSERVO=m
1111# CONFIG_USB_IDMOUSE is not set
1112CONFIG_USB_TEST=m
1113
1114#
1115# USB ATM/DSL drivers
1116#
1117
1118#
1119# USB Gadget Support
1120#
1121# CONFIG_USB_GADGET is not set
1122
1123#
1124# MMC/SD Card support
1125#
1126# CONFIG_MMC is not set
1127
1128#
1129# InfiniBand support
1130#
1131# CONFIG_INFINIBAND is not set
1132
1133#
1134# File systems
1135#
1136CONFIG_EXT2_FS=m
1137# CONFIG_EXT2_FS_XATTR is not set
1138CONFIG_EXT3_FS=y
1139CONFIG_EXT3_FS_XATTR=y
1140# CONFIG_EXT3_FS_POSIX_ACL is not set
1141# CONFIG_EXT3_FS_SECURITY is not set
1142CONFIG_JBD=y
1143# CONFIG_JBD_DEBUG is not set
1144CONFIG_FS_MBCACHE=y
1145CONFIG_REISERFS_FS=m
1146# CONFIG_REISERFS_CHECK is not set
1147# CONFIG_REISERFS_PROC_INFO is not set
1148CONFIG_REISERFS_FS_XATTR=y
1149CONFIG_REISERFS_FS_POSIX_ACL=y
1150CONFIG_REISERFS_FS_SECURITY=y
1151# CONFIG_JFS_FS is not set
1152CONFIG_FS_POSIX_ACL=y
1153CONFIG_XFS_FS=m
1154# CONFIG_XFS_RT is not set
1155CONFIG_XFS_QUOTA=y
1156CONFIG_XFS_SECURITY=y
1157# CONFIG_XFS_POSIX_ACL is not set
1158CONFIG_MINIX_FS=m
1159CONFIG_ROMFS_FS=m
1160# CONFIG_QUOTA is not set
1161CONFIG_QUOTACTL=y
1162CONFIG_DNOTIFY=y
1163CONFIG_AUTOFS_FS=m
1164CONFIG_AUTOFS4_FS=m
1165
1166#
1167# CD-ROM/DVD Filesystems
1168#
1169CONFIG_ISO9660_FS=m
1170CONFIG_JOLIET=y
1171CONFIG_ZISOFS=y
1172CONFIG_ZISOFS_FS=m
1173CONFIG_UDF_FS=m
1174CONFIG_UDF_NLS=y
1175
1176#
1177# DOS/FAT/NT Filesystems
1178#
1179CONFIG_FAT_FS=m
1180CONFIG_MSDOS_FS=m
1181CONFIG_VFAT_FS=m
1182CONFIG_FAT_DEFAULT_CODEPAGE=437
1183CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1184CONFIG_NTFS_FS=m
1185# CONFIG_NTFS_DEBUG is not set
1186# CONFIG_NTFS_RW is not set
1187
1188#
1189# Pseudo filesystems
1190#
1191CONFIG_PROC_FS=y
1192CONFIG_PROC_KCORE=y
1193CONFIG_SYSFS=y
1194# CONFIG_DEVFS_FS is not set
1195CONFIG_DEVPTS_FS_XATTR=y
1196CONFIG_DEVPTS_FS_SECURITY=y
1197# CONFIG_TMPFS is not set
1198# CONFIG_HUGETLB_PAGE is not set
1199CONFIG_RAMFS=y
1200
1201#
1202# Miscellaneous filesystems
1203#
1204CONFIG_ADFS_FS=m
1205# CONFIG_ADFS_FS_RW is not set
1206CONFIG_AFFS_FS=m
1207CONFIG_HFS_FS=m
1208# CONFIG_HFSPLUS_FS is not set
1209CONFIG_BEFS_FS=m
1210# CONFIG_BEFS_DEBUG is not set
1211CONFIG_BFS_FS=m
1212CONFIG_EFS_FS=m
1213CONFIG_CRAMFS=m
1214CONFIG_VXFS_FS=m
1215CONFIG_HPFS_FS=m
1216CONFIG_QNX4FS_FS=m
1217CONFIG_SYSV_FS=m
1218CONFIG_UFS_FS=m
1219# CONFIG_UFS_FS_WRITE is not set
1220
1221#
1222# Network File Systems
1223#
1224CONFIG_NFS_FS=m
1225CONFIG_NFS_V3=y
1226# CONFIG_NFS_V4 is not set
1227# CONFIG_NFS_DIRECTIO is not set
1228CONFIG_NFSD=m
1229CONFIG_NFSD_V3=y
1230# CONFIG_NFSD_V4 is not set
1231CONFIG_NFSD_TCP=y
1232CONFIG_LOCKD=m
1233CONFIG_LOCKD_V4=y
1234CONFIG_EXPORTFS=m
1235CONFIG_SUNRPC=m
1236CONFIG_SUNRPC_GSS=m
1237CONFIG_RPCSEC_GSS_KRB5=m
1238CONFIG_RPCSEC_GSS_SPKM3=m
1239CONFIG_SMB_FS=m
1240# CONFIG_SMB_NLS_DEFAULT is not set
1241CONFIG_CIFS=m
1242# CONFIG_CIFS_STATS is not set
1243# CONFIG_CIFS_XATTR is not set
1244# CONFIG_CIFS_EXPERIMENTAL is not set
1245CONFIG_NCP_FS=m
1246CONFIG_NCPFS_PACKET_SIGNING=y
1247CONFIG_NCPFS_IOCTL_LOCKING=y
1248CONFIG_NCPFS_STRONG=y
1249CONFIG_NCPFS_NFS_NS=y
1250CONFIG_NCPFS_OS2_NS=y
1251CONFIG_NCPFS_SMALLDOS=y
1252CONFIG_NCPFS_NLS=y
1253CONFIG_NCPFS_EXTRAS=y
1254CONFIG_CODA_FS=m
1255CONFIG_CODA_FS_OLD_API=y
1256CONFIG_AFS_FS=m
1257CONFIG_RXRPC=m
1258
1259#
1260# Partition Types
1261#
1262CONFIG_PARTITION_ADVANCED=y
1263# CONFIG_ACORN_PARTITION is not set
1264# CONFIG_OSF_PARTITION is not set
1265# CONFIG_AMIGA_PARTITION is not set
1266# CONFIG_ATARI_PARTITION is not set
1267# CONFIG_MAC_PARTITION is not set
1268CONFIG_MSDOS_PARTITION=y
1269# CONFIG_BSD_DISKLABEL is not set
1270# CONFIG_MINIX_SUBPARTITION is not set
1271# CONFIG_SOLARIS_X86_PARTITION is not set
1272# CONFIG_UNIXWARE_DISKLABEL is not set
1273# CONFIG_LDM_PARTITION is not set
1274# CONFIG_SGI_PARTITION is not set
1275# CONFIG_ULTRIX_PARTITION is not set
1276# CONFIG_SUN_PARTITION is not set
1277# CONFIG_EFI_PARTITION is not set
1278
1279#
1280# Native Language Support
1281#
1282CONFIG_NLS=m
1283CONFIG_NLS_DEFAULT="iso8859-1"
1284CONFIG_NLS_CODEPAGE_437=m
1285CONFIG_NLS_CODEPAGE_737=m
1286CONFIG_NLS_CODEPAGE_775=m
1287CONFIG_NLS_CODEPAGE_850=m
1288CONFIG_NLS_CODEPAGE_852=m
1289CONFIG_NLS_CODEPAGE_855=m
1290CONFIG_NLS_CODEPAGE_857=m
1291CONFIG_NLS_CODEPAGE_860=m
1292CONFIG_NLS_CODEPAGE_861=m
1293CONFIG_NLS_CODEPAGE_862=m
1294CONFIG_NLS_CODEPAGE_863=m
1295CONFIG_NLS_CODEPAGE_864=m
1296CONFIG_NLS_CODEPAGE_865=m
1297CONFIG_NLS_CODEPAGE_866=m
1298CONFIG_NLS_CODEPAGE_869=m
1299CONFIG_NLS_CODEPAGE_936=m
1300CONFIG_NLS_CODEPAGE_950=m
1301CONFIG_NLS_CODEPAGE_932=m
1302CONFIG_NLS_CODEPAGE_949=m
1303CONFIG_NLS_CODEPAGE_874=m
1304CONFIG_NLS_ISO8859_8=m
1305CONFIG_NLS_CODEPAGE_1250=m
1306CONFIG_NLS_CODEPAGE_1251=m
1307CONFIG_NLS_ASCII=m
1308CONFIG_NLS_ISO8859_1=m
1309CONFIG_NLS_ISO8859_2=m
1310CONFIG_NLS_ISO8859_3=m
1311CONFIG_NLS_ISO8859_4=m
1312CONFIG_NLS_ISO8859_5=m
1313CONFIG_NLS_ISO8859_6=m
1314CONFIG_NLS_ISO8859_7=m
1315CONFIG_NLS_ISO8859_9=m
1316CONFIG_NLS_ISO8859_13=m
1317CONFIG_NLS_ISO8859_14=m
1318CONFIG_NLS_ISO8859_15=m
1319CONFIG_NLS_KOI8_R=m
1320CONFIG_NLS_KOI8_U=m
1321CONFIG_NLS_UTF8=m
1322
1323#
1324# Profiling support
1325#
1326# CONFIG_PROFILING is not set
1327
1328#
1329# Kernel hacking
1330#
1331# CONFIG_DEBUG_KERNEL is not set
1332CONFIG_CROSSCOMPILE=y
1333CONFIG_CMDLINE=""
1334
1335#
1336# Security options
1337#
1338CONFIG_KEYS=y
1339CONFIG_KEYS_DEBUG_PROC_KEYS=y
1340# CONFIG_SECURITY is not set
1341
1342#
1343# Cryptographic options
1344#
1345CONFIG_CRYPTO=y
1346CONFIG_CRYPTO_HMAC=y
1347CONFIG_CRYPTO_NULL=m
1348CONFIG_CRYPTO_MD4=m
1349CONFIG_CRYPTO_MD5=m
1350CONFIG_CRYPTO_SHA1=m
1351CONFIG_CRYPTO_SHA256=m
1352CONFIG_CRYPTO_SHA512=m
1353CONFIG_CRYPTO_WP512=m
1354CONFIG_CRYPTO_DES=m
1355CONFIG_CRYPTO_BLOWFISH=m
1356CONFIG_CRYPTO_TWOFISH=m
1357CONFIG_CRYPTO_SERPENT=m
1358CONFIG_CRYPTO_AES=m
1359CONFIG_CRYPTO_CAST5=m
1360CONFIG_CRYPTO_CAST6=m
1361CONFIG_CRYPTO_TEA=m
1362# CONFIG_CRYPTO_ARC4 is not set
1363CONFIG_CRYPTO_KHAZAD=m
1364CONFIG_CRYPTO_ANUBIS=m
1365CONFIG_CRYPTO_DEFLATE=m
1366CONFIG_CRYPTO_MICHAEL_MIC=m
1367# CONFIG_CRYPTO_CRC32C is not set
1368CONFIG_CRYPTO_TEST=m
1369
1370#
1371# Hardware crypto devices
1372#
1373
1374#
1375# Library routines
1376#
1377CONFIG_CRC_CCITT=m
1378CONFIG_CRC32=y
1379# CONFIG_LIBCRC32C is not set
1380CONFIG_ZLIB_INFLATE=m
1381CONFIG_ZLIB_DEFLATE=m
1382CONFIG_GENERIC_HARDIRQS=y
1383CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
new file mode 100644
index 000000000000..84978b70714b
--- /dev/null
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -0,0 +1,734 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:10 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_LOCK_KERNEL=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=15
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55CONFIG_STOP_MACHINE=y
56
57#
58# Machine selection
59#
60# CONFIG_MACH_JAZZ is not set
61# CONFIG_MACH_VR41XX is not set
62# CONFIG_TOSHIBA_JMR3927 is not set
63# CONFIG_MIPS_COBALT is not set
64# CONFIG_MACH_DECSTATION is not set
65# CONFIG_MIPS_EV64120 is not set
66# CONFIG_MIPS_EV96100 is not set
67# CONFIG_MIPS_IVR is not set
68# CONFIG_LASAT is not set
69# CONFIG_MIPS_ITE8172 is not set
70# CONFIG_MIPS_ATLAS is not set
71# CONFIG_MIPS_MALTA is not set
72# CONFIG_MIPS_SEAD is not set
73# CONFIG_MOMENCO_OCELOT is not set
74# CONFIG_MOMENCO_OCELOT_G is not set
75# CONFIG_MOMENCO_OCELOT_C is not set
76# CONFIG_MOMENCO_OCELOT_3 is not set
77# CONFIG_MOMENCO_JAGUAR_ATX is not set
78# CONFIG_PMC_YOSEMITE is not set
79# CONFIG_DDB5074 is not set
80# CONFIG_DDB5476 is not set
81# CONFIG_DDB5477 is not set
82# CONFIG_NEC_OSPREY is not set
83# CONFIG_SGI_IP22 is not set
84# CONFIG_SOC_AU1X00 is not set
85CONFIG_SIBYTE_SB1xxx_SOC=y
86CONFIG_SIBYTE_SWARM=y
87# CONFIG_SIBYTE_SENTOSA is not set
88# CONFIG_SIBYTE_RHONE is not set
89# CONFIG_SIBYTE_CARMEL is not set
90# CONFIG_SIBYTE_PTSWARM is not set
91# CONFIG_SIBYTE_LITTLESUR is not set
92# CONFIG_SIBYTE_CRHINE is not set
93# CONFIG_SIBYTE_CRHONE is not set
94# CONFIG_SIBYTE_UNKNOWN is not set
95CONFIG_SIBYTE_BOARD=y
96CONFIG_SIBYTE_SB1250=y
97CONFIG_CPU_SB1_PASS_1=y
98# CONFIG_CPU_SB1_PASS_2_1250 is not set
99# CONFIG_CPU_SB1_PASS_2_2 is not set
100# CONFIG_CPU_SB1_PASS_4 is not set
101# CONFIG_CPU_SB1_PASS_2_112x is not set
102# CONFIG_CPU_SB1_PASS_3 is not set
103CONFIG_SIBYTE_HAS_LDT=y
104# CONFIG_SIMULATION is not set
105CONFIG_SIBYTE_CFE=y
106# CONFIG_SIBYTE_CFE_CONSOLE is not set
107# CONFIG_SIBYTE_BUS_WATCHER is not set
108# CONFIG_SIBYTE_SB1250_PROF is not set
109# CONFIG_SIBYTE_TBPROF is not set
110# CONFIG_SNI_RM200_PCI is not set
111# CONFIG_TOSHIBA_RBTX4927 is not set
112CONFIG_RWSEM_GENERIC_SPINLOCK=y
113CONFIG_GENERIC_CALIBRATE_DELAY=y
114CONFIG_HAVE_DEC_LOCK=y
115CONFIG_DMA_COHERENT=y
116# CONFIG_CPU_LITTLE_ENDIAN is not set
117CONFIG_SWAP_IO_SPACE=y
118CONFIG_BOOT_ELF32=y
119CONFIG_MIPS_L1_CACHE_SHIFT=5
120
121#
122# CPU selection
123#
124# CONFIG_CPU_MIPS32 is not set
125# CONFIG_CPU_MIPS64 is not set
126# CONFIG_CPU_R3000 is not set
127# CONFIG_CPU_TX39XX is not set
128# CONFIG_CPU_VR41XX is not set
129# CONFIG_CPU_R4300 is not set
130# CONFIG_CPU_R4X00 is not set
131# CONFIG_CPU_TX49XX is not set
132# CONFIG_CPU_R5000 is not set
133# CONFIG_CPU_R5432 is not set
134# CONFIG_CPU_R6000 is not set
135# CONFIG_CPU_NEVADA is not set
136# CONFIG_CPU_R8000 is not set
137# CONFIG_CPU_R10000 is not set
138# CONFIG_CPU_RM7000 is not set
139# CONFIG_CPU_RM9000 is not set
140CONFIG_CPU_SB1=y
141CONFIG_PAGE_SIZE_4KB=y
142# CONFIG_PAGE_SIZE_8KB is not set
143# CONFIG_PAGE_SIZE_16KB is not set
144# CONFIG_PAGE_SIZE_64KB is not set
145# CONFIG_SIBYTE_DMA_PAGEOPS is not set
146CONFIG_CPU_HAS_PREFETCH=y
147CONFIG_SB1_PASS_1_WORKAROUNDS=y
148# CONFIG_64BIT_PHYS_ADDR is not set
149# CONFIG_CPU_ADVANCED is not set
150CONFIG_CPU_HAS_LLSC=y
151CONFIG_CPU_HAS_LLDSCD=y
152CONFIG_CPU_HAS_SYNC=y
153# CONFIG_HIGHMEM is not set
154CONFIG_SMP=y
155CONFIG_NR_CPUS=2
156# CONFIG_PREEMPT is not set
157
158#
159# Bus options (PCI, PCMCIA, EISA, ISA, TC)
160#
161CONFIG_HW_HAS_PCI=y
162CONFIG_PCI=y
163CONFIG_PCI_LEGACY_PROC=y
164CONFIG_PCI_NAMES=y
165CONFIG_MMU=y
166
167#
168# PCCARD (PCMCIA/CardBus) support
169#
170# CONFIG_PCCARD is not set
171
172#
173# PC-card bridges
174#
175
176#
177# PCI Hotplug Support
178#
179# CONFIG_HOTPLUG_PCI is not set
180
181#
182# Executable file formats
183#
184CONFIG_BINFMT_ELF=y
185# CONFIG_BINFMT_MISC is not set
186CONFIG_TRAD_SIGNALS=y
187
188#
189# Device Drivers
190#
191
192#
193# Generic Driver Options
194#
195CONFIG_STANDALONE=y
196CONFIG_PREVENT_FIRMWARE_BUILD=y
197# CONFIG_FW_LOADER is not set
198
199#
200# Memory Technology Devices (MTD)
201#
202# CONFIG_MTD is not set
203
204#
205# Parallel port support
206#
207# CONFIG_PARPORT is not set
208
209#
210# Plug and Play support
211#
212
213#
214# Block devices
215#
216# CONFIG_BLK_DEV_FD is not set
217# CONFIG_BLK_CPQ_DA is not set
218# CONFIG_BLK_CPQ_CISS_DA is not set
219# CONFIG_BLK_DEV_DAC960 is not set
220# CONFIG_BLK_DEV_UMEM is not set
221# CONFIG_BLK_DEV_COW_COMMON is not set
222# CONFIG_BLK_DEV_LOOP is not set
223# CONFIG_BLK_DEV_NBD is not set
224# CONFIG_BLK_DEV_SX8 is not set
225CONFIG_BLK_DEV_RAM=y
226CONFIG_BLK_DEV_RAM_COUNT=16
227CONFIG_BLK_DEV_RAM_SIZE=9220
228CONFIG_BLK_DEV_INITRD=y
229CONFIG_INITRAMFS_SOURCE=""
230# CONFIG_LBD is not set
231CONFIG_CDROM_PKTCDVD=m
232CONFIG_CDROM_PKTCDVD_BUFFERS=8
233# CONFIG_CDROM_PKTCDVD_WCACHE is not set
234
235#
236# IO Schedulers
237#
238CONFIG_IOSCHED_NOOP=y
239CONFIG_IOSCHED_AS=y
240CONFIG_IOSCHED_DEADLINE=y
241CONFIG_IOSCHED_CFQ=y
242CONFIG_ATA_OVER_ETH=m
243
244#
245# ATA/ATAPI/MFM/RLL support
246#
247CONFIG_IDE=y
248CONFIG_BLK_DEV_IDE=y
249
250#
251# Please see Documentation/ide.txt for help/info on IDE drives
252#
253# CONFIG_BLK_DEV_IDE_SATA is not set
254CONFIG_BLK_DEV_IDEDISK=y
255# CONFIG_IDEDISK_MULTI_MODE is not set
256CONFIG_BLK_DEV_IDECD=y
257CONFIG_BLK_DEV_IDETAPE=y
258CONFIG_BLK_DEV_IDEFLOPPY=y
259# CONFIG_IDE_TASK_IOCTL is not set
260
261#
262# IDE chipset support/bugfixes
263#
264CONFIG_IDE_GENERIC=y
265# CONFIG_BLK_DEV_IDEPCI is not set
266CONFIG_BLK_DEV_IDE_SWARM=y
267# CONFIG_IDE_ARM is not set
268# CONFIG_BLK_DEV_IDEDMA is not set
269# CONFIG_IDEDMA_AUTO is not set
270# CONFIG_BLK_DEV_HD is not set
271
272#
273# SCSI device support
274#
275# CONFIG_SCSI is not set
276
277#
278# Multi-device support (RAID and LVM)
279#
280# CONFIG_MD is not set
281
282#
283# Fusion MPT device support
284#
285
286#
287# IEEE 1394 (FireWire) support
288#
289# CONFIG_IEEE1394 is not set
290
291#
292# I2O device support
293#
294# CONFIG_I2O is not set
295
296#
297# Networking support
298#
299CONFIG_NET=y
300
301#
302# Networking options
303#
304CONFIG_PACKET=y
305CONFIG_PACKET_MMAP=y
306CONFIG_NETLINK_DEV=y
307CONFIG_UNIX=y
308CONFIG_NET_KEY=y
309CONFIG_INET=y
310# CONFIG_IP_MULTICAST is not set
311# CONFIG_IP_ADVANCED_ROUTER is not set
312CONFIG_IP_PNP=y
313CONFIG_IP_PNP_DHCP=y
314CONFIG_IP_PNP_BOOTP=y
315# CONFIG_IP_PNP_RARP is not set
316# CONFIG_NET_IPIP is not set
317# CONFIG_NET_IPGRE is not set
318# CONFIG_ARPD is not set
319# CONFIG_SYN_COOKIES is not set
320# CONFIG_INET_AH is not set
321# CONFIG_INET_ESP is not set
322# CONFIG_INET_IPCOMP is not set
323CONFIG_INET_TUNNEL=m
324CONFIG_IP_TCPDIAG=m
325# CONFIG_IP_TCPDIAG_IPV6 is not set
326# CONFIG_IPV6 is not set
327# CONFIG_NETFILTER is not set
328CONFIG_XFRM=y
329CONFIG_XFRM_USER=m
330
331#
332# SCTP Configuration (EXPERIMENTAL)
333#
334# CONFIG_IP_SCTP is not set
335# CONFIG_ATM is not set
336# CONFIG_BRIDGE is not set
337# CONFIG_VLAN_8021Q is not set
338# CONFIG_DECNET is not set
339# CONFIG_LLC2 is not set
340# CONFIG_IPX is not set
341# CONFIG_ATALK is not set
342# CONFIG_X25 is not set
343# CONFIG_LAPB is not set
344# CONFIG_NET_DIVERT is not set
345# CONFIG_ECONET is not set
346# CONFIG_WAN_ROUTER is not set
347
348#
349# QoS and/or fair queueing
350#
351# CONFIG_NET_SCHED is not set
352# CONFIG_NET_CLS_ROUTE is not set
353
354#
355# Network testing
356#
357# CONFIG_NET_PKTGEN is not set
358# CONFIG_NETPOLL is not set
359# CONFIG_NET_POLL_CONTROLLER is not set
360# CONFIG_HAMRADIO is not set
361# CONFIG_IRDA is not set
362# CONFIG_BT is not set
363CONFIG_NETDEVICES=y
364# CONFIG_DUMMY is not set
365# CONFIG_BONDING is not set
366# CONFIG_EQUALIZER is not set
367# CONFIG_TUN is not set
368# CONFIG_ETHERTAP is not set
369
370#
371# ARCnet devices
372#
373# CONFIG_ARCNET is not set
374
375#
376# Ethernet (10 or 100Mbit)
377#
378CONFIG_NET_ETHERNET=y
379CONFIG_MII=y
380# CONFIG_HAPPYMEAL is not set
381# CONFIG_SUNGEM is not set
382# CONFIG_NET_VENDOR_3COM is not set
383
384#
385# Tulip family network device support
386#
387# CONFIG_NET_TULIP is not set
388# CONFIG_HP100 is not set
389# CONFIG_NET_PCI is not set
390
391#
392# Ethernet (1000 Mbit)
393#
394# CONFIG_ACENIC is not set
395# CONFIG_DL2K is not set
396# CONFIG_E1000 is not set
397# CONFIG_NS83820 is not set
398# CONFIG_HAMACHI is not set
399# CONFIG_YELLOWFIN is not set
400# CONFIG_R8169 is not set
401CONFIG_NET_SB1250_MAC=y
402# CONFIG_SK98LIN is not set
403# CONFIG_TIGON3 is not set
404
405#
406# Ethernet (10000 Mbit)
407#
408# CONFIG_IXGB is not set
409# CONFIG_S2IO is not set
410
411#
412# Token Ring devices
413#
414# CONFIG_TR is not set
415
416#
417# Wireless LAN (non-hamradio)
418#
419# CONFIG_NET_RADIO is not set
420
421#
422# Wan interfaces
423#
424# CONFIG_WAN is not set
425# CONFIG_FDDI is not set
426# CONFIG_HIPPI is not set
427# CONFIG_PPP is not set
428# CONFIG_SLIP is not set
429# CONFIG_SHAPER is not set
430# CONFIG_NETCONSOLE is not set
431
432#
433# ISDN subsystem
434#
435# CONFIG_ISDN is not set
436
437#
438# Telephony Support
439#
440# CONFIG_PHONE is not set
441
442#
443# Input device support
444#
445# CONFIG_INPUT is not set
446
447#
448# Userland interfaces
449#
450
451#
452# Input I/O drivers
453#
454# CONFIG_GAMEPORT is not set
455CONFIG_SOUND_GAMEPORT=y
456CONFIG_SERIO=y
457# CONFIG_SERIO_I8042 is not set
458CONFIG_SERIO_SERPORT=y
459# CONFIG_SERIO_CT82C710 is not set
460# CONFIG_SERIO_PCIPS2 is not set
461# CONFIG_SERIO_LIBPS2 is not set
462CONFIG_SERIO_RAW=m
463
464#
465# Input Device Drivers
466#
467
468#
469# Character devices
470#
471# CONFIG_VT is not set
472CONFIG_SERIAL_NONSTANDARD=y
473# CONFIG_ROCKETPORT is not set
474# CONFIG_CYCLADES is not set
475# CONFIG_MOXA_SMARTIO is not set
476# CONFIG_ISI is not set
477# CONFIG_SYNCLINK is not set
478# CONFIG_SYNCLINKMP is not set
479# CONFIG_N_HDLC is not set
480# CONFIG_STALDRV is not set
481CONFIG_SIBYTE_SB1250_DUART=y
482CONFIG_SIBYTE_SB1250_DUART_CONSOLE=y
483
484#
485# Serial drivers
486#
487# CONFIG_SERIAL_8250 is not set
488
489#
490# Non-8250 serial port support
491#
492CONFIG_UNIX98_PTYS=y
493CONFIG_LEGACY_PTYS=y
494CONFIG_LEGACY_PTY_COUNT=256
495
496#
497# IPMI
498#
499# CONFIG_IPMI_HANDLER is not set
500
501#
502# Watchdog Cards
503#
504# CONFIG_WATCHDOG is not set
505# CONFIG_RTC is not set
506# CONFIG_GEN_RTC is not set
507# CONFIG_DTLK is not set
508# CONFIG_R3964 is not set
509# CONFIG_APPLICOM is not set
510
511#
512# Ftape, the floppy tape device driver
513#
514# CONFIG_DRM is not set
515# CONFIG_RAW_DRIVER is not set
516
517#
518# I2C support
519#
520# CONFIG_I2C is not set
521
522#
523# Dallas's 1-wire bus
524#
525# CONFIG_W1 is not set
526
527#
528# Misc devices
529#
530
531#
532# Multimedia devices
533#
534# CONFIG_VIDEO_DEV is not set
535
536#
537# Digital Video Broadcasting Devices
538#
539# CONFIG_DVB is not set
540
541#
542# Graphics support
543#
544# CONFIG_FB is not set
545# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
546
547#
548# Sound
549#
550# CONFIG_SOUND is not set
551
552#
553# USB support
554#
555# CONFIG_USB is not set
556CONFIG_USB_ARCH_HAS_HCD=y
557CONFIG_USB_ARCH_HAS_OHCI=y
558
559#
560# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
561#
562
563#
564# USB Gadget Support
565#
566# CONFIG_USB_GADGET is not set
567
568#
569# MMC/SD Card support
570#
571# CONFIG_MMC is not set
572
573#
574# InfiniBand support
575#
576# CONFIG_INFINIBAND is not set
577
578#
579# File systems
580#
581CONFIG_EXT2_FS=y
582CONFIG_EXT2_FS_XATTR=y
583CONFIG_EXT2_FS_POSIX_ACL=y
584CONFIG_EXT2_FS_SECURITY=y
585# CONFIG_EXT3_FS is not set
586# CONFIG_JBD is not set
587CONFIG_FS_MBCACHE=y
588# CONFIG_REISERFS_FS is not set
589# CONFIG_JFS_FS is not set
590CONFIG_FS_POSIX_ACL=y
591# CONFIG_XFS_FS is not set
592# CONFIG_MINIX_FS is not set
593# CONFIG_ROMFS_FS is not set
594# CONFIG_QUOTA is not set
595CONFIG_DNOTIFY=y
596# CONFIG_AUTOFS_FS is not set
597# CONFIG_AUTOFS4_FS is not set
598
599#
600# CD-ROM/DVD Filesystems
601#
602# CONFIG_ISO9660_FS is not set
603# CONFIG_UDF_FS is not set
604
605#
606# DOS/FAT/NT Filesystems
607#
608# CONFIG_MSDOS_FS is not set
609# CONFIG_VFAT_FS is not set
610# CONFIG_NTFS_FS is not set
611
612#
613# Pseudo filesystems
614#
615CONFIG_PROC_FS=y
616CONFIG_PROC_KCORE=y
617CONFIG_SYSFS=y
618# CONFIG_DEVFS_FS is not set
619# CONFIG_DEVPTS_FS_XATTR is not set
620# CONFIG_TMPFS is not set
621# CONFIG_HUGETLB_PAGE is not set
622CONFIG_RAMFS=y
623
624#
625# Miscellaneous filesystems
626#
627# CONFIG_ADFS_FS is not set
628# CONFIG_AFFS_FS is not set
629# CONFIG_HFS_FS is not set
630# CONFIG_HFSPLUS_FS is not set
631# CONFIG_BEFS_FS is not set
632# CONFIG_BFS_FS is not set
633# CONFIG_EFS_FS is not set
634# CONFIG_CRAMFS is not set
635# CONFIG_VXFS_FS is not set
636# CONFIG_HPFS_FS is not set
637# CONFIG_QNX4FS_FS is not set
638# CONFIG_SYSV_FS is not set
639# CONFIG_UFS_FS is not set
640
641#
642# Network File Systems
643#
644CONFIG_NFS_FS=y
645CONFIG_NFS_V3=y
646# CONFIG_NFS_V4 is not set
647# CONFIG_NFS_DIRECTIO is not set
648# CONFIG_NFSD is not set
649CONFIG_ROOT_NFS=y
650CONFIG_LOCKD=y
651CONFIG_LOCKD_V4=y
652# CONFIG_EXPORTFS is not set
653CONFIG_SUNRPC=y
654# CONFIG_RPCSEC_GSS_KRB5 is not set
655# CONFIG_RPCSEC_GSS_SPKM3 is not set
656# CONFIG_SMB_FS is not set
657# CONFIG_CIFS is not set
658# CONFIG_NCP_FS is not set
659# CONFIG_CODA_FS is not set
660# CONFIG_AFS_FS is not set
661
662#
663# Partition Types
664#
665# CONFIG_PARTITION_ADVANCED is not set
666CONFIG_MSDOS_PARTITION=y
667
668#
669# Native Language Support
670#
671# CONFIG_NLS is not set
672
673#
674# Profiling support
675#
676# CONFIG_PROFILING is not set
677
678#
679# Kernel hacking
680#
681# CONFIG_DEBUG_KERNEL is not set
682CONFIG_CROSSCOMPILE=y
683CONFIG_CMDLINE=""
684# CONFIG_SB1XXX_CORELIS is not set
685
686#
687# Security options
688#
689CONFIG_KEYS=y
690CONFIG_KEYS_DEBUG_PROC_KEYS=y
691# CONFIG_SECURITY is not set
692
693#
694# Cryptographic options
695#
696CONFIG_CRYPTO=y
697CONFIG_CRYPTO_HMAC=y
698CONFIG_CRYPTO_NULL=y
699CONFIG_CRYPTO_MD4=y
700CONFIG_CRYPTO_MD5=y
701CONFIG_CRYPTO_SHA1=y
702CONFIG_CRYPTO_SHA256=y
703CONFIG_CRYPTO_SHA512=y
704CONFIG_CRYPTO_WP512=m
705CONFIG_CRYPTO_DES=y
706CONFIG_CRYPTO_BLOWFISH=y
707CONFIG_CRYPTO_TWOFISH=y
708CONFIG_CRYPTO_SERPENT=y
709CONFIG_CRYPTO_AES=m
710# CONFIG_CRYPTO_CAST5 is not set
711# CONFIG_CRYPTO_CAST6 is not set
712CONFIG_CRYPTO_TEA=m
713# CONFIG_CRYPTO_ARC4 is not set
714CONFIG_CRYPTO_KHAZAD=m
715CONFIG_CRYPTO_ANUBIS=m
716CONFIG_CRYPTO_DEFLATE=y
717CONFIG_CRYPTO_MICHAEL_MIC=y
718# CONFIG_CRYPTO_CRC32C is not set
719# CONFIG_CRYPTO_TEST is not set
720
721#
722# Hardware crypto devices
723#
724
725#
726# Library routines
727#
728# CONFIG_CRC_CCITT is not set
729CONFIG_CRC32=y
730# CONFIG_LIBCRC32C is not set
731CONFIG_ZLIB_INFLATE=y
732CONFIG_ZLIB_DEFLATE=y
733CONFIG_GENERIC_HARDIRQS=y
734CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/sead_defconfig b/arch/mips/configs/sead_defconfig
new file mode 100644
index 000000000000..7c718a429b04
--- /dev/null
+++ b/arch/mips/configs/sead_defconfig
@@ -0,0 +1,493 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:10 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23# CONFIG_SYSVIPC is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_LOG_BUF_SHIFT=14
28# CONFIG_HOTPLUG is not set
29# CONFIG_IKCONFIG is not set
30CONFIG_EMBEDDED=y
31CONFIG_KALLSYMS=y
32# CONFIG_KALLSYMS_EXTRA_PASS is not set
33CONFIG_FUTEX=y
34CONFIG_EPOLL=y
35# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
36CONFIG_SHMEM=y
37CONFIG_CC_ALIGN_FUNCTIONS=0
38CONFIG_CC_ALIGN_LABELS=0
39CONFIG_CC_ALIGN_LOOPS=0
40CONFIG_CC_ALIGN_JUMPS=0
41# CONFIG_TINY_SHMEM is not set
42
43#
44# Loadable module support
45#
46# CONFIG_MODULES is not set
47
48#
49# Machine selection
50#
51# CONFIG_MACH_JAZZ is not set
52# CONFIG_MACH_VR41XX is not set
53# CONFIG_TOSHIBA_JMR3927 is not set
54# CONFIG_MIPS_COBALT is not set
55# CONFIG_MACH_DECSTATION is not set
56# CONFIG_MIPS_EV64120 is not set
57# CONFIG_MIPS_EV96100 is not set
58# CONFIG_MIPS_IVR is not set
59# CONFIG_LASAT is not set
60# CONFIG_MIPS_ITE8172 is not set
61# CONFIG_MIPS_ATLAS is not set
62# CONFIG_MIPS_MALTA is not set
63CONFIG_MIPS_SEAD=y
64# CONFIG_MOMENCO_OCELOT is not set
65# CONFIG_MOMENCO_OCELOT_G is not set
66# CONFIG_MOMENCO_OCELOT_C is not set
67# CONFIG_MOMENCO_OCELOT_3 is not set
68# CONFIG_MOMENCO_JAGUAR_ATX is not set
69# CONFIG_PMC_YOSEMITE is not set
70# CONFIG_DDB5074 is not set
71# CONFIG_DDB5476 is not set
72# CONFIG_DDB5477 is not set
73# CONFIG_NEC_OSPREY is not set
74# CONFIG_SGI_IP22 is not set
75# CONFIG_SOC_AU1X00 is not set
76# CONFIG_SIBYTE_SB1xxx_SOC is not set
77# CONFIG_SNI_RM200_PCI is not set
78# CONFIG_TOSHIBA_RBTX4927 is not set
79CONFIG_RWSEM_GENERIC_SPINLOCK=y
80CONFIG_GENERIC_CALIBRATE_DELAY=y
81CONFIG_HAVE_DEC_LOCK=y
82CONFIG_DMA_NONCOHERENT=y
83CONFIG_CPU_LITTLE_ENDIAN=y
84CONFIG_IRQ_CPU=y
85CONFIG_MIPS_BOARDS_GEN=y
86CONFIG_MIPS_L1_CACHE_SHIFT=5
87
88#
89# CPU selection
90#
91CONFIG_CPU_MIPS32=y
92# CONFIG_CPU_MIPS64 is not set
93# CONFIG_CPU_R3000 is not set
94# CONFIG_CPU_TX39XX is not set
95# CONFIG_CPU_VR41XX is not set
96# CONFIG_CPU_R4300 is not set
97# CONFIG_CPU_R4X00 is not set
98# CONFIG_CPU_TX49XX is not set
99# CONFIG_CPU_R5000 is not set
100# CONFIG_CPU_R5432 is not set
101# CONFIG_CPU_R6000 is not set
102# CONFIG_CPU_NEVADA is not set
103# CONFIG_CPU_R8000 is not set
104# CONFIG_CPU_R10000 is not set
105# CONFIG_CPU_RM7000 is not set
106# CONFIG_CPU_RM9000 is not set
107# CONFIG_CPU_SB1 is not set
108CONFIG_PAGE_SIZE_4KB=y
109# CONFIG_PAGE_SIZE_8KB is not set
110# CONFIG_PAGE_SIZE_16KB is not set
111# CONFIG_PAGE_SIZE_64KB is not set
112CONFIG_CPU_HAS_PREFETCH=y
113# CONFIG_64BIT_PHYS_ADDR is not set
114# CONFIG_CPU_ADVANCED is not set
115CONFIG_CPU_HAS_LLSC=y
116CONFIG_CPU_HAS_SYNC=y
117# CONFIG_PREEMPT is not set
118
119#
120# Bus options (PCI, PCMCIA, EISA, ISA, TC)
121#
122CONFIG_MMU=y
123
124#
125# PCCARD (PCMCIA/CardBus) support
126#
127# CONFIG_PCCARD is not set
128
129#
130# PC-card bridges
131#
132
133#
134# PCI Hotplug Support
135#
136
137#
138# Executable file formats
139#
140CONFIG_BINFMT_ELF=y
141# CONFIG_BINFMT_MISC is not set
142CONFIG_TRAD_SIGNALS=y
143
144#
145# Device Drivers
146#
147
148#
149# Generic Driver Options
150#
151CONFIG_STANDALONE=y
152CONFIG_PREVENT_FIRMWARE_BUILD=y
153# CONFIG_FW_LOADER is not set
154
155#
156# Memory Technology Devices (MTD)
157#
158# CONFIG_MTD is not set
159
160#
161# Parallel port support
162#
163# CONFIG_PARPORT is not set
164
165#
166# Plug and Play support
167#
168
169#
170# Block devices
171#
172# CONFIG_BLK_DEV_FD is not set
173# CONFIG_BLK_DEV_COW_COMMON is not set
174CONFIG_BLK_DEV_LOOP=y
175# CONFIG_BLK_DEV_CRYPTOLOOP is not set
176CONFIG_BLK_DEV_RAM=y
177CONFIG_BLK_DEV_RAM_COUNT=16
178CONFIG_BLK_DEV_RAM_SIZE=18432
179CONFIG_BLK_DEV_INITRD=y
180CONFIG_INITRAMFS_SOURCE=""
181# CONFIG_LBD is not set
182CONFIG_CDROM_PKTCDVD=y
183CONFIG_CDROM_PKTCDVD_BUFFERS=8
184# CONFIG_CDROM_PKTCDVD_WCACHE is not set
185
186#
187# IO Schedulers
188#
189CONFIG_IOSCHED_NOOP=y
190CONFIG_IOSCHED_AS=y
191CONFIG_IOSCHED_DEADLINE=y
192CONFIG_IOSCHED_CFQ=y
193
194#
195# ATA/ATAPI/MFM/RLL support
196#
197# CONFIG_IDE is not set
198
199#
200# SCSI device support
201#
202# CONFIG_SCSI is not set
203
204#
205# Multi-device support (RAID and LVM)
206#
207# CONFIG_MD is not set
208
209#
210# Fusion MPT device support
211#
212
213#
214# IEEE 1394 (FireWire) support
215#
216
217#
218# I2O device support
219#
220
221#
222# Networking support
223#
224# CONFIG_NET is not set
225# CONFIG_NETPOLL is not set
226# CONFIG_NET_POLL_CONTROLLER is not set
227
228#
229# ISDN subsystem
230#
231
232#
233# Telephony Support
234#
235# CONFIG_PHONE is not set
236
237#
238# Input device support
239#
240CONFIG_INPUT=y
241
242#
243# Userland interfaces
244#
245CONFIG_INPUT_MOUSEDEV=y
246CONFIG_INPUT_MOUSEDEV_PSAUX=y
247CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
248CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
249# CONFIG_INPUT_JOYDEV is not set
250# CONFIG_INPUT_TSDEV is not set
251# CONFIG_INPUT_EVDEV is not set
252# CONFIG_INPUT_EVBUG is not set
253
254#
255# Input I/O drivers
256#
257# CONFIG_GAMEPORT is not set
258CONFIG_SOUND_GAMEPORT=y
259CONFIG_SERIO=y
260# CONFIG_SERIO_I8042 is not set
261CONFIG_SERIO_SERPORT=y
262# CONFIG_SERIO_CT82C710 is not set
263# CONFIG_SERIO_LIBPS2 is not set
264CONFIG_SERIO_RAW=y
265
266#
267# Input Device Drivers
268#
269# CONFIG_INPUT_KEYBOARD is not set
270# CONFIG_INPUT_MOUSE is not set
271# CONFIG_INPUT_JOYSTICK is not set
272# CONFIG_INPUT_TOUCHSCREEN is not set
273# CONFIG_INPUT_MISC is not set
274
275#
276# Character devices
277#
278CONFIG_VT=y
279CONFIG_VT_CONSOLE=y
280CONFIG_HW_CONSOLE=y
281# CONFIG_SERIAL_NONSTANDARD is not set
282
283#
284# Serial drivers
285#
286CONFIG_SERIAL_8250=y
287CONFIG_SERIAL_8250_CONSOLE=y
288CONFIG_SERIAL_8250_NR_UARTS=4
289# CONFIG_SERIAL_8250_EXTENDED is not set
290
291#
292# Non-8250 serial port support
293#
294CONFIG_SERIAL_CORE=y
295CONFIG_SERIAL_CORE_CONSOLE=y
296# CONFIG_UNIX98_PTYS is not set
297CONFIG_LEGACY_PTYS=y
298CONFIG_LEGACY_PTY_COUNT=256
299
300#
301# IPMI
302#
303# CONFIG_IPMI_HANDLER is not set
304
305#
306# Watchdog Cards
307#
308# CONFIG_WATCHDOG is not set
309# CONFIG_RTC is not set
310# CONFIG_GEN_RTC is not set
311# CONFIG_DTLK is not set
312# CONFIG_R3964 is not set
313
314#
315# Ftape, the floppy tape device driver
316#
317# CONFIG_DRM is not set
318# CONFIG_RAW_DRIVER is not set
319
320#
321# I2C support
322#
323# CONFIG_I2C is not set
324
325#
326# Dallas's 1-wire bus
327#
328# CONFIG_W1 is not set
329
330#
331# Misc devices
332#
333
334#
335# Multimedia devices
336#
337# CONFIG_VIDEO_DEV is not set
338
339#
340# Digital Video Broadcasting Devices
341#
342
343#
344# Graphics support
345#
346# CONFIG_FB is not set
347
348#
349# Console display driver support
350#
351# CONFIG_VGA_CONSOLE is not set
352CONFIG_DUMMY_CONSOLE=y
353# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
354
355#
356# Sound
357#
358# CONFIG_SOUND is not set
359
360#
361# USB support
362#
363# CONFIG_USB_ARCH_HAS_HCD is not set
364# CONFIG_USB_ARCH_HAS_OHCI is not set
365
366#
367# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
368#
369
370#
371# USB Gadget Support
372#
373# CONFIG_USB_GADGET is not set
374
375#
376# MMC/SD Card support
377#
378# CONFIG_MMC is not set
379
380#
381# InfiniBand support
382#
383# CONFIG_INFINIBAND is not set
384
385#
386# File systems
387#
388CONFIG_EXT2_FS=y
389CONFIG_EXT2_FS_XATTR=y
390CONFIG_EXT2_FS_POSIX_ACL=y
391CONFIG_EXT2_FS_SECURITY=y
392# CONFIG_EXT3_FS is not set
393# CONFIG_JBD is not set
394CONFIG_FS_MBCACHE=y
395# CONFIG_REISERFS_FS is not set
396# CONFIG_JFS_FS is not set
397CONFIG_FS_POSIX_ACL=y
398# CONFIG_XFS_FS is not set
399# CONFIG_MINIX_FS is not set
400# CONFIG_ROMFS_FS is not set
401# CONFIG_QUOTA is not set
402CONFIG_DNOTIFY=y
403# CONFIG_AUTOFS_FS is not set
404# CONFIG_AUTOFS4_FS is not set
405
406#
407# CD-ROM/DVD Filesystems
408#
409# CONFIG_ISO9660_FS is not set
410# CONFIG_UDF_FS is not set
411
412#
413# DOS/FAT/NT Filesystems
414#
415# CONFIG_MSDOS_FS is not set
416# CONFIG_VFAT_FS is not set
417# CONFIG_NTFS_FS is not set
418
419#
420# Pseudo filesystems
421#
422CONFIG_PROC_FS=y
423CONFIG_PROC_KCORE=y
424CONFIG_SYSFS=y
425# CONFIG_DEVFS_FS is not set
426# CONFIG_TMPFS is not set
427# CONFIG_HUGETLB_PAGE is not set
428CONFIG_RAMFS=y
429
430#
431# Miscellaneous filesystems
432#
433# CONFIG_ADFS_FS is not set
434# CONFIG_AFFS_FS is not set
435# CONFIG_HFS_FS is not set
436# CONFIG_HFSPLUS_FS is not set
437# CONFIG_BEFS_FS is not set
438# CONFIG_BFS_FS is not set
439# CONFIG_EFS_FS is not set
440# CONFIG_CRAMFS is not set
441# CONFIG_VXFS_FS is not set
442# CONFIG_HPFS_FS is not set
443# CONFIG_QNX4FS_FS is not set
444# CONFIG_SYSV_FS is not set
445# CONFIG_UFS_FS is not set
446
447#
448# Partition Types
449#
450# CONFIG_PARTITION_ADVANCED is not set
451CONFIG_MSDOS_PARTITION=y
452
453#
454# Native Language Support
455#
456# CONFIG_NLS is not set
457
458#
459# Profiling support
460#
461# CONFIG_PROFILING is not set
462
463#
464# Kernel hacking
465#
466# CONFIG_DEBUG_KERNEL is not set
467CONFIG_CROSSCOMPILE=y
468CONFIG_CMDLINE=""
469
470#
471# Security options
472#
473CONFIG_KEYS=y
474CONFIG_KEYS_DEBUG_PROC_KEYS=y
475# CONFIG_SECURITY is not set
476
477#
478# Cryptographic options
479#
480# CONFIG_CRYPTO is not set
481
482#
483# Hardware crypto devices
484#
485
486#
487# Library routines
488#
489# CONFIG_CRC_CCITT is not set
490# CONFIG_CRC32 is not set
491# CONFIG_LIBCRC32C is not set
492CONFIG_GENERIC_HARDIRQS=y
493CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
new file mode 100644
index 000000000000..e01727cd0fe9
--- /dev/null
+++ b/arch/mips/configs/tb0226_defconfig
@@ -0,0 +1,763 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:12 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60CONFIG_MACH_VR41XX=y
61# CONFIG_NEC_CMBVR4133 is not set
62# CONFIG_CASIO_E55 is not set
63# CONFIG_IBM_WORKPAD is not set
64CONFIG_TANBAC_TB0226=y
65# CONFIG_TANBAC_TB0229 is not set
66# CONFIG_VICTOR_MPC30X is not set
67# CONFIG_ZAO_CAPCELLA is not set
68# CONFIG_TOSHIBA_JMR3927 is not set
69# CONFIG_MIPS_COBALT is not set
70# CONFIG_MACH_DECSTATION is not set
71# CONFIG_MIPS_EV64120 is not set
72# CONFIG_MIPS_EV96100 is not set
73# CONFIG_MIPS_IVR is not set
74# CONFIG_LASAT is not set
75# CONFIG_MIPS_ITE8172 is not set
76# CONFIG_MIPS_ATLAS is not set
77# CONFIG_MIPS_MALTA is not set
78# CONFIG_MIPS_SEAD is not set
79# CONFIG_MOMENCO_OCELOT is not set
80# CONFIG_MOMENCO_OCELOT_G is not set
81# CONFIG_MOMENCO_OCELOT_C is not set
82# CONFIG_MOMENCO_OCELOT_3 is not set
83# CONFIG_MOMENCO_JAGUAR_ATX is not set
84# CONFIG_PMC_YOSEMITE is not set
85# CONFIG_DDB5074 is not set
86# CONFIG_DDB5476 is not set
87# CONFIG_DDB5477 is not set
88# CONFIG_NEC_OSPREY is not set
89# CONFIG_SGI_IP22 is not set
90# CONFIG_SOC_AU1X00 is not set
91# CONFIG_SIBYTE_SB1xxx_SOC is not set
92# CONFIG_SNI_RM200_PCI is not set
93# CONFIG_TOSHIBA_RBTX4927 is not set
94CONFIG_RWSEM_GENERIC_SPINLOCK=y
95CONFIG_GENERIC_CALIBRATE_DELAY=y
96CONFIG_HAVE_DEC_LOCK=y
97CONFIG_DMA_NONCOHERENT=y
98CONFIG_CPU_LITTLE_ENDIAN=y
99CONFIG_IRQ_CPU=y
100CONFIG_MIPS_L1_CACHE_SHIFT=5
101
102#
103# CPU selection
104#
105# CONFIG_CPU_MIPS32 is not set
106# CONFIG_CPU_MIPS64 is not set
107# CONFIG_CPU_R3000 is not set
108# CONFIG_CPU_TX39XX is not set
109CONFIG_CPU_VR41XX=y
110# CONFIG_CPU_R4300 is not set
111# CONFIG_CPU_R4X00 is not set
112# CONFIG_CPU_TX49XX is not set
113# CONFIG_CPU_R5000 is not set
114# CONFIG_CPU_R5432 is not set
115# CONFIG_CPU_R6000 is not set
116# CONFIG_CPU_NEVADA is not set
117# CONFIG_CPU_R8000 is not set
118# CONFIG_CPU_R10000 is not set
119# CONFIG_CPU_RM7000 is not set
120# CONFIG_CPU_RM9000 is not set
121# CONFIG_CPU_SB1 is not set
122CONFIG_PAGE_SIZE_4KB=y
123# CONFIG_PAGE_SIZE_8KB is not set
124# CONFIG_PAGE_SIZE_16KB is not set
125# CONFIG_PAGE_SIZE_64KB is not set
126# CONFIG_CPU_ADVANCED is not set
127CONFIG_CPU_HAS_SYNC=y
128# CONFIG_PREEMPT is not set
129
130#
131# Bus options (PCI, PCMCIA, EISA, ISA, TC)
132#
133CONFIG_HW_HAS_PCI=y
134# CONFIG_PCI is not set
135CONFIG_MMU=y
136
137#
138# PCCARD (PCMCIA/CardBus) support
139#
140# CONFIG_PCCARD is not set
141
142#
143# PC-card bridges
144#
145
146#
147# PCI Hotplug Support
148#
149
150#
151# Executable file formats
152#
153CONFIG_BINFMT_ELF=y
154# CONFIG_BINFMT_MISC is not set
155CONFIG_TRAD_SIGNALS=y
156
157#
158# Device Drivers
159#
160
161#
162# Generic Driver Options
163#
164CONFIG_STANDALONE=y
165CONFIG_PREVENT_FIRMWARE_BUILD=y
166# CONFIG_FW_LOADER is not set
167
168#
169# Memory Technology Devices (MTD)
170#
171# CONFIG_MTD is not set
172
173#
174# Parallel port support
175#
176# CONFIG_PARPORT is not set
177
178#
179# Plug and Play support
180#
181
182#
183# Block devices
184#
185# CONFIG_BLK_DEV_FD is not set
186# CONFIG_BLK_DEV_COW_COMMON is not set
187CONFIG_BLK_DEV_LOOP=m
188# CONFIG_BLK_DEV_CRYPTOLOOP is not set
189CONFIG_BLK_DEV_NBD=m
190CONFIG_BLK_DEV_RAM=m
191CONFIG_BLK_DEV_RAM_COUNT=16
192CONFIG_BLK_DEV_RAM_SIZE=4096
193CONFIG_INITRAMFS_SOURCE=""
194# CONFIG_LBD is not set
195CONFIG_CDROM_PKTCDVD=m
196CONFIG_CDROM_PKTCDVD_BUFFERS=8
197# CONFIG_CDROM_PKTCDVD_WCACHE is not set
198
199#
200# IO Schedulers
201#
202CONFIG_IOSCHED_NOOP=y
203CONFIG_IOSCHED_AS=y
204CONFIG_IOSCHED_DEADLINE=y
205CONFIG_IOSCHED_CFQ=y
206CONFIG_ATA_OVER_ETH=m
207
208#
209# ATA/ATAPI/MFM/RLL support
210#
211CONFIG_IDE=y
212CONFIG_BLK_DEV_IDE=y
213
214#
215# Please see Documentation/ide.txt for help/info on IDE drives
216#
217# CONFIG_BLK_DEV_IDE_SATA is not set
218CONFIG_BLK_DEV_IDEDISK=y
219CONFIG_IDEDISK_MULTI_MODE=y
220# CONFIG_BLK_DEV_IDECD is not set
221# CONFIG_BLK_DEV_IDETAPE is not set
222# CONFIG_BLK_DEV_IDEFLOPPY is not set
223CONFIG_BLK_DEV_IDESCSI=y
224# CONFIG_IDE_TASK_IOCTL is not set
225
226#
227# IDE chipset support/bugfixes
228#
229CONFIG_IDE_GENERIC=y
230# CONFIG_IDE_ARM is not set
231# CONFIG_BLK_DEV_IDEDMA is not set
232# CONFIG_IDEDMA_AUTO is not set
233# CONFIG_BLK_DEV_HD is not set
234
235#
236# SCSI device support
237#
238CONFIG_SCSI=y
239CONFIG_SCSI_PROC_FS=y
240
241#
242# SCSI support type (disk, tape, CD-ROM)
243#
244CONFIG_BLK_DEV_SD=y
245# CONFIG_CHR_DEV_ST is not set
246# CONFIG_CHR_DEV_OSST is not set
247CONFIG_BLK_DEV_SR=y
248# CONFIG_BLK_DEV_SR_VENDOR is not set
249CONFIG_CHR_DEV_SG=y
250
251#
252# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
253#
254CONFIG_SCSI_MULTI_LUN=y
255CONFIG_SCSI_CONSTANTS=y
256# CONFIG_SCSI_LOGGING is not set
257
258#
259# SCSI Transport Attributes
260#
261# CONFIG_SCSI_SPI_ATTRS is not set
262# CONFIG_SCSI_FC_ATTRS is not set
263# CONFIG_SCSI_ISCSI_ATTRS is not set
264
265#
266# SCSI low-level drivers
267#
268# CONFIG_SCSI_SATA is not set
269# CONFIG_SCSI_DEBUG is not set
270
271#
272# Multi-device support (RAID and LVM)
273#
274# CONFIG_MD is not set
275
276#
277# Fusion MPT device support
278#
279
280#
281# IEEE 1394 (FireWire) support
282#
283
284#
285# I2O device support
286#
287
288#
289# Networking support
290#
291CONFIG_NET=y
292
293#
294# Networking options
295#
296CONFIG_PACKET=y
297# CONFIG_PACKET_MMAP is not set
298CONFIG_NETLINK_DEV=m
299CONFIG_UNIX=y
300# CONFIG_NET_KEY is not set
301CONFIG_INET=y
302CONFIG_IP_MULTICAST=y
303CONFIG_IP_ADVANCED_ROUTER=y
304CONFIG_IP_MULTIPLE_TABLES=y
305CONFIG_IP_ROUTE_MULTIPATH=y
306CONFIG_IP_ROUTE_VERBOSE=y
307CONFIG_IP_PNP=y
308# CONFIG_IP_PNP_DHCP is not set
309CONFIG_IP_PNP_BOOTP=y
310# CONFIG_IP_PNP_RARP is not set
311# CONFIG_NET_IPIP is not set
312# CONFIG_NET_IPGRE is not set
313# CONFIG_IP_MROUTE is not set
314# CONFIG_ARPD is not set
315CONFIG_SYN_COOKIES=y
316# CONFIG_INET_AH is not set
317# CONFIG_INET_ESP is not set
318# CONFIG_INET_IPCOMP is not set
319CONFIG_INET_TUNNEL=m
320CONFIG_IP_TCPDIAG=m
321# CONFIG_IP_TCPDIAG_IPV6 is not set
322# CONFIG_IPV6 is not set
323# CONFIG_NETFILTER is not set
324CONFIG_XFRM=y
325CONFIG_XFRM_USER=m
326
327#
328# SCTP Configuration (EXPERIMENTAL)
329#
330# CONFIG_IP_SCTP is not set
331# CONFIG_ATM is not set
332# CONFIG_BRIDGE is not set
333# CONFIG_VLAN_8021Q is not set
334# CONFIG_DECNET is not set
335# CONFIG_LLC2 is not set
336# CONFIG_IPX is not set
337# CONFIG_ATALK is not set
338# CONFIG_X25 is not set
339# CONFIG_LAPB is not set
340# CONFIG_NET_DIVERT is not set
341# CONFIG_ECONET is not set
342# CONFIG_WAN_ROUTER is not set
343
344#
345# QoS and/or fair queueing
346#
347# CONFIG_NET_SCHED is not set
348# CONFIG_NET_CLS_ROUTE is not set
349
350#
351# Network testing
352#
353# CONFIG_NET_PKTGEN is not set
354# CONFIG_NETPOLL is not set
355# CONFIG_NET_POLL_CONTROLLER is not set
356# CONFIG_HAMRADIO is not set
357# CONFIG_IRDA is not set
358# CONFIG_BT is not set
359CONFIG_NETDEVICES=y
360# CONFIG_DUMMY is not set
361# CONFIG_BONDING is not set
362# CONFIG_EQUALIZER is not set
363# CONFIG_TUN is not set
364# CONFIG_ETHERTAP is not set
365
366#
367# Ethernet (10 or 100Mbit)
368#
369CONFIG_NET_ETHERNET=y
370# CONFIG_MII is not set
371
372#
373# Ethernet (1000 Mbit)
374#
375
376#
377# Ethernet (10000 Mbit)
378#
379
380#
381# Token Ring devices
382#
383
384#
385# Wireless LAN (non-hamradio)
386#
387# CONFIG_NET_RADIO is not set
388
389#
390# Wan interfaces
391#
392# CONFIG_WAN is not set
393CONFIG_PPP=m
394CONFIG_PPP_MULTILINK=y
395# CONFIG_PPP_FILTER is not set
396CONFIG_PPP_ASYNC=m
397CONFIG_PPP_SYNC_TTY=m
398CONFIG_PPP_DEFLATE=m
399CONFIG_PPP_BSDCOMP=m
400CONFIG_PPPOE=m
401# CONFIG_SLIP is not set
402# CONFIG_SHAPER is not set
403# CONFIG_NETCONSOLE is not set
404
405#
406# ISDN subsystem
407#
408# CONFIG_ISDN is not set
409
410#
411# Telephony Support
412#
413# CONFIG_PHONE is not set
414
415#
416# Input device support
417#
418CONFIG_INPUT=y
419
420#
421# Userland interfaces
422#
423CONFIG_INPUT_MOUSEDEV=y
424CONFIG_INPUT_MOUSEDEV_PSAUX=y
425CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
426CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
427# CONFIG_INPUT_JOYDEV is not set
428# CONFIG_INPUT_TSDEV is not set
429# CONFIG_INPUT_EVDEV is not set
430# CONFIG_INPUT_EVBUG is not set
431
432#
433# Input I/O drivers
434#
435# CONFIG_GAMEPORT is not set
436CONFIG_SOUND_GAMEPORT=y
437CONFIG_SERIO=y
438CONFIG_SERIO_I8042=y
439CONFIG_SERIO_SERPORT=y
440# CONFIG_SERIO_CT82C710 is not set
441# CONFIG_SERIO_LIBPS2 is not set
442CONFIG_SERIO_RAW=m
443
444#
445# Input Device Drivers
446#
447# CONFIG_INPUT_KEYBOARD is not set
448# CONFIG_INPUT_MOUSE is not set
449# CONFIG_INPUT_JOYSTICK is not set
450# CONFIG_INPUT_TOUCHSCREEN is not set
451# CONFIG_INPUT_MISC is not set
452
453#
454# Character devices
455#
456CONFIG_VT=y
457CONFIG_VT_CONSOLE=y
458CONFIG_HW_CONSOLE=y
459# CONFIG_SERIAL_NONSTANDARD is not set
460
461#
462# Serial drivers
463#
464CONFIG_SERIAL_8250=y
465CONFIG_SERIAL_8250_CONSOLE=y
466CONFIG_SERIAL_8250_NR_UARTS=4
467# CONFIG_SERIAL_8250_EXTENDED is not set
468
469#
470# Non-8250 serial port support
471#
472CONFIG_SERIAL_CORE=y
473CONFIG_SERIAL_CORE_CONSOLE=y
474CONFIG_UNIX98_PTYS=y
475CONFIG_LEGACY_PTYS=y
476CONFIG_LEGACY_PTY_COUNT=256
477
478#
479# IPMI
480#
481# CONFIG_IPMI_HANDLER is not set
482
483#
484# Watchdog Cards
485#
486# CONFIG_WATCHDOG is not set
487# CONFIG_RTC is not set
488# CONFIG_GEN_RTC is not set
489# CONFIG_DTLK is not set
490# CONFIG_R3964 is not set
491
492#
493# Ftape, the floppy tape device driver
494#
495# CONFIG_DRM is not set
496# CONFIG_RAW_DRIVER is not set
497
498#
499# I2C support
500#
501# CONFIG_I2C is not set
502
503#
504# Dallas's 1-wire bus
505#
506# CONFIG_W1 is not set
507
508#
509# Misc devices
510#
511
512#
513# Multimedia devices
514#
515# CONFIG_VIDEO_DEV is not set
516
517#
518# Digital Video Broadcasting Devices
519#
520# CONFIG_DVB is not set
521
522#
523# Graphics support
524#
525CONFIG_FB=y
526# CONFIG_FB_MODE_HELPERS is not set
527# CONFIG_FB_TILEBLITTING is not set
528# CONFIG_FB_VIRTUAL is not set
529
530#
531# Console display driver support
532#
533# CONFIG_VGA_CONSOLE is not set
534CONFIG_DUMMY_CONSOLE=y
535# CONFIG_FRAMEBUFFER_CONSOLE is not set
536
537#
538# Logo configuration
539#
540# CONFIG_LOGO is not set
541# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
542
543#
544# Sound
545#
546CONFIG_SOUND=y
547
548#
549# Advanced Linux Sound Architecture
550#
551# CONFIG_SND is not set
552
553#
554# Open Sound System
555#
556# CONFIG_SOUND_PRIME is not set
557
558#
559# USB support
560#
561# CONFIG_USB_ARCH_HAS_HCD is not set
562# CONFIG_USB_ARCH_HAS_OHCI is not set
563
564#
565# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
566#
567
568#
569# USB Gadget Support
570#
571# CONFIG_USB_GADGET is not set
572
573#
574# MMC/SD Card support
575#
576# CONFIG_MMC is not set
577
578#
579# InfiniBand support
580#
581# CONFIG_INFINIBAND is not set
582
583#
584# File systems
585#
586CONFIG_EXT2_FS=y
587# CONFIG_EXT2_FS_XATTR is not set
588# CONFIG_EXT3_FS is not set
589# CONFIG_JBD is not set
590# CONFIG_REISERFS_FS is not set
591# CONFIG_JFS_FS is not set
592# CONFIG_XFS_FS is not set
593# CONFIG_MINIX_FS is not set
594CONFIG_ROMFS_FS=m
595# CONFIG_QUOTA is not set
596CONFIG_DNOTIFY=y
597# CONFIG_AUTOFS_FS is not set
598CONFIG_AUTOFS4_FS=y
599
600#
601# CD-ROM/DVD Filesystems
602#
603CONFIG_ISO9660_FS=y
604CONFIG_JOLIET=y
605CONFIG_ZISOFS=y
606CONFIG_ZISOFS_FS=y
607# CONFIG_UDF_FS is not set
608
609#
610# DOS/FAT/NT Filesystems
611#
612CONFIG_FAT_FS=m
613CONFIG_MSDOS_FS=m
614CONFIG_VFAT_FS=m
615CONFIG_FAT_DEFAULT_CODEPAGE=437
616CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
617# CONFIG_NTFS_FS is not set
618
619#
620# Pseudo filesystems
621#
622CONFIG_PROC_FS=y
623CONFIG_PROC_KCORE=y
624CONFIG_SYSFS=y
625# CONFIG_DEVFS_FS is not set
626CONFIG_DEVPTS_FS_XATTR=y
627CONFIG_DEVPTS_FS_SECURITY=y
628CONFIG_TMPFS=y
629# CONFIG_TMPFS_XATTR is not set
630# CONFIG_HUGETLB_PAGE is not set
631CONFIG_RAMFS=y
632
633#
634# Miscellaneous filesystems
635#
636# CONFIG_ADFS_FS is not set
637# CONFIG_AFFS_FS is not set
638# CONFIG_HFS_FS is not set
639# CONFIG_HFSPLUS_FS is not set
640# CONFIG_BEFS_FS is not set
641# CONFIG_BFS_FS is not set
642# CONFIG_EFS_FS is not set
643CONFIG_CRAMFS=m
644# CONFIG_VXFS_FS is not set
645# CONFIG_HPFS_FS is not set
646# CONFIG_QNX4FS_FS is not set
647# CONFIG_SYSV_FS is not set
648# CONFIG_UFS_FS is not set
649
650#
651# Network File Systems
652#
653CONFIG_NFS_FS=y
654CONFIG_NFS_V3=y
655# CONFIG_NFS_V4 is not set
656# CONFIG_NFS_DIRECTIO is not set
657CONFIG_NFSD=m
658CONFIG_NFSD_V3=y
659# CONFIG_NFSD_V4 is not set
660# CONFIG_NFSD_TCP is not set
661CONFIG_ROOT_NFS=y
662CONFIG_LOCKD=y
663CONFIG_LOCKD_V4=y
664CONFIG_EXPORTFS=m
665CONFIG_SUNRPC=y
666# CONFIG_RPCSEC_GSS_KRB5 is not set
667# CONFIG_RPCSEC_GSS_SPKM3 is not set
668CONFIG_SMB_FS=m
669CONFIG_SMB_NLS_DEFAULT=y
670CONFIG_SMB_NLS_REMOTE="cp932"
671# CONFIG_CIFS is not set
672# CONFIG_NCP_FS is not set
673# CONFIG_CODA_FS is not set
674# CONFIG_AFS_FS is not set
675
676#
677# Partition Types
678#
679# CONFIG_PARTITION_ADVANCED is not set
680CONFIG_MSDOS_PARTITION=y
681
682#
683# Native Language Support
684#
685CONFIG_NLS=y
686CONFIG_NLS_DEFAULT="iso8859-1"
687CONFIG_NLS_CODEPAGE_437=m
688# CONFIG_NLS_CODEPAGE_737 is not set
689# CONFIG_NLS_CODEPAGE_775 is not set
690# CONFIG_NLS_CODEPAGE_850 is not set
691# CONFIG_NLS_CODEPAGE_852 is not set
692# CONFIG_NLS_CODEPAGE_855 is not set
693# CONFIG_NLS_CODEPAGE_857 is not set
694# CONFIG_NLS_CODEPAGE_860 is not set
695# CONFIG_NLS_CODEPAGE_861 is not set
696# CONFIG_NLS_CODEPAGE_862 is not set
697# CONFIG_NLS_CODEPAGE_863 is not set
698# CONFIG_NLS_CODEPAGE_864 is not set
699# CONFIG_NLS_CODEPAGE_865 is not set
700# CONFIG_NLS_CODEPAGE_866 is not set
701# CONFIG_NLS_CODEPAGE_869 is not set
702# CONFIG_NLS_CODEPAGE_936 is not set
703# CONFIG_NLS_CODEPAGE_950 is not set
704CONFIG_NLS_CODEPAGE_932=m
705# CONFIG_NLS_CODEPAGE_949 is not set
706# CONFIG_NLS_CODEPAGE_874 is not set
707# CONFIG_NLS_ISO8859_8 is not set
708# CONFIG_NLS_CODEPAGE_1250 is not set
709# CONFIG_NLS_CODEPAGE_1251 is not set
710# CONFIG_NLS_ASCII is not set
711CONFIG_NLS_ISO8859_1=m
712# CONFIG_NLS_ISO8859_2 is not set
713# CONFIG_NLS_ISO8859_3 is not set
714# CONFIG_NLS_ISO8859_4 is not set
715# CONFIG_NLS_ISO8859_5 is not set
716# CONFIG_NLS_ISO8859_6 is not set
717# CONFIG_NLS_ISO8859_7 is not set
718# CONFIG_NLS_ISO8859_9 is not set
719# CONFIG_NLS_ISO8859_13 is not set
720# CONFIG_NLS_ISO8859_14 is not set
721# CONFIG_NLS_ISO8859_15 is not set
722# CONFIG_NLS_KOI8_R is not set
723# CONFIG_NLS_KOI8_U is not set
724# CONFIG_NLS_UTF8 is not set
725
726#
727# Profiling support
728#
729# CONFIG_PROFILING is not set
730
731#
732# Kernel hacking
733#
734# CONFIG_DEBUG_KERNEL is not set
735CONFIG_CROSSCOMPILE=y
736CONFIG_CMDLINE=""
737
738#
739# Security options
740#
741CONFIG_KEYS=y
742CONFIG_KEYS_DEBUG_PROC_KEYS=y
743# CONFIG_SECURITY is not set
744
745#
746# Cryptographic options
747#
748# CONFIG_CRYPTO is not set
749
750#
751# Hardware crypto devices
752#
753
754#
755# Library routines
756#
757CONFIG_CRC_CCITT=m
758# CONFIG_CRC32 is not set
759# CONFIG_LIBCRC32C is not set
760CONFIG_ZLIB_INFLATE=y
761CONFIG_ZLIB_DEFLATE=m
762CONFIG_GENERIC_HARDIRQS=y
763CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/tb0229_defconfig b/arch/mips/configs/tb0229_defconfig
new file mode 100644
index 000000000000..c6ba3de27614
--- /dev/null
+++ b/arch/mips/configs/tb0229_defconfig
@@ -0,0 +1,775 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:12 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60CONFIG_MACH_VR41XX=y
61# CONFIG_NEC_CMBVR4133 is not set
62# CONFIG_CASIO_E55 is not set
63# CONFIG_IBM_WORKPAD is not set
64# CONFIG_TANBAC_TB0226 is not set
65CONFIG_TANBAC_TB0229=y
66CONFIG_TANBAC_TB0219=y
67# CONFIG_VICTOR_MPC30X is not set
68# CONFIG_ZAO_CAPCELLA is not set
69CONFIG_PCI_VR41XX=y
70# CONFIG_VRC4173 is not set
71# CONFIG_TOSHIBA_JMR3927 is not set
72# CONFIG_MIPS_COBALT is not set
73# CONFIG_MACH_DECSTATION is not set
74# CONFIG_MIPS_EV64120 is not set
75# CONFIG_MIPS_EV96100 is not set
76# CONFIG_MIPS_IVR is not set
77# CONFIG_LASAT is not set
78# CONFIG_MIPS_ITE8172 is not set
79# CONFIG_MIPS_ATLAS is not set
80# CONFIG_MIPS_MALTA is not set
81# CONFIG_MIPS_SEAD is not set
82# CONFIG_MOMENCO_OCELOT is not set
83# CONFIG_MOMENCO_OCELOT_G is not set
84# CONFIG_MOMENCO_OCELOT_C is not set
85# CONFIG_MOMENCO_OCELOT_3 is not set
86# CONFIG_MOMENCO_JAGUAR_ATX is not set
87# CONFIG_PMC_YOSEMITE is not set
88# CONFIG_DDB5074 is not set
89# CONFIG_DDB5476 is not set
90# CONFIG_DDB5477 is not set
91# CONFIG_NEC_OSPREY is not set
92# CONFIG_SGI_IP22 is not set
93# CONFIG_SOC_AU1X00 is not set
94# CONFIG_SIBYTE_SB1xxx_SOC is not set
95# CONFIG_SNI_RM200_PCI is not set
96# CONFIG_TOSHIBA_RBTX4927 is not set
97CONFIG_RWSEM_GENERIC_SPINLOCK=y
98CONFIG_GENERIC_CALIBRATE_DELAY=y
99CONFIG_HAVE_DEC_LOCK=y
100CONFIG_DMA_NONCOHERENT=y
101CONFIG_CPU_LITTLE_ENDIAN=y
102CONFIG_IRQ_CPU=y
103CONFIG_MIPS_L1_CACHE_SHIFT=5
104
105#
106# CPU selection
107#
108# CONFIG_CPU_MIPS32 is not set
109# CONFIG_CPU_MIPS64 is not set
110# CONFIG_CPU_R3000 is not set
111# CONFIG_CPU_TX39XX is not set
112CONFIG_CPU_VR41XX=y
113# CONFIG_CPU_R4300 is not set
114# CONFIG_CPU_R4X00 is not set
115# CONFIG_CPU_TX49XX is not set
116# CONFIG_CPU_R5000 is not set
117# CONFIG_CPU_R5432 is not set
118# CONFIG_CPU_R6000 is not set
119# CONFIG_CPU_NEVADA is not set
120# CONFIG_CPU_R8000 is not set
121# CONFIG_CPU_R10000 is not set
122# CONFIG_CPU_RM7000 is not set
123# CONFIG_CPU_RM9000 is not set
124# CONFIG_CPU_SB1 is not set
125CONFIG_PAGE_SIZE_4KB=y
126# CONFIG_PAGE_SIZE_8KB is not set
127# CONFIG_PAGE_SIZE_16KB is not set
128# CONFIG_PAGE_SIZE_64KB is not set
129# CONFIG_CPU_ADVANCED is not set
130CONFIG_CPU_HAS_SYNC=y
131# CONFIG_PREEMPT is not set
132
133#
134# Bus options (PCI, PCMCIA, EISA, ISA, TC)
135#
136CONFIG_HW_HAS_PCI=y
137CONFIG_PCI=y
138CONFIG_PCI_LEGACY_PROC=y
139CONFIG_PCI_NAMES=y
140CONFIG_MMU=y
141
142#
143# PCCARD (PCMCIA/CardBus) support
144#
145# CONFIG_PCCARD is not set
146
147#
148# PC-card bridges
149#
150
151#
152# PCI Hotplug Support
153#
154# CONFIG_HOTPLUG_PCI is not set
155
156#
157# Executable file formats
158#
159CONFIG_BINFMT_ELF=y
160# CONFIG_BINFMT_MISC is not set
161CONFIG_TRAD_SIGNALS=y
162
163#
164# Device Drivers
165#
166
167#
168# Generic Driver Options
169#
170CONFIG_STANDALONE=y
171CONFIG_PREVENT_FIRMWARE_BUILD=y
172# CONFIG_FW_LOADER is not set
173
174#
175# Memory Technology Devices (MTD)
176#
177# CONFIG_MTD is not set
178
179#
180# Parallel port support
181#
182# CONFIG_PARPORT is not set
183
184#
185# Plug and Play support
186#
187
188#
189# Block devices
190#
191# CONFIG_BLK_DEV_FD is not set
192# CONFIG_BLK_CPQ_DA is not set
193# CONFIG_BLK_CPQ_CISS_DA is not set
194# CONFIG_BLK_DEV_DAC960 is not set
195# CONFIG_BLK_DEV_UMEM is not set
196# CONFIG_BLK_DEV_COW_COMMON is not set
197CONFIG_BLK_DEV_LOOP=m
198# CONFIG_BLK_DEV_CRYPTOLOOP is not set
199CONFIG_BLK_DEV_NBD=m
200# CONFIG_BLK_DEV_SX8 is not set
201CONFIG_BLK_DEV_RAM=y
202CONFIG_BLK_DEV_RAM_COUNT=16
203CONFIG_BLK_DEV_RAM_SIZE=4096
204# CONFIG_BLK_DEV_INITRD is not set
205CONFIG_INITRAMFS_SOURCE=""
206# CONFIG_LBD is not set
207CONFIG_CDROM_PKTCDVD=m
208CONFIG_CDROM_PKTCDVD_BUFFERS=8
209# CONFIG_CDROM_PKTCDVD_WCACHE is not set
210
211#
212# IO Schedulers
213#
214CONFIG_IOSCHED_NOOP=y
215CONFIG_IOSCHED_AS=y
216CONFIG_IOSCHED_DEADLINE=y
217CONFIG_IOSCHED_CFQ=y
218CONFIG_ATA_OVER_ETH=m
219
220#
221# ATA/ATAPI/MFM/RLL support
222#
223# CONFIG_IDE is not set
224
225#
226# SCSI device support
227#
228# CONFIG_SCSI is not set
229
230#
231# Multi-device support (RAID and LVM)
232#
233# CONFIG_MD is not set
234
235#
236# Fusion MPT device support
237#
238
239#
240# IEEE 1394 (FireWire) support
241#
242# CONFIG_IEEE1394 is not set
243
244#
245# I2O device support
246#
247# CONFIG_I2O is not set
248
249#
250# Networking support
251#
252CONFIG_NET=y
253
254#
255# Networking options
256#
257CONFIG_PACKET=y
258# CONFIG_PACKET_MMAP is not set
259CONFIG_NETLINK_DEV=m
260CONFIG_UNIX=y
261# CONFIG_NET_KEY is not set
262CONFIG_INET=y
263CONFIG_IP_MULTICAST=y
264CONFIG_IP_ADVANCED_ROUTER=y
265CONFIG_IP_MULTIPLE_TABLES=y
266CONFIG_IP_ROUTE_MULTIPATH=y
267CONFIG_IP_ROUTE_VERBOSE=y
268CONFIG_IP_PNP=y
269# CONFIG_IP_PNP_DHCP is not set
270CONFIG_IP_PNP_BOOTP=y
271# CONFIG_IP_PNP_RARP is not set
272CONFIG_NET_IPIP=m
273CONFIG_NET_IPGRE=m
274# CONFIG_NET_IPGRE_BROADCAST is not set
275# CONFIG_IP_MROUTE is not set
276# CONFIG_ARPD is not set
277CONFIG_SYN_COOKIES=y
278# CONFIG_INET_AH is not set
279# CONFIG_INET_ESP is not set
280# CONFIG_INET_IPCOMP is not set
281CONFIG_INET_TUNNEL=m
282CONFIG_IP_TCPDIAG=m
283# CONFIG_IP_TCPDIAG_IPV6 is not set
284# CONFIG_IPV6 is not set
285# CONFIG_NETFILTER is not set
286CONFIG_XFRM=y
287CONFIG_XFRM_USER=m
288
289#
290# SCTP Configuration (EXPERIMENTAL)
291#
292# CONFIG_IP_SCTP is not set
293# CONFIG_ATM is not set
294# CONFIG_BRIDGE is not set
295# CONFIG_VLAN_8021Q is not set
296# CONFIG_DECNET is not set
297# CONFIG_LLC2 is not set
298# CONFIG_IPX is not set
299# CONFIG_ATALK is not set
300# CONFIG_X25 is not set
301# CONFIG_LAPB is not set
302# CONFIG_NET_DIVERT is not set
303# CONFIG_ECONET is not set
304# CONFIG_WAN_ROUTER is not set
305
306#
307# QoS and/or fair queueing
308#
309# CONFIG_NET_SCHED is not set
310# CONFIG_NET_CLS_ROUTE is not set
311
312#
313# Network testing
314#
315# CONFIG_NET_PKTGEN is not set
316# CONFIG_NETPOLL is not set
317# CONFIG_NET_POLL_CONTROLLER is not set
318# CONFIG_HAMRADIO is not set
319# CONFIG_IRDA is not set
320# CONFIG_BT is not set
321CONFIG_NETDEVICES=y
322CONFIG_DUMMY=m
323# CONFIG_BONDING is not set
324# CONFIG_EQUALIZER is not set
325# CONFIG_TUN is not set
326# CONFIG_ETHERTAP is not set
327
328#
329# ARCnet devices
330#
331# CONFIG_ARCNET is not set
332
333#
334# Ethernet (10 or 100Mbit)
335#
336CONFIG_NET_ETHERNET=y
337CONFIG_MII=y
338# CONFIG_HAPPYMEAL is not set
339# CONFIG_SUNGEM is not set
340# CONFIG_NET_VENDOR_3COM is not set
341
342#
343# Tulip family network device support
344#
345# CONFIG_NET_TULIP is not set
346# CONFIG_HP100 is not set
347CONFIG_NET_PCI=y
348CONFIG_PCNET32=y
349# CONFIG_AMD8111_ETH is not set
350# CONFIG_ADAPTEC_STARFIRE is not set
351# CONFIG_B44 is not set
352# CONFIG_FORCEDETH is not set
353# CONFIG_DGRS is not set
354CONFIG_EEPRO100=y
355# CONFIG_E100 is not set
356# CONFIG_FEALNX is not set
357# CONFIG_NATSEMI is not set
358# CONFIG_NE2K_PCI is not set
359# CONFIG_8139CP is not set
360# CONFIG_8139TOO is not set
361# CONFIG_SIS900 is not set
362# CONFIG_EPIC100 is not set
363# CONFIG_SUNDANCE is not set
364# CONFIG_TLAN is not set
365# CONFIG_VIA_RHINE is not set
366# CONFIG_LAN_SAA9730 is not set
367
368#
369# Ethernet (1000 Mbit)
370#
371# CONFIG_ACENIC is not set
372# CONFIG_DL2K is not set
373# CONFIG_E1000 is not set
374# CONFIG_NS83820 is not set
375# CONFIG_HAMACHI is not set
376# CONFIG_YELLOWFIN is not set
377# CONFIG_R8169 is not set
378# CONFIG_SK98LIN is not set
379# CONFIG_VIA_VELOCITY is not set
380# CONFIG_TIGON3 is not set
381
382#
383# Ethernet (10000 Mbit)
384#
385# CONFIG_IXGB is not set
386# CONFIG_S2IO is not set
387
388#
389# Token Ring devices
390#
391# CONFIG_TR is not set
392
393#
394# Wireless LAN (non-hamradio)
395#
396# CONFIG_NET_RADIO is not set
397
398#
399# Wan interfaces
400#
401# CONFIG_WAN is not set
402# CONFIG_FDDI is not set
403# CONFIG_HIPPI is not set
404CONFIG_PPP=m
405CONFIG_PPP_MULTILINK=y
406CONFIG_PPP_FILTER=y
407CONFIG_PPP_ASYNC=m
408CONFIG_PPP_SYNC_TTY=m
409CONFIG_PPP_DEFLATE=m
410CONFIG_PPP_BSDCOMP=m
411CONFIG_PPPOE=m
412CONFIG_SLIP=m
413CONFIG_SLIP_COMPRESSED=y
414CONFIG_SLIP_SMART=y
415CONFIG_SLIP_MODE_SLIP6=y
416# CONFIG_SHAPER is not set
417# CONFIG_NETCONSOLE is not set
418
419#
420# ISDN subsystem
421#
422# CONFIG_ISDN is not set
423
424#
425# Telephony Support
426#
427# CONFIG_PHONE is not set
428
429#
430# Input device support
431#
432CONFIG_INPUT=y
433
434#
435# Userland interfaces
436#
437CONFIG_INPUT_MOUSEDEV=y
438CONFIG_INPUT_MOUSEDEV_PSAUX=y
439CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
440CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
441# CONFIG_INPUT_JOYDEV is not set
442# CONFIG_INPUT_TSDEV is not set
443# CONFIG_INPUT_EVDEV is not set
444# CONFIG_INPUT_EVBUG is not set
445
446#
447# Input I/O drivers
448#
449# CONFIG_GAMEPORT is not set
450CONFIG_SOUND_GAMEPORT=y
451CONFIG_SERIO=y
452CONFIG_SERIO_I8042=y
453CONFIG_SERIO_SERPORT=y
454# CONFIG_SERIO_CT82C710 is not set
455# CONFIG_SERIO_PCIPS2 is not set
456# CONFIG_SERIO_LIBPS2 is not set
457CONFIG_SERIO_RAW=m
458
459#
460# Input Device Drivers
461#
462# CONFIG_INPUT_KEYBOARD is not set
463# CONFIG_INPUT_MOUSE is not set
464# CONFIG_INPUT_JOYSTICK is not set
465# CONFIG_INPUT_TOUCHSCREEN is not set
466# CONFIG_INPUT_MISC is not set
467
468#
469# Character devices
470#
471CONFIG_VT=y
472CONFIG_VT_CONSOLE=y
473CONFIG_HW_CONSOLE=y
474# CONFIG_SERIAL_NONSTANDARD is not set
475
476#
477# Serial drivers
478#
479CONFIG_SERIAL_8250=y
480CONFIG_SERIAL_8250_CONSOLE=y
481CONFIG_SERIAL_8250_NR_UARTS=4
482# CONFIG_SERIAL_8250_EXTENDED is not set
483
484#
485# Non-8250 serial port support
486#
487CONFIG_SERIAL_CORE=y
488CONFIG_SERIAL_CORE_CONSOLE=y
489CONFIG_UNIX98_PTYS=y
490CONFIG_LEGACY_PTYS=y
491CONFIG_LEGACY_PTY_COUNT=256
492
493#
494# IPMI
495#
496# CONFIG_IPMI_HANDLER is not set
497
498#
499# Watchdog Cards
500#
501# CONFIG_WATCHDOG is not set
502# CONFIG_RTC is not set
503# CONFIG_GEN_RTC is not set
504# CONFIG_DTLK is not set
505# CONFIG_R3964 is not set
506# CONFIG_APPLICOM is not set
507
508#
509# Ftape, the floppy tape device driver
510#
511# CONFIG_DRM is not set
512# CONFIG_RAW_DRIVER is not set
513
514#
515# I2C support
516#
517# CONFIG_I2C is not set
518
519#
520# Dallas's 1-wire bus
521#
522# CONFIG_W1 is not set
523
524#
525# Misc devices
526#
527
528#
529# Multimedia devices
530#
531# CONFIG_VIDEO_DEV is not set
532
533#
534# Digital Video Broadcasting Devices
535#
536# CONFIG_DVB is not set
537
538#
539# Graphics support
540#
541# CONFIG_FB is not set
542
543#
544# Console display driver support
545#
546# CONFIG_VGA_CONSOLE is not set
547CONFIG_DUMMY_CONSOLE=y
548# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
549
550#
551# Sound
552#
553# CONFIG_SOUND is not set
554
555#
556# USB support
557#
558# CONFIG_USB is not set
559CONFIG_USB_ARCH_HAS_HCD=y
560CONFIG_USB_ARCH_HAS_OHCI=y
561
562#
563# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
564#
565
566#
567# USB Gadget Support
568#
569# CONFIG_USB_GADGET is not set
570
571#
572# MMC/SD Card support
573#
574# CONFIG_MMC is not set
575
576#
577# InfiniBand support
578#
579# CONFIG_INFINIBAND is not set
580
581#
582# File systems
583#
584CONFIG_EXT2_FS=y
585# CONFIG_EXT2_FS_XATTR is not set
586CONFIG_EXT3_FS=m
587CONFIG_EXT3_FS_XATTR=y
588# CONFIG_EXT3_FS_POSIX_ACL is not set
589CONFIG_EXT3_FS_SECURITY=y
590CONFIG_JBD=m
591# CONFIG_JBD_DEBUG is not set
592CONFIG_FS_MBCACHE=y
593# CONFIG_REISERFS_FS is not set
594CONFIG_JFS_FS=m
595# CONFIG_JFS_POSIX_ACL is not set
596# CONFIG_JFS_SECURITY is not set
597# CONFIG_JFS_DEBUG is not set
598# CONFIG_JFS_STATISTICS is not set
599CONFIG_XFS_FS=y
600# CONFIG_XFS_RT is not set
601CONFIG_XFS_QUOTA=y
602# CONFIG_XFS_SECURITY is not set
603CONFIG_XFS_POSIX_ACL=y
604# CONFIG_MINIX_FS is not set
605CONFIG_ROMFS_FS=m
606# CONFIG_QUOTA is not set
607CONFIG_QUOTACTL=y
608CONFIG_DNOTIFY=y
609# CONFIG_AUTOFS_FS is not set
610CONFIG_AUTOFS4_FS=y
611
612#
613# CD-ROM/DVD Filesystems
614#
615CONFIG_ISO9660_FS=y
616CONFIG_JOLIET=y
617CONFIG_ZISOFS=y
618CONFIG_ZISOFS_FS=y
619# CONFIG_UDF_FS is not set
620
621#
622# DOS/FAT/NT Filesystems
623#
624CONFIG_FAT_FS=m
625CONFIG_MSDOS_FS=m
626CONFIG_VFAT_FS=m
627CONFIG_FAT_DEFAULT_CODEPAGE=437
628CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
629# CONFIG_NTFS_FS is not set
630
631#
632# Pseudo filesystems
633#
634CONFIG_PROC_FS=y
635CONFIG_PROC_KCORE=y
636CONFIG_SYSFS=y
637# CONFIG_DEVFS_FS is not set
638CONFIG_DEVPTS_FS_XATTR=y
639CONFIG_DEVPTS_FS_SECURITY=y
640CONFIG_TMPFS=y
641# CONFIG_TMPFS_XATTR is not set
642# CONFIG_HUGETLB_PAGE is not set
643CONFIG_RAMFS=y
644
645#
646# Miscellaneous filesystems
647#
648# CONFIG_ADFS_FS is not set
649# CONFIG_AFFS_FS is not set
650# CONFIG_HFS_FS is not set
651# CONFIG_HFSPLUS_FS is not set
652# CONFIG_BEFS_FS is not set
653# CONFIG_BFS_FS is not set
654# CONFIG_EFS_FS is not set
655CONFIG_CRAMFS=m
656# CONFIG_VXFS_FS is not set
657# CONFIG_HPFS_FS is not set
658# CONFIG_QNX4FS_FS is not set
659# CONFIG_SYSV_FS is not set
660# CONFIG_UFS_FS is not set
661
662#
663# Network File Systems
664#
665CONFIG_NFS_FS=y
666CONFIG_NFS_V3=y
667# CONFIG_NFS_V4 is not set
668# CONFIG_NFS_DIRECTIO is not set
669CONFIG_NFSD=y
670CONFIG_NFSD_V3=y
671# CONFIG_NFSD_V4 is not set
672CONFIG_NFSD_TCP=y
673CONFIG_ROOT_NFS=y
674CONFIG_LOCKD=y
675CONFIG_LOCKD_V4=y
676CONFIG_EXPORTFS=y
677CONFIG_SUNRPC=y
678# CONFIG_RPCSEC_GSS_KRB5 is not set
679# CONFIG_RPCSEC_GSS_SPKM3 is not set
680CONFIG_SMB_FS=m
681CONFIG_SMB_NLS_DEFAULT=y
682CONFIG_SMB_NLS_REMOTE="cp932"
683# CONFIG_CIFS is not set
684# CONFIG_NCP_FS is not set
685# CONFIG_CODA_FS is not set
686# CONFIG_AFS_FS is not set
687
688#
689# Partition Types
690#
691# CONFIG_PARTITION_ADVANCED is not set
692CONFIG_MSDOS_PARTITION=y
693
694#
695# Native Language Support
696#
697CONFIG_NLS=y
698CONFIG_NLS_DEFAULT="iso8859-1"
699CONFIG_NLS_CODEPAGE_437=m
700# CONFIG_NLS_CODEPAGE_737 is not set
701# CONFIG_NLS_CODEPAGE_775 is not set
702# CONFIG_NLS_CODEPAGE_850 is not set
703# CONFIG_NLS_CODEPAGE_852 is not set
704# CONFIG_NLS_CODEPAGE_855 is not set
705# CONFIG_NLS_CODEPAGE_857 is not set
706# CONFIG_NLS_CODEPAGE_860 is not set
707# CONFIG_NLS_CODEPAGE_861 is not set
708# CONFIG_NLS_CODEPAGE_862 is not set
709# CONFIG_NLS_CODEPAGE_863 is not set
710# CONFIG_NLS_CODEPAGE_864 is not set
711# CONFIG_NLS_CODEPAGE_865 is not set
712# CONFIG_NLS_CODEPAGE_866 is not set
713# CONFIG_NLS_CODEPAGE_869 is not set
714# CONFIG_NLS_CODEPAGE_936 is not set
715# CONFIG_NLS_CODEPAGE_950 is not set
716CONFIG_NLS_CODEPAGE_932=m
717# CONFIG_NLS_CODEPAGE_949 is not set
718# CONFIG_NLS_CODEPAGE_874 is not set
719# CONFIG_NLS_ISO8859_8 is not set
720# CONFIG_NLS_CODEPAGE_1250 is not set
721# CONFIG_NLS_CODEPAGE_1251 is not set
722# CONFIG_NLS_ASCII is not set
723CONFIG_NLS_ISO8859_1=m
724# CONFIG_NLS_ISO8859_2 is not set
725# CONFIG_NLS_ISO8859_3 is not set
726# CONFIG_NLS_ISO8859_4 is not set
727# CONFIG_NLS_ISO8859_5 is not set
728# CONFIG_NLS_ISO8859_6 is not set
729# CONFIG_NLS_ISO8859_7 is not set
730# CONFIG_NLS_ISO8859_9 is not set
731# CONFIG_NLS_ISO8859_13 is not set
732# CONFIG_NLS_ISO8859_14 is not set
733# CONFIG_NLS_ISO8859_15 is not set
734# CONFIG_NLS_KOI8_R is not set
735# CONFIG_NLS_KOI8_U is not set
736# CONFIG_NLS_UTF8 is not set
737
738#
739# Profiling support
740#
741# CONFIG_PROFILING is not set
742
743#
744# Kernel hacking
745#
746# CONFIG_DEBUG_KERNEL is not set
747CONFIG_CROSSCOMPILE=y
748CONFIG_CMDLINE="mem=64M console=ttyS0,38400 ip=bootp root=/dev/nfs"
749
750#
751# Security options
752#
753CONFIG_KEYS=y
754CONFIG_KEYS_DEBUG_PROC_KEYS=y
755# CONFIG_SECURITY is not set
756
757#
758# Cryptographic options
759#
760# CONFIG_CRYPTO is not set
761
762#
763# Hardware crypto devices
764#
765
766#
767# Library routines
768#
769CONFIG_CRC_CCITT=m
770CONFIG_CRC32=y
771# CONFIG_LIBCRC32C is not set
772CONFIG_ZLIB_INFLATE=y
773CONFIG_ZLIB_DEFLATE=m
774CONFIG_GENERIC_HARDIRQS=y
775CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
new file mode 100644
index 000000000000..915c43b6e2d9
--- /dev/null
+++ b/arch/mips/configs/workpad_defconfig
@@ -0,0 +1,687 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:12 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31# CONFIG_IKCONFIG is not set
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_FUTEX=y
36CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0
43# CONFIG_TINY_SHMEM is not set
44
45#
46# Loadable module support
47#
48CONFIG_MODULES=y
49CONFIG_MODULE_UNLOAD=y
50# CONFIG_MODULE_FORCE_UNLOAD is not set
51CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60CONFIG_MACH_VR41XX=y
61# CONFIG_NEC_CMBVR4133 is not set
62# CONFIG_CASIO_E55 is not set
63CONFIG_IBM_WORKPAD=y
64# CONFIG_TANBAC_TB0226 is not set
65# CONFIG_TANBAC_TB0229 is not set
66# CONFIG_VICTOR_MPC30X is not set
67# CONFIG_ZAO_CAPCELLA is not set
68CONFIG_VRC4171=y
69# CONFIG_TOSHIBA_JMR3927 is not set
70# CONFIG_MIPS_COBALT is not set
71# CONFIG_MACH_DECSTATION is not set
72# CONFIG_MIPS_EV64120 is not set
73# CONFIG_MIPS_EV96100 is not set
74# CONFIG_MIPS_IVR is not set
75# CONFIG_LASAT is not set
76# CONFIG_MIPS_ITE8172 is not set
77# CONFIG_MIPS_ATLAS is not set
78# CONFIG_MIPS_MALTA is not set
79# CONFIG_MIPS_SEAD is not set
80# CONFIG_MOMENCO_OCELOT is not set
81# CONFIG_MOMENCO_OCELOT_G is not set
82# CONFIG_MOMENCO_OCELOT_C is not set
83# CONFIG_MOMENCO_OCELOT_3 is not set
84# CONFIG_MOMENCO_JAGUAR_ATX is not set
85# CONFIG_PMC_YOSEMITE is not set
86# CONFIG_DDB5074 is not set
87# CONFIG_DDB5476 is not set
88# CONFIG_DDB5477 is not set
89# CONFIG_NEC_OSPREY is not set
90# CONFIG_SGI_IP22 is not set
91# CONFIG_SOC_AU1X00 is not set
92# CONFIG_SIBYTE_SB1xxx_SOC is not set
93# CONFIG_SNI_RM200_PCI is not set
94# CONFIG_TOSHIBA_RBTX4927 is not set
95CONFIG_RWSEM_GENERIC_SPINLOCK=y
96CONFIG_GENERIC_CALIBRATE_DELAY=y
97CONFIG_HAVE_DEC_LOCK=y
98CONFIG_DMA_NONCOHERENT=y
99CONFIG_CPU_LITTLE_ENDIAN=y
100CONFIG_IRQ_CPU=y
101CONFIG_MIPS_L1_CACHE_SHIFT=5
102
103#
104# CPU selection
105#
106# CONFIG_CPU_MIPS32 is not set
107# CONFIG_CPU_MIPS64 is not set
108# CONFIG_CPU_R3000 is not set
109# CONFIG_CPU_TX39XX is not set
110CONFIG_CPU_VR41XX=y
111# CONFIG_CPU_R4300 is not set
112# CONFIG_CPU_R4X00 is not set
113# CONFIG_CPU_TX49XX is not set
114# CONFIG_CPU_R5000 is not set
115# CONFIG_CPU_R5432 is not set
116# CONFIG_CPU_R6000 is not set
117# CONFIG_CPU_NEVADA is not set
118# CONFIG_CPU_R8000 is not set
119# CONFIG_CPU_R10000 is not set
120# CONFIG_CPU_RM7000 is not set
121# CONFIG_CPU_RM9000 is not set
122# CONFIG_CPU_SB1 is not set
123CONFIG_PAGE_SIZE_4KB=y
124# CONFIG_PAGE_SIZE_8KB is not set
125# CONFIG_PAGE_SIZE_16KB is not set
126# CONFIG_PAGE_SIZE_64KB is not set
127# CONFIG_CPU_ADVANCED is not set
128CONFIG_CPU_HAS_SYNC=y
129# CONFIG_PREEMPT is not set
130
131#
132# Bus options (PCI, PCMCIA, EISA, ISA, TC)
133#
134CONFIG_ISA=y
135CONFIG_MMU=y
136
137#
138# PCCARD (PCMCIA/CardBus) support
139#
140# CONFIG_PCCARD is not set
141
142#
143# PC-card bridges
144#
145CONFIG_PCMCIA_PROBE=y
146
147#
148# PCI Hotplug Support
149#
150
151#
152# Executable file formats
153#
154CONFIG_BINFMT_ELF=y
155# CONFIG_BINFMT_MISC is not set
156CONFIG_TRAD_SIGNALS=y
157
158#
159# Device Drivers
160#
161
162#
163# Generic Driver Options
164#
165CONFIG_STANDALONE=y
166CONFIG_PREVENT_FIRMWARE_BUILD=y
167# CONFIG_FW_LOADER is not set
168
169#
170# Memory Technology Devices (MTD)
171#
172# CONFIG_MTD is not set
173
174#
175# Parallel port support
176#
177# CONFIG_PARPORT is not set
178
179#
180# Plug and Play support
181#
182# CONFIG_PNP is not set
183
184#
185# Block devices
186#
187# CONFIG_BLK_DEV_FD is not set
188# CONFIG_BLK_DEV_XD is not set
189# CONFIG_BLK_DEV_COW_COMMON is not set
190# CONFIG_BLK_DEV_LOOP is not set
191# CONFIG_BLK_DEV_NBD is not set
192# CONFIG_BLK_DEV_RAM is not set
193CONFIG_BLK_DEV_RAM_COUNT=16
194CONFIG_INITRAMFS_SOURCE=""
195# CONFIG_LBD is not set
196CONFIG_CDROM_PKTCDVD=m
197CONFIG_CDROM_PKTCDVD_BUFFERS=8
198# CONFIG_CDROM_PKTCDVD_WCACHE is not set
199
200#
201# IO Schedulers
202#
203CONFIG_IOSCHED_NOOP=y
204CONFIG_IOSCHED_AS=y
205CONFIG_IOSCHED_DEADLINE=y
206CONFIG_IOSCHED_CFQ=y
207CONFIG_ATA_OVER_ETH=m
208
209#
210# ATA/ATAPI/MFM/RLL support
211#
212CONFIG_IDE=y
213CONFIG_BLK_DEV_IDE=y
214
215#
216# Please see Documentation/ide.txt for help/info on IDE drives
217#
218# CONFIG_BLK_DEV_IDE_SATA is not set
219CONFIG_BLK_DEV_IDEDISK=y
220# CONFIG_IDEDISK_MULTI_MODE is not set
221# CONFIG_BLK_DEV_IDECD is not set
222# CONFIG_BLK_DEV_IDETAPE is not set
223# CONFIG_BLK_DEV_IDEFLOPPY is not set
224# CONFIG_IDE_TASK_IOCTL is not set
225
226#
227# IDE chipset support/bugfixes
228#
229CONFIG_IDE_GENERIC=y
230# CONFIG_IDE_ARM is not set
231# CONFIG_IDE_CHIPSETS is not set
232# CONFIG_BLK_DEV_IDEDMA is not set
233# CONFIG_IDEDMA_AUTO is not set
234# CONFIG_BLK_DEV_HD is not set
235
236#
237# SCSI device support
238#
239# CONFIG_SCSI is not set
240
241#
242# Old CD-ROM drivers (not SCSI, not IDE)
243#
244# CONFIG_CD_NO_IDESCSI is not set
245
246#
247# Multi-device support (RAID and LVM)
248#
249# CONFIG_MD is not set
250
251#
252# Fusion MPT device support
253#
254
255#
256# IEEE 1394 (FireWire) support
257#
258
259#
260# I2O device support
261#
262
263#
264# Networking support
265#
266CONFIG_NET=y
267
268#
269# Networking options
270#
271CONFIG_PACKET=y
272CONFIG_PACKET_MMAP=y
273CONFIG_NETLINK_DEV=y
274CONFIG_UNIX=y
275CONFIG_NET_KEY=y
276CONFIG_INET=y
277CONFIG_IP_MULTICAST=y
278# CONFIG_IP_ADVANCED_ROUTER is not set
279# CONFIG_IP_PNP is not set
280# CONFIG_NET_IPIP is not set
281# CONFIG_NET_IPGRE is not set
282# CONFIG_IP_MROUTE is not set
283# CONFIG_ARPD is not set
284# CONFIG_SYN_COOKIES is not set
285# CONFIG_INET_AH is not set
286# CONFIG_INET_ESP is not set
287# CONFIG_INET_IPCOMP is not set
288CONFIG_INET_TUNNEL=m
289CONFIG_IP_TCPDIAG=m
290# CONFIG_IP_TCPDIAG_IPV6 is not set
291# CONFIG_IPV6 is not set
292# CONFIG_NETFILTER is not set
293CONFIG_XFRM=y
294CONFIG_XFRM_USER=m
295
296#
297# SCTP Configuration (EXPERIMENTAL)
298#
299# CONFIG_IP_SCTP is not set
300# CONFIG_ATM is not set
301# CONFIG_BRIDGE is not set
302# CONFIG_VLAN_8021Q is not set
303# CONFIG_DECNET is not set
304# CONFIG_LLC2 is not set
305# CONFIG_IPX is not set
306# CONFIG_ATALK is not set
307# CONFIG_X25 is not set
308# CONFIG_LAPB is not set
309# CONFIG_NET_DIVERT is not set
310# CONFIG_ECONET is not set
311# CONFIG_WAN_ROUTER is not set
312
313#
314# QoS and/or fair queueing
315#
316# CONFIG_NET_SCHED is not set
317# CONFIG_NET_CLS_ROUTE is not set
318
319#
320# Network testing
321#
322# CONFIG_NET_PKTGEN is not set
323# CONFIG_NETPOLL is not set
324# CONFIG_NET_POLL_CONTROLLER is not set
325# CONFIG_HAMRADIO is not set
326# CONFIG_IRDA is not set
327# CONFIG_BT is not set
328CONFIG_NETDEVICES=y
329# CONFIG_DUMMY is not set
330# CONFIG_BONDING is not set
331# CONFIG_EQUALIZER is not set
332# CONFIG_TUN is not set
333# CONFIG_ETHERTAP is not set
334
335#
336# ARCnet devices
337#
338# CONFIG_ARCNET is not set
339
340#
341# Ethernet (10 or 100Mbit)
342#
343CONFIG_NET_ETHERNET=y
344# CONFIG_MII is not set
345# CONFIG_NET_VENDOR_3COM is not set
346# CONFIG_LANCE is not set
347# CONFIG_NET_VENDOR_SMC is not set
348# CONFIG_NET_VENDOR_RACAL is not set
349# CONFIG_AT1700 is not set
350# CONFIG_DEPCA is not set
351# CONFIG_HP100 is not set
352# CONFIG_NET_ISA is not set
353# CONFIG_NET_PCI is not set
354# CONFIG_NET_POCKET is not set
355
356#
357# Ethernet (1000 Mbit)
358#
359
360#
361# Ethernet (10000 Mbit)
362#
363
364#
365# Token Ring devices
366#
367# CONFIG_TR is not set
368
369#
370# Wireless LAN (non-hamradio)
371#
372# CONFIG_NET_RADIO is not set
373
374#
375# Wan interfaces
376#
377# CONFIG_WAN is not set
378# CONFIG_PPP is not set
379# CONFIG_SLIP is not set
380# CONFIG_SHAPER is not set
381# CONFIG_NETCONSOLE is not set
382
383#
384# ISDN subsystem
385#
386# CONFIG_ISDN is not set
387
388#
389# Telephony Support
390#
391# CONFIG_PHONE is not set
392
393#
394# Input device support
395#
396CONFIG_INPUT=y
397
398#
399# Userland interfaces
400#
401CONFIG_INPUT_MOUSEDEV=y
402CONFIG_INPUT_MOUSEDEV_PSAUX=y
403CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
404CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
405# CONFIG_INPUT_JOYDEV is not set
406# CONFIG_INPUT_TSDEV is not set
407# CONFIG_INPUT_EVDEV is not set
408# CONFIG_INPUT_EVBUG is not set
409
410#
411# Input I/O drivers
412#
413# CONFIG_GAMEPORT is not set
414CONFIG_SOUND_GAMEPORT=y
415CONFIG_SERIO=y
416CONFIG_SERIO_I8042=y
417CONFIG_SERIO_SERPORT=y
418# CONFIG_SERIO_CT82C710 is not set
419# CONFIG_SERIO_LIBPS2 is not set
420CONFIG_SERIO_RAW=m
421
422#
423# Input Device Drivers
424#
425# CONFIG_INPUT_KEYBOARD is not set
426# CONFIG_INPUT_MOUSE is not set
427# CONFIG_INPUT_JOYSTICK is not set
428# CONFIG_INPUT_TOUCHSCREEN is not set
429# CONFIG_INPUT_MISC is not set
430
431#
432# Character devices
433#
434CONFIG_VT=y
435CONFIG_VT_CONSOLE=y
436CONFIG_HW_CONSOLE=y
437# CONFIG_SERIAL_NONSTANDARD is not set
438
439#
440# Serial drivers
441#
442CONFIG_SERIAL_8250=y
443CONFIG_SERIAL_8250_CONSOLE=y
444CONFIG_SERIAL_8250_NR_UARTS=4
445# CONFIG_SERIAL_8250_EXTENDED is not set
446
447#
448# Non-8250 serial port support
449#
450CONFIG_SERIAL_CORE=y
451CONFIG_SERIAL_CORE_CONSOLE=y
452CONFIG_UNIX98_PTYS=y
453CONFIG_LEGACY_PTYS=y
454CONFIG_LEGACY_PTY_COUNT=256
455
456#
457# IPMI
458#
459# CONFIG_IPMI_HANDLER is not set
460
461#
462# Watchdog Cards
463#
464CONFIG_WATCHDOG=y
465# CONFIG_WATCHDOG_NOWAYOUT is not set
466
467#
468# Watchdog Device Drivers
469#
470# CONFIG_SOFT_WATCHDOG is not set
471
472#
473# ISA-based Watchdog Cards
474#
475# CONFIG_PCWATCHDOG is not set
476# CONFIG_MIXCOMWD is not set
477# CONFIG_WDT is not set
478# CONFIG_RTC is not set
479# CONFIG_GEN_RTC is not set
480# CONFIG_DTLK is not set
481# CONFIG_R3964 is not set
482
483#
484# Ftape, the floppy tape device driver
485#
486# CONFIG_DRM is not set
487# CONFIG_RAW_DRIVER is not set
488
489#
490# I2C support
491#
492# CONFIG_I2C is not set
493
494#
495# Dallas's 1-wire bus
496#
497# CONFIG_W1 is not set
498
499#
500# Misc devices
501#
502
503#
504# Multimedia devices
505#
506# CONFIG_VIDEO_DEV is not set
507
508#
509# Digital Video Broadcasting Devices
510#
511# CONFIG_DVB is not set
512
513#
514# Graphics support
515#
516# CONFIG_FB is not set
517
518#
519# Console display driver support
520#
521# CONFIG_VGA_CONSOLE is not set
522# CONFIG_MDA_CONSOLE is not set
523CONFIG_DUMMY_CONSOLE=y
524# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
525
526#
527# Sound
528#
529# CONFIG_SOUND is not set
530
531#
532# USB support
533#
534# CONFIG_USB_ARCH_HAS_HCD is not set
535# CONFIG_USB_ARCH_HAS_OHCI is not set
536
537#
538# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
539#
540
541#
542# USB Gadget Support
543#
544# CONFIG_USB_GADGET is not set
545
546#
547# MMC/SD Card support
548#
549# CONFIG_MMC is not set
550
551#
552# InfiniBand support
553#
554# CONFIG_INFINIBAND is not set
555
556#
557# File systems
558#
559CONFIG_EXT2_FS=y
560CONFIG_EXT2_FS_XATTR=y
561CONFIG_EXT2_FS_POSIX_ACL=y
562CONFIG_EXT2_FS_SECURITY=y
563# CONFIG_EXT3_FS is not set
564# CONFIG_JBD is not set
565CONFIG_FS_MBCACHE=y
566# CONFIG_REISERFS_FS is not set
567# CONFIG_JFS_FS is not set
568CONFIG_FS_POSIX_ACL=y
569# CONFIG_XFS_FS is not set
570# CONFIG_MINIX_FS is not set
571# CONFIG_ROMFS_FS is not set
572# CONFIG_QUOTA is not set
573CONFIG_DNOTIFY=y
574CONFIG_AUTOFS_FS=y
575CONFIG_AUTOFS4_FS=y
576
577#
578# CD-ROM/DVD Filesystems
579#
580# CONFIG_ISO9660_FS is not set
581# CONFIG_UDF_FS is not set
582
583#
584# DOS/FAT/NT Filesystems
585#
586# CONFIG_MSDOS_FS is not set
587# CONFIG_VFAT_FS is not set
588# CONFIG_NTFS_FS is not set
589
590#
591# Pseudo filesystems
592#
593CONFIG_PROC_FS=y
594CONFIG_PROC_KCORE=y
595CONFIG_SYSFS=y
596# CONFIG_DEVFS_FS is not set
597CONFIG_DEVPTS_FS_XATTR=y
598CONFIG_DEVPTS_FS_SECURITY=y
599# CONFIG_TMPFS is not set
600# CONFIG_HUGETLB_PAGE is not set
601CONFIG_RAMFS=y
602
603#
604# Miscellaneous filesystems
605#
606# CONFIG_ADFS_FS is not set
607# CONFIG_AFFS_FS is not set
608# CONFIG_HFS_FS is not set
609# CONFIG_HFSPLUS_FS is not set
610# CONFIG_BEFS_FS is not set
611# CONFIG_BFS_FS is not set
612# CONFIG_EFS_FS is not set
613# CONFIG_CRAMFS is not set
614# CONFIG_VXFS_FS is not set
615# CONFIG_HPFS_FS is not set
616# CONFIG_QNX4FS_FS is not set
617# CONFIG_SYSV_FS is not set
618# CONFIG_UFS_FS is not set
619
620#
621# Network File Systems
622#
623CONFIG_NFS_FS=y
624# CONFIG_NFS_V3 is not set
625# CONFIG_NFS_V4 is not set
626# CONFIG_NFS_DIRECTIO is not set
627CONFIG_NFSD=y
628# CONFIG_NFSD_V3 is not set
629# CONFIG_NFSD_TCP is not set
630CONFIG_LOCKD=y
631CONFIG_EXPORTFS=y
632CONFIG_SUNRPC=y
633# CONFIG_RPCSEC_GSS_KRB5 is not set
634# CONFIG_RPCSEC_GSS_SPKM3 is not set
635# CONFIG_SMB_FS is not set
636# CONFIG_CIFS is not set
637# CONFIG_NCP_FS is not set
638# CONFIG_CODA_FS is not set
639# CONFIG_AFS_FS is not set
640
641#
642# Partition Types
643#
644# CONFIG_PARTITION_ADVANCED is not set
645CONFIG_MSDOS_PARTITION=y
646
647#
648# Native Language Support
649#
650# CONFIG_NLS is not set
651
652#
653# Profiling support
654#
655# CONFIG_PROFILING is not set
656
657#
658# Kernel hacking
659#
660# CONFIG_DEBUG_KERNEL is not set
661CONFIG_CROSSCOMPILE=y
662CONFIG_CMDLINE=""
663
664#
665# Security options
666#
667CONFIG_KEYS=y
668CONFIG_KEYS_DEBUG_PROC_KEYS=y
669# CONFIG_SECURITY is not set
670
671#
672# Cryptographic options
673#
674# CONFIG_CRYPTO is not set
675
676#
677# Hardware crypto devices
678#
679
680#
681# Library routines
682#
683# CONFIG_CRC_CCITT is not set
684# CONFIG_CRC32 is not set
685# CONFIG_LIBCRC32C is not set
686CONFIG_GENERIC_HARDIRQS=y
687CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
new file mode 100644
index 000000000000..562f2b8043ac
--- /dev/null
+++ b/arch/mips/configs/yosemite_defconfig
@@ -0,0 +1,615 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:49:13 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14# CONFIG_EXPERIMENTAL is not set
15CONFIG_CLEAN_COMPILE=y
16CONFIG_LOCK_KERNEL=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_LOG_BUF_SHIFT=14
28# CONFIG_HOTPLUG is not set
29CONFIG_KOBJECT_UEVENT=y
30CONFIG_IKCONFIG=y
31CONFIG_IKCONFIG_PROC=y
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_ALL is not set
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_FUTEX=y
37CONFIG_EPOLL=y
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SHMEM=y
40CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0
44# CONFIG_TINY_SHMEM is not set
45
46#
47# Loadable module support
48#
49CONFIG_MODULES=y
50CONFIG_MODULE_UNLOAD=y
51CONFIG_OBSOLETE_MODPARM=y
52# CONFIG_MODULE_SRCVERSION_ALL is not set
53CONFIG_KMOD=y
54CONFIG_STOP_MACHINE=y
55
56#
57# Machine selection
58#
59# CONFIG_MACH_JAZZ is not set
60# CONFIG_MACH_VR41XX is not set
61# CONFIG_TOSHIBA_JMR3927 is not set
62# CONFIG_MACH_DECSTATION is not set
63# CONFIG_MIPS_IVR is not set
64# CONFIG_LASAT is not set
65# CONFIG_MIPS_ITE8172 is not set
66# CONFIG_MIPS_ATLAS is not set
67# CONFIG_MIPS_MALTA is not set
68# CONFIG_MOMENCO_OCELOT is not set
69# CONFIG_MOMENCO_OCELOT_G is not set
70# CONFIG_MOMENCO_OCELOT_C is not set
71# CONFIG_MOMENCO_OCELOT_3 is not set
72# CONFIG_MOMENCO_JAGUAR_ATX is not set
73CONFIG_PMC_YOSEMITE=y
74# CONFIG_HYPERTRANSPORT is not set
75# CONFIG_DDB5476 is not set
76# CONFIG_DDB5477 is not set
77# CONFIG_NEC_OSPREY is not set
78# CONFIG_SGI_IP22 is not set
79# CONFIG_SOC_AU1X00 is not set
80# CONFIG_SNI_RM200_PCI is not set
81# CONFIG_TOSHIBA_RBTX4927 is not set
82CONFIG_RWSEM_GENERIC_SPINLOCK=y
83CONFIG_GENERIC_CALIBRATE_DELAY=y
84CONFIG_HAVE_DEC_LOCK=y
85CONFIG_DMA_COHERENT=y
86# CONFIG_CPU_LITTLE_ENDIAN is not set
87CONFIG_IRQ_CPU=y
88CONFIG_IRQ_CPU_RM7K=y
89CONFIG_IRQ_CPU_RM9K=y
90CONFIG_SWAP_IO_SPACE=y
91CONFIG_MIPS_L1_CACHE_SHIFT=5
92
93#
94# CPU selection
95#
96# CONFIG_CPU_MIPS32 is not set
97# CONFIG_CPU_MIPS64 is not set
98# CONFIG_CPU_R3000 is not set
99# CONFIG_CPU_TX39XX is not set
100# CONFIG_CPU_VR41XX is not set
101# CONFIG_CPU_R4300 is not set
102# CONFIG_CPU_R4X00 is not set
103# CONFIG_CPU_TX49XX is not set
104# CONFIG_CPU_R5000 is not set
105# CONFIG_CPU_R5432 is not set
106# CONFIG_CPU_R6000 is not set
107# CONFIG_CPU_NEVADA is not set
108# CONFIG_CPU_R8000 is not set
109# CONFIG_CPU_R10000 is not set
110# CONFIG_CPU_RM7000 is not set
111CONFIG_CPU_RM9000=y
112# CONFIG_CPU_SB1 is not set
113CONFIG_PAGE_SIZE_4KB=y
114# CONFIG_PAGE_SIZE_8KB is not set
115# CONFIG_PAGE_SIZE_16KB is not set
116# CONFIG_PAGE_SIZE_64KB is not set
117CONFIG_CPU_HAS_PREFETCH=y
118# CONFIG_64BIT_PHYS_ADDR is not set
119# CONFIG_CPU_ADVANCED is not set
120CONFIG_CPU_HAS_LLSC=y
121CONFIG_CPU_HAS_LLDSCD=y
122CONFIG_CPU_HAS_SYNC=y
123CONFIG_HIGHMEM=y
124CONFIG_SMP=y
125CONFIG_NR_CPUS=2
126# CONFIG_PREEMPT is not set
127
128#
129# Bus options (PCI, PCMCIA, EISA, ISA, TC)
130#
131CONFIG_HW_HAS_PCI=y
132CONFIG_PCI=y
133CONFIG_PCI_LEGACY_PROC=y
134CONFIG_PCI_NAMES=y
135CONFIG_MMU=y
136
137#
138# PCCARD (PCMCIA/CardBus) support
139#
140# CONFIG_PCCARD is not set
141
142#
143# PC-card bridges
144#
145
146#
147# PCI Hotplug Support
148#
149
150#
151# Executable file formats
152#
153CONFIG_BINFMT_ELF=y
154# CONFIG_BINFMT_MISC is not set
155CONFIG_TRAD_SIGNALS=y
156
157#
158# Device Drivers
159#
160
161#
162# Generic Driver Options
163#
164CONFIG_STANDALONE=y
165CONFIG_PREVENT_FIRMWARE_BUILD=y
166# CONFIG_FW_LOADER is not set
167# CONFIG_DEBUG_DRIVER is not set
168
169#
170# Memory Technology Devices (MTD)
171#
172# CONFIG_MTD is not set
173
174#
175# Parallel port support
176#
177# CONFIG_PARPORT is not set
178
179#
180# Plug and Play support
181#
182
183#
184# Block devices
185#
186# CONFIG_BLK_DEV_FD is not set
187# CONFIG_BLK_CPQ_DA is not set
188# CONFIG_BLK_CPQ_CISS_DA is not set
189# CONFIG_BLK_DEV_DAC960 is not set
190# CONFIG_BLK_DEV_COW_COMMON is not set
191# CONFIG_BLK_DEV_LOOP is not set
192# CONFIG_BLK_DEV_NBD is not set
193# CONFIG_BLK_DEV_SX8 is not set
194# CONFIG_BLK_DEV_RAM is not set
195CONFIG_BLK_DEV_RAM_COUNT=16
196CONFIG_INITRAMFS_SOURCE=""
197# CONFIG_LBD is not set
198CONFIG_CDROM_PKTCDVD=m
199CONFIG_CDROM_PKTCDVD_BUFFERS=8
200# CONFIG_CDROM_PKTCDVD_WCACHE is not set
201
202#
203# IO Schedulers
204#
205CONFIG_IOSCHED_NOOP=y
206CONFIG_IOSCHED_AS=y
207CONFIG_IOSCHED_DEADLINE=y
208CONFIG_IOSCHED_CFQ=y
209CONFIG_ATA_OVER_ETH=m
210
211#
212# ATA/ATAPI/MFM/RLL support
213#
214# CONFIG_IDE is not set
215
216#
217# SCSI device support
218#
219# CONFIG_SCSI is not set
220
221#
222# Multi-device support (RAID and LVM)
223#
224# CONFIG_MD is not set
225
226#
227# Fusion MPT device support
228#
229
230#
231# IEEE 1394 (FireWire) support
232#
233# CONFIG_IEEE1394 is not set
234
235#
236# I2O device support
237#
238# CONFIG_I2O is not set
239
240#
241# Networking support
242#
243CONFIG_NET=y
244
245#
246# Networking options
247#
248CONFIG_PACKET=m
249CONFIG_PACKET_MMAP=y
250CONFIG_NETLINK_DEV=m
251CONFIG_UNIX=y
252# CONFIG_NET_KEY is not set
253CONFIG_INET=y
254# CONFIG_IP_MULTICAST is not set
255# CONFIG_IP_ADVANCED_ROUTER is not set
256CONFIG_IP_PNP=y
257# CONFIG_IP_PNP_DHCP is not set
258CONFIG_IP_PNP_BOOTP=y
259# CONFIG_IP_PNP_RARP is not set
260# CONFIG_NET_IPIP is not set
261# CONFIG_NET_IPGRE is not set
262# CONFIG_SYN_COOKIES is not set
263# CONFIG_INET_AH is not set
264# CONFIG_INET_ESP is not set
265# CONFIG_INET_IPCOMP is not set
266CONFIG_INET_TUNNEL=m
267CONFIG_IP_TCPDIAG=m
268# CONFIG_IP_TCPDIAG_IPV6 is not set
269# CONFIG_NETFILTER is not set
270CONFIG_XFRM=y
271CONFIG_XFRM_USER=m
272# CONFIG_BRIDGE is not set
273# CONFIG_VLAN_8021Q is not set
274# CONFIG_DECNET is not set
275# CONFIG_LLC2 is not set
276# CONFIG_IPX is not set
277# CONFIG_ATALK is not set
278
279#
280# QoS and/or fair queueing
281#
282# CONFIG_NET_SCHED is not set
283# CONFIG_NET_CLS_ROUTE is not set
284
285#
286# Network testing
287#
288# CONFIG_NET_PKTGEN is not set
289# CONFIG_NETPOLL is not set
290# CONFIG_NET_POLL_CONTROLLER is not set
291# CONFIG_HAMRADIO is not set
292# CONFIG_IRDA is not set
293# CONFIG_BT is not set
294CONFIG_NETDEVICES=y
295# CONFIG_DUMMY is not set
296# CONFIG_BONDING is not set
297# CONFIG_EQUALIZER is not set
298# CONFIG_TUN is not set
299
300#
301# ARCnet devices
302#
303# CONFIG_ARCNET is not set
304
305#
306# Ethernet (10 or 100Mbit)
307#
308CONFIG_NET_ETHERNET=y
309CONFIG_MII=y
310# CONFIG_HAPPYMEAL is not set
311# CONFIG_SUNGEM is not set
312# CONFIG_NET_VENDOR_3COM is not set
313
314#
315# Tulip family network device support
316#
317# CONFIG_NET_TULIP is not set
318# CONFIG_HP100 is not set
319# CONFIG_NET_PCI is not set
320
321#
322# Ethernet (1000 Mbit)
323#
324# CONFIG_ACENIC is not set
325# CONFIG_DL2K is not set
326# CONFIG_E1000 is not set
327# CONFIG_NS83820 is not set
328# CONFIG_HAMACHI is not set
329# CONFIG_R8169 is not set
330# CONFIG_SK98LIN is not set
331# CONFIG_TIGON3 is not set
332CONFIG_TITAN_GE=y
333
334#
335# Ethernet (10000 Mbit)
336#
337# CONFIG_IXGB is not set
338# CONFIG_S2IO is not set
339
340#
341# Token Ring devices
342#
343# CONFIG_TR is not set
344
345#
346# Wireless LAN (non-hamradio)
347#
348# CONFIG_NET_RADIO is not set
349
350#
351# Wan interfaces
352#
353# CONFIG_WAN is not set
354# CONFIG_FDDI is not set
355# CONFIG_PPP is not set
356# CONFIG_SLIP is not set
357
358#
359# ISDN subsystem
360#
361# CONFIG_ISDN is not set
362
363#
364# Telephony Support
365#
366# CONFIG_PHONE is not set
367
368#
369# Input device support
370#
371# CONFIG_INPUT is not set
372
373#
374# Userland interfaces
375#
376
377#
378# Input I/O drivers
379#
380# CONFIG_GAMEPORT is not set
381CONFIG_SOUND_GAMEPORT=y
382# CONFIG_SERIO is not set
383# CONFIG_SERIO_I8042 is not set
384
385#
386# Input Device Drivers
387#
388
389#
390# Character devices
391#
392# CONFIG_VT is not set
393# CONFIG_SERIAL_NONSTANDARD is not set
394
395#
396# Serial drivers
397#
398CONFIG_SERIAL_8250=y
399CONFIG_SERIAL_8250_CONSOLE=y
400CONFIG_SERIAL_8250_NR_UARTS=4
401# CONFIG_SERIAL_8250_EXTENDED is not set
402
403#
404# Non-8250 serial port support
405#
406CONFIG_SERIAL_CORE=y
407CONFIG_SERIAL_CORE_CONSOLE=y
408CONFIG_UNIX98_PTYS=y
409CONFIG_LEGACY_PTYS=y
410CONFIG_LEGACY_PTY_COUNT=256
411
412#
413# IPMI
414#
415# CONFIG_IPMI_HANDLER is not set
416
417#
418# Watchdog Cards
419#
420# CONFIG_WATCHDOG is not set
421# CONFIG_RTC is not set
422CONFIG_GEN_RTC=y
423CONFIG_GEN_RTC_X=y
424# CONFIG_DTLK is not set
425# CONFIG_R3964 is not set
426# CONFIG_APPLICOM is not set
427
428#
429# Ftape, the floppy tape device driver
430#
431# CONFIG_DRM is not set
432# CONFIG_RAW_DRIVER is not set
433
434#
435# I2C support
436#
437# CONFIG_I2C is not set
438
439#
440# Dallas's 1-wire bus
441#
442# CONFIG_W1 is not set
443
444#
445# Misc devices
446#
447
448#
449# Multimedia devices
450#
451# CONFIG_VIDEO_DEV is not set
452
453#
454# Digital Video Broadcasting Devices
455#
456# CONFIG_DVB is not set
457
458#
459# Graphics support
460#
461# CONFIG_FB is not set
462# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
463
464#
465# Sound
466#
467# CONFIG_SOUND is not set
468
469#
470# USB support
471#
472# CONFIG_USB is not set
473CONFIG_USB_ARCH_HAS_HCD=y
474CONFIG_USB_ARCH_HAS_OHCI=y
475
476#
477# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
478#
479
480#
481# USB Gadget Support
482#
483# CONFIG_USB_GADGET is not set
484
485#
486# MMC/SD Card support
487#
488# CONFIG_MMC is not set
489
490#
491# InfiniBand support
492#
493# CONFIG_INFINIBAND is not set
494
495#
496# File systems
497#
498# CONFIG_EXT2_FS is not set
499# CONFIG_EXT3_FS is not set
500# CONFIG_JBD is not set
501# CONFIG_REISERFS_FS is not set
502# CONFIG_JFS_FS is not set
503# CONFIG_XFS_FS is not set
504# CONFIG_MINIX_FS is not set
505# CONFIG_ROMFS_FS is not set
506# CONFIG_QUOTA is not set
507CONFIG_DNOTIFY=y
508# CONFIG_AUTOFS_FS is not set
509# CONFIG_AUTOFS4_FS is not set
510
511#
512# CD-ROM/DVD Filesystems
513#
514# CONFIG_ISO9660_FS is not set
515# CONFIG_UDF_FS is not set
516
517#
518# DOS/FAT/NT Filesystems
519#
520# CONFIG_MSDOS_FS is not set
521# CONFIG_VFAT_FS is not set
522# CONFIG_NTFS_FS is not set
523
524#
525# Pseudo filesystems
526#
527CONFIG_PROC_FS=y
528CONFIG_PROC_KCORE=y
529CONFIG_SYSFS=y
530# CONFIG_DEVPTS_FS_XATTR is not set
531CONFIG_TMPFS=y
532# CONFIG_TMPFS_XATTR is not set
533# CONFIG_HUGETLB_PAGE is not set
534CONFIG_RAMFS=y
535
536#
537# Miscellaneous filesystems
538#
539# CONFIG_HFSPLUS_FS is not set
540# CONFIG_CRAMFS is not set
541# CONFIG_VXFS_FS is not set
542# CONFIG_HPFS_FS is not set
543# CONFIG_QNX4FS_FS is not set
544# CONFIG_SYSV_FS is not set
545# CONFIG_UFS_FS is not set
546
547#
548# Network File Systems
549#
550CONFIG_NFS_FS=y
551# CONFIG_NFS_V3 is not set
552# CONFIG_NFSD is not set
553CONFIG_ROOT_NFS=y
554CONFIG_LOCKD=y
555# CONFIG_EXPORTFS is not set
556CONFIG_SUNRPC=y
557# CONFIG_SMB_FS is not set
558# CONFIG_CIFS is not set
559# CONFIG_NCP_FS is not set
560# CONFIG_CODA_FS is not set
561
562#
563# Partition Types
564#
565# CONFIG_PARTITION_ADVANCED is not set
566CONFIG_MSDOS_PARTITION=y
567
568#
569# Native Language Support
570#
571# CONFIG_NLS is not set
572
573#
574# Kernel hacking
575#
576CONFIG_DEBUG_KERNEL=y
577# CONFIG_MAGIC_SYSRQ is not set
578# CONFIG_SCHEDSTATS is not set
579# CONFIG_DEBUG_SLAB is not set
580# CONFIG_DEBUG_SPINLOCK is not set
581# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
582# CONFIG_DEBUG_KOBJECT is not set
583# CONFIG_DEBUG_HIGHMEM is not set
584# CONFIG_DEBUG_INFO is not set
585# CONFIG_DEBUG_FS is not set
586CONFIG_CROSSCOMPILE=y
587CONFIG_CMDLINE=""
588# CONFIG_DEBUG_STACK_USAGE is not set
589# CONFIG_KGDB is not set
590# CONFIG_RUNTIME_DEBUG is not set
591
592#
593# Security options
594#
595CONFIG_KEYS=y
596CONFIG_KEYS_DEBUG_PROC_KEYS=y
597# CONFIG_SECURITY is not set
598
599#
600# Cryptographic options
601#
602# CONFIG_CRYPTO is not set
603
604#
605# Hardware crypto devices
606#
607
608#
609# Library routines
610#
611# CONFIG_CRC_CCITT is not set
612# CONFIG_CRC32 is not set
613# CONFIG_LIBCRC32C is not set
614CONFIG_GENERIC_HARDIRQS=y
615CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/ddb5xxx/common/Makefile b/arch/mips/ddb5xxx/common/Makefile
new file mode 100644
index 000000000000..bc44e3032711
--- /dev/null
+++ b/arch/mips/ddb5xxx/common/Makefile
@@ -0,0 +1,5 @@
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
new file mode 100644
index 000000000000..7ec7d903ba97
--- /dev/null
+++ b/arch/mips/ddb5xxx/common/nile4.c
@@ -0,0 +1,130 @@
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
new file mode 100644
index 000000000000..b8d1f7489f3b
--- /dev/null
+++ b/arch/mips/ddb5xxx/common/prom.c
@@ -0,0 +1,142 @@
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/config.h>
11#include <linux/init.h>
12#include <linux/mm.h>
13#include <linux/sched.h>
14#include <linux/bootmem.h>
15
16#include <asm/addrspace.h>
17#include <asm/bootinfo.h>
18#include <asm/ddb5xxx/ddb5xxx.h>
19#include <asm/debug.h>
20
21const char *get_system_type(void)
22{
23 switch (mips_machtype) {
24 case MACH_NEC_DDB5074: return "NEC DDB Vrc-5074";
25 case MACH_NEC_DDB5476: return "NEC DDB Vrc-5476";
26 case MACH_NEC_DDB5477: return "NEC DDB Vrc-5477";
27 case MACH_NEC_ROCKHOPPER: return "NEC Rockhopper";
28 case MACH_NEC_ROCKHOPPERII: return "NEC RockhopperII";
29 default: return "Unknown NEC board";
30 }
31}
32
33#if defined(CONFIG_DDB5477)
34void ddb5477_runtime_detection(void);
35#endif
36
37/* [jsun@junsun.net] PMON passes arguments in C main() style */
38void __init prom_init(void)
39{
40 int argc = fw_arg0;
41 char **arg = (char**) fw_arg1;
42 int i;
43
44 /* if user passes kernel args, ignore the default one */
45 if (argc > 1)
46 arcs_cmdline[0] = '\0';
47
48 /* arg[0] is "g", the rest is boot parameters */
49 for (i = 1; i < argc; i++) {
50 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
51 >= sizeof(arcs_cmdline))
52 break;
53 strcat(arcs_cmdline, arg[i]);
54 strcat(arcs_cmdline, " ");
55 }
56
57 mips_machgroup = MACH_GROUP_NEC_DDB;
58
59#if defined(CONFIG_DDB5074)
60 mips_machtype = MACH_NEC_DDB5074;
61 add_memory_region(0, DDB_SDRAM_SIZE, BOOT_MEM_RAM);
62#elif defined(CONFIG_DDB5476)
63 mips_machtype = MACH_NEC_DDB5476;
64 add_memory_region(0, DDB_SDRAM_SIZE, BOOT_MEM_RAM);
65#elif defined(CONFIG_DDB5477)
66 ddb5477_runtime_detection();
67 add_memory_region(0, board_ram_size, BOOT_MEM_RAM);
68#endif
69}
70
71unsigned long __init prom_free_prom_memory(void)
72{
73 return 0;
74}
75
76#if defined(CONFIG_DDB5477)
77
78#define DEFAULT_LCS1_BASE 0x19000000
79#define TESTVAL1 'K'
80#define TESTVAL2 'S'
81
82int board_ram_size;
83void ddb5477_runtime_detection(void)
84{
85 volatile char *test_offset;
86 char saved_test_byte;
87
88 /* Determine if this is a DDB5477 board, or a BSB-VR0300
89 base board. We can tell by checking for the location of
90 the NVRAM. It lives at the beginning of LCS1 on the DDB5477,
91 and the beginning of LCS1 on the BSB-VR0300 is flash memory.
92 The first 2K of the NVRAM are reserved, so don't we'll poke
93 around just after that.
94 */
95
96 /* We can only use the PCI bus to distinquish between
97 the Rockhopper and RockhopperII backplanes and this must
98 wait until ddb5477_board_init() in setup.c after the 5477
99 is initialized. So, until then handle
100 both Rockhopper and RockhopperII backplanes as Rockhopper 1
101 */
102
103 test_offset = (char *)KSEG1ADDR(DEFAULT_LCS1_BASE + 0x800);
104 saved_test_byte = *test_offset;
105
106 *test_offset = TESTVAL1;
107 if (*test_offset != TESTVAL1) {
108 /* We couldn't set our test value, so it must not be NVRAM,
109 so it's a BSB_VR0300 */
110 mips_machtype = MACH_NEC_ROCKHOPPER;
111 } else {
112 /* We may have gotten lucky, and the TESTVAL1 was already
113 stored at the test location, so we must check a second
114 test value */
115 *test_offset = TESTVAL2;
116 if (*test_offset != TESTVAL2) {
117 /* OK, we couldn't set this value either, so it must
118 definately be a BSB_VR0300 */
119 mips_machtype = MACH_NEC_ROCKHOPPER;
120 } else {
121 /* We could change the value twice, so it must be
122 NVRAM, so it's a DDB_VRC5477 */
123 mips_machtype = MACH_NEC_DDB5477;
124 }
125 }
126 /* Restore the original byte */
127 *test_offset = saved_test_byte;
128
129 /* before we know a better way, we will trust PMON for getting
130 * RAM size
131 */
132 board_ram_size = 1 << (36 - (ddb_in32(DDB_SDRAM0) & 0xf));
133
134 db_run(printk("DDB run-time detection : %s, %d MB RAM\n",
135 mips_machtype == MACH_NEC_DDB5477 ?
136 "DDB5477" : "Rockhopper",
137 board_ram_size >> 20));
138
139 /* we can't handle ram size > 128 MB */
140 db_assert(board_ram_size <= (128 << 20));
141}
142#endif
diff --git a/arch/mips/ddb5xxx/common/rtc_ds1386.c b/arch/mips/ddb5xxx/common/rtc_ds1386.c
new file mode 100644
index 000000000000..f5b11508ff2f
--- /dev/null
+++ b/arch/mips/ddb5xxx/common/rtc_ds1386.c
@@ -0,0 +1,164 @@
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
45 /* let us freeze external registers */
46 byte = READ_RTC(0xB);
47 byte &= 0x3f;
48 WRITE_RTC(0xB, byte);
49
50 /* read time data */
51 year = BCD2BIN(READ_RTC(0xA)) + EPOCH;
52 month = BCD2BIN(READ_RTC(0x9) & 0x1f);
53 day = BCD2BIN(READ_RTC(0x8));
54 minute = BCD2BIN(READ_RTC(0x2));
55 second = BCD2BIN(READ_RTC(0x1));
56
57 /* hour is special - deal with it later */
58 temp = READ_RTC(0x4);
59
60 /* enable time transfer */
61 byte |= 0x80;
62 WRITE_RTC(0xB, byte);
63
64 /* calc hour */
65 if (temp & 0x40) {
66 /* 12 hour format */
67 hour = BCD2BIN(temp & 0x1f);
68 if (temp & 0x20) hour += 12; /* PM */
69 } else {
70 /* 24 hour format */
71 hour = BCD2BIN(temp & 0x3f);
72 }
73
74 return mktime(year, month, day, hour, minute, second);
75}
76
77static int
78rtc_ds1386_set_time(unsigned long t)
79{
80 struct rtc_time tm;
81 u8 byte;
82 u8 temp;
83 u8 year, month, day, hour, minute, second;
84
85 /* let us freeze external registers */
86 byte = READ_RTC(0xB);
87 byte &= 0x3f;
88 WRITE_RTC(0xB, byte);
89
90 /* convert */
91 to_tm(t, &tm);
92
93
94 /* check each field one by one */
95 year = BIN2BCD(tm.tm_year - EPOCH);
96 if (year != READ_RTC(0xA)) {
97 WRITE_RTC(0xA, year);
98 }
99
100 temp = READ_RTC(0x9);
101 month = BIN2BCD(tm.tm_mon+1); /* tm_mon starts from 0 to 11 */
102 if (month != (temp & 0x1f)) {
103 WRITE_RTC( 0x9,
104 (month & 0x1f) | (temp & ~0x1f) );
105 }
106
107 day = BIN2BCD(tm.tm_mday);
108 if (day != READ_RTC(0x8)) {
109 WRITE_RTC(0x8, day);
110 }
111
112 temp = READ_RTC(0x4);
113 if (temp & 0x40) {
114 /* 12 hour format */
115 hour = 0x40;
116 if (tm.tm_hour > 12) {
117 hour |= 0x20 | (BIN2BCD(hour-12) & 0x1f);
118 } else {
119 hour |= BIN2BCD(tm.tm_hour);
120 }
121 } else {
122 /* 24 hour format */
123 hour = BIN2BCD(tm.tm_hour) & 0x3f;
124 }
125 if (hour != temp) WRITE_RTC(0x4, hour);
126
127 minute = BIN2BCD(tm.tm_min);
128 if (minute != READ_RTC(0x2)) {
129 WRITE_RTC(0x2, minute);
130 }
131
132 second = BIN2BCD(tm.tm_sec);
133 if (second != READ_RTC(0x1)) {
134 WRITE_RTC(0x1, second);
135 }
136
137 return 0;
138}
139
140void
141rtc_ds1386_init(unsigned long base)
142{
143 unsigned char byte;
144
145 /* remember the base */
146 rtc_base = base;
147 db_assert((rtc_base & 0xe0000000) == KSEG1);
148
149 /* turn on RTC if it is not on */
150 byte = READ_RTC(0x9);
151 if (byte & 0x80) {
152 byte &= 0x7f;
153 WRITE_RTC(0x9, byte);
154 }
155
156 /* enable time transfer */
157 byte = READ_RTC(0xB);
158 byte |= 0x80;
159 WRITE_RTC(0xB, byte);
160
161 /* set the function pointers */
162 rtc_get_time = rtc_ds1386_get_time;
163 rtc_set_time = rtc_ds1386_set_time;
164}
diff --git a/arch/mips/ddb5xxx/ddb5074/Makefile b/arch/mips/ddb5xxx/ddb5074/Makefile
new file mode 100644
index 000000000000..488206b8d94e
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5074/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for the NEC DDB Vrc-5074 specific kernel interface routines
3# under Linux.
4#
5
6obj-y += setup.o irq.o int-handler.o nile4_pic.o
7
8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/ddb5xxx/ddb5074/int-handler.S b/arch/mips/ddb5xxx/ddb5074/int-handler.S
new file mode 100644
index 000000000000..a78644150b37
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5074/int-handler.S
@@ -0,0 +1,120 @@
1/*
2 * arch/mips/ddb5074/int-handler.S -- NEC DDB Vrc-5074 interrupt handler
3 *
4 * Based on arch/mips/sgi/kernel/indyIRQ.S
5 *
6 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
7 *
8 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
9 * Sony Software Development Center Europe (SDCE), Brussels
10 */
11#include <asm/asm.h>
12#include <asm/mipsregs.h>
13#include <asm/regdef.h>
14#include <asm/stackframe.h>
15
16/* A lot of complication here is taken away because:
17 *
18 * 1) We handle one interrupt and return, sitting in a loop and moving across
19 * all the pending IRQ bits in the cause register is _NOT_ the answer, the
20 * common case is one pending IRQ so optimize in that direction.
21 *
22 * 2) We need not check against bits in the status register IRQ mask, that
23 * would make this routine slow as hell.
24 *
25 * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
26 * between like BSD spl() brain-damage.
27 *
28 * Furthermore, the IRQs on the INDY look basically (barring software IRQs
29 * which we don't use at all) like:
30 *
31 * MIPS IRQ Source
32 * -------- ------
33 * 0 Software (ignored)
34 * 1 Software (ignored)
35 * 2 Local IRQ level zero
36 * 3 Local IRQ level one
37 * 4 8254 Timer zero
38 * 5 8254 Timer one
39 * 6 Bus Error
40 * 7 R4k timer (what we use)
41 *
42 * We handle the IRQ according to _our_ priority which is:
43 *
44 * Highest ---- R4k Timer
45 * Local IRQ zero
46 * Local IRQ one
47 * Bus Error
48 * 8254 Timer zero
49 * Lowest ---- 8254 Timer one
50 *
51 * then we just return, if multiple IRQs are pending then we will just take
52 * another exception, big deal.
53 */
54
55 .text
56 .set noreorder
57 .set noat
58 .align 5
59 NESTED(ddbIRQ, PT_SIZE, sp)
60 SAVE_ALL
61 CLI
62 .set at
63 mfc0 s0, CP0_CAUSE # get irq mask
64
65#if 1
66 mfc0 t2,CP0_STATUS # get enabled interrupts
67 and s0,t2 # isolate allowed ones
68#endif
69 /* First we check for r4k counter/timer IRQ. */
70 andi a0, s0, CAUSEF_IP2 # delay slot, check local level zero
71 beq a0, zero, 1f
72 andi a0, s0, CAUSEF_IP3 # delay slot, check local level one
73
74 /* Wheee, local level zero interrupt. */
75 jal ddb_local0_irqdispatch
76 move a0, sp # delay slot
77
78 j ret_from_irq
79 nop # delay slot
80
811:
82 beq a0, zero, 1f
83 andi a0, s0, CAUSEF_IP6 # delay slot, check bus error
84
85 /* Wheee, local level one interrupt. */
86 move a0, sp
87 jal ddb_local1_irqdispatch
88 nop
89
90 j ret_from_irq
91 nop
92
931:
94 beq a0, zero, 1f
95 nop
96
97 /* Wheee, an asynchronous bus error... */
98 move a0, sp
99 jal ddb_buserror_irq
100 nop
101
102 j ret_from_irq
103 nop
104
1051:
106 /* Here by mistake? This is possible, what can happen
107 * is that by the time we take the exception the IRQ
108 * pin goes low, so just leave if this is the case.
109 */
110 andi a0, s0, (CAUSEF_IP4 | CAUSEF_IP5)
111 beq a0, zero, 1f
112
113 /* Must be one of the 8254 timers... */
114 move a0, sp
115 jal ddb_8254timer_irq
116 nop
1171:
118 j ret_from_irq
119 nop
120 END(ddbIRQ)
diff --git a/arch/mips/ddb5xxx/ddb5074/irq.c b/arch/mips/ddb5xxx/ddb5074/irq.c
new file mode 100644
index 000000000000..45088a1be414
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5074/irq.c
@@ -0,0 +1,159 @@
1/*
2 * arch/mips/ddb5074/irq.c -- NEC DDB Vrc-5074 interrupt routines
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7#include <linux/init.h>
8#include <linux/irq.h>
9#include <linux/signal.h>
10#include <linux/sched.h>
11#include <linux/types.h>
12#include <linux/interrupt.h>
13#include <linux/ioport.h>
14
15#include <asm/i8259.h>
16#include <asm/io.h>
17#include <asm/irq_cpu.h>
18#include <asm/ptrace.h>
19#include <asm/nile4.h>
20#include <asm/ddb5xxx/ddb5xxx.h>
21#include <asm/ddb5xxx/ddb5074.h>
22
23
24extern asmlinkage void ddbIRQ(void);
25
26static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
27
28#define M1543_PNP_CONFIG 0x03f0 /* PnP Config Port */
29#define M1543_PNP_INDEX 0x03f0 /* PnP Index Port */
30#define M1543_PNP_DATA 0x03f1 /* PnP Data Port */
31
32#define M1543_PNP_ALT_CONFIG 0x0370 /* Alternative PnP Config Port */
33#define M1543_PNP_ALT_INDEX 0x0370 /* Alternative PnP Index Port */
34#define M1543_PNP_ALT_DATA 0x0371 /* Alternative PnP Data Port */
35
36#define M1543_INT1_MASTER_CTRL 0x0020 /* INT_1 (master) Control Register */
37#define M1543_INT1_MASTER_MASK 0x0021 /* INT_1 (master) Mask Register */
38
39#define M1543_INT1_SLAVE_CTRL 0x00a0 /* INT_1 (slave) Control Register */
40#define M1543_INT1_SLAVE_MASK 0x00a1 /* INT_1 (slave) Mask Register */
41
42#define M1543_INT1_MASTER_ELCR 0x04d0 /* INT_1 (master) Edge/Level Control */
43#define M1543_INT1_SLAVE_ELCR 0x04d1 /* INT_1 (slave) Edge/Level Control */
44
45
46static void m1543_irq_setup(void)
47{
48 /*
49 * The ALI M1543 has 13 interrupt inputs, IRQ1..IRQ13. Not all
50 * the possible IO sources in the M1543 are in use by us. We will
51 * use the following mapping:
52 *
53 * IRQ1 - keyboard (default set by M1543)
54 * IRQ3 - reserved for UART B (default set by M1543) (note that
55 * the schematics for the DDB Vrc-5074 board seem to
56 * indicate that IRQ3 is connected to the DS1386
57 * watchdog timer interrupt output so we might have
58 * a conflict)
59 * IRQ4 - reserved for UART A (default set by M1543)
60 * IRQ5 - parallel (default set by M1543)
61 * IRQ8 - DS1386 time of day (RTC) interrupt
62 * IRQ12 - mouse
63 */
64
65 /*
66 * Assing mouse interrupt to IRQ12
67 */
68
69 /* Enter configuration mode */
70 outb(0x51, M1543_PNP_CONFIG);
71 outb(0x23, M1543_PNP_CONFIG);
72
73 /* Select logical device 7 (Keyboard) */
74 outb(0x07, M1543_PNP_INDEX);
75 outb(0x07, M1543_PNP_DATA);
76
77 /* Select IRQ12 */
78 outb(0x72, M1543_PNP_INDEX);
79 outb(0x0c, M1543_PNP_DATA);
80
81 outb(0x30, M1543_PNP_INDEX);
82 printk("device 7, 0x30: %02x\n",inb(M1543_PNP_DATA));
83
84 outb(0x70, M1543_PNP_INDEX);
85 printk("device 7, 0x70: %02x\n",inb(M1543_PNP_DATA));
86
87 /* Leave configration mode */
88 outb(0xbb, M1543_PNP_CONFIG);
89
90
91}
92
93void ddb_local0_irqdispatch(struct pt_regs *regs)
94{
95 u32 mask;
96 int nile4_irq;
97
98 mask = nile4_get_irq_stat(0);
99
100 /* Handle the timer interrupt first */
101#if 0
102 if (mask & (1 << NILE4_INT_GPT)) {
103 do_IRQ(nile4_to_irq(NILE4_INT_GPT), regs);
104 mask &= ~(1 << NILE4_INT_GPT);
105 }
106#endif
107 for (nile4_irq = 0; mask; nile4_irq++, mask >>= 1)
108 if (mask & 1) {
109 if (nile4_irq == NILE4_INT_INTE) {
110 int i8259_irq;
111
112 nile4_clear_irq(NILE4_INT_INTE);
113 i8259_irq = nile4_i8259_iack();
114 do_IRQ(i8259_irq, regs);
115 } else
116 do_IRQ(nile4_to_irq(nile4_irq), regs);
117
118 }
119}
120
121void ddb_local1_irqdispatch(void)
122{
123 printk("ddb_local1_irqdispatch called\n");
124}
125
126void ddb_buserror_irq(void)
127{
128 printk("ddb_buserror_irq called\n");
129}
130
131void ddb_8254timer_irq(void)
132{
133 printk("ddb_8254timer_irq called\n");
134}
135
136void __init arch_init_irq(void)
137{
138 /* setup cascade interrupts */
139 setup_irq(NILE4_IRQ_BASE + NILE4_INT_INTE, &irq_cascade);
140 setup_irq(CPU_IRQ_BASE + CPU_NILE4_CASCADE, &irq_cascade);
141
142 set_except_vector(0, ddbIRQ);
143
144 nile4_irq_setup(NILE4_IRQ_BASE);
145 m1543_irq_setup();
146 init_i8259_irqs();
147
148
149 printk("CPU_IRQ_BASE: %d\n",CPU_IRQ_BASE);
150
151 mips_cpu_irq_init(CPU_IRQ_BASE);
152
153 printk("enabling 8259 cascade\n");
154
155 ddb5074_led_hex(0);
156
157 /* Enable the interrupt cascade */
158 nile4_enable_irq(NILE4_IRQ_BASE+IRQ_I8259_CASCADE);
159}
diff --git a/arch/mips/ddb5xxx/ddb5074/nile4_pic.c b/arch/mips/ddb5xxx/ddb5074/nile4_pic.c
new file mode 100644
index 000000000000..68c127cd70c9
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5074/nile4_pic.c
@@ -0,0 +1,287 @@
1/*
2 * arch/mips/ddb5476/nile4.c --
3 * low-level PIC code for NEC Vrc-5476 (Nile 4)
4 *
5 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
6 * Sony Software Development Center Europe (SDCE), Brussels
7 *
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
10 *
11 */
12#include <linux/config.h>
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/ioport.h>
17
18#include <asm/addrspace.h>
19
20#include <asm/ddb5xxx/ddb5xxx.h>
21
22static int irq_base;
23
24/*
25 * Interrupt Programming
26 */
27void nile4_map_irq(int nile4_irq, int cpu_irq)
28{
29 u32 offset, t;
30
31 offset = DDB_INTCTRL;
32 if (nile4_irq >= 8) {
33 offset += 4;
34 nile4_irq -= 8;
35 }
36 t = ddb_in32(offset);
37 t &= ~(7 << (nile4_irq * 4));
38 t |= cpu_irq << (nile4_irq * 4);
39 ddb_out32(offset, t);
40}
41
42void nile4_map_irq_all(int cpu_irq)
43{
44 u32 all, t;
45
46 all = cpu_irq;
47 all |= all << 4;
48 all |= all << 8;
49 all |= all << 16;
50 t = ddb_in32(DDB_INTCTRL);
51 t &= 0x88888888;
52 t |= all;
53 ddb_out32(DDB_INTCTRL, t);
54 t = ddb_in32(DDB_INTCTRL + 4);
55 t &= 0x88888888;
56 t |= all;
57 ddb_out32(DDB_INTCTRL + 4, t);
58}
59
60void nile4_enable_irq(unsigned int nile4_irq)
61{
62 u32 offset, t;
63
64 nile4_irq-=irq_base;
65
66 ddb5074_led_hex(8);
67
68 offset = DDB_INTCTRL;
69 if (nile4_irq >= 8) {
70 offset += 4;
71 nile4_irq -= 8;
72 }
73 ddb5074_led_hex(9);
74 t = ddb_in32(offset);
75 ddb5074_led_hex(0xa);
76 t |= 8 << (nile4_irq * 4);
77 ddb_out32(offset, t);
78 ddb5074_led_hex(0xb);
79}
80
81void nile4_disable_irq(unsigned int nile4_irq)
82{
83 u32 offset, t;
84
85 nile4_irq-=irq_base;
86
87 offset = DDB_INTCTRL;
88 if (nile4_irq >= 8) {
89 offset += 4;
90 nile4_irq -= 8;
91 }
92 t = ddb_in32(offset);
93 t &= ~(8 << (nile4_irq * 4));
94 ddb_out32(offset, t);
95}
96
97void nile4_disable_irq_all(void)
98{
99 ddb_out32(DDB_INTCTRL, 0);
100 ddb_out32(DDB_INTCTRL + 4, 0);
101}
102
103u16 nile4_get_irq_stat(int cpu_irq)
104{
105 return ddb_in16(DDB_INTSTAT0 + cpu_irq * 2);
106}
107
108void nile4_enable_irq_output(int cpu_irq)
109{
110 u32 t;
111
112 t = ddb_in32(DDB_INTSTAT1 + 4);
113 t |= 1 << (16 + cpu_irq);
114 ddb_out32(DDB_INTSTAT1, t);
115}
116
117void nile4_disable_irq_output(int cpu_irq)
118{
119 u32 t;
120
121 t = ddb_in32(DDB_INTSTAT1 + 4);
122 t &= ~(1 << (16 + cpu_irq));
123 ddb_out32(DDB_INTSTAT1, t);
124}
125
126void nile4_set_pci_irq_polarity(int pci_irq, int high)
127{
128 u32 t;
129
130 t = ddb_in32(DDB_INTPPES);
131 if (high)
132 t &= ~(1 << (pci_irq * 2));
133 else
134 t |= 1 << (pci_irq * 2);
135 ddb_out32(DDB_INTPPES, t);
136}
137
138void nile4_set_pci_irq_level_or_edge(int pci_irq, int level)
139{
140 u32 t;
141
142 t = ddb_in32(DDB_INTPPES);
143 if (level)
144 t |= 2 << (pci_irq * 2);
145 else
146 t &= ~(2 << (pci_irq * 2));
147 ddb_out32(DDB_INTPPES, t);
148}
149
150void nile4_clear_irq(int nile4_irq)
151{
152 nile4_irq-=irq_base;
153 ddb_out32(DDB_INTCLR, 1 << nile4_irq);
154}
155
156void nile4_clear_irq_mask(u32 mask)
157{
158 ddb_out32(DDB_INTCLR, mask);
159}
160
161u8 nile4_i8259_iack(void)
162{
163 u8 irq;
164 u32 reg;
165
166 /* Set window 0 for interrupt acknowledge */
167 reg = ddb_in32(DDB_PCIINIT0);
168
169 ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IACK, 0, DDB_PCI_ACCESS_32);
170 irq = *(volatile u8 *) KSEG1ADDR(DDB_PCI_IACK_BASE);
171 /* restore window 0 for PCI I/O space */
172 // ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IO, 0, DDB_PCI_ACCESS_32);
173 ddb_out32(DDB_PCIINIT0, reg);
174
175 /* i8269.c set the base vector to be 0x0 */
176 return irq ;
177}
178
179static unsigned int nile4_irq_startup(unsigned int irq) {
180
181 nile4_enable_irq(irq);
182 return 0;
183
184}
185
186static void nile4_ack_irq(unsigned int irq) {
187
188 ddb5074_led_hex(4);
189
190 nile4_clear_irq(irq);
191 ddb5074_led_hex(2);
192 nile4_disable_irq(irq);
193
194 ddb5074_led_hex(0);
195}
196
197static void nile4_irq_end(unsigned int irq) {
198
199 ddb5074_led_hex(3);
200 if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
201 ddb5074_led_hex(5);
202 nile4_enable_irq(irq);
203 ddb5074_led_hex(7);
204 }
205
206 ddb5074_led_hex(1);
207}
208
209#define nile4_irq_shutdown nile4_disable_irq
210
211static hw_irq_controller nile4_irq_controller = {
212 "nile4",
213 nile4_irq_startup,
214 nile4_irq_shutdown,
215 nile4_enable_irq,
216 nile4_disable_irq,
217 nile4_ack_irq,
218 nile4_irq_end,
219 NULL
220};
221
222void nile4_irq_setup(u32 base) {
223
224 int i;
225
226 irq_base=base;
227
228 /* Map all interrupts to CPU int #0 */
229 nile4_map_irq_all(0);
230
231 /* PCI INTA#-E# must be level triggered */
232 nile4_set_pci_irq_level_or_edge(0, 1);
233 nile4_set_pci_irq_level_or_edge(1, 1);
234 nile4_set_pci_irq_level_or_edge(2, 1);
235 nile4_set_pci_irq_level_or_edge(3, 1);
236 nile4_set_pci_irq_level_or_edge(4, 1);
237
238 /* PCI INTA#-D# must be active low, INTE# must be active high */
239 nile4_set_pci_irq_polarity(0, 0);
240 nile4_set_pci_irq_polarity(1, 0);
241 nile4_set_pci_irq_polarity(2, 0);
242 nile4_set_pci_irq_polarity(3, 0);
243 nile4_set_pci_irq_polarity(4, 1);
244
245
246 for (i = 0; i < 16; i++) {
247 nile4_clear_irq(i);
248 nile4_disable_irq(i);
249 }
250
251 /* Enable CPU int #0 */
252 nile4_enable_irq_output(0);
253
254 for (i= base; i< base + NUM_NILE4_INTERRUPTS; i++) {
255 irq_desc[i].status = IRQ_DISABLED;
256 irq_desc[i].action = NULL;
257 irq_desc[i].depth = 1;
258 irq_desc[i].handler = &nile4_irq_controller;
259 }
260}
261
262#if defined(CONFIG_RUNTIME_DEBUG)
263void nile4_dump_irq_status(void)
264{
265 printk(KERN_DEBUG "
266 CPUSTAT = %p:%p\n", (void *) ddb_in32(DDB_CPUSTAT + 4),
267 (void *) ddb_in32(DDB_CPUSTAT));
268 printk(KERN_DEBUG "
269 INTCTRL = %p:%p\n", (void *) ddb_in32(DDB_INTCTRL + 4),
270 (void *) ddb_in32(DDB_INTCTRL));
271 printk(KERN_DEBUG
272 "INTSTAT0 = %p:%p\n",
273 (void *) ddb_in32(DDB_INTSTAT0 + 4),
274 (void *) ddb_in32(DDB_INTSTAT0));
275 printk(KERN_DEBUG
276 "INTSTAT1 = %p:%p\n",
277 (void *) ddb_in32(DDB_INTSTAT1 + 4),
278 (void *) ddb_in32(DDB_INTSTAT1));
279 printk(KERN_DEBUG
280 "INTCLR = %p:%p\n", (void *) ddb_in32(DDB_INTCLR + 4),
281 (void *) ddb_in32(DDB_INTCLR));
282 printk(KERN_DEBUG
283 "INTPPES = %p:%p\n", (void *) ddb_in32(DDB_INTPPES + 4),
284 (void *) ddb_in32(DDB_INTPPES));
285}
286
287#endif
diff --git a/arch/mips/ddb5xxx/ddb5074/setup.c b/arch/mips/ddb5xxx/ddb5074/setup.c
new file mode 100644
index 000000000000..a73a5978d550
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5074/setup.c
@@ -0,0 +1,235 @@
1/*
2 * arch/mips/ddb5074/setup.c -- NEC DDB Vrc-5074 setup routines
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7#include <linux/init.h>
8#include <linux/kbd_ll.h>
9#include <linux/kernel.h>
10#include <linux/kdev_t.h>
11#include <linux/types.h>
12#include <linux/sched.h>
13#include <linux/pci.h>
14#include <linux/ide.h>
15#include <linux/ioport.h>
16#include <linux/irq.h>
17
18#include <asm/addrspace.h>
19#include <asm/bcache.h>
20#include <asm/irq.h>
21#include <asm/reboot.h>
22#include <asm/gdb-stub.h>
23#include <asm/time.h>
24#include <asm/nile4.h>
25#include <asm/ddb5xxx/ddb5074.h>
26#include <asm/ddb5xxx/ddb5xxx.h>
27
28static void (*back_to_prom) (void) = (void (*)(void)) 0xbfc00000;
29
30static void ddb_machine_restart(char *command)
31{
32 u32 t;
33
34 /* PCI cold reset */
35 t = nile4_in32(NILE4_PCICTRL + 4);
36 t |= 0x40000000;
37 nile4_out32(NILE4_PCICTRL + 4, t);
38 /* CPU cold reset */
39 t = nile4_in32(NILE4_CPUSTAT);
40 t |= 1;
41 nile4_out32(NILE4_CPUSTAT, t);
42 /* Call the PROM */
43 back_to_prom();
44}
45
46static void ddb_machine_halt(void)
47{
48 printk("DDB Vrc-5074 halted.\n");
49 do {
50 } while (1);
51}
52
53static void ddb_machine_power_off(void)
54{
55 printk("DDB Vrc-5074 halted. Please turn off the power.\n");
56 do {
57 } while (1);
58}
59
60extern void rtc_ds1386_init(unsigned long base);
61
62extern void (*board_timer_setup) (struct irqaction * irq);
63
64static void __init ddb_timer_init(struct irqaction *irq)
65{
66 /* set the clock to 1 Hz */
67 nile4_out32(NILE4_T2CTRL, 1000000);
68 /* enable the General-Purpose Timer */
69 nile4_out32(NILE4_T2CTRL + 4, 0x00000001);
70 /* reset timer */
71 nile4_out32(NILE4_T2CNTR, 0);
72 /* enable interrupt */
73 setup_irq(nile4_to_irq(NILE4_INT_GPT), irq);
74 nile4_enable_irq(nile4_to_irq(NILE4_INT_GPT));
75 change_c0_status(ST0_IM,
76 IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4);
77
78}
79
80static void __init ddb_time_init(void)
81{
82 /* we have ds1396 RTC chip */
83 rtc_ds1386_init(KSEG1ADDR(DDB_PCI_MEM_BASE));
84}
85
86
87
88static void __init ddb5074_setup(void)
89{
90 set_io_port_base(NILE4_PCI_IO_BASE);
91 isa_slot_offset = NILE4_PCI_MEM_BASE;
92 board_timer_setup = ddb_timer_init;
93 board_time_init = ddb_time_init;
94
95
96 _machine_restart = ddb_machine_restart;
97 _machine_halt = ddb_machine_halt;
98 _machine_power_off = ddb_machine_power_off;
99
100 ddb_out32(DDB_BAR0, 0);
101
102 ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IO, 0, 0x10);
103 ddb_set_pmr(DDB_PCIINIT1, DDB_PCICMD_MEM, DDB_PCI_MEM_BASE , 0x10);
104
105 /* Reboot on panic */
106 panic_timeout = 180;
107}
108
109early_initcall(ddb5074_setup);
110
111#define USE_NILE4_SERIAL 0
112
113#if USE_NILE4_SERIAL
114#define ns16550_in(reg) nile4_in8((reg)*8)
115#define ns16550_out(reg, val) nile4_out8((reg)*8, (val))
116#else
117#define NS16550_BASE (NILE4_PCI_IO_BASE+0x03f8)
118static inline u8 ns16550_in(u32 reg)
119{
120 return *(volatile u8 *) (NS16550_BASE + reg);
121}
122
123static inline void ns16550_out(u32 reg, u8 val)
124{
125 *(volatile u8 *) (NS16550_BASE + reg) = val;
126}
127#endif
128
129#define NS16550_RBR 0
130#define NS16550_THR 0
131#define NS16550_DLL 0
132#define NS16550_IER 1
133#define NS16550_DLM 1
134#define NS16550_FCR 2
135#define NS16550_IIR 2
136#define NS16550_LCR 3
137#define NS16550_MCR 4
138#define NS16550_LSR 5
139#define NS16550_MSR 6
140#define NS16550_SCR 7
141
142#define NS16550_LSR_DR 0x01 /* Data ready */
143#define NS16550_LSR_OE 0x02 /* Overrun */
144#define NS16550_LSR_PE 0x04 /* Parity error */
145#define NS16550_LSR_FE 0x08 /* Framing error */
146#define NS16550_LSR_BI 0x10 /* Break */
147#define NS16550_LSR_THRE 0x20 /* Xmit holding register empty */
148#define NS16550_LSR_TEMT 0x40 /* Xmitter empty */
149#define NS16550_LSR_ERR 0x80 /* Error */
150
151
152void _serinit(void)
153{
154#if USE_NILE4_SERIAL
155 ns16550_out(NS16550_LCR, 0x80);
156 ns16550_out(NS16550_DLM, 0x00);
157 ns16550_out(NS16550_DLL, 0x36); /* 9600 baud */
158 ns16550_out(NS16550_LCR, 0x00);
159 ns16550_out(NS16550_LCR, 0x03);
160 ns16550_out(NS16550_FCR, 0x47);
161#else
162 /* done by PMON */
163#endif
164}
165
166void _putc(char c)
167{
168 while (!(ns16550_in(NS16550_LSR) & NS16550_LSR_THRE));
169 ns16550_out(NS16550_THR, c);
170 if (c == '\n') {
171 while (!(ns16550_in(NS16550_LSR) & NS16550_LSR_THRE));
172 ns16550_out(NS16550_THR, '\r');
173 }
174}
175
176void _puts(const char *s)
177{
178 char c;
179 while ((c = *s++))
180 _putc(c);
181}
182
183char _getc(void)
184{
185 while (!(ns16550_in(NS16550_LSR) & NS16550_LSR_DR));
186 return ns16550_in(NS16550_RBR);
187}
188
189int _testc(void)
190{
191 return (ns16550_in(NS16550_LSR) & NS16550_LSR_DR) != 0;
192}
193
194
195/*
196 * Hexadecimal 7-segment LED
197 */
198void ddb5074_led_hex(int hex)
199{
200 outb(hex, 0x80);
201}
202
203
204/*
205 * LEDs D2 and D3, connected to the GPIO pins of the PMU in the ALi M1543
206 */
207struct pci_dev *pci_pmu = NULL;
208
209void ddb5074_led_d2(int on)
210{
211 u8 t;
212
213 if (pci_pmu) {
214 pci_read_config_byte(pci_pmu, 0x7e, &t);
215 if (on)
216 t &= 0x7f;
217 else
218 t |= 0x80;
219 pci_write_config_byte(pci_pmu, 0x7e, t);
220 }
221}
222
223void ddb5074_led_d3(int on)
224{
225 u8 t;
226
227 if (pci_pmu) {
228 pci_read_config_byte(pci_pmu, 0x7e, &t);
229 if (on)
230 t &= 0xbf;
231 else
232 t |= 0x40;
233 pci_write_config_byte(pci_pmu, 0x7e, t);
234 }
235}
diff --git a/arch/mips/ddb5xxx/ddb5476/Makefile b/arch/mips/ddb5xxx/ddb5476/Makefile
new file mode 100644
index 000000000000..61eec363cb02
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5476/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for the NEC DDB Vrc-5476 specific kernel interface routines
3# under Linux.
4#
5
6obj-y += setup.o irq.o int-handler.o nile4_pic.o vrc5476_irq.o
7obj-$(CONFIG_KGDB) += dbg_io.o
8
9EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/ddb5xxx/ddb5476/dbg_io.c b/arch/mips/ddb5xxx/ddb5476/dbg_io.c
new file mode 100644
index 000000000000..85e9e5013679
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5476/dbg_io.c
@@ -0,0 +1,136 @@
1/*
2 * kgdb io functions for DDB5476. We use the second serial port.
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 0xa60002f8
18#define MAX_BAUD 115200
19
20/* distance in bytes between two serial registers */
21#define REG_OFFSET 1
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 buad 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/ddb5476/int-handler.S b/arch/mips/ddb5xxx/ddb5476/int-handler.S
new file mode 100644
index 000000000000..12c292e189ba
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5476/int-handler.S
@@ -0,0 +1,112 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * First-level interrupt dispatcher for ddb5476
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#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17
18#include <asm/ddb5xxx/ddb5476.h>
19
20/*
21 * first level interrupt dispatcher for ocelot board -
22 * We check for the timer first, then check PCI ints A and D.
23 * Then check for serial IRQ and fall through.
24 */
25 .align 5
26 NESTED(ddb5476_handle_int, PT_SIZE, sp)
27 SAVE_ALL
28 CLI
29 .set at
30 .set noreorder
31 mfc0 t0, CP0_CAUSE
32 mfc0 t2, CP0_STATUS
33
34 and t0, t2
35
36 andi t1, t0, STATUSF_IP7 /* cpu timer */
37 bnez t1, ll_cpu_ip7
38 andi t1, t0, STATUSF_IP2 /* vrc5476 & i8259 */
39 bnez t1, ll_cpu_ip2
40 andi t1, t0, STATUSF_IP3
41 bnez t1, ll_cpu_ip3
42 andi t1, t0, STATUSF_IP4
43 bnez t1, ll_cpu_ip4
44 andi t1, t0, STATUSF_IP5
45 bnez t1, ll_cpu_ip5
46 andi t1, t0, STATUSF_IP6
47 bnez t1, ll_cpu_ip6
48 andi t1, t0, STATUSF_IP0 /* software int 0 */
49 bnez t1, ll_cpu_ip0
50 andi t1, t0, STATUSF_IP1 /* software int 1 */
51 bnez t1, ll_cpu_ip1
52 nop
53
54 .set reorder
55
56 /* wrong alarm or masked ... */
57 // j spurious_interrupt
58 move a0, sp
59 jal vrc5476_irq_dispatch
60 j ret_from_irq
61 nop
62
63 .align 5
64
65ll_cpu_ip0:
66 li a0, CPU_IRQ_BASE + 0
67 move a1, sp
68 jal do_IRQ
69 j ret_from_irq
70
71ll_cpu_ip1:
72 li a0, CPU_IRQ_BASE + 1
73 move a1, sp
74 jal do_IRQ
75 j ret_from_irq
76
77ll_cpu_ip2: /* jump to second-level dispatching */
78 move a0, sp
79 jal vrc5476_irq_dispatch
80 j ret_from_irq
81
82ll_cpu_ip3:
83 li a0, CPU_IRQ_BASE + 3
84 move a1, sp
85 jal do_IRQ
86 j ret_from_irq
87
88ll_cpu_ip4:
89 li a0, CPU_IRQ_BASE + 4
90 move a1, sp
91 jal do_IRQ
92 j ret_from_irq
93
94ll_cpu_ip5:
95 li a0, CPU_IRQ_BASE + 5
96 move a1, sp
97 jal do_IRQ
98 j ret_from_irq
99
100ll_cpu_ip6:
101 li a0, CPU_IRQ_BASE + 6
102 move a1, sp
103 jal do_IRQ
104 j ret_from_irq
105
106ll_cpu_ip7:
107 li a0, CPU_IRQ_BASE + 7
108 move a1, sp
109 jal do_IRQ
110 j ret_from_irq
111
112 END(ddb5476_handle_int)
diff --git a/arch/mips/ddb5xxx/ddb5476/irq.c b/arch/mips/ddb5xxx/ddb5476/irq.c
new file mode 100644
index 000000000000..5388b5868c4a
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5476/irq.c
@@ -0,0 +1,143 @@
1/*
2 * arch/mips/ddb5476/irq.c -- NEC DDB Vrc-5476 interrupt routines
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 *
7 * Re-write the whole thing to use new irq.c file.
8 * Copyright (C) 2001 MontaVista Software Inc.
9 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
10 *
11 */
12#include <linux/init.h>
13#include <linux/sched.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16
17#include <asm/i8259.h>
18#include <asm/io.h>
19#include <asm/ptrace.h>
20
21#include <asm/ddb5xxx/ddb5xxx.h>
22
23#define M1543_PNP_CONFIG 0x03f0 /* PnP Config Port */
24#define M1543_PNP_INDEX 0x03f0 /* PnP Index Port */
25#define M1543_PNP_DATA 0x03f1 /* PnP Data Port */
26
27#define M1543_PNP_ALT_CONFIG 0x0370 /* Alternative PnP Config Port */
28#define M1543_PNP_ALT_INDEX 0x0370 /* Alternative PnP Index Port */
29#define M1543_PNP_ALT_DATA 0x0371 /* Alternative PnP Data Port */
30
31#define M1543_INT1_MASTER_CTRL 0x0020 /* INT_1 (master) Control Register */
32#define M1543_INT1_MASTER_MASK 0x0021 /* INT_1 (master) Mask Register */
33
34#define M1543_INT1_SLAVE_CTRL 0x00a0 /* INT_1 (slave) Control Register */
35#define M1543_INT1_SLAVE_MASK 0x00a1 /* INT_1 (slave) Mask Register */
36
37#define M1543_INT1_MASTER_ELCR 0x04d0 /* INT_1 (master) Edge/Level Control */
38#define M1543_INT1_SLAVE_ELCR 0x04d1 /* INT_1 (slave) Edge/Level Control */
39
40static void m1543_irq_setup(void)
41{
42 /*
43 * The ALI M1543 has 13 interrupt inputs, IRQ1..IRQ13. Not all
44 * the possible IO sources in the M1543 are in use by us. We will
45 * use the following mapping:
46 *
47 * IRQ1 - keyboard (default set by M1543)
48 * IRQ3 - reserved for UART B (default set by M1543) (note that
49 * the schematics for the DDB Vrc-5476 board seem to
50 * indicate that IRQ3 is connected to the DS1386
51 * watchdog timer interrupt output so we might have
52 * a conflict)
53 * IRQ4 - reserved for UART A (default set by M1543)
54 * IRQ5 - parallel (default set by M1543)
55 * IRQ8 - DS1386 time of day (RTC) interrupt
56 * IRQ9 - USB (hardwired in ddb_setup)
57 * IRQ10 - PMU (hardwired in ddb_setup)
58 * IRQ12 - mouse
59 * IRQ14,15 - IDE controller (need to be confirmed, jsun)
60 */
61
62 /*
63 * Assing mouse interrupt to IRQ12
64 */
65
66 /* Enter configuration mode */
67 outb(0x51, M1543_PNP_CONFIG);
68 outb(0x23, M1543_PNP_CONFIG);
69
70 /* Select logical device 7 (Keyboard) */
71 outb(0x07, M1543_PNP_INDEX);
72 outb(0x07, M1543_PNP_DATA);
73
74 /* Select IRQ12 */
75 outb(0x72, M1543_PNP_INDEX);
76 outb(0x0c, M1543_PNP_DATA);
77
78 /* Leave configration mode */
79 outb(0xbb, M1543_PNP_CONFIG);
80}
81
82static void nile4_irq_setup(void)
83{
84 int i;
85
86 /* Map all interrupts to CPU int #0 (IP2) */
87 nile4_map_irq_all(0);
88
89 /* PCI INTA#-E# must be level triggered */
90 nile4_set_pci_irq_level_or_edge(0, 1);
91 nile4_set_pci_irq_level_or_edge(1, 1);
92 nile4_set_pci_irq_level_or_edge(2, 1);
93 nile4_set_pci_irq_level_or_edge(3, 1);
94
95 /* PCI INTA#, B#, D# must be active low, INTC# must be active high */
96 nile4_set_pci_irq_polarity(0, 0);
97 nile4_set_pci_irq_polarity(1, 0);
98 nile4_set_pci_irq_polarity(2, 1);
99 nile4_set_pci_irq_polarity(3, 0);
100
101 for (i = 0; i < 16; i++)
102 nile4_clear_irq(i);
103
104 /* Enable CPU int #0 */
105 nile4_enable_irq_output(0);
106
107 /* memory resource acquire in ddb_setup */
108}
109
110static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
111static struct irqaction irq_error = { no_action, 0, CPU_MASK_NONE, "error", NULL, NULL };
112
113extern asmlinkage void ddb5476_handle_int(void);
114extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
115extern void mips_cpu_irq_init(u32 irq_base);
116extern void vrc5476_irq_init(u32 irq_base);
117
118void __init arch_init_irq(void)
119{
120 /* hardware initialization */
121 nile4_irq_setup();
122 m1543_irq_setup();
123
124 /* controller setup */
125 init_i8259_irqs();
126 vrc5476_irq_init(VRC5476_IRQ_BASE);
127 mips_cpu_irq_init(CPU_IRQ_BASE);
128
129 /* setup cascade interrupts */
130 setup_irq(VRC5476_IRQ_BASE + VRC5476_I8259_CASCADE, &irq_cascade);
131 setup_irq(CPU_IRQ_BASE + CPU_VRC5476_CASCADE, &irq_cascade);
132
133 /* setup error interrupts for debugging */
134 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_CPCE, &irq_error);
135 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_CNTD, &irq_error);
136 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_MCE, &irq_error);
137 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_LBRT, &irq_error);
138 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_PCIS, &irq_error);
139 setup_irq(VRC5476_IRQ_BASE + VRC5476_IRQ_PCI, &irq_error);
140
141 /* setup the grandpa intr vector */
142 set_except_vector(0, ddb5476_handle_int);
143}
diff --git a/arch/mips/ddb5xxx/ddb5476/nile4_pic.c b/arch/mips/ddb5xxx/ddb5476/nile4_pic.c
new file mode 100644
index 000000000000..e930cee7944f
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5476/nile4_pic.c
@@ -0,0 +1,190 @@
1/*
2 * arch/mips/ddb5476/nile4.c --
3 * low-level PIC code for NEC Vrc-5476 (Nile 4)
4 *
5 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
6 * Sony Software Development Center Europe (SDCE), Brussels
7 *
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
10 *
11 */
12#include <linux/config.h>
13#include <linux/kernel.h>
14#include <linux/types.h>
15
16#include <asm/addrspace.h>
17
18#include <asm/ddb5xxx/ddb5xxx.h>
19
20
21/*
22 * Interrupt Programming
23 */
24void nile4_map_irq(int nile4_irq, int cpu_irq)
25{
26 u32 offset, t;
27
28 offset = DDB_INTCTRL;
29 if (nile4_irq >= 8) {
30 offset += 4;
31 nile4_irq -= 8;
32 }
33 t = ddb_in32(offset);
34 t &= ~(7 << (nile4_irq * 4));
35 t |= cpu_irq << (nile4_irq * 4);
36 ddb_out32(offset, t);
37}
38
39void nile4_map_irq_all(int cpu_irq)
40{
41 u32 all, t;
42
43 all = cpu_irq;
44 all |= all << 4;
45 all |= all << 8;
46 all |= all << 16;
47 t = ddb_in32(DDB_INTCTRL);
48 t &= 0x88888888;
49 t |= all;
50 ddb_out32(DDB_INTCTRL, t);
51 t = ddb_in32(DDB_INTCTRL + 4);
52 t &= 0x88888888;
53 t |= all;
54 ddb_out32(DDB_INTCTRL + 4, t);
55}
56
57void nile4_enable_irq(int nile4_irq)
58{
59 u32 offset, t;
60
61 offset = DDB_INTCTRL;
62 if (nile4_irq >= 8) {
63 offset += 4;
64 nile4_irq -= 8;
65 }
66 t = ddb_in32(offset);
67 t |= 8 << (nile4_irq * 4);
68 ddb_out32(offset, t);
69}
70
71void nile4_disable_irq(int nile4_irq)
72{
73 u32 offset, t;
74
75 offset = DDB_INTCTRL;
76 if (nile4_irq >= 8) {
77 offset += 4;
78 nile4_irq -= 8;
79 }
80 t = ddb_in32(offset);
81 t &= ~(8 << (nile4_irq * 4));
82 ddb_out32(offset, t);
83}
84
85void nile4_disable_irq_all(void)
86{
87 ddb_out32(DDB_INTCTRL, 0);
88 ddb_out32(DDB_INTCTRL + 4, 0);
89}
90
91u16 nile4_get_irq_stat(int cpu_irq)
92{
93 return ddb_in16(DDB_INTSTAT0 + cpu_irq * 2);
94}
95
96void nile4_enable_irq_output(int cpu_irq)
97{
98 u32 t;
99
100 t = ddb_in32(DDB_INTSTAT1 + 4);
101 t |= 1 << (16 + cpu_irq);
102 ddb_out32(DDB_INTSTAT1, t);
103}
104
105void nile4_disable_irq_output(int cpu_irq)
106{
107 u32 t;
108
109 t = ddb_in32(DDB_INTSTAT1 + 4);
110 t &= ~(1 << (16 + cpu_irq));
111 ddb_out32(DDB_INTSTAT1, t);
112}
113
114void nile4_set_pci_irq_polarity(int pci_irq, int high)
115{
116 u32 t;
117
118 t = ddb_in32(DDB_INTPPES);
119 if (high)
120 t &= ~(1 << (pci_irq * 2));
121 else
122 t |= 1 << (pci_irq * 2);
123 ddb_out32(DDB_INTPPES, t);
124}
125
126void nile4_set_pci_irq_level_or_edge(int pci_irq, int level)
127{
128 u32 t;
129
130 t = ddb_in32(DDB_INTPPES);
131 if (level)
132 t |= 2 << (pci_irq * 2);
133 else
134 t &= ~(2 << (pci_irq * 2));
135 ddb_out32(DDB_INTPPES, t);
136}
137
138void nile4_clear_irq(int nile4_irq)
139{
140 ddb_out32(DDB_INTCLR, 1 << nile4_irq);
141}
142
143void nile4_clear_irq_mask(u32 mask)
144{
145 ddb_out32(DDB_INTCLR, mask);
146}
147
148u8 nile4_i8259_iack(void)
149{
150 u8 irq;
151 u32 reg;
152
153 /* Set window 0 for interrupt acknowledge */
154 reg = ddb_in32(DDB_PCIINIT0);
155
156 ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IACK, 0, DDB_PCI_ACCESS_32);
157 irq = *(volatile u8 *) KSEG1ADDR(DDB_PCI_IACK_BASE);
158 /* restore window 0 for PCI I/O space */
159 // ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IO, 0, DDB_PCI_ACCESS_32);
160 ddb_out32(DDB_PCIINIT0, reg);
161
162 /* i8269.c set the base vector to be 0x0 */
163 return irq + I8259_IRQ_BASE;
164}
165
166#if defined(CONFIG_RUNTIME_DEBUG)
167void nile4_dump_irq_status(void)
168{
169 printk(KERN_DEBUG "
170 CPUSTAT = %p:%p\n", (void *) ddb_in32(DDB_CPUSTAT + 4),
171 (void *) ddb_in32(DDB_CPUSTAT));
172 printk(KERN_DEBUG "
173 INTCTRL = %p:%p\n", (void *) ddb_in32(DDB_INTCTRL + 4),
174 (void *) ddb_in32(DDB_INTCTRL));
175 printk(KERN_DEBUG
176 "INTSTAT0 = %p:%p\n",
177 (void *) ddb_in32(DDB_INTSTAT0 + 4),
178 (void *) ddb_in32(DDB_INTSTAT0));
179 printk(KERN_DEBUG
180 "INTSTAT1 = %p:%p\n",
181 (void *) ddb_in32(DDB_INTSTAT1 + 4),
182 (void *) ddb_in32(DDB_INTSTAT1));
183 printk(KERN_DEBUG
184 "INTCLR = %p:%p\n", (void *) ddb_in32(DDB_INTCLR + 4),
185 (void *) ddb_in32(DDB_INTCLR));
186 printk(KERN_DEBUG
187 "INTPPES = %p:%p\n", (void *) ddb_in32(DDB_INTPPES + 4),
188 (void *) ddb_in32(DDB_INTPPES));
189}
190#endif
diff --git a/arch/mips/ddb5xxx/ddb5476/setup.c b/arch/mips/ddb5xxx/ddb5476/setup.c
new file mode 100644
index 000000000000..71531f8146ea
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5476/setup.c
@@ -0,0 +1,297 @@
1/*
2 * arch/mips/ddb5476/setup.c -- NEC DDB Vrc-5476 setup routines
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 */
7#include <linux/init.h>
8#include <linux/kbd_ll.h>
9#include <linux/kernel.h>
10#include <linux/kdev_t.h>
11#include <linux/types.h>
12#include <linux/sched.h>
13#include <linux/pci.h>
14
15#include <asm/addrspace.h>
16#include <asm/bcache.h>
17#include <asm/irq.h>
18#include <asm/reboot.h>
19#include <asm/gdb-stub.h>
20#include <asm/time.h>
21#include <asm/debug.h>
22#include <asm/traps.h>
23
24#include <asm/ddb5xxx/ddb5xxx.h>
25
26// #define USE_CPU_COUNTER_TIMER /* whether we use cpu counter */
27
28#ifdef USE_CPU_COUNTER_TIMER
29
30#define CPU_COUNTER_FREQUENCY 83000000
31#else
32/* otherwise we use general purpose timer */
33#define TIMER_FREQUENCY 83000000
34#define TIMER_BASE DDB_T2CTRL
35#define TIMER_IRQ (VRC5476_IRQ_BASE + VRC5476_IRQ_GPT)
36#endif
37
38static void (*back_to_prom) (void) = (void (*)(void)) 0xbfc00000;
39
40static void ddb_machine_restart(char *command)
41{
42 u32 t;
43
44 /* PCI cold reset */
45 t = ddb_in32(DDB_PCICTRL + 4);
46 t |= 0x40000000;
47 ddb_out32(DDB_PCICTRL + 4, t);
48 /* CPU cold reset */
49 t = ddb_in32(DDB_CPUSTAT);
50 t |= 1;
51 ddb_out32(DDB_CPUSTAT, t);
52 /* Call the PROM */
53 back_to_prom();
54}
55
56static void ddb_machine_halt(void)
57{
58 printk(KERN_NOTICE "DDB Vrc-5476 halted.\n");
59 while (1);
60}
61
62static void ddb_machine_power_off(void)
63{
64 printk(KERN_NOTICE "DDB Vrc-5476 halted. Please turn off the power.\n");
65 while (1);
66}
67
68extern void rtc_ds1386_init(unsigned long base);
69
70static void __init ddb_time_init(void)
71{
72#if defined(USE_CPU_COUNTER_TIMER)
73 mips_hpt_frequency = CPU_COUNTER_FREQUENCY;
74#endif
75
76 /* we have ds1396 RTC chip */
77 rtc_ds1386_init(KSEG1ADDR(DDB_PCI_MEM_BASE));
78}
79
80
81extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
82static void __init ddb_timer_setup(struct irqaction *irq)
83{
84#if defined(USE_CPU_COUNTER_TIMER)
85
86 unsigned int count;
87
88 /* we are using the cpu counter for timer interrupts */
89 setup_irq(CPU_IRQ_BASE + 7, irq);
90
91 /* to generate the first timer interrupt */
92 count = read_c0_count();
93 write_c0_compare(count + 1000);
94
95#else
96
97 ddb_out32(TIMER_BASE, TIMER_FREQUENCY/HZ);
98 ddb_out32(TIMER_BASE+4, 0x1); /* enable timer */
99 setup_irq(TIMER_IRQ, irq);
100#endif
101}
102
103static struct {
104 struct resource dma1;
105 struct resource timer;
106 struct resource rtc;
107 struct resource dma_page_reg;
108 struct resource dma2;
109} ddb5476_ioport = {
110 {
111 "dma1", 0x00, 0x1f, IORESOURCE_BUSY}, {
112 "timer", 0x40, 0x5f, IORESOURCE_BUSY}, {
113 "rtc", 0x70, 0x7f, IORESOURCE_BUSY}, {
114 "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY}, {
115 "dma2", 0xc0, 0xdf, IORESOURCE_BUSY}
116};
117
118static struct {
119 struct resource nile4;
120} ddb5476_iomem = {
121 { "Nile 4", DDB_BASE, DDB_BASE + DDB_SIZE - 1, IORESOURCE_BUSY}
122};
123
124
125static void ddb5476_board_init(void);
126
127static void __init ddb5476_setup(void)
128{
129 set_io_port_base(KSEG1ADDR(DDB_PCI_IO_BASE));
130
131 board_time_init = ddb_time_init;
132 board_timer_setup = ddb_timer_setup;
133
134 _machine_restart = ddb_machine_restart;
135 _machine_halt = ddb_machine_halt;
136 _machine_power_off = ddb_machine_power_off;
137
138 /* request io port/mem resources */
139 if (request_resource(&ioport_resource, &ddb5476_ioport.dma1) ||
140 request_resource(&ioport_resource, &ddb5476_ioport.timer) ||
141 request_resource(&ioport_resource, &ddb5476_ioport.rtc) ||
142 request_resource(&ioport_resource,
143 &ddb5476_ioport.dma_page_reg)
144 || request_resource(&ioport_resource, &ddb5476_ioport.dma2)
145 || request_resource(&iomem_resource, &ddb5476_iomem.nile4)) {
146 printk
147 ("ddb_setup - requesting oo port resources failed.\n");
148 for (;;);
149 }
150
151 /* Reboot on panic */
152 panic_timeout = 180;
153
154 /* [jsun] we need to set BAR0 so that SDRAM 0 appears at 0x0 in PCI */
155 /* *(long*)0xbfa00218 = 0x8; */
156
157 /* board initialization stuff */
158 ddb5476_board_init();
159}
160
161early_initcall(ddb5476_setup);
162
163/*
164 * We don't trust bios. We essentially does hardware re-initialization
165 * as complete as possible, as far as we know we can safely do.
166 */
167static void ddb5476_board_init(void)
168{
169 /* ----------- setup PDARs ------------ */
170 /* check SDRAM0, whether we are on MEM bus does not matter */
171 db_assert((ddb_in32(DDB_SDRAM0) & 0xffffffef) ==
172 ddb_calc_pdar(DDB_SDRAM_BASE, DDB_SDRAM_SIZE, 32, 0, 1));
173
174 /* SDRAM1 should be turned off. What is this for anyway ? */
175 db_assert( (ddb_in32(DDB_SDRAM1) & 0xf) == 0);
176
177 /* flash 1&2, DDB status, DDB control */
178 ddb_set_pdar(DDB_DCS2, DDB_DCS2_BASE, DDB_DCS2_SIZE, 16, 0, 0);
179 ddb_set_pdar(DDB_DCS3, DDB_DCS3_BASE, DDB_DCS3_SIZE, 16, 0, 0);
180 ddb_set_pdar(DDB_DCS4, DDB_DCS4_BASE, DDB_DCS4_SIZE, 8, 0, 0);
181 ddb_set_pdar(DDB_DCS5, DDB_DCS5_BASE, DDB_DCS5_SIZE, 8, 0, 0);
182
183 /* shut off other pdar so they don't accidentally get into the way */
184 ddb_set_pdar(DDB_DCS6, 0xffffffff, 0, 32, 0, 0);
185 ddb_set_pdar(DDB_DCS7, 0xffffffff, 0, 32, 0, 0);
186 ddb_set_pdar(DDB_DCS8, 0xffffffff, 0, 32, 0, 0);
187
188 /* verify VRC5477 base addr */
189 /* don't care about some details */
190 db_assert((ddb_in32(DDB_INTCS) & 0xffffff0f) ==
191 ddb_calc_pdar(DDB_INTCS_BASE, DDB_INTCS_SIZE, 8, 0, 0));
192
193 /* verify BOOT ROM addr */
194 /* don't care about some details */
195 db_assert((ddb_in32(DDB_BOOTCS) & 0xffffff0f) ==
196 ddb_calc_pdar(DDB_BOOTCS_BASE, DDB_BOOTCS_SIZE, 8, 0, 0));
197
198 /* setup PCI windows - window1 for MEM/config, window0 for IO */
199 ddb_set_pdar(DDB_PCIW0, DDB_PCI_IO_BASE, DDB_PCI_IO_SIZE, 32, 0, 1);
200 ddb_set_pmr(DDB_PCIINIT0, DDB_PCICMD_IO, 0, DDB_PCI_ACCESS_32);
201
202 ddb_set_pdar(DDB_PCIW1, DDB_PCI_MEM_BASE, DDB_PCI_MEM_SIZE, 32, 0, 1);
203 ddb_set_pmr(DDB_PCIINIT1, DDB_PCICMD_MEM, DDB_PCI_MEM_BASE, DDB_PCI_ACCESS_32);
204
205 /* ----------- setup PDARs ------------ */
206 /* this is problematic - it will reset Aladin which cause we loose
207 * serial port, and we don't know how to set up Aladin chip again.
208 */
209 // ddb_pci_reset_bus();
210
211 ddb_out32(DDB_BAR0, 0x00000008);
212
213 ddb_out32(DDB_BARC, 0xffffffff);
214 ddb_out32(DDB_BARB, 0xffffffff);
215 ddb_out32(DDB_BAR1, 0xffffffff);
216 ddb_out32(DDB_BAR2, 0xffffffff);
217 ddb_out32(DDB_BAR3, 0xffffffff);
218 ddb_out32(DDB_BAR4, 0xffffffff);
219 ddb_out32(DDB_BAR5, 0xffffffff);
220 ddb_out32(DDB_BAR6, 0xffffffff);
221 ddb_out32(DDB_BAR7, 0xffffffff);
222 ddb_out32(DDB_BAR8, 0xffffffff);
223
224 /* ----------- switch PCI1 to PCI CONFIG space ------------ */
225 ddb_set_pdar(DDB_PCIW1, DDB_PCI_CONFIG_BASE, DDB_PCI_CONFIG_SIZE, 32, 0, 1);
226 ddb_set_pmr(DDB_PCIINIT1, DDB_PCICMD_CFG, 0x0, DDB_PCI_ACCESS_32);
227
228 /* ----- M1543 PCI setup ------ */
229
230 /* we know M1543 PCI-ISA controller is at addr:18 */
231 /* xxxx1010 makes USB at addr:13 and PMU at addr:14 */
232 *(volatile unsigned char *) 0xa8040072 &= 0xf0;
233 *(volatile unsigned char *) 0xa8040072 |= 0xa;
234
235 /* setup USB interrupt to IRQ 9, (bit 0:3 - 0001)
236 * no IOCHRDY signal, (bit 7 - 1)
237 * M1543C & M7101 VID and Subsys Device ID are read-only (bit 6 - 1)
238 * Make USB Master INTAJ level to edge conversion (bit 4 - 1)
239 */
240 *(unsigned char *) 0xa8040074 = 0xd1;
241
242 /* setup PMU(SCI to IRQ 10 (bit 0:3 - 0011)
243 * SCI routing to IRQ 13 disabled (bit 7 - 1)
244 * SCI interrupt level to edge conversion bypassed (bit 4 - 0)
245 */
246 *(unsigned char *) 0xa8040076 = 0x83;
247
248 /* setup IDE controller
249 * enable IDE controller (bit 6 - 1)
250 * IDE IDSEL to be addr:24 (bit 4:5 - 11)
251 * no IDE ATA Secondary Bus Signal Pad Control (bit 3 - 0)
252 * no IDE ATA Primary Bus Signal Pad Control (bit 2 - 0)
253 * primary IRQ is 14, secondary is 15 (bit 1:0 - 01
254 */
255 // *(unsigned char*)0xa8040058 = 0x71;
256 // *(unsigned char*)0xa8040058 = 0x79;
257 // *(unsigned char*)0xa8040058 = 0x74; // use SIRQ, primary tri-state
258 *(unsigned char *) 0xa8040058 = 0x75; // primary tri-state
259
260#if 0
261 /* this is not necessary if M5229 does not use SIRQ */
262 *(unsigned char *) 0xa8040044 = 0x0d; // primary to IRQ 14
263 *(unsigned char *) 0xa8040075 = 0x0d; // secondary to IRQ 14
264#endif
265
266 /* enable IDE in the M5229 config register 0x50 (bit 0 - 1) */
267 /* M5229 IDSEL is addr:24; see above setting */
268 *(unsigned char *) 0xa9000050 |= 0x1;
269
270 /* enable bus master (bit 2) and IO decoding (bit 0) */
271 *(unsigned char *) 0xa9000004 |= 0x5;
272
273 /* enable native, copied from arch/ppc/k2boot/head.S */
274 /* TODO - need volatile, need to be portable */
275 *(unsigned char *) 0xa9000009 = 0xff;
276
277 /* ----- end of M1543 PCI setup ------ */
278
279 /* ----- reset on-board ether chip ------ */
280 *((volatile u32 *) 0xa8020004) |= 1; /* decode I/O */
281 *((volatile u32 *) 0xa8020010) = 0; /* set BAR address */
282
283 /* send reset command */
284 *((volatile u32 *) 0xa6000000) = 1; /* do a soft reset */
285
286 /* disable ether chip */
287 *((volatile u32 *) 0xa8020004) = 0; /* disable any decoding */
288
289 /* put it into sleep */
290 *((volatile u32 *) 0xa8020040) = 0x80000000;
291
292 /* ----- end of reset on-board ether chip ------ */
293
294 /* ----------- switch PCI1 back to PCI MEM space ------------ */
295 ddb_set_pdar(DDB_PCIW1, DDB_PCI_MEM_BASE, DDB_PCI_MEM_SIZE, 32, 0, 1);
296 ddb_set_pmr(DDB_PCIINIT1, DDB_PCICMD_MEM, DDB_PCI_MEM_BASE, DDB_PCI_ACCESS_32);
297}
diff --git a/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c b/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
new file mode 100644
index 000000000000..a77682be01ac
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
@@ -0,0 +1,112 @@
1/*
2 * The irq controller for vrc5476.
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#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/system.h>
20
21#include <asm/ddb5xxx/ddb5xxx.h>
22
23static int irq_base;
24
25static void vrc5476_irq_enable(uint irq)
26{
27 nile4_enable_irq(irq - irq_base);
28}
29
30static void vrc5476_irq_disable(uint irq)
31{
32 nile4_disable_irq(irq - irq_base);
33}
34
35static unsigned int vrc5476_irq_startup(uint irq)
36{
37 nile4_enable_irq(irq - irq_base);
38 return 0;
39}
40
41#define vrc5476_irq_shutdown vrc5476_irq_disable
42
43static void vrc5476_irq_ack(uint irq)
44{
45 nile4_clear_irq(irq - irq_base);
46 nile4_disable_irq(irq - irq_base);
47}
48
49static void vrc5476_irq_end(uint irq)
50{
51 if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
52 vrc5476_irq_enable(irq);
53}
54
55static hw_irq_controller vrc5476_irq_controller = {
56 "vrc5476",
57 vrc5476_irq_startup,
58 vrc5476_irq_shutdown,
59 vrc5476_irq_enable,
60 vrc5476_irq_disable,
61 vrc5476_irq_ack,
62 vrc5476_irq_end,
63 NULL /* no affinity stuff for UP */
64};
65
66void __init
67vrc5476_irq_init(u32 base)
68{
69 u32 i;
70
71 irq_base = base;
72 for (i= base; i< base + NUM_VRC5476_IRQ; i++) {
73 irq_desc[i].status = IRQ_DISABLED;
74 irq_desc[i].action = NULL;
75 irq_desc[i].depth = 1;
76 irq_desc[i].handler = &vrc5476_irq_controller;
77 }
78}
79
80
81asmlinkage void
82vrc5476_irq_dispatch(struct pt_regs *regs)
83{
84 extern void spurious_interrupt(void);
85
86 u32 mask;
87 int nile4_irq;
88
89 mask = nile4_get_irq_stat(0);
90
91 /* quick check for possible time interrupt */
92 if (mask & (1 << VRC5476_IRQ_GPT)) {
93 do_IRQ(VRC5476_IRQ_BASE + VRC5476_IRQ_GPT, regs);
94 return;
95 }
96
97 /* check for i8259 interrupts */
98 if (mask & (1 << VRC5476_I8259_CASCADE)) {
99 int i8259_irq = nile4_i8259_iack();
100 do_IRQ(I8259_IRQ_BASE + i8259_irq, regs);
101 return;
102 }
103
104 /* regular nile4 interrupts (we should not really have any */
105 for (nile4_irq = 0; mask; nile4_irq++, mask >>= 1) {
106 if (mask & 1) {
107 do_IRQ(VRC5476_IRQ_BASE + nile4_irq, regs);
108 return;
109 }
110 }
111 spurious_interrupt();
112}
diff --git a/arch/mips/ddb5xxx/ddb5477/Makefile b/arch/mips/ddb5xxx/ddb5477/Makefile
new file mode 100644
index 000000000000..b79b43c9f93b
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5477/Makefile
@@ -0,0 +1,10 @@
1#
2# Makefile for NEC DDB-Vrc5477 board
3#
4
5obj-y += int-handler.o irq.o irq_5477.o setup.o lcd44780.o
6
7obj-$(CONFIG_RUNTIME_DEBUG) += debug.o
8obj-$(CONFIG_KGDB) += kgdb_io.o
9
10EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/ddb5xxx/ddb5477/debug.c b/arch/mips/ddb5xxx/ddb5477/debug.c
new file mode 100644
index 000000000000..68919d5f8ffd
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5477/debug.c
@@ -0,0 +1,160 @@
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/int-handler.S b/arch/mips/ddb5xxx/ddb5477/int-handler.S
new file mode 100644
index 000000000000..a2502a14400e
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5477/int-handler.S
@@ -0,0 +1,75 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * First-level interrupt dispatcher for ddb5477
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#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17#include <asm/ddb5xxx/ddb5477.h>
18
19/*
20 * first level interrupt dispatcher for ocelot board -
21 * We check for the timer first, then check PCI ints A and D.
22 * Then check for serial IRQ and fall through.
23 */
24 .align 5
25 NESTED(ddb5477_handle_int, PT_SIZE, sp)
26 SAVE_ALL
27 CLI
28 .set at
29 .set noreorder
30 mfc0 t0, CP0_CAUSE
31 mfc0 t2, CP0_STATUS
32
33 and t0, t2
34
35 andi t1, t0, STATUSF_IP7 /* cpu timer */
36 bnez t1, ll_cputimer_irq
37 andi t1, t0, (STATUSF_IP2 | STATUSF_IP3 | STATUSF_IP4 | STATUSF_IP5 | STATUSF_IP6 )
38 bnez t1, ll_vrc5477_irq
39 andi t1, t0, STATUSF_IP0 /* software int 0 */
40 bnez t1, ll_cpu_ip0
41 andi t1, t0, STATUSF_IP1 /* software int 1 */
42 bnez t1, ll_cpu_ip1
43 nop
44 .set reorder
45
46 /* wrong alarm or masked ... */
47 j spurious_interrupt
48 nop
49 END(ddb5477_handle_int)
50
51 .align 5
52
53ll_vrc5477_irq:
54 move a0, sp
55 jal vrc5477_irq_dispatch
56 j ret_from_irq
57
58ll_cputimer_irq:
59 li a0, CPU_IRQ_BASE + 7
60 move a1, sp
61 jal do_IRQ
62 j ret_from_irq
63
64
65ll_cpu_ip0:
66 li a0, CPU_IRQ_BASE + 0
67 move a1, sp
68 jal do_IRQ
69 j ret_from_irq
70
71ll_cpu_ip1:
72 li a0, CPU_IRQ_BASE + 1
73 move a1, sp
74 jal do_IRQ
75 j ret_from_irq
diff --git a/arch/mips/ddb5xxx/ddb5477/irq.c b/arch/mips/ddb5xxx/ddb5477/irq.c
new file mode 100644
index 000000000000..5f027bfa4af8
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5477/irq.c
@@ -0,0 +1,199 @@
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/config.h>
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/irq.h>
17#include <linux/types.h>
18#include <linux/ptrace.h>
19
20#include <asm/i8259.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);
77extern void mips_cpu_irq_init(u32 base);
78extern asmlinkage void ddb5477_handle_int(void);
79extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
80static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
81
82void __init arch_init_irq(void)
83{
84 /* by default, we disable all interrupts and route all vrc5477
85 * interrupts to pin 0 (irq 2) */
86 ddb_out32(DDB_INTCTRL0, 0);
87 ddb_out32(DDB_INTCTRL1, 0);
88 ddb_out32(DDB_INTCTRL2, 0);
89 ddb_out32(DDB_INTCTRL3, 0);
90
91 clear_c0_status(0xff00);
92 set_c0_status(0x0400);
93
94 /* setup PCI interrupt attributes */
95 set_pci_int_attr(PCI0, INTA, ACTIVE_LOW, LEVEL_SENSE);
96 set_pci_int_attr(PCI0, INTB, ACTIVE_LOW, LEVEL_SENSE);
97 if (mips_machtype == MACH_NEC_ROCKHOPPERII)
98 set_pci_int_attr(PCI0, INTC, ACTIVE_HIGH, LEVEL_SENSE);
99 else
100 set_pci_int_attr(PCI0, INTC, ACTIVE_LOW, LEVEL_SENSE);
101 set_pci_int_attr(PCI0, INTD, ACTIVE_LOW, LEVEL_SENSE);
102 set_pci_int_attr(PCI0, INTE, ACTIVE_LOW, LEVEL_SENSE);
103
104 set_pci_int_attr(PCI1, INTA, ACTIVE_LOW, LEVEL_SENSE);
105 set_pci_int_attr(PCI1, INTB, ACTIVE_LOW, LEVEL_SENSE);
106 set_pci_int_attr(PCI1, INTC, ACTIVE_LOW, LEVEL_SENSE);
107 set_pci_int_attr(PCI1, INTD, ACTIVE_LOW, LEVEL_SENSE);
108 set_pci_int_attr(PCI1, INTE, ACTIVE_LOW, LEVEL_SENSE);
109
110 /*
111 * for debugging purpose, we enable several error interrupts
112 * and route them to pin 1. (IP3)
113 */
114 /* cpu parity check - 0 */
115 ll_vrc5477_irq_route(0, 1); ll_vrc5477_irq_enable(0);
116 /* cpu no-target decode - 1 */
117 ll_vrc5477_irq_route(1, 1); ll_vrc5477_irq_enable(1);
118 /* local bus read time-out - 7 */
119 ll_vrc5477_irq_route(7, 1); ll_vrc5477_irq_enable(7);
120 /* PCI SERR# - 14 */
121 ll_vrc5477_irq_route(14, 1); ll_vrc5477_irq_enable(14);
122 /* PCI internal error - 15 */
123 ll_vrc5477_irq_route(15, 1); ll_vrc5477_irq_enable(15);
124 /* IOPCI SERR# - 30 */
125 ll_vrc5477_irq_route(30, 1); ll_vrc5477_irq_enable(30);
126 /* IOPCI internal error - 31 */
127 ll_vrc5477_irq_route(31, 1); ll_vrc5477_irq_enable(31);
128
129 /* init all controllers */
130 init_i8259_irqs();
131 mips_cpu_irq_init(CPU_IRQ_BASE);
132 vrc5477_irq_init(VRC5477_IRQ_BASE);
133
134
135 /* setup cascade interrupts */
136 setup_irq(VRC5477_IRQ_BASE + VRC5477_I8259_CASCADE, &irq_cascade);
137 setup_irq(CPU_IRQ_BASE + CPU_VRC5477_CASCADE, &irq_cascade);
138
139 /* hook up the first-level interrupt handler */
140 set_except_vector(0, ddb5477_handle_int);
141}
142
143u8 i8259_interrupt_ack(void)
144{
145 u8 irq;
146 u32 reg;
147
148 /* Set window 0 for interrupt acknowledge */
149 reg = ddb_in32(DDB_PCIINIT10);
150
151 ddb_set_pmr(DDB_PCIINIT10, DDB_PCICMD_IACK, 0, DDB_PCI_ACCESS_32);
152 irq = *(volatile u8 *) KSEG1ADDR(DDB_PCI_IACK_BASE);
153 ddb_out32(DDB_PCIINIT10, reg);
154
155 /* i8259.c set the base vector to be 0x0 */
156 return irq + I8259_IRQ_BASE;
157}
158/*
159 * the first level int-handler will jump here if it is a vrc5477 irq
160 */
161#define NUM_5477_IRQS 32
162asmlinkage void
163vrc5477_irq_dispatch(struct pt_regs *regs)
164{
165 u32 intStatus;
166 u32 bitmask;
167 u32 i;
168
169 db_assert(ddb_in32(DDB_INT2STAT) == 0);
170 db_assert(ddb_in32(DDB_INT3STAT) == 0);
171 db_assert(ddb_in32(DDB_INT4STAT) == 0);
172 db_assert(ddb_in32(DDB_NMISTAT) == 0);
173
174 if (ddb_in32(DDB_INT1STAT) != 0) {
175#if defined(CONFIG_RUNTIME_DEBUG)
176 vrc5477_show_int_regs();
177#endif
178 panic("error interrupt has happened.");
179 }
180
181 intStatus = ddb_in32(DDB_INT0STAT);
182
183 if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
184 /* check for i8259 interrupts */
185 if (intStatus & (1 << VRC5477_I8259_CASCADE)) {
186 int i8259_irq = i8259_interrupt_ack();
187 do_IRQ(I8259_IRQ_BASE + i8259_irq, regs);
188 return;
189 }
190 }
191
192 for (i=0, bitmask=1; i<= NUM_5477_IRQS; bitmask <<=1, i++) {
193 /* do we need to "and" with the int mask? */
194 if (intStatus & bitmask) {
195 do_IRQ(VRC5477_IRQ_BASE + i, regs);
196 return;
197 }
198 }
199}
diff --git a/arch/mips/ddb5xxx/ddb5477/irq_5477.c b/arch/mips/ddb5xxx/ddb5477/irq_5477.c
new file mode 100644
index 000000000000..0d5e706207ec
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5477/irq_5477.c
@@ -0,0 +1,168 @@
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 unsigned int vrc5477_irq_startup(unsigned int irq)
57{
58 vrc5477_irq_enable(irq);
59 return 0;
60}
61
62#define vrc5477_irq_shutdown vrc5477_irq_disable
63
64static void
65vrc5477_irq_ack(unsigned int irq)
66{
67 db_assert(vrc5477_irq_base != -1);
68 db_assert(irq >= vrc5477_irq_base);
69 db_assert(irq < vrc5477_irq_base+ NUM_5477_IRQ);
70
71 /* clear the interrupt bit */
72 /* some irqs require the driver to clear the sources */
73 ddb_out32(DDB_INTCLR32, 1 << (irq - vrc5477_irq_base));
74
75 /* disable interrupt - some handler will re-enable the irq
76 * and if the interrupt is leveled, we will have infinite loop
77 */
78 ll_vrc5477_irq_disable(irq - vrc5477_irq_base);
79}
80
81static void
82vrc5477_irq_end(unsigned int irq)
83{
84 db_assert(vrc5477_irq_base != -1);
85 db_assert(irq >= vrc5477_irq_base);
86 db_assert(irq < vrc5477_irq_base + NUM_5477_IRQ);
87
88 if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
89 ll_vrc5477_irq_enable( irq - vrc5477_irq_base);
90}
91
92hw_irq_controller vrc5477_irq_controller = {
93 "vrc5477_irq",
94 vrc5477_irq_startup,
95 vrc5477_irq_shutdown,
96 vrc5477_irq_enable,
97 vrc5477_irq_disable,
98 vrc5477_irq_ack,
99 vrc5477_irq_end,
100 NULL /* no affinity stuff for UP */
101};
102
103void __init vrc5477_irq_init(u32 irq_base)
104{
105 u32 i;
106
107 for (i= irq_base; i< irq_base+ NUM_5477_IRQ; i++) {
108 irq_desc[i].status = IRQ_DISABLED;
109 irq_desc[i].action = NULL;
110 irq_desc[i].depth = 1;
111 irq_desc[i].handler = &vrc5477_irq_controller;
112 }
113
114 vrc5477_irq_base = irq_base;
115}
116
117void ll_vrc5477_irq_route(int vrc5477_irq, int ip)
118{
119 u32 reg_value;
120 u32 reg_bitmask;
121 u32 reg_index;
122
123 db_assert(vrc5477_irq >= 0);
124 db_assert(vrc5477_irq < NUM_5477_IRQ);
125 db_assert(ip >= 0);
126 db_assert((ip < 5) || (ip == 6));
127
128 reg_index = DDB_INTCTRL0 + vrc5477_irq/8*4;
129 reg_value = ddb_in32(reg_index);
130 reg_bitmask = 7 << (vrc5477_irq % 8 * 4);
131 reg_value &= ~reg_bitmask;
132 reg_value |= ip << (vrc5477_irq % 8 * 4);
133 ddb_out32(reg_index, reg_value);
134}
135
136void ll_vrc5477_irq_enable(int vrc5477_irq)
137{
138 u32 reg_value;
139 u32 reg_bitmask;
140 u32 reg_index;
141
142 db_assert(vrc5477_irq >= 0);
143 db_assert(vrc5477_irq < NUM_5477_IRQ);
144
145 reg_index = DDB_INTCTRL0 + vrc5477_irq/8*4;
146 reg_value = ddb_in32(reg_index);
147 reg_bitmask = 8 << (vrc5477_irq % 8 * 4);
148 db_assert((reg_value & reg_bitmask) == 0);
149 ddb_out32(reg_index, reg_value | reg_bitmask);
150}
151
152void ll_vrc5477_irq_disable(int vrc5477_irq)
153{
154 u32 reg_value;
155 u32 reg_bitmask;
156 u32 reg_index;
157
158 db_assert(vrc5477_irq >= 0);
159 db_assert(vrc5477_irq < NUM_5477_IRQ);
160
161 reg_index = DDB_INTCTRL0 + vrc5477_irq/8*4;
162 reg_value = ddb_in32(reg_index);
163 reg_bitmask = 8 << (vrc5477_irq % 8 * 4);
164
165 /* we assert that the interrupt is enabled (perhaps over-zealous) */
166 db_assert( (reg_value & reg_bitmask) != 0);
167 ddb_out32(reg_index, reg_value & ~reg_bitmask);
168}
diff --git a/arch/mips/ddb5xxx/ddb5477/kgdb_io.c b/arch/mips/ddb5xxx/ddb5477/kgdb_io.c
new file mode 100644
index 000000000000..1d18d590495b
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5477/kgdb_io.c
@@ -0,0 +1,136 @@
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 buad 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
new file mode 100644
index 000000000000..35c6c22610c5
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5477/lcd44780.c
@@ -0,0 +1,92 @@
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 i,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 for(i = 1; i < 2000; i++)
80 lcd44780_wait();
81#endif
82}
83
84void lcd44780_init(void)
85{
86 // The display on the RockHopper is physically a single
87 // 16 char line (two 8 char lines concatenated). bdl
88 lcd44780_command(LCD44780_8BIT_2LINE);
89 lcd44780_command(LCD44780_MODE_INC);
90 lcd44780_command(LCD44780_CURSOR_BLOCK);
91 lcd44780_command(LCD44780_CLEAR);
92}
diff --git a/arch/mips/ddb5xxx/ddb5477/lcd44780.h b/arch/mips/ddb5xxx/ddb5477/lcd44780.h
new file mode 100644
index 000000000000..cf2f0f71eee5
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5477/lcd44780.h
@@ -0,0 +1,15 @@
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
new file mode 100644
index 000000000000..15c6e543b56f
--- /dev/null
+++ b/arch/mips/ddb5xxx/ddb5477/setup.c
@@ -0,0 +1,405 @@
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/config.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/sched.h>
21#include <linux/pci.h>
22#include <linux/ide.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
30#include <asm/cpu.h>
31#include <asm/bootinfo.h>
32#include <asm/addrspace.h>
33#include <asm/time.h>
34#include <asm/bcache.h>
35#include <asm/irq.h>
36#include <asm/reboot.h>
37#include <asm/gdb-stub.h>
38#include <asm/traps.h>
39#include <asm/debug.h>
40
41#include <asm/ddb5xxx/ddb5xxx.h>
42
43#include "lcd44780.h"
44
45
46#define USE_CPU_COUNTER_TIMER /* whether we use cpu counter */
47
48#define SP_TIMER_BASE DDB_SPT1CTRL_L
49#define SP_TIMER_IRQ VRC5477_IRQ_SPT1
50
51static int bus_frequency = CONFIG_DDB5477_BUS_FREQUENCY*1000;
52
53static void ddb_machine_restart(char *command)
54{
55 static void (*back_to_prom) (void) = (void (*)(void)) 0xbfc00000;
56
57 u32 t;
58
59 /* PCI cold reset */
60 ddb_pci_reset_bus();
61
62 /* CPU cold reset */
63 t = ddb_in32(DDB_CPUSTAT);
64 db_assert((t&1));
65 ddb_out32(DDB_CPUSTAT, t);
66
67 /* Call the PROM */
68 back_to_prom();
69}
70
71static void ddb_machine_halt(void)
72{
73 printk("DDB Vrc-5477 halted.\n");
74 while (1);
75}
76
77static void ddb_machine_power_off(void)
78{
79 printk("DDB Vrc-5477 halted. Please turn off the power.\n");
80 while (1);
81}
82
83extern void rtc_ds1386_init(unsigned long base);
84
85static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
86{
87 unsigned int freq;
88 unsigned char c;
89 unsigned int t1, t2;
90 unsigned i;
91
92 ddb_out32(SP_TIMER_BASE, 0xffffffff);
93 ddb_out32(SP_TIMER_BASE+4, 0x1);
94 ddb_out32(SP_TIMER_BASE+8, 0xffffffff);
95
96 /* check if rtc is running */
97 c= *(volatile unsigned char*)rtc_base;
98 for(i=0; (c == *(volatile unsigned char*)rtc_base) && (i<100000000); i++);
99 if (c == *(volatile unsigned char*)rtc_base) {
100 printk("Failed to detect bus frequency. Use default 83.3MHz.\n");
101 return 83333000;
102 }
103
104 c= *(volatile unsigned char*)rtc_base;
105 while (c == *(volatile unsigned char*)rtc_base);
106 /* we are now at the turn of 1/100th second, if no error. */
107 t1 = ddb_in32(SP_TIMER_BASE+8);
108
109 for (i=0; i< 10; i++) {
110 c= *(volatile unsigned char*)rtc_base;
111 while (c == *(volatile unsigned char*)rtc_base);
112 /* we are now at the turn of another 1/100th second */
113 t2 = ddb_in32(SP_TIMER_BASE+8);
114 }
115
116 ddb_out32(SP_TIMER_BASE+4, 0x0); /* disable it again */
117
118 freq = (t1 - t2)*10;
119 printk("DDB bus frequency detection : %u \n", freq);
120 return freq;
121}
122
123static void __init ddb_time_init(void)
124{
125 unsigned long rtc_base;
126 unsigned int i;
127
128 /* we have ds1396 RTC chip */
129 if (mips_machtype == MACH_NEC_ROCKHOPPER
130 || mips_machtype == MACH_NEC_ROCKHOPPERII) {
131 rtc_base = KSEG1ADDR(DDB_LCS2_BASE);
132 } else {
133 rtc_base = KSEG1ADDR(DDB_LCS1_BASE);
134 }
135 rtc_ds1386_init(rtc_base);
136
137 /* do we need to do run-time detection of bus speed? */
138 if (bus_frequency == 0) {
139 bus_frequency = detect_bus_frequency(rtc_base);
140 }
141
142 /* mips_hpt_frequency is 1/2 of the cpu core freq */
143 i = (read_c0_config() >> 28 ) & 7;
144 if ((current_cpu_data.cputype == CPU_R5432) && (i == 3))
145 i = 4;
146 mips_hpt_frequency = bus_frequency*(i+4)/4;
147}
148
149extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
150
151static void __init ddb_timer_setup(struct irqaction *irq)
152{
153#if defined(USE_CPU_COUNTER_TIMER)
154
155 /* we are using the cpu counter for timer interrupts */
156 setup_irq(CPU_IRQ_BASE + 7, irq);
157
158#else
159
160 /* if we use Special purpose timer 1 */
161 ddb_out32(SP_TIMER_BASE, bus_frequency/HZ);
162 ddb_out32(SP_TIMER_BASE+4, 0x1);
163 setup_irq(SP_TIMER_IRQ, irq);
164
165#endif
166}
167
168static void ddb5477_board_init(void);
169
170extern struct pci_controller ddb5477_ext_controller;
171extern struct pci_controller ddb5477_io_controller;
172
173static int ddb5477_setup(void)
174{
175 /* initialize board - we don't trust the loader */
176 ddb5477_board_init();
177
178 set_io_port_base(KSEG1ADDR(DDB_PCI_IO_BASE));
179
180 board_time_init = ddb_time_init;
181 board_timer_setup = ddb_timer_setup;
182
183 _machine_restart = ddb_machine_restart;
184 _machine_halt = ddb_machine_halt;
185 _machine_power_off = ddb_machine_power_off;
186
187 /* setup resource limits */
188 ioport_resource.end = DDB_PCI0_IO_SIZE + DDB_PCI1_IO_SIZE - 1;
189 iomem_resource.end = 0xffffffff;
190
191 /* Reboot on panic */
192 panic_timeout = 180;
193
194 register_pci_controller (&ddb5477_ext_controller);
195 register_pci_controller (&ddb5477_io_controller);
196
197 return 0;
198}
199
200early_initcall(ddb5477_setup);
201
202static void __init ddb5477_board_init(void)
203{
204 /* ----------- setup PDARs ------------ */
205
206 /* SDRAM should have been set */
207 db_assert(ddb_in32(DDB_SDRAM0) ==
208 ddb_calc_pdar(DDB_SDRAM_BASE, board_ram_size, 32, 0, 1));
209
210 /* SDRAM1 should be turned off. What is this for anyway ? */
211 db_assert( (ddb_in32(DDB_SDRAM1) & 0xf) == 0);
212
213 /* Setup local bus. */
214
215 /* Flash U12 PDAR and timing. */
216 ddb_set_pdar(DDB_LCS0, DDB_LCS0_BASE, DDB_LCS0_SIZE, 16, 0, 0);
217 ddb_out32(DDB_LCST0, 0x00090842);
218
219 /* We need to setup LCS1 and LCS2 differently based on the
220 board_version */
221 if (mips_machtype == MACH_NEC_ROCKHOPPER) {
222 /* Flash U13 PDAR and timing. */
223 ddb_set_pdar(DDB_LCS1, DDB_LCS1_BASE, DDB_LCS1_SIZE, 16, 0, 0);
224 ddb_out32(DDB_LCST1, 0x00090842);
225
226 /* EPLD (NVRAM, switch, LCD, and mezzanie). */
227 ddb_set_pdar(DDB_LCS2, DDB_LCS2_BASE, DDB_LCS2_SIZE, 8, 0, 0);
228 } else {
229 /* misc */
230 ddb_set_pdar(DDB_LCS1, DDB_LCS1_BASE, DDB_LCS1_SIZE, 8, 0, 0);
231 /* mezzanie (?) */
232 ddb_set_pdar(DDB_LCS2, DDB_LCS2_BASE, DDB_LCS2_SIZE, 16, 0, 0);
233 }
234
235 /* verify VRC5477 base addr */
236 db_assert(ddb_in32(DDB_VRC5477) ==
237 ddb_calc_pdar(DDB_VRC5477_BASE, DDB_VRC5477_SIZE, 32, 0, 1));
238
239 /* verify BOOT ROM addr */
240 db_assert(ddb_in32(DDB_BOOTCS) ==
241 ddb_calc_pdar(DDB_BOOTCS_BASE, DDB_BOOTCS_SIZE, 8, 0, 0));
242
243 /* setup PCI windows - window0 for MEM/config, window1 for IO */
244 ddb_set_pdar(DDB_PCIW0, DDB_PCI0_MEM_BASE, DDB_PCI0_MEM_SIZE, 32, 0, 1);
245 ddb_set_pdar(DDB_PCIW1, DDB_PCI0_IO_BASE, DDB_PCI0_IO_SIZE, 32, 0, 1);
246 ddb_set_pdar(DDB_IOPCIW0, DDB_PCI1_MEM_BASE, DDB_PCI1_MEM_SIZE, 32, 0, 1);
247 ddb_set_pdar(DDB_IOPCIW1, DDB_PCI1_IO_BASE, DDB_PCI1_IO_SIZE, 32, 0, 1);
248
249 /* ------------ reset PCI bus and BARs ----------------- */
250 ddb_pci_reset_bus();
251
252 ddb_out32(DDB_BARM010, 0x00000008);
253 ddb_out32(DDB_BARM011, 0x00000008);
254
255 ddb_out32(DDB_BARC0, 0xffffffff);
256 ddb_out32(DDB_BARM230, 0xffffffff);
257 ddb_out32(DDB_BAR00, 0xffffffff);
258 ddb_out32(DDB_BAR10, 0xffffffff);
259 ddb_out32(DDB_BAR20, 0xffffffff);
260 ddb_out32(DDB_BAR30, 0xffffffff);
261 ddb_out32(DDB_BAR40, 0xffffffff);
262 ddb_out32(DDB_BAR50, 0xffffffff);
263 ddb_out32(DDB_BARB0, 0xffffffff);
264
265 ddb_out32(DDB_BARC1, 0xffffffff);
266 ddb_out32(DDB_BARM231, 0xffffffff);
267 ddb_out32(DDB_BAR01, 0xffffffff);
268 ddb_out32(DDB_BAR11, 0xffffffff);
269 ddb_out32(DDB_BAR21, 0xffffffff);
270 ddb_out32(DDB_BAR31, 0xffffffff);
271 ddb_out32(DDB_BAR41, 0xffffffff);
272 ddb_out32(DDB_BAR51, 0xffffffff);
273 ddb_out32(DDB_BARB1, 0xffffffff);
274
275 /*
276 * We use pci master register 0 for memory space / config space
277 * And we use register 1 for IO space.
278 * Note that for memory space, we bump up the pci base address
279 * so that we have 1:1 mapping between PCI memory and cpu physical.
280 * For PCI IO space, it starts from 0 in PCI IO space but with
281 * DDB_xx_IO_BASE in CPU physical address space.
282 */
283 ddb_set_pmr(DDB_PCIINIT00, DDB_PCICMD_MEM, DDB_PCI0_MEM_BASE,
284 DDB_PCI_ACCESS_32);
285 ddb_set_pmr(DDB_PCIINIT10, DDB_PCICMD_IO, 0, DDB_PCI_ACCESS_32);
286
287 ddb_set_pmr(DDB_PCIINIT01, DDB_PCICMD_MEM, DDB_PCI1_MEM_BASE,
288 DDB_PCI_ACCESS_32);
289 ddb_set_pmr(DDB_PCIINIT11, DDB_PCICMD_IO, DDB_PCI0_IO_SIZE,
290 DDB_PCI_ACCESS_32);
291
292
293 /* PCI cross window should be set properly */
294 ddb_set_pdar(DDB_BARP00, DDB_PCI1_MEM_BASE, DDB_PCI1_MEM_SIZE, 32, 0, 1);
295 ddb_set_pdar(DDB_BARP10, DDB_PCI1_IO_BASE, DDB_PCI1_IO_SIZE, 32, 0, 1);
296 ddb_set_pdar(DDB_BARP01, DDB_PCI0_MEM_BASE, DDB_PCI0_MEM_SIZE, 32, 0, 1);
297 ddb_set_pdar(DDB_BARP11, DDB_PCI0_IO_BASE, DDB_PCI0_IO_SIZE, 32, 0, 1);
298
299 if (mips_machtype == MACH_NEC_ROCKHOPPER
300 || mips_machtype == MACH_NEC_ROCKHOPPERII) {
301 /* Disable bus diagnostics. */
302 ddb_out32(DDB_PCICTL0_L, 0);
303 ddb_out32(DDB_PCICTL0_H, 0);
304 ddb_out32(DDB_PCICTL1_L, 0);
305 ddb_out32(DDB_PCICTL1_H, 0);
306 }
307
308 if (mips_machtype == MACH_NEC_ROCKHOPPER) {
309 u16 vid;
310 struct pci_bus bus;
311 struct pci_dev dev_m1533;
312 extern struct pci_ops ddb5477_ext_pci_ops;
313
314 bus.parent = NULL; /* we scan the top level only */
315 bus.ops = &ddb5477_ext_pci_ops;
316 dev_m1533.bus = &bus;
317 dev_m1533.sysdata = NULL;
318 dev_m1533.devfn = 7*8; // slot 7: M1533 SouthBridge.
319 pci_read_config_word(&dev_m1533, 0, &vid);
320 if (vid == PCI_VENDOR_ID_AL) {
321 printk("Changing mips_machtype to MACH_NEC_ROCKHOPPERII\n");
322 mips_machtype = MACH_NEC_ROCKHOPPERII;
323 }
324 }
325
326 /* enable USB input buffers */
327 ddb_out32(DDB_PIBMISC, 0x00000007);
328
329 /* For dual-function pins, make them all non-GPIO */
330 ddb_out32(DDB_GIUFUNSEL, 0x0);
331 // ddb_out32(DDB_GIUFUNSEL, 0xfe0fcfff); /* NEC recommanded value */
332
333 if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
334
335 /* enable IDE controller on Ali chip (south bridge) */
336 u8 temp8;
337 struct pci_bus bus;
338 struct pci_dev dev_m1533;
339 struct pci_dev dev_m5229;
340 extern struct pci_ops ddb5477_ext_pci_ops;
341
342 /* Setup M1535 registers */
343 bus.parent = NULL; /* we scan the top level only */
344 bus.ops = &ddb5477_ext_pci_ops;
345 dev_m1533.bus = &bus;
346 dev_m1533.sysdata = NULL;
347 dev_m1533.devfn = 7*8; // slot 7: M1533 SouthBridge.
348
349 /* setup IDE controller
350 * enable IDE controller (bit 6 - 1)
351 * IDE IDSEL to be addr:A15 (bit 4:5 - 11)
352 * disable IDE ATA Secondary Bus Signal Pad Control (bit 3 - 0)
353 * enable IDE ATA Primary Bus Signal Pad Control (bit 2 - 1)
354 */
355 pci_write_config_byte(&dev_m1533, 0x58, 0x74);
356
357 /*
358 * positive decode (bit6 -0)
359 * enable IDE controler interrupt (bit 4 -1)
360 * setup SIRQ to point to IRQ 14 (bit 3:0 - 1101)
361 */
362 pci_write_config_byte(&dev_m1533, 0x44, 0x1d);
363
364 /* Setup M5229 registers */
365 dev_m5229.bus = &bus;
366 dev_m5229.sysdata = NULL;
367 dev_m5229.devfn = 4*8; // slot 4 (AD15): M5229 IDE
368
369 /*
370 * enable IDE in the M5229 config register 0x50 (bit 0 - 1)
371 * M5229 IDSEL is addr:15; see above setting
372 */
373 pci_read_config_byte(&dev_m5229, 0x50, &temp8);
374 pci_write_config_byte(&dev_m5229, 0x50, temp8 | 0x1);
375
376 /*
377 * enable bus master (bit 2) and IO decoding (bit 0)
378 */
379 pci_read_config_byte(&dev_m5229, 0x04, &temp8);
380 pci_write_config_byte(&dev_m5229, 0x04, temp8 | 0x5);
381
382 /*
383 * enable native, copied from arch/ppc/k2boot/head.S
384 * TODO - need volatile, need to be portable
385 */
386 pci_write_config_byte(&dev_m5229, 0x09, 0xef);
387
388 /* Set Primary Channel Command Block Timing */
389 pci_write_config_byte(&dev_m5229, 0x59, 0x31);
390
391 /*
392 * Enable primary channel 40-pin cable
393 * M5229 register 0x4a (bit 0)
394 */
395 pci_read_config_byte(&dev_m5229, 0x4a, &temp8);
396 pci_write_config_byte(&dev_m5229, 0x4a, temp8 | 0x1);
397 }
398
399 if (mips_machtype == MACH_NEC_ROCKHOPPER
400 || mips_machtype == MACH_NEC_ROCKHOPPERII) {
401 printk("lcd44780: initializing\n");
402 lcd44780_init();
403 lcd44780_puts("MontaVista Linux");
404 }
405}
diff --git a/arch/mips/dec/Makefile b/arch/mips/dec/Makefile
new file mode 100644
index 000000000000..688757a97cb8
--- /dev/null
+++ b/arch/mips/dec/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the DECstation family specific parts of the kernel
3#
4
5obj-y := ecc-berr.o int-handler.o ioasic-irq.o kn02-irq.o reset.o \
6 setup.o time.o
7
8obj-$(CONFIG_PROM_CONSOLE) += promcon.o
9obj-$(CONFIG_CPU_HAS_WB) += wbflush.o
10
11EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/dec/boot/Makefile b/arch/mips/dec/boot/Makefile
new file mode 100644
index 000000000000..bcea41698ef5
--- /dev/null
+++ b/arch/mips/dec/boot/Makefile
@@ -0,0 +1,12 @@
1#
2# Makefile for the DECstation family specific parts of the kernel
3#
4
5netboot: all
6 $(LD) -N -G 0 -T ld.ecoff ../../boot/zImage \
7 dec_boot.o ramdisk.img -o nbImage
8
9obj-y := decstation.o
10
11clean:
12 rm -f nbImage
diff --git a/arch/mips/dec/boot/decstation.c b/arch/mips/dec/boot/decstation.c
new file mode 100644
index 000000000000..56fd4277555e
--- /dev/null
+++ b/arch/mips/dec/boot/decstation.c
@@ -0,0 +1,83 @@
1/*
2 * arch/mips/dec/decstation.c
3 */
4
5#define RELOC
6#define INITRD
7#define DEBUG_BOOT
8
9/*
10 * Magic number indicating REX PROM available on DECSTATION.
11 */
12#define REX_PROM_MAGIC 0x30464354
13
14#define REX_PROM_CLEARCACHE 0x7c/4
15#define REX_PROM_PRINTF 0x30/4
16
17#define VEC_RESET 0xBFC00000 /* Prom base address */
18#define PMAX_PROM_ENTRY(x) (VEC_RESET+((x)*8)) /* Prom jump table */
19#define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17)
20
21#define PARAM (k_start + 0x2000)
22
23#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210))
24#define INITRD_START (*(unsigned long *) (PARAM+0x218))
25#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
26
27extern int _ftext, _end; /* begin and end of kernel image */
28extern void kernel_entry(int, char **, unsigned long, int *);
29
30void * memcpy(void * dest, const void *src, unsigned int count)
31{
32 unsigned long *tmp = (unsigned long *) dest, *s = (unsigned long *) src;
33
34 count >>= 2;
35 while (count--)
36 *tmp++ = *s++;
37
38 return dest;
39}
40
41void dec_entry(int argc, char **argv,
42 unsigned long magic, int *prom_vec)
43{
44 void (*rex_clear_cache)(void);
45 int (*prom_printf)(char *, ...);
46 unsigned long k_start, len;
47
48 /*
49 * The DS5100 leaves cpu with BEV enabled, clear it.
50 */
51 asm( "lui\t$8,0x3000\n\t"
52 "mtc0\t$8,$12\n\t"
53 ".section\t.sdata\n\t"
54 ".section\t.sbss\n\t"
55 ".section\t.text"
56 : : : "$8");
57
58#ifdef DEBUG_BOOT
59 if (magic == REX_PROM_MAGIC) {
60 prom_printf = (int (*)(char *, ...)) *(prom_vec + REX_PROM_PRINTF);
61 } else {
62 prom_printf = (int (*)(char *, ...)) PMAX_PROM_PRINTF;
63 }
64 prom_printf("Launching kernel...\n");
65#endif
66
67 k_start = (unsigned long) (&kernel_entry) & 0xffff0000;
68
69#ifdef RELOC
70 /*
71 * Now copy kernel image to its destination.
72 */
73 len = ((unsigned long) (&_end) - k_start);
74 memcpy((void *)k_start, &_ftext, len);
75#endif
76
77 if (magic == REX_PROM_MAGIC) {
78 rex_clear_cache = (void (*)(void)) * (prom_vec + REX_PROM_CLEARCACHE);
79 rex_clear_cache();
80 }
81
82 kernel_entry(argc, argv, magic, prom_vec);
83}
diff --git a/arch/mips/dec/boot/ld.ecoff b/arch/mips/dec/boot/ld.ecoff
new file mode 100644
index 000000000000..aaa633dfb5f7
--- /dev/null
+++ b/arch/mips/dec/boot/ld.ecoff
@@ -0,0 +1,43 @@
1OUTPUT_FORMAT("ecoff-littlemips")
2OUTPUT_ARCH(mips)
3ENTRY(dec_entry)
4SECTIONS
5{
6 . = 0x80200000;
7
8 .text :
9 {
10 _ftext = .;
11 *(.text)
12 *(.fixup)
13 }
14 .rdata :
15 {
16 *(.rodata .rodata.* .rdata)
17 }
18 .data :
19 {
20 . = ALIGN(0x1000);
21 ramdisk.img (.data)
22 *(.data)
23 }
24 .sdata :
25 {
26 *(.sdata)
27 }
28 _gp = .;
29 .sbss :
30 {
31 *(.sbss)
32 *(.scommon)
33 }
34 .bss :
35 {
36 *(.dynbss)
37 *(.bss)
38 *(COMMON)
39 }
40 /DISCARD/ : {
41 *(.reginfo .mdebug .note)
42 }
43}
diff --git a/arch/mips/dec/ecc-berr.c b/arch/mips/dec/ecc-berr.c
new file mode 100644
index 000000000000..133fb7c48e6c
--- /dev/null
+++ b/arch/mips/dec/ecc-berr.c
@@ -0,0 +1,280 @@
1/*
2 * linux/arch/mips/dec/ecc-berr.c
3 *
4 * Bus error event handling code for systems equipped with ECC
5 * handling logic, i.e. DECstation/DECsystem 5000/200 (KN02),
6 * 5000/240 (KN03), 5000/260 (KN05) and DECsystem 5900 (KN03),
7 * 5900/260 (KN05) systems.
8 *
9 * Copyright (c) 2003 Maciej W. Rozycki
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/spinlock.h>
21#include <linux/types.h>
22
23#include <asm/addrspace.h>
24#include <asm/bootinfo.h>
25#include <asm/cpu.h>
26#include <asm/processor.h>
27#include <asm/system.h>
28#include <asm/traps.h>
29
30#include <asm/dec/ecc.h>
31#include <asm/dec/kn02.h>
32#include <asm/dec/kn03.h>
33#include <asm/dec/kn05.h>
34
35static volatile u32 *kn0x_erraddr;
36static volatile u32 *kn0x_chksyn;
37
38static inline void dec_ecc_be_ack(void)
39{
40 *kn0x_erraddr = 0; /* any write clears the IRQ */
41 iob();
42}
43
44static int dec_ecc_be_backend(struct pt_regs *regs, int is_fixup, int invoker)
45{
46 static const char excstr[] = "exception";
47 static const char intstr[] = "interrupt";
48 static const char cpustr[] = "CPU";
49 static const char dmastr[] = "DMA";
50 static const char readstr[] = "read";
51 static const char mreadstr[] = "memory read";
52 static const char writestr[] = "write";
53 static const char mwritstr[] = "partial memory write";
54 static const char timestr[] = "timeout";
55 static const char overstr[] = "overrun";
56 static const char eccstr[] = "ECC error";
57
58 const char *kind, *agent, *cycle, *event;
59 const char *status = "", *xbit = "", *fmt = "";
60 dma_addr_t address;
61 u16 syn = 0, sngl;
62
63 int i = 0;
64
65 u32 erraddr = *kn0x_erraddr;
66 u32 chksyn = *kn0x_chksyn;
67 int action = MIPS_BE_FATAL;
68
69 /* For non-ECC ack ASAP, so any subsequent errors get caught. */
70 if ((erraddr & (KN0X_EAR_VALID | KN0X_EAR_ECCERR)) == KN0X_EAR_VALID)
71 dec_ecc_be_ack();
72
73 kind = invoker ? intstr : excstr;
74
75 if (!(erraddr & KN0X_EAR_VALID)) {
76 /* No idea what happened. */
77 printk(KERN_ALERT "Unidentified bus error %s.\n", kind);
78 return action;
79 }
80
81 agent = (erraddr & KN0X_EAR_CPU) ? cpustr : dmastr;
82
83 if (erraddr & KN0X_EAR_ECCERR) {
84 /* An ECC error on a CPU or DMA transaction. */
85 cycle = (erraddr & KN0X_EAR_WRITE) ? mwritstr : mreadstr;
86 event = eccstr;
87 } else {
88 /* A CPU timeout or a DMA overrun. */
89 cycle = (erraddr & KN0X_EAR_WRITE) ? writestr : readstr;
90 event = (erraddr & KN0X_EAR_CPU) ? timestr : overstr;
91 }
92
93 address = erraddr & KN0X_EAR_ADDRESS;
94 /* For ECC errors on reads adjust for MT pipelining. */
95 if ((erraddr & (KN0X_EAR_WRITE | KN0X_EAR_ECCERR)) == KN0X_EAR_ECCERR)
96 address = (address & ~0xfffLL) | ((address - 5) & 0xfffLL);
97 address <<= 2;
98
99 /* Only CPU errors are fixable. */
100 if (erraddr & KN0X_EAR_CPU && is_fixup)
101 action = MIPS_BE_FIXUP;
102
103 if (erraddr & KN0X_EAR_ECCERR) {
104 static const u8 data_sbit[32] = {
105 0x4f, 0x4a, 0x52, 0x54, 0x57, 0x58, 0x5b, 0x5d,
106 0x23, 0x25, 0x26, 0x29, 0x2a, 0x2c, 0x31, 0x34,
107 0x0e, 0x0b, 0x13, 0x15, 0x16, 0x19, 0x1a, 0x1c,
108 0x62, 0x64, 0x67, 0x68, 0x6b, 0x6d, 0x70, 0x75,
109 };
110 static const u8 data_mbit[25] = {
111 0x07, 0x0d, 0x1f,
112 0x2f, 0x32, 0x37, 0x38, 0x3b, 0x3d, 0x3e,
113 0x43, 0x45, 0x46, 0x49, 0x4c, 0x51, 0x5e,
114 0x61, 0x6e, 0x73, 0x76, 0x79, 0x7a, 0x7c, 0x7f,
115 };
116 static const char sbestr[] = "corrected single";
117 static const char dbestr[] = "uncorrectable double";
118 static const char mbestr[] = "uncorrectable multiple";
119
120 if (!(address & 0x4))
121 syn = chksyn; /* Low bank. */
122 else
123 syn = chksyn >> 16; /* High bank. */
124
125 if (!(syn & KN0X_ESR_VLDLO)) {
126 /* Ack now, no rewrite will happen. */
127 dec_ecc_be_ack();
128
129 fmt = KERN_ALERT "%s" "invalid.\n";
130 } else {
131 sngl = syn & KN0X_ESR_SNGLO;
132 syn &= KN0X_ESR_SYNLO;
133
134 /*
135 * Multibit errors may be tagged incorrectly;
136 * check the syndrome explicitly.
137 */
138 for (i = 0; i < 25; i++)
139 if (syn == data_mbit[i])
140 break;
141
142 if (i < 25) {
143 status = mbestr;
144 } else if (!sngl) {
145 status = dbestr;
146 } else {
147 volatile u32 *ptr = (void *)KSEG1ADDR(address);
148
149 *ptr = *ptr; /* Rewrite. */
150 iob();
151
152 status = sbestr;
153 action = MIPS_BE_DISCARD;
154 }
155
156 /* Ack now, now we've rewritten (or not). */
157 dec_ecc_be_ack();
158
159 if (syn && syn == (syn & -syn)) {
160 if (syn == 0x01) {
161 fmt = KERN_ALERT "%s"
162 "%#04x -- %s bit error "
163 "at check bit C%s.\n";
164 xbit = "X";
165 } else {
166 fmt = KERN_ALERT "%s"
167 "%#04x -- %s bit error "
168 "at check bit C%s%u.\n";
169 }
170 i = syn >> 2;
171 } else {
172 for (i = 0; i < 32; i++)
173 if (syn == data_sbit[i])
174 break;
175 if (i < 32)
176 fmt = KERN_ALERT "%s"
177 "%#04x -- %s bit error "
178 "at data bit D%s%u.\n";
179 else
180 fmt = KERN_ALERT "%s"
181 "%#04x -- %s bit error.\n";
182 }
183 }
184 }
185
186 if (action != MIPS_BE_FIXUP)
187 printk(KERN_ALERT "Bus error %s: %s %s %s at %#010lx.\n",
188 kind, agent, cycle, event, address);
189
190 if (action != MIPS_BE_FIXUP && erraddr & KN0X_EAR_ECCERR)
191 printk(fmt, " ECC syndrome ", syn, status, xbit, i);
192
193 return action;
194}
195
196int dec_ecc_be_handler(struct pt_regs *regs, int is_fixup)
197{
198 return dec_ecc_be_backend(regs, is_fixup, 0);
199}
200
201irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id, struct pt_regs *regs)
202{
203 int action = dec_ecc_be_backend(regs, 0, 1);
204
205 if (action == MIPS_BE_DISCARD)
206 return IRQ_NONE;
207
208 /*
209 * FIXME: Find affected processes and kill them, otherwise we
210 * must die.
211 *
212 * The interrupt is asynchronously delivered thus EPC and RA
213 * may be irrelevant, but are printed for a reference.
214 */
215 printk(KERN_ALERT "Fatal bus interrupt, epc == %08lx, ra == %08lx\n",
216 regs->cp0_epc, regs->regs[31]);
217 die("Unrecoverable bus error", regs);
218}
219
220
221/*
222 * Initialization differs a bit between KN02 and KN03/KN05, so we
223 * need two variants. Once set up, all systems can be handled the
224 * same way.
225 */
226static inline void dec_kn02_be_init(void)
227{
228 volatile u32 *csr = (void *)KN02_CSR_BASE;
229 unsigned long flags;
230
231 kn0x_erraddr = (void *)(KN02_SLOT_BASE + KN02_ERRADDR);
232 kn0x_chksyn = (void *)(KN02_SLOT_BASE + KN02_CHKSYN);
233
234 spin_lock_irqsave(&kn02_lock, flags);
235
236 /* Preset write-only bits of the Control Register cache. */
237 cached_kn02_csr = *csr | KN03_CSR_LEDS;
238
239 /* Set normal ECC detection and generation. */
240 cached_kn02_csr &= ~(KN02_CSR_DIAGCHK | KN02_CSR_DIAGGEN);
241 /* Enable ECC correction. */
242 cached_kn02_csr |= KN02_CSR_CORRECT;
243 *csr = cached_kn02_csr;
244 iob();
245
246 spin_unlock_irqrestore(&kn02_lock, flags);
247}
248
249static inline void dec_kn03_be_init(void)
250{
251 volatile u32 *mcr = (void *)(KN03_SLOT_BASE + IOASIC_MCR);
252 volatile u32 *mbcs = (void *)(KN03_SLOT_BASE + KN05_MB_CSR);
253
254 kn0x_erraddr = (void *)(KN03_SLOT_BASE + IOASIC_ERRADDR);
255 kn0x_chksyn = (void *)(KN03_SLOT_BASE + IOASIC_CHKSYN);
256
257 /*
258 * Set normal ECC detection and generation, enable ECC correction.
259 * For KN05 we also need to make sure EE (?) is enabled in the MB.
260 * Otherwise DBE/IBE exceptions would be masked but bus error
261 * interrupts would still arrive, resulting in an inevitable crash
262 * if get_dbe() triggers one.
263 */
264 *mcr = (*mcr & ~(KN03_MCR_DIAGCHK | KN03_MCR_DIAGGEN)) |
265 KN03_MCR_CORRECT;
266 if (current_cpu_data.cputype == CPU_R4400SC)
267 *mbcs |= KN05_MB_CSR_EE;
268 fast_iob();
269}
270
271void __init dec_ecc_be_init(void)
272{
273 if (mips_machtype == MACH_DS5000_200)
274 dec_kn02_be_init();
275 else
276 dec_kn03_be_init();
277
278 /* Clear any leftover errors from the firmware. */
279 dec_ecc_be_ack();
280}
diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S
new file mode 100644
index 000000000000..3b3790993219
--- /dev/null
+++ b/arch/mips/dec/int-handler.S
@@ -0,0 +1,297 @@
1/*
2 * arch/mips/dec/int-handler.S
3 *
4 * Copyright (C) 1995, 1996, 1997 Paul M. Antoine and Harald Koerfgen
5 * Copyright (C) 2000, 2001, 2002, 2003 Maciej W. Rozycki
6 *
7 * Written by Ralf Baechle and Andreas Busse, modified for DECStation
8 * support by Paul Antoine and Harald Koerfgen.
9 *
10 * completly rewritten:
11 * Copyright (C) 1998 Harald Koerfgen
12 *
13 * Rewritten extensively for controller-driven IRQ support
14 * by Maciej W. Rozycki.
15 */
16#include <linux/config.h>
17#include <asm/asm.h>
18#include <asm/regdef.h>
19#include <asm/mipsregs.h>
20#include <asm/stackframe.h>
21#include <asm/addrspace.h>
22
23#include <asm/dec/interrupts.h>
24#include <asm/dec/ioasic_addrs.h>
25#include <asm/dec/ioasic_ints.h>
26#include <asm/dec/kn01.h>
27#include <asm/dec/kn02.h>
28#include <asm/dec/kn02xa.h>
29#include <asm/dec/kn03.h>
30
31
32 .text
33 .set noreorder
34/*
35 * decstation_handle_int: Interrupt handler for DECStations
36 *
37 * We follow the model in the Indy interrupt code by David Miller, where he
38 * says: a lot of complication here is taken away because:
39 *
40 * 1) We handle one interrupt and return, sitting in a loop
41 * and moving across all the pending IRQ bits in the cause
42 * register is _NOT_ the answer, the common case is one
43 * pending IRQ so optimize in that direction.
44 *
45 * 2) We need not check against bits in the status register
46 * IRQ mask, that would make this routine slow as hell.
47 *
48 * 3) Linux only thinks in terms of all IRQs on or all IRQs
49 * off, nothing in between like BSD spl() brain-damage.
50 *
51 * Furthermore, the IRQs on the DECStations look basically (barring
52 * software IRQs which we don't use at all) like...
53 *
54 * DS2100/3100's, aka kn01, aka Pmax:
55 *
56 * MIPS IRQ Source
57 * -------- ------
58 * 0 Software (ignored)
59 * 1 Software (ignored)
60 * 2 SCSI
61 * 3 Lance Ethernet
62 * 4 DZ11 serial
63 * 5 RTC
64 * 6 Memory Controller
65 * 7 FPU
66 *
67 * DS5000/200, aka kn02, aka 3max:
68 *
69 * MIPS IRQ Source
70 * -------- ------
71 * 0 Software (ignored)
72 * 1 Software (ignored)
73 * 2 TurboChannel
74 * 3 RTC
75 * 4 Reserved
76 * 5 Memory Controller
77 * 6 Reserved
78 * 7 FPU
79 *
80 * DS5000/1xx's, aka kn02ba, aka 3min:
81 *
82 * MIPS IRQ Source
83 * -------- ------
84 * 0 Software (ignored)
85 * 1 Software (ignored)
86 * 2 TurboChannel Slot 0
87 * 3 TurboChannel Slot 1
88 * 4 TurboChannel Slot 2
89 * 5 TurboChannel Slot 3 (ASIC)
90 * 6 Halt button
91 * 7 FPU/R4k timer
92 *
93 * DS5000/2x's, aka kn02ca, aka maxine:
94 *
95 * MIPS IRQ Source
96 * -------- ------
97 * 0 Software (ignored)
98 * 1 Software (ignored)
99 * 2 Periodic Interrupt (100usec)
100 * 3 RTC
101 * 4 I/O write timeout
102 * 5 TurboChannel (ASIC)
103 * 6 Halt Keycode from Access.Bus keyboard (CTRL-ALT-ENTER)
104 * 7 FPU/R4k timer
105 *
106 * DS5000/2xx's, aka kn03, aka 3maxplus:
107 *
108 * MIPS IRQ Source
109 * -------- ------
110 * 0 Software (ignored)
111 * 1 Software (ignored)
112 * 2 System Board (ASIC)
113 * 3 RTC
114 * 4 Reserved
115 * 5 Memory
116 * 6 Halt Button
117 * 7 FPU/R4k timer
118 *
119 * We handle the IRQ according to _our_ priority (see setup.c),
120 * then we just return. If multiple IRQs are pending then we will
121 * just take another exception, big deal.
122 */
123 .align 5
124 NESTED(decstation_handle_int, PT_SIZE, ra)
125 .set noat
126 SAVE_ALL
127 CLI # TEST: interrupts should be off
128 .set at
129 .set noreorder
130
131 /*
132 * Get pending Interrupts
133 */
134 mfc0 t0,CP0_CAUSE # get pending interrupts
135 mfc0 t1,CP0_STATUS
136#ifdef CONFIG_MIPS32
137 lw t2,cpu_fpu_mask
138#endif
139 andi t0,ST0_IM # CAUSE.CE may be non-zero!
140 and t0,t1 # isolate allowed ones
141
142 beqz t0,spurious
143
144#ifdef CONFIG_MIPS32
145 and t2,t0
146 bnez t2,fpu # handle FPU immediately
147#endif
148
149 /*
150 * Find irq with highest priority
151 */
152 PTR_LA t1,cpu_mask_nr_tbl
1531: lw t2,(t1)
154 nop
155 and t2,t0
156 beqz t2,1b
157 addu t1,2*PTRSIZE # delay slot
158
159 /*
160 * Do the low-level stuff
161 */
162 lw a0,(-PTRSIZE)(t1)
163 nop
164 bgez a0,handle_it # irq_nr >= 0?
165 # irq_nr < 0: it is an address
166 nop
167 jr a0
168 # a trick to save a branch:
169 lui t2,(KN03_IOASIC_BASE>>16)&0xffff
170 # upper part of IOASIC Address
171
172/*
173 * Handle "IRQ Controller" Interrupts
174 * Masked Interrupts are still visible and have to be masked "by hand".
175 */
176 FEXPORT(kn02_io_int) # 3max
177 lui t0,(KN02_CSR_BASE>>16)&0xffff
178 # get interrupt status and mask
179 lw t0,(t0)
180 nop
181 andi t1,t0,KN02_IRQ_ALL
182 b 1f
183 srl t0,16 # shift interrupt mask
184
185 FEXPORT(kn02xa_io_int) # 3min/maxine
186 lui t2,(KN02XA_IOASIC_BASE>>16)&0xffff
187 # upper part of IOASIC Address
188
189 FEXPORT(kn03_io_int) # 3max+ (t2 loaded earlier)
190 lw t0,IO_REG_SIR(t2) # get status: IOASIC sir
191 lw t1,IO_REG_SIMR(t2) # get mask: IOASIC simr
192 nop
193
1941: and t0,t1 # mask out allowed ones
195
196 beqz t0,spurious
197
198 /*
199 * Find irq with highest priority
200 */
201 PTR_LA t1,asic_mask_nr_tbl
2022: lw t2,(t1)
203 nop
204 and t2,t0
205 beq zero,t2,2b
206 addu t1,2*PTRSIZE # delay slot
207
208 /*
209 * Do the low-level stuff
210 */
211 lw a0,%lo(-PTRSIZE)(t1)
212 nop
213 bgez a0,handle_it # irq_nr >= 0?
214 # irq_nr < 0: it is an address
215 nop
216 jr a0
217 nop # delay slot
218
219/*
220 * Dispatch low-priority interrupts. We reconsider all status
221 * bits again, which looks like a lose, but it makes the code
222 * simple and O(log n), so it gets compensated.
223 */
224 FEXPORT(cpu_all_int) # HALT, timers, software junk
225 li a0,DEC_CPU_IRQ_BASE
226 srl t0,CAUSEB_IP
227 li t1,CAUSEF_IP>>CAUSEB_IP # mask
228 b 1f
229 li t2,4 # nr of bits / 2
230
231 FEXPORT(kn02_all_int) # impossible ?
232 li a0,KN02_IRQ_BASE
233 li t1,KN02_IRQ_ALL # mask
234 b 1f
235 li t2,4 # nr of bits / 2
236
237 FEXPORT(asic_all_int) # various I/O ASIC junk
238 li a0,IO_IRQ_BASE
239 li t1,IO_IRQ_ALL # mask
240 b 1f
241 li t2,8 # nr of bits / 2
242
243/*
244 * Dispatch DMA interrupts -- O(log n).
245 */
246 FEXPORT(asic_dma_int) # I/O ASIC DMA events
247 li a0,IO_IRQ_BASE+IO_INR_DMA
248 srl t0,IO_INR_DMA
249 li t1,IO_IRQ_DMA>>IO_INR_DMA # mask
250 li t2,8 # nr of bits / 2
251
252 /*
253 * Find irq with highest priority.
254 * Highest irq number takes precedence.
255 */
2561: srlv t3,t1,t2
2572: xor t1,t3
258 and t3,t0,t1
259 beqz t3,3f
260 nop
261 move t0,t3
262 addu a0,t2
2633: srl t2,1
264 bnez t2,2b
265 srlv t3,t1,t2
266
267handle_it:
268 jal do_IRQ
269 move a1,sp
270
271 j ret_from_irq
272 nop
273
274#ifdef CONFIG_MIPS32
275fpu:
276 j handle_fpe_int
277 nop
278#endif
279
280spurious:
281 j spurious_interrupt
282 nop
283 END(decstation_handle_int)
284
285/*
286 * Generic unimplemented interrupt routines -- cpu_mask_nr_tbl
287 * and asic_mask_nr_tbl are initialized to point all interrupts here.
288 * The tables are then filled in by machine-specific initialisation
289 * in dec_setup().
290 */
291 FEXPORT(dec_intr_unimplemented)
292 move a1,t0 # cheats way of printing an arg!
293 PANIC("Unimplemented cpu interrupt! CP0_CAUSE: 0x%08x");
294
295 FEXPORT(asic_intr_unimplemented)
296 move a1,t0 # cheats way of printing an arg!
297 PANIC("Unimplemented asic interrupt! ASIC ISR: 0x%08x");
diff --git a/arch/mips/dec/ioasic-irq.c b/arch/mips/dec/ioasic-irq.c
new file mode 100644
index 000000000000..d5bca5d233b6
--- /dev/null
+++ b/arch/mips/dec/ioasic-irq.c
@@ -0,0 +1,157 @@
1/*
2 * linux/arch/mips/dec/ioasic-irq.c
3 *
4 * DEC I/O ASIC interrupts.
5 *
6 * Copyright (c) 2002, 2003 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <linux/spinlock.h>
17#include <linux/types.h>
18
19#include <asm/dec/ioasic.h>
20#include <asm/dec/ioasic_addrs.h>
21#include <asm/dec/ioasic_ints.h>
22
23
24static DEFINE_SPINLOCK(ioasic_lock);
25
26static int ioasic_irq_base;
27
28
29static inline void unmask_ioasic_irq(unsigned int irq)
30{
31 u32 simr;
32
33 simr = ioasic_read(IO_REG_SIMR);
34 simr |= (1 << (irq - ioasic_irq_base));
35 ioasic_write(IO_REG_SIMR, simr);
36}
37
38static inline void mask_ioasic_irq(unsigned int irq)
39{
40 u32 simr;
41
42 simr = ioasic_read(IO_REG_SIMR);
43 simr &= ~(1 << (irq - ioasic_irq_base));
44 ioasic_write(IO_REG_SIMR, simr);
45}
46
47static inline void clear_ioasic_irq(unsigned int irq)
48{
49 u32 sir;
50
51 sir = ~(1 << (irq - ioasic_irq_base));
52 ioasic_write(IO_REG_SIR, sir);
53}
54
55static inline void enable_ioasic_irq(unsigned int irq)
56{
57 unsigned long flags;
58
59 spin_lock_irqsave(&ioasic_lock, flags);
60 unmask_ioasic_irq(irq);
61 spin_unlock_irqrestore(&ioasic_lock, flags);
62}
63
64static inline void disable_ioasic_irq(unsigned int irq)
65{
66 unsigned long flags;
67
68 spin_lock_irqsave(&ioasic_lock, flags);
69 mask_ioasic_irq(irq);
70 spin_unlock_irqrestore(&ioasic_lock, flags);
71}
72
73
74static inline unsigned int startup_ioasic_irq(unsigned int irq)
75{
76 enable_ioasic_irq(irq);
77 return 0;
78}
79
80#define shutdown_ioasic_irq disable_ioasic_irq
81
82static inline void ack_ioasic_irq(unsigned int irq)
83{
84 spin_lock(&ioasic_lock);
85 mask_ioasic_irq(irq);
86 spin_unlock(&ioasic_lock);
87 fast_iob();
88}
89
90static inline void end_ioasic_irq(unsigned int irq)
91{
92 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
93 enable_ioasic_irq(irq);
94}
95
96static struct hw_interrupt_type ioasic_irq_type = {
97 .typename = "IO-ASIC",
98 .startup = startup_ioasic_irq,
99 .shutdown = shutdown_ioasic_irq,
100 .enable = enable_ioasic_irq,
101 .disable = disable_ioasic_irq,
102 .ack = ack_ioasic_irq,
103 .end = end_ioasic_irq,
104};
105
106
107#define startup_ioasic_dma_irq startup_ioasic_irq
108
109#define shutdown_ioasic_dma_irq shutdown_ioasic_irq
110
111#define enable_ioasic_dma_irq enable_ioasic_irq
112
113#define disable_ioasic_dma_irq disable_ioasic_irq
114
115#define ack_ioasic_dma_irq ack_ioasic_irq
116
117static inline void end_ioasic_dma_irq(unsigned int irq)
118{
119 clear_ioasic_irq(irq);
120 fast_iob();
121 end_ioasic_irq(irq);
122}
123
124static struct hw_interrupt_type ioasic_dma_irq_type = {
125 .typename = "IO-ASIC-DMA",
126 .startup = startup_ioasic_dma_irq,
127 .shutdown = shutdown_ioasic_dma_irq,
128 .enable = enable_ioasic_dma_irq,
129 .disable = disable_ioasic_dma_irq,
130 .ack = ack_ioasic_dma_irq,
131 .end = end_ioasic_dma_irq,
132};
133
134
135void __init init_ioasic_irqs(int base)
136{
137 int i;
138
139 /* Mask interrupts. */
140 ioasic_write(IO_REG_SIMR, 0);
141 fast_iob();
142
143 for (i = base; i < base + IO_INR_DMA; i++) {
144 irq_desc[i].status = IRQ_DISABLED;
145 irq_desc[i].action = 0;
146 irq_desc[i].depth = 1;
147 irq_desc[i].handler = &ioasic_irq_type;
148 }
149 for (; i < base + IO_IRQ_LINES; i++) {
150 irq_desc[i].status = IRQ_DISABLED;
151 irq_desc[i].action = 0;
152 irq_desc[i].depth = 1;
153 irq_desc[i].handler = &ioasic_dma_irq_type;
154 }
155
156 ioasic_irq_base = base;
157}
diff --git a/arch/mips/dec/kn02-irq.c b/arch/mips/dec/kn02-irq.c
new file mode 100644
index 000000000000..e0bfcd1521e2
--- /dev/null
+++ b/arch/mips/dec/kn02-irq.c
@@ -0,0 +1,127 @@
1/*
2 * linux/arch/mips/dec/kn02-irq.c
3 *
4 * DECstation 5000/200 (KN02) Control and Status Register
5 * interrupts.
6 *
7 * Copyright (c) 2002, 2003 Maciej W. Rozycki
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/spinlock.h>
18#include <linux/types.h>
19
20#include <asm/dec/kn02.h>
21
22
23/*
24 * Bits 7:0 of the Control Register are write-only -- the
25 * corresponding bits of the Status Register have a different
26 * meaning. Hence we use a cache. It speeds up things a bit
27 * as well.
28 *
29 * There is no default value -- it has to be initialized.
30 */
31u32 cached_kn02_csr;
32DEFINE_SPINLOCK(kn02_lock);
33
34
35static int kn02_irq_base;
36
37
38static inline void unmask_kn02_irq(unsigned int irq)
39{
40 volatile u32 *csr = (volatile u32 *)KN02_CSR_BASE;
41
42 cached_kn02_csr |= (1 << (irq - kn02_irq_base + 16));
43 *csr = cached_kn02_csr;
44}
45
46static inline void mask_kn02_irq(unsigned int irq)
47{
48 volatile u32 *csr = (volatile u32 *)KN02_CSR_BASE;
49
50 cached_kn02_csr &= ~(1 << (irq - kn02_irq_base + 16));
51 *csr = cached_kn02_csr;
52}
53
54static inline void enable_kn02_irq(unsigned int irq)
55{
56 unsigned long flags;
57
58 spin_lock_irqsave(&kn02_lock, flags);
59 unmask_kn02_irq(irq);
60 spin_unlock_irqrestore(&kn02_lock, flags);
61}
62
63static inline void disable_kn02_irq(unsigned int irq)
64{
65 unsigned long flags;
66
67 spin_lock_irqsave(&kn02_lock, flags);
68 mask_kn02_irq(irq);
69 spin_unlock_irqrestore(&kn02_lock, flags);
70}
71
72
73static unsigned int startup_kn02_irq(unsigned int irq)
74{
75 enable_kn02_irq(irq);
76 return 0;
77}
78
79#define shutdown_kn02_irq disable_kn02_irq
80
81static void ack_kn02_irq(unsigned int irq)
82{
83 spin_lock(&kn02_lock);
84 mask_kn02_irq(irq);
85 spin_unlock(&kn02_lock);
86 iob();
87}
88
89static void end_kn02_irq(unsigned int irq)
90{
91 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
92 enable_kn02_irq(irq);
93}
94
95static struct hw_interrupt_type kn02_irq_type = {
96 .typename = "KN02-CSR",
97 .startup = startup_kn02_irq,
98 .shutdown = shutdown_kn02_irq,
99 .enable = enable_kn02_irq,
100 .disable = disable_kn02_irq,
101 .ack = ack_kn02_irq,
102 .end = end_kn02_irq,
103};
104
105
106void __init init_kn02_irqs(int base)
107{
108 volatile u32 *csr = (volatile u32 *)KN02_CSR_BASE;
109 unsigned long flags;
110 int i;
111
112 /* Mask interrupts. */
113 spin_lock_irqsave(&kn02_lock, flags);
114 cached_kn02_csr &= ~KN03_CSR_IOINTEN;
115 *csr = cached_kn02_csr;
116 iob();
117 spin_unlock_irqrestore(&kn02_lock, flags);
118
119 for (i = base; i < base + KN02_IRQ_LINES; i++) {
120 irq_desc[i].status = IRQ_DISABLED;
121 irq_desc[i].action = 0;
122 irq_desc[i].depth = 1;
123 irq_desc[i].handler = &kn02_irq_type;
124 }
125
126 kn02_irq_base = base;
127}
diff --git a/arch/mips/dec/prom/Makefile b/arch/mips/dec/prom/Makefile
new file mode 100644
index 000000000000..373822ec2d8c
--- /dev/null
+++ b/arch/mips/dec/prom/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the DECstation prom monitor library routines
3# under Linux.
4#
5
6lib-y += init.o memory.o cmdline.o identify.o console.o
7
8lib-$(CONFIG_MIPS32) += locore.o
9lib-$(CONFIG_MIPS64) += call_o32.o
10
11EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/dec/prom/call_o32.S b/arch/mips/dec/prom/call_o32.S
new file mode 100644
index 000000000000..0dd56db9b3d0
--- /dev/null
+++ b/arch/mips/dec/prom/call_o32.S
@@ -0,0 +1,91 @@
1/*
2 * arch/mips/dec/call_o32.S
3 *
4 * O32 interface for the 64 (or N32) ABI.
5 *
6 * Copyright (C) 2002 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#include <asm/asm.h>
15#include <asm/regdef.h>
16
17/* Maximum number of arguments supported. Must be even! */
18#define O32_ARGC 32
19/* Number of static registers we save. */
20#define O32_STATC 11
21/* Frame size for both of the above. */
22#define O32_FRAMESZ (4 * O32_ARGC + SZREG * O32_STATC)
23
24 .text
25
26/*
27 * O32 function call dispatcher, for interfacing 32-bit ROM routines.
28 *
29 * The standard 64 (N32) calling sequence is supported, with a0
30 * holding a function pointer, a1-a7 -- its first seven arguments
31 * and the stack -- remaining ones (up to O32_ARGC, including a1-a7).
32 * Static registers, gp and fp are preserved, v0 holds a result.
33 * This code relies on the called o32 function for sp and ra
34 * restoration and thus both this dispatcher and the current stack
35 * have to be placed in a KSEGx (or KUSEG) address space. Any
36 * pointers passed have to point to addresses within one of these
37 * spaces as well.
38 */
39NESTED(call_o32, O32_FRAMESZ, ra)
40 REG_SUBU sp,O32_FRAMESZ
41
42 REG_S ra,O32_FRAMESZ-1*SZREG(sp)
43 REG_S fp,O32_FRAMESZ-2*SZREG(sp)
44 REG_S gp,O32_FRAMESZ-3*SZREG(sp)
45 REG_S s7,O32_FRAMESZ-4*SZREG(sp)
46 REG_S s6,O32_FRAMESZ-5*SZREG(sp)
47 REG_S s5,O32_FRAMESZ-6*SZREG(sp)
48 REG_S s4,O32_FRAMESZ-7*SZREG(sp)
49 REG_S s3,O32_FRAMESZ-8*SZREG(sp)
50 REG_S s2,O32_FRAMESZ-9*SZREG(sp)
51 REG_S s1,O32_FRAMESZ-10*SZREG(sp)
52 REG_S s0,O32_FRAMESZ-11*SZREG(sp)
53
54 move jp,a0
55
56 sll a0,a1,zero
57 sll a1,a2,zero
58 sll a2,a3,zero
59 sll a3,a4,zero
60 sw a5,0x10(sp)
61 sw a6,0x14(sp)
62 sw a7,0x18(sp)
63
64 PTR_LA t0,O32_FRAMESZ(sp)
65 PTR_LA t1,0x1c(sp)
66 li t2,O32_ARGC-7
671:
68 lw t3,(t0)
69 REG_ADDU t0,SZREG
70 sw t3,(t1)
71 REG_SUBU t2,1
72 REG_ADDU t1,4
73 bnez t2,1b
74
75 jalr jp
76
77 REG_L s0,O32_FRAMESZ-11*SZREG(sp)
78 REG_L s1,O32_FRAMESZ-10*SZREG(sp)
79 REG_L s2,O32_FRAMESZ-9*SZREG(sp)
80 REG_L s3,O32_FRAMESZ-8*SZREG(sp)
81 REG_L s4,O32_FRAMESZ-7*SZREG(sp)
82 REG_L s5,O32_FRAMESZ-6*SZREG(sp)
83 REG_L s6,O32_FRAMESZ-5*SZREG(sp)
84 REG_L s7,O32_FRAMESZ-4*SZREG(sp)
85 REG_L gp,O32_FRAMESZ-3*SZREG(sp)
86 REG_L fp,O32_FRAMESZ-2*SZREG(sp)
87 REG_L ra,O32_FRAMESZ-1*SZREG(sp)
88
89 REG_ADDU sp,O32_FRAMESZ
90 jr ra
91END(call_o32)
diff --git a/arch/mips/dec/prom/cmdline.c b/arch/mips/dec/prom/cmdline.c
new file mode 100644
index 000000000000..c3490bebbc5d
--- /dev/null
+++ b/arch/mips/dec/prom/cmdline.c
@@ -0,0 +1,39 @@
1/*
2 * cmdline.c: read the command line passed to us by the PROM.
3 *
4 * Copyright (C) 1998 Harald Koerfgen
5 * Copyright (C) 2002, 2004 Maciej W. Rozycki
6 */
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/string.h>
10#include <linux/types.h>
11
12#include <asm/bootinfo.h>
13#include <asm/dec/prom.h>
14
15#undef PROM_DEBUG
16
17void __init prom_init_cmdline(s32 argc, s32 *argv, u32 magic)
18{
19 char *arg;
20 int start_arg, i;
21
22 /*
23 * collect args and prepare cmd_line
24 */
25 if (!prom_is_rex(magic))
26 start_arg = 1;
27 else
28 start_arg = 2;
29 for (i = start_arg; i < argc; i++) {
30 arg = (void *)(long)(argv[i]);
31 strcat(arcs_cmdline, arg);
32 if (i < (argc - 1))
33 strcat(arcs_cmdline, " ");
34 }
35
36#ifdef PROM_DEBUG
37 printk("arcs_cmdline: %s\n", &(arcs_cmdline[0]));
38#endif
39}
diff --git a/arch/mips/dec/prom/console.c b/arch/mips/dec/prom/console.c
new file mode 100644
index 000000000000..cade16ec7e5a
--- /dev/null
+++ b/arch/mips/dec/prom/console.c
@@ -0,0 +1,55 @@
1/*
2 * arch/mips/dec/prom/console.c
3 *
4 * DECstation PROM-based early console support.
5 *
6 * Copyright (C) 2004 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#include <linux/console.h>
14#include <linux/init.h>
15#include <linux/kernel.h>
16
17#include <asm/dec/prom.h>
18
19static void __init prom_console_write(struct console *con, const char *s,
20 unsigned int c)
21{
22 static char sfmt[] __initdata = "%%%us";
23 char fmt[13];
24
25 snprintf(fmt, sizeof(fmt), sfmt, c);
26 prom_printf(fmt, s);
27}
28
29static struct console promcons __initdata = {
30 .name = "prom",
31 .write = prom_console_write,
32 .flags = CON_PRINTBUFFER,
33 .index = -1,
34};
35
36static int promcons_output __initdata = 0;
37
38void __init register_prom_console(void)
39{
40 if (!promcons_output) {
41 promcons_output = 1;
42 register_console(&promcons);
43 }
44}
45
46void __init unregister_prom_console(void)
47{
48 if (promcons_output) {
49 unregister_console(&promcons);
50 promcons_output = 0;
51 }
52}
53
54void disable_early_printk(void)
55 __attribute__((alias("unregister_prom_console")));
diff --git a/arch/mips/dec/prom/dectypes.h b/arch/mips/dec/prom/dectypes.h
new file mode 100644
index 000000000000..707b6f1f5a9d
--- /dev/null
+++ b/arch/mips/dec/prom/dectypes.h
@@ -0,0 +1,14 @@
1#ifndef DECTYPES
2#define DECTYPES
3
4#define DS2100_3100 1 /* DS2100/3100 Pmax */
5#define DS5000_200 2 /* DS5000/200 3max */
6#define DS5000_1XX 3 /* DS5000/1xx kmin */
7#define DS5000_2X0 4 /* DS5000/2x0 3max+ */
8#define DS5800 5 /* DS5800 Isis */
9#define DS5400 6 /* DS5400 MIPSfair */
10#define DS5000_XX 7 /* DS5000/xx maxine */
11#define DS5500 11 /* DS5500 MIPSfair-2 */
12#define DS5100 12 /* DS5100 MIPSmate */
13
14#endif
diff --git a/arch/mips/dec/prom/identify.c b/arch/mips/dec/prom/identify.c
new file mode 100644
index 000000000000..9380588cb15c
--- /dev/null
+++ b/arch/mips/dec/prom/identify.c
@@ -0,0 +1,177 @@
1/*
2 * identify.c: machine identification code.
3 *
4 * Copyright (C) 1998 Harald Koerfgen and Paul M. Antoine
5 * Copyright (C) 2002, 2003, 2004 Maciej W. Rozycki
6 */
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/mc146818rtc.h>
10#include <linux/module.h>
11#include <linux/string.h>
12#include <linux/types.h>
13
14#include <asm/bootinfo.h>
15#include <asm/dec/ioasic.h>
16#include <asm/dec/ioasic_addrs.h>
17#include <asm/dec/kn01.h>
18#include <asm/dec/kn02.h>
19#include <asm/dec/kn02ba.h>
20#include <asm/dec/kn02ca.h>
21#include <asm/dec/kn03.h>
22#include <asm/dec/kn230.h>
23#include <asm/dec/prom.h>
24
25#include "dectypes.h"
26
27extern unsigned long mips_machgroup;
28extern unsigned long mips_machtype;
29
30static const char *dec_system_strings[] = {
31 [MACH_DSUNKNOWN] "unknown DECstation",
32 [MACH_DS23100] "DECstation 2100/3100",
33 [MACH_DS5100] "DECsystem 5100",
34 [MACH_DS5000_200] "DECstation 5000/200",
35 [MACH_DS5000_1XX] "DECstation 5000/1xx",
36 [MACH_DS5000_XX] "Personal DECstation 5000/xx",
37 [MACH_DS5000_2X0] "DECstation 5000/2x0",
38 [MACH_DS5400] "DECsystem 5400",
39 [MACH_DS5500] "DECsystem 5500",
40 [MACH_DS5800] "DECsystem 5800",
41 [MACH_DS5900] "DECsystem 5900",
42};
43
44const char *get_system_type(void)
45{
46#define STR_BUF_LEN 64
47 static char system[STR_BUF_LEN];
48 static int called = 0;
49
50 if (called == 0) {
51 called = 1;
52 snprintf(system, STR_BUF_LEN, "Digital %s",
53 dec_system_strings[mips_machtype]);
54 }
55
56 return system;
57}
58
59
60/*
61 * Setup essential system-specific memory addresses. We need them
62 * early. Semantically the functions belong to prom/init.c, but they
63 * are compact enough we want them inlined. --macro
64 */
65volatile u8 *dec_rtc_base;
66
67EXPORT_SYMBOL(dec_rtc_base);
68
69static inline void prom_init_kn01(void)
70{
71 dec_rtc_base = (void *)KN01_RTC_BASE;
72 dec_kn_slot_size = KN01_SLOT_SIZE;
73}
74
75static inline void prom_init_kn230(void)
76{
77 dec_rtc_base = (void *)KN01_RTC_BASE;
78 dec_kn_slot_size = KN01_SLOT_SIZE;
79}
80
81static inline void prom_init_kn02(void)
82{
83 dec_rtc_base = (void *)KN02_RTC_BASE;
84 dec_kn_slot_size = KN02_SLOT_SIZE;
85}
86
87static inline void prom_init_kn02xa(void)
88{
89 ioasic_base = (void *)KN02XA_IOASIC_BASE;
90 dec_rtc_base = (void *)KN02XA_RTC_BASE;
91 dec_kn_slot_size = IOASIC_SLOT_SIZE;
92}
93
94static inline void prom_init_kn03(void)
95{
96 ioasic_base = (void *)KN03_IOASIC_BASE;
97 dec_rtc_base = (void *)KN03_RTC_BASE;
98 dec_kn_slot_size = IOASIC_SLOT_SIZE;
99}
100
101
102void __init prom_identify_arch(u32 magic)
103{
104 unsigned char dec_cpunum, dec_firmrev, dec_etc, dec_systype;
105 u32 dec_sysid;
106
107 if (!prom_is_rex(magic)) {
108 dec_sysid = simple_strtoul(prom_getenv("systype"),
109 (char **)0, 0);
110 } else {
111 dec_sysid = rex_getsysid();
112 if (dec_sysid == 0) {
113 printk("Zero sysid returned from PROM! "
114 "Assuming a PMAX-like machine.\n");
115 dec_sysid = 1;
116 }
117 }
118
119 dec_cpunum = (dec_sysid & 0xff000000) >> 24;
120 dec_systype = (dec_sysid & 0xff0000) >> 16;
121 dec_firmrev = (dec_sysid & 0xff00) >> 8;
122 dec_etc = dec_sysid & 0xff;
123
124 /* We're obviously one of the DEC machines */
125 mips_machgroup = MACH_GROUP_DEC;
126
127 /*
128 * FIXME: This may not be an exhaustive list of DECStations/Servers!
129 * Put all model-specific initialisation calls here.
130 */
131 switch (dec_systype) {
132 case DS2100_3100:
133 mips_machtype = MACH_DS23100;
134 prom_init_kn01();
135 break;
136 case DS5100: /* DS5100 MIPSMATE */
137 mips_machtype = MACH_DS5100;
138 prom_init_kn230();
139 break;
140 case DS5000_200: /* DS5000 3max */
141 mips_machtype = MACH_DS5000_200;
142 prom_init_kn02();
143 break;
144 case DS5000_1XX: /* DS5000/100 3min */
145 mips_machtype = MACH_DS5000_1XX;
146 prom_init_kn02xa();
147 break;
148 case DS5000_2X0: /* DS5000/240 3max+ or DS5900 bigmax */
149 mips_machtype = MACH_DS5000_2X0;
150 prom_init_kn03();
151 if (!(ioasic_read(IO_REG_SIR) & KN03_IO_INR_3MAXP))
152 mips_machtype = MACH_DS5900;
153 break;
154 case DS5000_XX: /* Personal DS5000/xx maxine */
155 mips_machtype = MACH_DS5000_XX;
156 prom_init_kn02xa();
157 break;
158 case DS5800: /* DS5800 Isis */
159 mips_machtype = MACH_DS5800;
160 break;
161 case DS5400: /* DS5400 MIPSfair */
162 mips_machtype = MACH_DS5400;
163 break;
164 case DS5500: /* DS5500 MIPSfair-2 */
165 mips_machtype = MACH_DS5500;
166 break;
167 default:
168 mips_machtype = MACH_DSUNKNOWN;
169 break;
170 }
171
172 if (mips_machtype == MACH_DSUNKNOWN)
173 printk("This is an %s, id is %x\n",
174 dec_system_strings[mips_machtype], dec_systype);
175 else
176 printk("This is a %s\n", dec_system_strings[mips_machtype]);
177}
diff --git a/arch/mips/dec/prom/init.c b/arch/mips/dec/prom/init.c
new file mode 100644
index 000000000000..60f74256e689
--- /dev/null
+++ b/arch/mips/dec/prom/init.c
@@ -0,0 +1,134 @@
1/*
2 * init.c: PROM library initialisation code.
3 *
4 * Copyright (C) 1998 Harald Koerfgen
5 * Copyright (C) 2002, 2004 Maciej W. Rozycki
6 */
7#include <linux/config.h>
8#include <linux/init.h>
9#include <linux/smp.h>
10#include <linux/string.h>
11#include <linux/types.h>
12
13#include <asm/bootinfo.h>
14#include <asm/cpu.h>
15#include <asm/processor.h>
16
17#include <asm/dec/prom.h>
18
19
20int (*__rex_bootinit)(void);
21int (*__rex_bootread)(void);
22int (*__rex_getbitmap)(memmap *);
23unsigned long *(*__rex_slot_address)(int);
24void *(*__rex_gettcinfo)(void);
25int (*__rex_getsysid)(void);
26void (*__rex_clear_cache)(void);
27
28int (*__prom_getchar)(void);
29char *(*__prom_getenv)(char *);
30int (*__prom_printf)(char *, ...);
31
32int (*__pmax_open)(char*, int);
33int (*__pmax_lseek)(int, long, int);
34int (*__pmax_read)(int, void *, int);
35int (*__pmax_close)(int);
36
37
38/*
39 * Detect which PROM the DECSTATION has, and set the callback vectors
40 * appropriately.
41 */
42void __init which_prom(s32 magic, s32 *prom_vec)
43{
44 /*
45 * No sign of the REX PROM's magic number means we assume a non-REX
46 * machine (i.e. we're on a DS2100/3100, DS5100 or DS5000/2xx)
47 */
48 if (prom_is_rex(magic)) {
49 /*
50 * Set up prom abstraction structure with REX entry points.
51 */
52 __rex_bootinit =
53 (void *)(long)*(prom_vec + REX_PROM_BOOTINIT);
54 __rex_bootread =
55 (void *)(long)*(prom_vec + REX_PROM_BOOTREAD);
56 __rex_getbitmap =
57 (void *)(long)*(prom_vec + REX_PROM_GETBITMAP);
58 __prom_getchar =
59 (void *)(long)*(prom_vec + REX_PROM_GETCHAR);
60 __prom_getenv =
61 (void *)(long)*(prom_vec + REX_PROM_GETENV);
62 __rex_getsysid =
63 (void *)(long)*(prom_vec + REX_PROM_GETSYSID);
64 __rex_gettcinfo =
65 (void *)(long)*(prom_vec + REX_PROM_GETTCINFO);
66 __prom_printf =
67 (void *)(long)*(prom_vec + REX_PROM_PRINTF);
68 __rex_slot_address =
69 (void *)(long)*(prom_vec + REX_PROM_SLOTADDR);
70 __rex_clear_cache =
71 (void *)(long)*(prom_vec + REX_PROM_CLEARCACHE);
72 } else {
73 /*
74 * Set up prom abstraction structure with non-REX entry points.
75 */
76 __prom_getchar = (void *)PMAX_PROM_GETCHAR;
77 __prom_getenv = (void *)PMAX_PROM_GETENV;
78 __prom_printf = (void *)PMAX_PROM_PRINTF;
79 __pmax_open = (void *)PMAX_PROM_OPEN;
80 __pmax_lseek = (void *)PMAX_PROM_LSEEK;
81 __pmax_read = (void *)PMAX_PROM_READ;
82 __pmax_close = (void *)PMAX_PROM_CLOSE;
83 }
84}
85
86void __init prom_init(void)
87{
88 extern void dec_machine_halt(void);
89 static char cpu_msg[] __initdata =
90 "Sorry, this kernel is compiled for a wrong CPU type!\n";
91 static char r3k_msg[] __initdata =
92 "Please recompile with \"CONFIG_CPU_R3000 = y\".\n";
93 static char r4k_msg[] __initdata =
94 "Please recompile with \"CONFIG_CPU_R4x00 = y\".\n";
95 s32 argc = fw_arg0;
96 s32 argv = fw_arg1;
97 u32 magic = fw_arg2;
98 s32 prom_vec = fw_arg3;
99
100 /*
101 * Determine which PROM we have
102 * (and therefore which machine we're on!)
103 */
104 which_prom(magic, prom_vec);
105
106 if (prom_is_rex(magic))
107 rex_clear_cache();
108
109 /* Register the early console. */
110 register_prom_console();
111
112 /* Were we compiled with the right CPU option? */
113#if defined(CONFIG_CPU_R3000)
114 if ((current_cpu_data.cputype == CPU_R4000SC) ||
115 (current_cpu_data.cputype == CPU_R4400SC)) {
116 printk(cpu_msg);
117 printk(r4k_msg);
118 dec_machine_halt();
119 }
120#endif
121
122#if defined(CONFIG_CPU_R4X00)
123 if ((current_cpu_data.cputype == CPU_R3000) ||
124 (current_cpu_data.cputype == CPU_R3000A)) {
125 printk(cpu_msg);
126 printk(r3k_msg);
127 dec_machine_halt();
128 }
129#endif
130
131 prom_meminit(magic);
132 prom_identify_arch(magic);
133 prom_init_cmdline(argc, argv, magic);
134}
diff --git a/arch/mips/dec/prom/locore.S b/arch/mips/dec/prom/locore.S
new file mode 100644
index 000000000000..d9acdcefee81
--- /dev/null
+++ b/arch/mips/dec/prom/locore.S
@@ -0,0 +1,30 @@
1/*
2 * locore.S
3 */
4#include <asm/asm.h>
5#include <asm/regdef.h>
6#include <asm/mipsregs.h>
7
8 .text
9
10/*
11 * Simple general exception handling routine. This one is used for the
12 * Memory sizing routine for pmax machines. HK
13 */
14
15NESTED(genexcept_early, 0, sp)
16 .set noat
17 .set noreorder
18
19 mfc0 k0, CP0_STATUS
20 la k1, mem_err
21
22 sw k0, 0(k1)
23
24 mfc0 k0, CP0_EPC
25 nop
26 addiu k0, 4 # skip the causing instruction
27 jr k0
28 rfe
29END(genexcept_early)
30
diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c
new file mode 100644
index 000000000000..e4f6f26425ea
--- /dev/null
+++ b/arch/mips/dec/prom/memory.c
@@ -0,0 +1,130 @@
1/*
2 * memory.c: memory initialisation code.
3 *
4 * Copyright (C) 1998 Harald Koerfgen, Frieder Streffer and Paul M. Antoine
5 * Copyright (C) 2000, 2002 Maciej W. Rozycki
6 */
7#include <linux/config.h>
8#include <linux/init.h>
9#include <linux/kernel.h>
10#include <linux/mm.h>
11#include <linux/bootmem.h>
12#include <linux/types.h>
13
14#include <asm/addrspace.h>
15#include <asm/bootinfo.h>
16#include <asm/dec/machtype.h>
17#include <asm/dec/prom.h>
18#include <asm/page.h>
19#include <asm/sections.h>
20
21
22volatile unsigned long mem_err = 0; /* So we know an error occurred */
23
24/*
25 * Probe memory in 4MB chunks, waiting for an error to tell us we've fallen
26 * off the end of real memory. Only suitable for the 2100/3100's (PMAX).
27 */
28
29#define CHUNK_SIZE 0x400000
30
31static inline void pmax_setup_memory_region(void)
32{
33 volatile unsigned char *memory_page, dummy;
34 char old_handler[0x80];
35 extern char genexcept_early;
36
37 /* Install exception handler */
38 memcpy(&old_handler, (void *)(KSEG0 + 0x80), 0x80);
39 memcpy((void *)(KSEG0 + 0x80), &genexcept_early, 0x80);
40
41 /* read unmapped and uncached (KSEG1)
42 * DECstations have at least 4MB RAM
43 * Assume less than 480MB of RAM, as this is max for 5000/2xx
44 * FIXME this should be replaced by the first free page!
45 */
46 for (memory_page = (unsigned char *) KSEG1 + CHUNK_SIZE;
47 (mem_err== 0) && (memory_page < ((unsigned char *) KSEG1+0x1E000000));
48 memory_page += CHUNK_SIZE) {
49 dummy = *memory_page;
50 }
51 memcpy((void *)(KSEG0 + 0x80), &old_handler, 0x80);
52
53 add_memory_region(0, (unsigned long)memory_page - KSEG1 - CHUNK_SIZE,
54 BOOT_MEM_RAM);
55}
56
57/*
58 * Use the REX prom calls to get hold of the memory bitmap, and thence
59 * determine memory size.
60 */
61static inline void rex_setup_memory_region(void)
62{
63 int i, bitmap_size;
64 unsigned long mem_start = 0, mem_size = 0;
65 memmap *bm;
66
67 /* some free 64k */
68 bm = (memmap *)KSEG0ADDR(0x28000);
69
70 bitmap_size = rex_getbitmap(bm);
71
72 for (i = 0; i < bitmap_size; i++) {
73 /* FIXME: very simplistically only add full sets of pages */
74 if (bm->bitmap[i] == 0xff)
75 mem_size += (8 * bm->pagesize);
76 else if (!mem_size)
77 mem_start += (8 * bm->pagesize);
78 else {
79 add_memory_region(mem_start, mem_size, BOOT_MEM_RAM);
80 mem_start += mem_size + (8 * bm->pagesize);
81 mem_size = 0;
82 }
83 }
84 if (mem_size)
85 add_memory_region(mem_start, mem_size, BOOT_MEM_RAM);
86}
87
88void __init prom_meminit(u32 magic)
89{
90 if (!prom_is_rex(magic))
91 pmax_setup_memory_region();
92 else
93 rex_setup_memory_region();
94}
95
96unsigned long __init prom_free_prom_memory(void)
97{
98 unsigned long addr, end;
99
100 /*
101 * Free everything below the kernel itself but leave
102 * the first page reserved for the exception handlers.
103 */
104
105#if defined(CONFIG_DECLANCE) || defined(CONFIG_DECLANCE_MODULE)
106 /*
107 * Leave 128 KB reserved for Lance memory for
108 * IOASIC DECstations.
109 *
110 * XXX: save this address for use in dec_lance.c?
111 */
112 if (IOASIC)
113 end = __pa(&_text) - 0x00020000;
114 else
115#endif
116 end = __pa(&_text);
117
118 addr = PAGE_SIZE;
119 while (addr < end) {
120 ClearPageReserved(virt_to_page(__va(addr)));
121 set_page_count(virt_to_page(__va(addr)), 1);
122 free_page((unsigned long)__va(addr));
123 addr += PAGE_SIZE;
124 }
125
126 printk("Freeing unused PROM memory: %ldk freed\n",
127 (end - PAGE_SIZE) >> 10);
128
129 return end - PAGE_SIZE;
130}
diff --git a/arch/mips/dec/promcon.c b/arch/mips/dec/promcon.c
new file mode 100644
index 000000000000..9f0972f5a702
--- /dev/null
+++ b/arch/mips/dec/promcon.c
@@ -0,0 +1,55 @@
1/*
2 * Wrap-around code for a console using the
3 * DECstation PROM io-routines.
4 *
5 * Copyright (c) 1998 Harald Koerfgen
6 */
7
8#include <linux/tty.h>
9#include <linux/ptrace.h>
10#include <linux/init.h>
11#include <linux/console.h>
12#include <linux/fs.h>
13
14#include <asm/dec/prom.h>
15
16static void prom_console_write(struct console *co, const char *s,
17 unsigned count)
18{
19 unsigned i;
20
21 /*
22 * Now, do each character
23 */
24 for (i = 0; i < count; i++) {
25 if (*s == 10)
26 prom_printf("%c", 13);
27 prom_printf("%c", *s++);
28 }
29}
30
31static int __init prom_console_setup(struct console *co, char *options)
32{
33 return 0;
34}
35
36static struct console sercons =
37{
38 .name = "ttyS",
39 .write = prom_console_write,
40 .setup = prom_console_setup,
41 .flags = CON_PRINTBUFFER,
42 .index = -1,
43};
44
45/*
46 * Register console.
47 */
48
49static int __init prom_console_init(void)
50{
51 register_console(&sercons);
52
53 return 0;
54}
55console_initcall(prom_console_init);
diff --git a/arch/mips/dec/reset.c b/arch/mips/dec/reset.c
new file mode 100644
index 000000000000..7e4d34d0573d
--- /dev/null
+++ b/arch/mips/dec/reset.c
@@ -0,0 +1,41 @@
1/*
2 * Reset a DECstation machine.
3 *
4 * Copyright (C) 199x the Anonymous
5 * Copyright (C) 2001, 2002, 2003 Maciej W. Rozycki
6 */
7#include <linux/interrupt.h>
8#include <linux/linkage.h>
9
10#include <asm/addrspace.h>
11#include <asm/ptrace.h>
12
13typedef void ATTRIB_NORET (* noret_func_t)(void);
14
15static inline void ATTRIB_NORET back_to_prom(void)
16{
17 noret_func_t func = (void *) KSEG1ADDR(0x1fc00000);
18
19 func();
20}
21
22void ATTRIB_NORET dec_machine_restart(char *command)
23{
24 back_to_prom();
25}
26
27void ATTRIB_NORET dec_machine_halt(void)
28{
29 back_to_prom();
30}
31
32void ATTRIB_NORET dec_machine_power_off(void)
33{
34 /* DECstations don't have a software power switch */
35 back_to_prom();
36}
37
38irqreturn_t dec_intr_halt(int irq, void *dev_id, struct pt_regs *regs)
39{
40 dec_machine_halt();
41}
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c
new file mode 100644
index 000000000000..6a69309baf40
--- /dev/null
+++ b/arch/mips/dec/setup.c
@@ -0,0 +1,750 @@
1/*
2 * Setup the interrupt stuff.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1998 Harald Koerfgen
9 * Copyright (C) 2000, 2001, 2002, 2003 Maciej W. Rozycki
10 */
11#include <linux/sched.h>
12#include <linux/interrupt.h>
13#include <linux/param.h>
14#include <linux/console.h>
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/spinlock.h>
18#include <linux/types.h>
19
20#include <asm/bootinfo.h>
21#include <asm/cpu.h>
22#include <asm/cpu-features.h>
23#include <asm/irq.h>
24#include <asm/irq_cpu.h>
25#include <asm/mipsregs.h>
26#include <asm/reboot.h>
27#include <asm/time.h>
28#include <asm/traps.h>
29#include <asm/wbflush.h>
30
31#include <asm/dec/interrupts.h>
32#include <asm/dec/ioasic.h>
33#include <asm/dec/ioasic_addrs.h>
34#include <asm/dec/ioasic_ints.h>
35#include <asm/dec/kn01.h>
36#include <asm/dec/kn02.h>
37#include <asm/dec/kn02ba.h>
38#include <asm/dec/kn02ca.h>
39#include <asm/dec/kn03.h>
40#include <asm/dec/kn230.h>
41
42
43extern void dec_machine_restart(char *command);
44extern void dec_machine_halt(void);
45extern void dec_machine_power_off(void);
46extern irqreturn_t dec_intr_halt(int irq, void *dev_id, struct pt_regs *regs);
47
48extern asmlinkage void decstation_handle_int(void);
49
50spinlock_t ioasic_ssr_lock;
51
52volatile u32 *ioasic_base;
53unsigned long dec_kn_slot_size;
54
55/*
56 * IRQ routing and priority tables. Priorites are set as follows:
57 *
58 * KN01 KN230 KN02 KN02-BA KN02-CA KN03
59 *
60 * MEMORY CPU CPU CPU ASIC CPU CPU
61 * RTC CPU CPU CPU ASIC CPU CPU
62 * DMA - - - ASIC ASIC ASIC
63 * SERIAL0 CPU CPU CSR ASIC ASIC ASIC
64 * SERIAL1 - - - ASIC - ASIC
65 * SCSI CPU CPU CSR ASIC ASIC ASIC
66 * ETHERNET CPU * CSR ASIC ASIC ASIC
67 * other - - - ASIC - -
68 * TC2 - - CSR CPU ASIC ASIC
69 * TC1 - - CSR CPU ASIC ASIC
70 * TC0 - - CSR CPU ASIC ASIC
71 * other - CPU - CPU ASIC ASIC
72 * other - - - - CPU CPU
73 *
74 * * -- shared with SCSI
75 */
76
77int dec_interrupt[DEC_NR_INTS] = {
78 [0 ... DEC_NR_INTS - 1] = -1
79};
80int_ptr cpu_mask_nr_tbl[DEC_MAX_CPU_INTS][2] = {
81 { { .i = ~0 }, { .p = dec_intr_unimplemented } },
82};
83int_ptr asic_mask_nr_tbl[DEC_MAX_ASIC_INTS][2] = {
84 { { .i = ~0 }, { .p = asic_intr_unimplemented } },
85};
86int cpu_fpu_mask = DEC_CPU_IRQ_MASK(DEC_CPU_INR_FPU);
87
88static struct irqaction ioirq = {
89 .handler = no_action,
90 .name = "cascade",
91};
92static struct irqaction fpuirq = {
93 .handler = no_action,
94 .name = "fpu",
95};
96
97static struct irqaction busirq = {
98 .flags = SA_INTERRUPT,
99 .name = "bus error",
100};
101
102static struct irqaction haltirq = {
103 .handler = dec_intr_halt,
104 .name = "halt",
105};
106
107
108/*
109 * Bus error (DBE/IBE exceptions and bus interrupts) handling setup.
110 */
111void __init dec_be_init(void)
112{
113 switch (mips_machtype) {
114 case MACH_DS23100: /* DS2100/DS3100 Pmin/Pmax */
115 busirq.flags |= SA_SHIRQ;
116 break;
117 case MACH_DS5000_200: /* DS5000/200 3max */
118 case MACH_DS5000_2X0: /* DS5000/240 3max+ */
119 case MACH_DS5900: /* DS5900 bigmax */
120 board_be_handler = dec_ecc_be_handler;
121 busirq.handler = dec_ecc_be_interrupt;
122 dec_ecc_be_init();
123 break;
124 }
125}
126
127
128extern void dec_time_init(void);
129extern void dec_timer_setup(struct irqaction *);
130
131static void __init decstation_setup(void)
132{
133 board_be_init = dec_be_init;
134 board_time_init = dec_time_init;
135 board_timer_setup = dec_timer_setup;
136
137 wbflush_setup();
138
139 _machine_restart = dec_machine_restart;
140 _machine_halt = dec_machine_halt;
141 _machine_power_off = dec_machine_power_off;
142}
143
144early_initcall(decstation_setup);
145
146/*
147 * Machine-specific initialisation for KN01, aka DS2100 (aka Pmin)
148 * or DS3100 (aka Pmax).
149 */
150static int kn01_interrupt[DEC_NR_INTS] __initdata = {
151 [DEC_IRQ_CASCADE] = -1,
152 [DEC_IRQ_AB_RECV] = -1,
153 [DEC_IRQ_AB_XMIT] = -1,
154 [DEC_IRQ_DZ11] = DEC_CPU_IRQ_NR(KN01_CPU_INR_DZ11),
155 [DEC_IRQ_ASC] = -1,
156 [DEC_IRQ_FLOPPY] = -1,
157 [DEC_IRQ_FPU] = DEC_CPU_IRQ_NR(DEC_CPU_INR_FPU),
158 [DEC_IRQ_HALT] = -1,
159 [DEC_IRQ_ISDN] = -1,
160 [DEC_IRQ_LANCE] = DEC_CPU_IRQ_NR(KN01_CPU_INR_LANCE),
161 [DEC_IRQ_BUS] = DEC_CPU_IRQ_NR(KN01_CPU_INR_BUS),
162 [DEC_IRQ_PSU] = -1,
163 [DEC_IRQ_RTC] = DEC_CPU_IRQ_NR(KN01_CPU_INR_RTC),
164 [DEC_IRQ_SCC0] = -1,
165 [DEC_IRQ_SCC1] = -1,
166 [DEC_IRQ_SII] = DEC_CPU_IRQ_NR(KN01_CPU_INR_SII),
167 [DEC_IRQ_TC0] = -1,
168 [DEC_IRQ_TC1] = -1,
169 [DEC_IRQ_TC2] = -1,
170 [DEC_IRQ_TIMER] = -1,
171 [DEC_IRQ_VIDEO] = DEC_CPU_IRQ_NR(KN01_CPU_INR_VIDEO),
172 [DEC_IRQ_ASC_MERR] = -1,
173 [DEC_IRQ_ASC_ERR] = -1,
174 [DEC_IRQ_ASC_DMA] = -1,
175 [DEC_IRQ_FLOPPY_ERR] = -1,
176 [DEC_IRQ_ISDN_ERR] = -1,
177 [DEC_IRQ_ISDN_RXDMA] = -1,
178 [DEC_IRQ_ISDN_TXDMA] = -1,
179 [DEC_IRQ_LANCE_MERR] = -1,
180 [DEC_IRQ_SCC0A_RXERR] = -1,
181 [DEC_IRQ_SCC0A_RXDMA] = -1,
182 [DEC_IRQ_SCC0A_TXERR] = -1,
183 [DEC_IRQ_SCC0A_TXDMA] = -1,
184 [DEC_IRQ_AB_RXERR] = -1,
185 [DEC_IRQ_AB_RXDMA] = -1,
186 [DEC_IRQ_AB_TXERR] = -1,
187 [DEC_IRQ_AB_TXDMA] = -1,
188 [DEC_IRQ_SCC1A_RXERR] = -1,
189 [DEC_IRQ_SCC1A_RXDMA] = -1,
190 [DEC_IRQ_SCC1A_TXERR] = -1,
191 [DEC_IRQ_SCC1A_TXDMA] = -1,
192};
193
194static int_ptr kn01_cpu_mask_nr_tbl[][2] __initdata = {
195 { { .i = DEC_CPU_IRQ_MASK(KN01_CPU_INR_BUS) },
196 { .i = DEC_CPU_IRQ_NR(KN01_CPU_INR_BUS) } },
197 { { .i = DEC_CPU_IRQ_MASK(KN01_CPU_INR_RTC) },
198 { .i = DEC_CPU_IRQ_NR(KN01_CPU_INR_RTC) } },
199 { { .i = DEC_CPU_IRQ_MASK(KN01_CPU_INR_DZ11) },
200 { .i = DEC_CPU_IRQ_NR(KN01_CPU_INR_DZ11) } },
201 { { .i = DEC_CPU_IRQ_MASK(KN01_CPU_INR_SII) },
202 { .i = DEC_CPU_IRQ_NR(KN01_CPU_INR_SII) } },
203 { { .i = DEC_CPU_IRQ_MASK(KN01_CPU_INR_LANCE) },
204 { .i = DEC_CPU_IRQ_NR(KN01_CPU_INR_LANCE) } },
205 { { .i = DEC_CPU_IRQ_ALL },
206 { .p = cpu_all_int } },
207};
208
209void __init dec_init_kn01(void)
210{
211 /* IRQ routing. */
212 memcpy(&dec_interrupt, &kn01_interrupt,
213 sizeof(kn01_interrupt));
214
215 /* CPU IRQ priorities. */
216 memcpy(&cpu_mask_nr_tbl, &kn01_cpu_mask_nr_tbl,
217 sizeof(kn01_cpu_mask_nr_tbl));
218
219 mips_cpu_irq_init(DEC_CPU_IRQ_BASE);
220
221} /* dec_init_kn01 */
222
223
224/*
225 * Machine-specific initialisation for KN230, aka DS5100, aka MIPSmate.
226 */
227static int kn230_interrupt[DEC_NR_INTS] __initdata = {
228 [DEC_IRQ_CASCADE] = -1,
229 [DEC_IRQ_AB_RECV] = -1,
230 [DEC_IRQ_AB_XMIT] = -1,
231 [DEC_IRQ_DZ11] = DEC_CPU_IRQ_NR(KN230_CPU_INR_DZ11),
232 [DEC_IRQ_ASC] = -1,
233 [DEC_IRQ_FLOPPY] = -1,
234 [DEC_IRQ_FPU] = DEC_CPU_IRQ_NR(DEC_CPU_INR_FPU),
235 [DEC_IRQ_HALT] = DEC_CPU_IRQ_NR(KN230_CPU_INR_HALT),
236 [DEC_IRQ_ISDN] = -1,
237 [DEC_IRQ_LANCE] = DEC_CPU_IRQ_NR(KN230_CPU_INR_LANCE),
238 [DEC_IRQ_BUS] = DEC_CPU_IRQ_NR(KN230_CPU_INR_BUS),
239 [DEC_IRQ_PSU] = -1,
240 [DEC_IRQ_RTC] = DEC_CPU_IRQ_NR(KN230_CPU_INR_RTC),
241 [DEC_IRQ_SCC0] = -1,
242 [DEC_IRQ_SCC1] = -1,
243 [DEC_IRQ_SII] = DEC_CPU_IRQ_NR(KN230_CPU_INR_SII),
244 [DEC_IRQ_TC0] = -1,
245 [DEC_IRQ_TC1] = -1,
246 [DEC_IRQ_TC2] = -1,
247 [DEC_IRQ_TIMER] = -1,
248 [DEC_IRQ_VIDEO] = -1,
249 [DEC_IRQ_ASC_MERR] = -1,
250 [DEC_IRQ_ASC_ERR] = -1,
251 [DEC_IRQ_ASC_DMA] = -1,
252 [DEC_IRQ_FLOPPY_ERR] = -1,
253 [DEC_IRQ_ISDN_ERR] = -1,
254 [DEC_IRQ_ISDN_RXDMA] = -1,
255 [DEC_IRQ_ISDN_TXDMA] = -1,
256 [DEC_IRQ_LANCE_MERR] = -1,
257 [DEC_IRQ_SCC0A_RXERR] = -1,
258 [DEC_IRQ_SCC0A_RXDMA] = -1,
259 [DEC_IRQ_SCC0A_TXERR] = -1,
260 [DEC_IRQ_SCC0A_TXDMA] = -1,
261 [DEC_IRQ_AB_RXERR] = -1,
262 [DEC_IRQ_AB_RXDMA] = -1,
263 [DEC_IRQ_AB_TXERR] = -1,
264 [DEC_IRQ_AB_TXDMA] = -1,
265 [DEC_IRQ_SCC1A_RXERR] = -1,
266 [DEC_IRQ_SCC1A_RXDMA] = -1,
267 [DEC_IRQ_SCC1A_TXERR] = -1,
268 [DEC_IRQ_SCC1A_TXDMA] = -1,
269};
270
271static int_ptr kn230_cpu_mask_nr_tbl[][2] __initdata = {
272 { { .i = DEC_CPU_IRQ_MASK(KN230_CPU_INR_BUS) },
273 { .i = DEC_CPU_IRQ_NR(KN230_CPU_INR_BUS) } },
274 { { .i = DEC_CPU_IRQ_MASK(KN230_CPU_INR_RTC) },
275 { .i = DEC_CPU_IRQ_NR(KN230_CPU_INR_RTC) } },
276 { { .i = DEC_CPU_IRQ_MASK(KN230_CPU_INR_DZ11) },
277 { .i = DEC_CPU_IRQ_NR(KN230_CPU_INR_DZ11) } },
278 { { .i = DEC_CPU_IRQ_MASK(KN230_CPU_INR_SII) },
279 { .i = DEC_CPU_IRQ_NR(KN230_CPU_INR_SII) } },
280 { { .i = DEC_CPU_IRQ_ALL },
281 { .p = cpu_all_int } },
282};
283
284void __init dec_init_kn230(void)
285{
286 /* IRQ routing. */
287 memcpy(&dec_interrupt, &kn230_interrupt,
288 sizeof(kn230_interrupt));
289
290 /* CPU IRQ priorities. */
291 memcpy(&cpu_mask_nr_tbl, &kn230_cpu_mask_nr_tbl,
292 sizeof(kn230_cpu_mask_nr_tbl));
293
294 mips_cpu_irq_init(DEC_CPU_IRQ_BASE);
295
296} /* dec_init_kn230 */
297
298
299/*
300 * Machine-specific initialisation for KN02, aka DS5000/200, aka 3max.
301 */
302static int kn02_interrupt[DEC_NR_INTS] __initdata = {
303 [DEC_IRQ_CASCADE] = DEC_CPU_IRQ_NR(KN02_CPU_INR_CASCADE),
304 [DEC_IRQ_AB_RECV] = -1,
305 [DEC_IRQ_AB_XMIT] = -1,
306 [DEC_IRQ_DZ11] = KN02_IRQ_NR(KN02_CSR_INR_DZ11),
307 [DEC_IRQ_ASC] = KN02_IRQ_NR(KN02_CSR_INR_ASC),
308 [DEC_IRQ_FLOPPY] = -1,
309 [DEC_IRQ_FPU] = DEC_CPU_IRQ_NR(DEC_CPU_INR_FPU),
310 [DEC_IRQ_HALT] = -1,
311 [DEC_IRQ_ISDN] = -1,
312 [DEC_IRQ_LANCE] = KN02_IRQ_NR(KN02_CSR_INR_LANCE),
313 [DEC_IRQ_BUS] = DEC_CPU_IRQ_NR(KN02_CPU_INR_BUS),
314 [DEC_IRQ_PSU] = -1,
315 [DEC_IRQ_RTC] = DEC_CPU_IRQ_NR(KN02_CPU_INR_RTC),
316 [DEC_IRQ_SCC0] = -1,
317 [DEC_IRQ_SCC1] = -1,
318 [DEC_IRQ_SII] = -1,
319 [DEC_IRQ_TC0] = KN02_IRQ_NR(KN02_CSR_INR_TC0),
320 [DEC_IRQ_TC1] = KN02_IRQ_NR(KN02_CSR_INR_TC1),
321 [DEC_IRQ_TC2] = KN02_IRQ_NR(KN02_CSR_INR_TC2),
322 [DEC_IRQ_TIMER] = -1,
323 [DEC_IRQ_VIDEO] = -1,
324 [DEC_IRQ_ASC_MERR] = -1,
325 [DEC_IRQ_ASC_ERR] = -1,
326 [DEC_IRQ_ASC_DMA] = -1,
327 [DEC_IRQ_FLOPPY_ERR] = -1,
328 [DEC_IRQ_ISDN_ERR] = -1,
329 [DEC_IRQ_ISDN_RXDMA] = -1,
330 [DEC_IRQ_ISDN_TXDMA] = -1,
331 [DEC_IRQ_LANCE_MERR] = -1,
332 [DEC_IRQ_SCC0A_RXERR] = -1,
333 [DEC_IRQ_SCC0A_RXDMA] = -1,
334 [DEC_IRQ_SCC0A_TXERR] = -1,
335 [DEC_IRQ_SCC0A_TXDMA] = -1,
336 [DEC_IRQ_AB_RXERR] = -1,
337 [DEC_IRQ_AB_RXDMA] = -1,
338 [DEC_IRQ_AB_TXERR] = -1,
339 [DEC_IRQ_AB_TXDMA] = -1,
340 [DEC_IRQ_SCC1A_RXERR] = -1,
341 [DEC_IRQ_SCC1A_RXDMA] = -1,
342 [DEC_IRQ_SCC1A_TXERR] = -1,
343 [DEC_IRQ_SCC1A_TXDMA] = -1,
344};
345
346static int_ptr kn02_cpu_mask_nr_tbl[][2] __initdata = {
347 { { .i = DEC_CPU_IRQ_MASK(KN02_CPU_INR_BUS) },
348 { .i = DEC_CPU_IRQ_NR(KN02_CPU_INR_BUS) } },
349 { { .i = DEC_CPU_IRQ_MASK(KN02_CPU_INR_RTC) },
350 { .i = DEC_CPU_IRQ_NR(KN02_CPU_INR_RTC) } },
351 { { .i = DEC_CPU_IRQ_MASK(KN02_CPU_INR_CASCADE) },
352 { .p = kn02_io_int } },
353 { { .i = DEC_CPU_IRQ_ALL },
354 { .p = cpu_all_int } },
355};
356
357static int_ptr kn02_asic_mask_nr_tbl[][2] __initdata = {
358 { { .i = KN02_IRQ_MASK(KN02_CSR_INR_DZ11) },
359 { .i = KN02_IRQ_NR(KN02_CSR_INR_DZ11) } },
360 { { .i = KN02_IRQ_MASK(KN02_CSR_INR_ASC) },
361 { .i = KN02_IRQ_NR(KN02_CSR_INR_ASC) } },
362 { { .i = KN02_IRQ_MASK(KN02_CSR_INR_LANCE) },
363 { .i = KN02_IRQ_NR(KN02_CSR_INR_LANCE) } },
364 { { .i = KN02_IRQ_MASK(KN02_CSR_INR_TC2) },
365 { .i = KN02_IRQ_NR(KN02_CSR_INR_TC2) } },
366 { { .i = KN02_IRQ_MASK(KN02_CSR_INR_TC1) },
367 { .i = KN02_IRQ_NR(KN02_CSR_INR_TC1) } },
368 { { .i = KN02_IRQ_MASK(KN02_CSR_INR_TC0) },
369 { .i = KN02_IRQ_NR(KN02_CSR_INR_TC0) } },
370 { { .i = KN02_IRQ_ALL },
371 { .p = kn02_all_int } },
372};
373
374void __init dec_init_kn02(void)
375{
376 /* IRQ routing. */
377 memcpy(&dec_interrupt, &kn02_interrupt,
378 sizeof(kn02_interrupt));
379
380 /* CPU IRQ priorities. */
381 memcpy(&cpu_mask_nr_tbl, &kn02_cpu_mask_nr_tbl,
382 sizeof(kn02_cpu_mask_nr_tbl));
383
384 /* KN02 CSR IRQ priorities. */
385 memcpy(&asic_mask_nr_tbl, &kn02_asic_mask_nr_tbl,
386 sizeof(kn02_asic_mask_nr_tbl));
387
388 mips_cpu_irq_init(DEC_CPU_IRQ_BASE);
389 init_kn02_irqs(KN02_IRQ_BASE);
390
391} /* dec_init_kn02 */
392
393
394/*
395 * Machine-specific initialisation for KN02-BA, aka DS5000/1xx
396 * (xx = 20, 25, 33), aka 3min. Also applies to KN04(-BA), aka
397 * DS5000/150, aka 4min.
398 */
399static int kn02ba_interrupt[DEC_NR_INTS] __initdata = {
400 [DEC_IRQ_CASCADE] = DEC_CPU_IRQ_NR(KN02BA_CPU_INR_CASCADE),
401 [DEC_IRQ_AB_RECV] = -1,
402 [DEC_IRQ_AB_XMIT] = -1,
403 [DEC_IRQ_DZ11] = -1,
404 [DEC_IRQ_ASC] = IO_IRQ_NR(KN02BA_IO_INR_ASC),
405 [DEC_IRQ_FLOPPY] = -1,
406 [DEC_IRQ_FPU] = DEC_CPU_IRQ_NR(DEC_CPU_INR_FPU),
407 [DEC_IRQ_HALT] = DEC_CPU_IRQ_NR(KN02BA_CPU_INR_HALT),
408 [DEC_IRQ_ISDN] = -1,
409 [DEC_IRQ_LANCE] = IO_IRQ_NR(KN02BA_IO_INR_LANCE),
410 [DEC_IRQ_BUS] = IO_IRQ_NR(KN02BA_IO_INR_BUS),
411 [DEC_IRQ_PSU] = IO_IRQ_NR(KN02BA_IO_INR_PSU),
412 [DEC_IRQ_RTC] = IO_IRQ_NR(KN02BA_IO_INR_RTC),
413 [DEC_IRQ_SCC0] = IO_IRQ_NR(KN02BA_IO_INR_SCC0),
414 [DEC_IRQ_SCC1] = IO_IRQ_NR(KN02BA_IO_INR_SCC1),
415 [DEC_IRQ_SII] = -1,
416 [DEC_IRQ_TC0] = DEC_CPU_IRQ_NR(KN02BA_CPU_INR_TC0),
417 [DEC_IRQ_TC1] = DEC_CPU_IRQ_NR(KN02BA_CPU_INR_TC1),
418 [DEC_IRQ_TC2] = DEC_CPU_IRQ_NR(KN02BA_CPU_INR_TC2),
419 [DEC_IRQ_TIMER] = -1,
420 [DEC_IRQ_VIDEO] = -1,
421 [DEC_IRQ_ASC_MERR] = IO_IRQ_NR(IO_INR_ASC_MERR),
422 [DEC_IRQ_ASC_ERR] = IO_IRQ_NR(IO_INR_ASC_ERR),
423 [DEC_IRQ_ASC_DMA] = IO_IRQ_NR(IO_INR_ASC_DMA),
424 [DEC_IRQ_FLOPPY_ERR] = -1,
425 [DEC_IRQ_ISDN_ERR] = -1,
426 [DEC_IRQ_ISDN_RXDMA] = -1,
427 [DEC_IRQ_ISDN_TXDMA] = -1,
428 [DEC_IRQ_LANCE_MERR] = IO_IRQ_NR(IO_INR_LANCE_MERR),
429 [DEC_IRQ_SCC0A_RXERR] = IO_IRQ_NR(IO_INR_SCC0A_RXERR),
430 [DEC_IRQ_SCC0A_RXDMA] = IO_IRQ_NR(IO_INR_SCC0A_RXDMA),
431 [DEC_IRQ_SCC0A_TXERR] = IO_IRQ_NR(IO_INR_SCC0A_TXERR),
432 [DEC_IRQ_SCC0A_TXDMA] = IO_IRQ_NR(IO_INR_SCC0A_TXDMA),
433 [DEC_IRQ_AB_RXERR] = -1,
434 [DEC_IRQ_AB_RXDMA] = -1,
435 [DEC_IRQ_AB_TXERR] = -1,
436 [DEC_IRQ_AB_TXDMA] = -1,
437 [DEC_IRQ_SCC1A_RXERR] = IO_IRQ_NR(IO_INR_SCC1A_RXERR),
438 [DEC_IRQ_SCC1A_RXDMA] = IO_IRQ_NR(IO_INR_SCC1A_RXDMA),
439 [DEC_IRQ_SCC1A_TXERR] = IO_IRQ_NR(IO_INR_SCC1A_TXERR),
440 [DEC_IRQ_SCC1A_TXDMA] = IO_IRQ_NR(IO_INR_SCC1A_TXDMA),
441};
442
443static int_ptr kn02ba_cpu_mask_nr_tbl[][2] __initdata = {
444 { { .i = DEC_CPU_IRQ_MASK(KN02BA_CPU_INR_CASCADE) },
445 { .p = kn02xa_io_int } },
446 { { .i = DEC_CPU_IRQ_MASK(KN02BA_CPU_INR_TC2) },
447 { .i = DEC_CPU_IRQ_NR(KN02BA_CPU_INR_TC2) } },
448 { { .i = DEC_CPU_IRQ_MASK(KN02BA_CPU_INR_TC1) },
449 { .i = DEC_CPU_IRQ_NR(KN02BA_CPU_INR_TC1) } },
450 { { .i = DEC_CPU_IRQ_MASK(KN02BA_CPU_INR_TC0) },
451 { .i = DEC_CPU_IRQ_NR(KN02BA_CPU_INR_TC0) } },
452 { { .i = DEC_CPU_IRQ_ALL },
453 { .p = cpu_all_int } },
454};
455
456static int_ptr kn02ba_asic_mask_nr_tbl[][2] __initdata = {
457 { { .i = IO_IRQ_MASK(KN02BA_IO_INR_BUS) },
458 { .i = IO_IRQ_NR(KN02BA_IO_INR_BUS) } },
459 { { .i = IO_IRQ_MASK(KN02BA_IO_INR_RTC) },
460 { .i = IO_IRQ_NR(KN02BA_IO_INR_RTC) } },
461 { { .i = IO_IRQ_DMA },
462 { .p = asic_dma_int } },
463 { { .i = IO_IRQ_MASK(KN02BA_IO_INR_SCC0) },
464 { .i = IO_IRQ_NR(KN02BA_IO_INR_SCC0) } },
465 { { .i = IO_IRQ_MASK(KN02BA_IO_INR_SCC1) },
466 { .i = IO_IRQ_NR(KN02BA_IO_INR_SCC1) } },
467 { { .i = IO_IRQ_MASK(KN02BA_IO_INR_ASC) },
468 { .i = IO_IRQ_NR(KN02BA_IO_INR_ASC) } },
469 { { .i = IO_IRQ_MASK(KN02BA_IO_INR_LANCE) },
470 { .i = IO_IRQ_NR(KN02BA_IO_INR_LANCE) } },
471 { { .i = IO_IRQ_ALL },
472 { .p = asic_all_int } },
473};
474
475void __init dec_init_kn02ba(void)
476{
477 /* IRQ routing. */
478 memcpy(&dec_interrupt, &kn02ba_interrupt,
479 sizeof(kn02ba_interrupt));
480
481 /* CPU IRQ priorities. */
482 memcpy(&cpu_mask_nr_tbl, &kn02ba_cpu_mask_nr_tbl,
483 sizeof(kn02ba_cpu_mask_nr_tbl));
484
485 /* I/O ASIC IRQ priorities. */
486 memcpy(&asic_mask_nr_tbl, &kn02ba_asic_mask_nr_tbl,
487 sizeof(kn02ba_asic_mask_nr_tbl));
488
489 mips_cpu_irq_init(DEC_CPU_IRQ_BASE);
490 init_ioasic_irqs(IO_IRQ_BASE);
491
492} /* dec_init_kn02ba */
493
494
495/*
496 * Machine-specific initialisation for KN02-CA, aka DS5000/xx,
497 * (xx = 20, 25, 33), aka MAXine. Also applies to KN04(-CA), aka
498 * DS5000/50, aka 4MAXine.
499 */
500static int kn02ca_interrupt[DEC_NR_INTS] __initdata = {
501 [DEC_IRQ_CASCADE] = DEC_CPU_IRQ_NR(KN02CA_CPU_INR_CASCADE),
502 [DEC_IRQ_AB_RECV] = IO_IRQ_NR(KN02CA_IO_INR_AB_RECV),
503 [DEC_IRQ_AB_XMIT] = IO_IRQ_NR(KN02CA_IO_INR_AB_XMIT),
504 [DEC_IRQ_DZ11] = -1,
505 [DEC_IRQ_ASC] = IO_IRQ_NR(KN02CA_IO_INR_ASC),
506 [DEC_IRQ_FLOPPY] = IO_IRQ_NR(KN02CA_IO_INR_FLOPPY),
507 [DEC_IRQ_FPU] = DEC_CPU_IRQ_NR(DEC_CPU_INR_FPU),
508 [DEC_IRQ_HALT] = DEC_CPU_IRQ_NR(KN02CA_CPU_INR_HALT),
509 [DEC_IRQ_ISDN] = IO_IRQ_NR(KN02CA_IO_INR_ISDN),
510 [DEC_IRQ_LANCE] = IO_IRQ_NR(KN02CA_IO_INR_LANCE),
511 [DEC_IRQ_BUS] = DEC_CPU_IRQ_NR(KN02CA_CPU_INR_BUS),
512 [DEC_IRQ_PSU] = -1,
513 [DEC_IRQ_RTC] = DEC_CPU_IRQ_NR(KN02CA_CPU_INR_RTC),
514 [DEC_IRQ_SCC0] = IO_IRQ_NR(KN02CA_IO_INR_SCC0),
515 [DEC_IRQ_SCC1] = -1,
516 [DEC_IRQ_SII] = -1,
517 [DEC_IRQ_TC0] = IO_IRQ_NR(KN02CA_IO_INR_TC0),
518 [DEC_IRQ_TC1] = IO_IRQ_NR(KN02CA_IO_INR_TC1),
519 [DEC_IRQ_TC2] = -1,
520 [DEC_IRQ_TIMER] = DEC_CPU_IRQ_NR(KN02CA_CPU_INR_TIMER),
521 [DEC_IRQ_VIDEO] = IO_IRQ_NR(KN02CA_IO_INR_VIDEO),
522 [DEC_IRQ_ASC_MERR] = IO_IRQ_NR(IO_INR_ASC_MERR),
523 [DEC_IRQ_ASC_ERR] = IO_IRQ_NR(IO_INR_ASC_ERR),
524 [DEC_IRQ_ASC_DMA] = IO_IRQ_NR(IO_INR_ASC_DMA),
525 [DEC_IRQ_FLOPPY_ERR] = IO_IRQ_NR(IO_INR_FLOPPY_ERR),
526 [DEC_IRQ_ISDN_ERR] = IO_IRQ_NR(IO_INR_ISDN_ERR),
527 [DEC_IRQ_ISDN_RXDMA] = IO_IRQ_NR(IO_INR_ISDN_RXDMA),
528 [DEC_IRQ_ISDN_TXDMA] = IO_IRQ_NR(IO_INR_ISDN_TXDMA),
529 [DEC_IRQ_LANCE_MERR] = IO_IRQ_NR(IO_INR_LANCE_MERR),
530 [DEC_IRQ_SCC0A_RXERR] = IO_IRQ_NR(IO_INR_SCC0A_RXERR),
531 [DEC_IRQ_SCC0A_RXDMA] = IO_IRQ_NR(IO_INR_SCC0A_RXDMA),
532 [DEC_IRQ_SCC0A_TXERR] = IO_IRQ_NR(IO_INR_SCC0A_TXERR),
533 [DEC_IRQ_SCC0A_TXDMA] = IO_IRQ_NR(IO_INR_SCC0A_TXDMA),
534 [DEC_IRQ_AB_RXERR] = IO_IRQ_NR(IO_INR_AB_RXERR),
535 [DEC_IRQ_AB_RXDMA] = IO_IRQ_NR(IO_INR_AB_RXDMA),
536 [DEC_IRQ_AB_TXERR] = IO_IRQ_NR(IO_INR_AB_TXERR),
537 [DEC_IRQ_AB_TXDMA] = IO_IRQ_NR(IO_INR_AB_TXDMA),
538 [DEC_IRQ_SCC1A_RXERR] = -1,
539 [DEC_IRQ_SCC1A_RXDMA] = -1,
540 [DEC_IRQ_SCC1A_TXERR] = -1,
541 [DEC_IRQ_SCC1A_TXDMA] = -1,
542};
543
544static int_ptr kn02ca_cpu_mask_nr_tbl[][2] __initdata = {
545 { { .i = DEC_CPU_IRQ_MASK(KN02CA_CPU_INR_BUS) },
546 { .i = DEC_CPU_IRQ_NR(KN02CA_CPU_INR_BUS) } },
547 { { .i = DEC_CPU_IRQ_MASK(KN02CA_CPU_INR_RTC) },
548 { .i = DEC_CPU_IRQ_NR(KN02CA_CPU_INR_RTC) } },
549 { { .i = DEC_CPU_IRQ_MASK(KN02CA_CPU_INR_CASCADE) },
550 { .p = kn02xa_io_int } },
551 { { .i = DEC_CPU_IRQ_ALL },
552 { .p = cpu_all_int } },
553};
554
555static int_ptr kn02ca_asic_mask_nr_tbl[][2] __initdata = {
556 { { .i = IO_IRQ_DMA },
557 { .p = asic_dma_int } },
558 { { .i = IO_IRQ_MASK(KN02CA_IO_INR_SCC0) },
559 { .i = IO_IRQ_NR(KN02CA_IO_INR_SCC0) } },
560 { { .i = IO_IRQ_MASK(KN02CA_IO_INR_ASC) },
561 { .i = IO_IRQ_NR(KN02CA_IO_INR_ASC) } },
562 { { .i = IO_IRQ_MASK(KN02CA_IO_INR_LANCE) },
563 { .i = IO_IRQ_NR(KN02CA_IO_INR_LANCE) } },
564 { { .i = IO_IRQ_MASK(KN02CA_IO_INR_TC1) },
565 { .i = IO_IRQ_NR(KN02CA_IO_INR_TC1) } },
566 { { .i = IO_IRQ_MASK(KN02CA_IO_INR_TC0) },
567 { .i = IO_IRQ_NR(KN02CA_IO_INR_TC0) } },
568 { { .i = IO_IRQ_ALL },
569 { .p = asic_all_int } },
570};
571
572void __init dec_init_kn02ca(void)
573{
574 /* IRQ routing. */
575 memcpy(&dec_interrupt, &kn02ca_interrupt,
576 sizeof(kn02ca_interrupt));
577
578 /* CPU IRQ priorities. */
579 memcpy(&cpu_mask_nr_tbl, &kn02ca_cpu_mask_nr_tbl,
580 sizeof(kn02ca_cpu_mask_nr_tbl));
581
582 /* I/O ASIC IRQ priorities. */
583 memcpy(&asic_mask_nr_tbl, &kn02ca_asic_mask_nr_tbl,
584 sizeof(kn02ca_asic_mask_nr_tbl));
585
586 mips_cpu_irq_init(DEC_CPU_IRQ_BASE);
587 init_ioasic_irqs(IO_IRQ_BASE);
588
589} /* dec_init_kn02ca */
590
591
592/*
593 * Machine-specific initialisation for KN03, aka DS5000/240,
594 * aka 3max+ and DS5900, aka BIGmax. Also applies to KN05, aka
595 * DS5000/260, aka 4max+ and DS5900/260.
596 */
597static int kn03_interrupt[DEC_NR_INTS] __initdata = {
598 [DEC_IRQ_CASCADE] = DEC_CPU_IRQ_NR(KN03_CPU_INR_CASCADE),
599 [DEC_IRQ_AB_RECV] = -1,
600 [DEC_IRQ_AB_XMIT] = -1,
601 [DEC_IRQ_DZ11] = -1,
602 [DEC_IRQ_ASC] = IO_IRQ_NR(KN03_IO_INR_ASC),
603 [DEC_IRQ_FLOPPY] = -1,
604 [DEC_IRQ_FPU] = DEC_CPU_IRQ_NR(DEC_CPU_INR_FPU),
605 [DEC_IRQ_HALT] = DEC_CPU_IRQ_NR(KN03_CPU_INR_HALT),
606 [DEC_IRQ_ISDN] = -1,
607 [DEC_IRQ_LANCE] = IO_IRQ_NR(KN03_IO_INR_LANCE),
608 [DEC_IRQ_BUS] = DEC_CPU_IRQ_NR(KN03_CPU_INR_BUS),
609 [DEC_IRQ_PSU] = IO_IRQ_NR(KN03_IO_INR_PSU),
610 [DEC_IRQ_RTC] = DEC_CPU_IRQ_NR(KN03_CPU_INR_RTC),
611 [DEC_IRQ_SCC0] = IO_IRQ_NR(KN03_IO_INR_SCC0),
612 [DEC_IRQ_SCC1] = IO_IRQ_NR(KN03_IO_INR_SCC1),
613 [DEC_IRQ_SII] = -1,
614 [DEC_IRQ_TC0] = IO_IRQ_NR(KN03_IO_INR_TC0),
615 [DEC_IRQ_TC1] = IO_IRQ_NR(KN03_IO_INR_TC1),
616 [DEC_IRQ_TC2] = IO_IRQ_NR(KN03_IO_INR_TC2),
617 [DEC_IRQ_TIMER] = -1,
618 [DEC_IRQ_VIDEO] = -1,
619 [DEC_IRQ_ASC_MERR] = IO_IRQ_NR(IO_INR_ASC_MERR),
620 [DEC_IRQ_ASC_ERR] = IO_IRQ_NR(IO_INR_ASC_ERR),
621 [DEC_IRQ_ASC_DMA] = IO_IRQ_NR(IO_INR_ASC_DMA),
622 [DEC_IRQ_FLOPPY_ERR] = -1,
623 [DEC_IRQ_ISDN_ERR] = -1,
624 [DEC_IRQ_ISDN_RXDMA] = -1,
625 [DEC_IRQ_ISDN_TXDMA] = -1,
626 [DEC_IRQ_LANCE_MERR] = IO_IRQ_NR(IO_INR_LANCE_MERR),
627 [DEC_IRQ_SCC0A_RXERR] = IO_IRQ_NR(IO_INR_SCC0A_RXERR),
628 [DEC_IRQ_SCC0A_RXDMA] = IO_IRQ_NR(IO_INR_SCC0A_RXDMA),
629 [DEC_IRQ_SCC0A_TXERR] = IO_IRQ_NR(IO_INR_SCC0A_TXERR),
630 [DEC_IRQ_SCC0A_TXDMA] = IO_IRQ_NR(IO_INR_SCC0A_TXDMA),
631 [DEC_IRQ_AB_RXERR] = -1,
632 [DEC_IRQ_AB_RXDMA] = -1,
633 [DEC_IRQ_AB_TXERR] = -1,
634 [DEC_IRQ_AB_TXDMA] = -1,
635 [DEC_IRQ_SCC1A_RXERR] = IO_IRQ_NR(IO_INR_SCC1A_RXERR),
636 [DEC_IRQ_SCC1A_RXDMA] = IO_IRQ_NR(IO_INR_SCC1A_RXDMA),
637 [DEC_IRQ_SCC1A_TXERR] = IO_IRQ_NR(IO_INR_SCC1A_TXERR),
638 [DEC_IRQ_SCC1A_TXDMA] = IO_IRQ_NR(IO_INR_SCC1A_TXDMA),
639};
640
641static int_ptr kn03_cpu_mask_nr_tbl[][2] __initdata = {
642 { { .i = DEC_CPU_IRQ_MASK(KN03_CPU_INR_BUS) },
643 { .i = DEC_CPU_IRQ_NR(KN03_CPU_INR_BUS) } },
644 { { .i = DEC_CPU_IRQ_MASK(KN03_CPU_INR_RTC) },
645 { .i = DEC_CPU_IRQ_NR(KN03_CPU_INR_RTC) } },
646 { { .i = DEC_CPU_IRQ_MASK(KN03_CPU_INR_CASCADE) },
647 { .p = kn03_io_int } },
648 { { .i = DEC_CPU_IRQ_ALL },
649 { .p = cpu_all_int } },
650};
651
652static int_ptr kn03_asic_mask_nr_tbl[][2] __initdata = {
653 { { .i = IO_IRQ_DMA },
654 { .p = asic_dma_int } },
655 { { .i = IO_IRQ_MASK(KN03_IO_INR_SCC0) },
656 { .i = IO_IRQ_NR(KN03_IO_INR_SCC0) } },
657 { { .i = IO_IRQ_MASK(KN03_IO_INR_SCC1) },
658 { .i = IO_IRQ_NR(KN03_IO_INR_SCC1) } },
659 { { .i = IO_IRQ_MASK(KN03_IO_INR_ASC) },
660 { .i = IO_IRQ_NR(KN03_IO_INR_ASC) } },
661 { { .i = IO_IRQ_MASK(KN03_IO_INR_LANCE) },
662 { .i = IO_IRQ_NR(KN03_IO_INR_LANCE) } },
663 { { .i = IO_IRQ_MASK(KN03_IO_INR_TC2) },
664 { .i = IO_IRQ_NR(KN03_IO_INR_TC2) } },
665 { { .i = IO_IRQ_MASK(KN03_IO_INR_TC1) },
666 { .i = IO_IRQ_NR(KN03_IO_INR_TC1) } },
667 { { .i = IO_IRQ_MASK(KN03_IO_INR_TC0) },
668 { .i = IO_IRQ_NR(KN03_IO_INR_TC0) } },
669 { { .i = IO_IRQ_ALL },
670 { .p = asic_all_int } },
671};
672
673void __init dec_init_kn03(void)
674{
675 /* IRQ routing. */
676 memcpy(&dec_interrupt, &kn03_interrupt,
677 sizeof(kn03_interrupt));
678
679 /* CPU IRQ priorities. */
680 memcpy(&cpu_mask_nr_tbl, &kn03_cpu_mask_nr_tbl,
681 sizeof(kn03_cpu_mask_nr_tbl));
682
683 /* I/O ASIC IRQ priorities. */
684 memcpy(&asic_mask_nr_tbl, &kn03_asic_mask_nr_tbl,
685 sizeof(kn03_asic_mask_nr_tbl));
686
687 mips_cpu_irq_init(DEC_CPU_IRQ_BASE);
688 init_ioasic_irqs(IO_IRQ_BASE);
689
690} /* dec_init_kn03 */
691
692
693void __init arch_init_irq(void)
694{
695 switch (mips_machtype) {
696 case MACH_DS23100: /* DS2100/DS3100 Pmin/Pmax */
697 dec_init_kn01();
698 break;
699 case MACH_DS5100: /* DS5100 MIPSmate */
700 dec_init_kn230();
701 break;
702 case MACH_DS5000_200: /* DS5000/200 3max */
703 dec_init_kn02();
704 break;
705 case MACH_DS5000_1XX: /* DS5000/1xx 3min */
706 dec_init_kn02ba();
707 break;
708 case MACH_DS5000_2X0: /* DS5000/240 3max+ */
709 case MACH_DS5900: /* DS5900 bigmax */
710 dec_init_kn03();
711 break;
712 case MACH_DS5000_XX: /* Personal DS5000/xx */
713 dec_init_kn02ca();
714 break;
715 case MACH_DS5800: /* DS5800 Isis */
716 panic("Don't know how to set this up!");
717 break;
718 case MACH_DS5400: /* DS5400 MIPSfair */
719 panic("Don't know how to set this up!");
720 break;
721 case MACH_DS5500: /* DS5500 MIPSfair-2 */
722 panic("Don't know how to set this up!");
723 break;
724 }
725 set_except_vector(0, decstation_handle_int);
726
727 /* Free the FPU interrupt if the exception is present. */
728 if (!cpu_has_nofpuex) {
729 cpu_fpu_mask = 0;
730 dec_interrupt[DEC_IRQ_FPU] = -1;
731 }
732
733 /* Register board interrupts: FPU and cascade. */
734 if (dec_interrupt[DEC_IRQ_FPU] >= 0)
735 setup_irq(dec_interrupt[DEC_IRQ_FPU], &fpuirq);
736 if (dec_interrupt[DEC_IRQ_CASCADE] >= 0)
737 setup_irq(dec_interrupt[DEC_IRQ_CASCADE], &ioirq);
738
739 /* Register the bus error interrupt. */
740 if (dec_interrupt[DEC_IRQ_BUS] >= 0 && busirq.handler)
741 setup_irq(dec_interrupt[DEC_IRQ_BUS], &busirq);
742
743 /* Register the HALT interrupt. */
744 if (dec_interrupt[DEC_IRQ_HALT] >= 0)
745 setup_irq(dec_interrupt[DEC_IRQ_HALT], &haltirq);
746}
747
748EXPORT_SYMBOL(ioasic_base);
749EXPORT_SYMBOL(dec_kn_slot_size);
750EXPORT_SYMBOL(dec_interrupt);
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c
new file mode 100644
index 000000000000..dc7091caa7aa
--- /dev/null
+++ b/arch/mips/dec/time.c
@@ -0,0 +1,200 @@
1/*
2 * linux/arch/mips/dec/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 * Copyright (C) 2000, 2003 Maciej W. Rozycki
6 *
7 * This file contains the time handling details for PC-style clocks as
8 * found in some MIPS systems.
9 *
10 */
11#include <linux/bcd.h>
12#include <linux/errno.h>
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/kernel.h>
16#include <linux/mc146818rtc.h>
17#include <linux/mm.h>
18#include <linux/module.h>
19#include <linux/param.h>
20#include <linux/sched.h>
21#include <linux/string.h>
22#include <linux/time.h>
23#include <linux/types.h>
24
25#include <asm/bootinfo.h>
26#include <asm/cpu.h>
27#include <asm/div64.h>
28#include <asm/io.h>
29#include <asm/irq.h>
30#include <asm/mipsregs.h>
31#include <asm/sections.h>
32#include <asm/time.h>
33
34#include <asm/dec/interrupts.h>
35#include <asm/dec/ioasic.h>
36#include <asm/dec/ioasic_addrs.h>
37#include <asm/dec/machtype.h>
38
39
40static unsigned long dec_rtc_get_time(void)
41{
42 unsigned int year, mon, day, hour, min, sec, real_year;
43 int i;
44
45 /* The Linux interpretation of the DS1287 clock register contents:
46 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
47 * RTC registers show the second which has precisely just started.
48 * Let's hope other operating systems interpret the RTC the same way.
49 */
50 /* read RTC exactly on falling edge of update flag */
51 for (i = 0; i < 1000000; i++) /* may take up to 1 second... */
52 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
53 break;
54 for (i = 0; i < 1000000; i++) /* must try at least 2.228 ms */
55 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
56 break;
57 /* Isn't this overkill? UIP above should guarantee consistency */
58 do {
59 sec = CMOS_READ(RTC_SECONDS);
60 min = CMOS_READ(RTC_MINUTES);
61 hour = CMOS_READ(RTC_HOURS);
62 day = CMOS_READ(RTC_DAY_OF_MONTH);
63 mon = CMOS_READ(RTC_MONTH);
64 year = CMOS_READ(RTC_YEAR);
65 } while (sec != CMOS_READ(RTC_SECONDS));
66 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
67 sec = BCD2BIN(sec);
68 min = BCD2BIN(min);
69 hour = BCD2BIN(hour);
70 day = BCD2BIN(day);
71 mon = BCD2BIN(mon);
72 year = BCD2BIN(year);
73 }
74 /*
75 * The PROM will reset the year to either '72 or '73.
76 * Therefore we store the real year separately, in one
77 * of unused BBU RAM locations.
78 */
79 real_year = CMOS_READ(RTC_DEC_YEAR);
80 year += real_year - 72 + 2000;
81
82 return mktime(year, mon, day, hour, min, sec);
83}
84
85/*
86 * In order to set the CMOS clock precisely, dec_rtc_set_mmss has to
87 * be called 500 ms after the second nowtime has started, because when
88 * nowtime is written into the registers of the CMOS clock, it will
89 * jump to the next second precisely 500 ms later. Check the Dallas
90 * DS1287 data sheet for details.
91 */
92static int dec_rtc_set_mmss(unsigned long nowtime)
93{
94 int retval = 0;
95 int real_seconds, real_minutes, cmos_minutes;
96 unsigned char save_control, save_freq_select;
97
98 /* tell the clock it's being set */
99 save_control = CMOS_READ(RTC_CONTROL);
100 CMOS_WRITE((save_control | RTC_SET), RTC_CONTROL);
101
102 /* stop and reset prescaler */
103 save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
104 CMOS_WRITE((save_freq_select | RTC_DIV_RESET2), RTC_FREQ_SELECT);
105
106 cmos_minutes = CMOS_READ(RTC_MINUTES);
107 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
108 cmos_minutes = BCD2BIN(cmos_minutes);
109
110 /*
111 * since we're only adjusting minutes and seconds,
112 * don't interfere with hour overflow. This avoids
113 * messing with unknown time zones but requires your
114 * RTC not to be off by more than 15 minutes
115 */
116 real_seconds = nowtime % 60;
117 real_minutes = nowtime / 60;
118 if (((abs(real_minutes - cmos_minutes) + 15) / 30) & 1)
119 real_minutes += 30; /* correct for half hour time zone */
120 real_minutes %= 60;
121
122 if (abs(real_minutes - cmos_minutes) < 30) {
123 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
124 real_seconds = BIN2BCD(real_seconds);
125 real_minutes = BIN2BCD(real_minutes);
126 }
127 CMOS_WRITE(real_seconds, RTC_SECONDS);
128 CMOS_WRITE(real_minutes, RTC_MINUTES);
129 } else {
130 printk(KERN_WARNING
131 "set_rtc_mmss: can't update from %d to %d\n",
132 cmos_minutes, real_minutes);
133 retval = -1;
134 }
135
136 /* The following flags have to be released exactly in this order,
137 * otherwise the DS1287 will not reset the oscillator and will not
138 * update precisely 500 ms later. You won't find this mentioned
139 * in the Dallas Semiconductor data sheets, but who believes data
140 * sheets anyway ... -- Markus Kuhn
141 */
142 CMOS_WRITE(save_control, RTC_CONTROL);
143 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
144
145 return retval;
146}
147
148
149static int dec_timer_state(void)
150{
151 return (CMOS_READ(RTC_REG_C) & RTC_PF) != 0;
152}
153
154static void dec_timer_ack(void)
155{
156 CMOS_READ(RTC_REG_C); /* Ack the RTC interrupt. */
157}
158
159static unsigned int dec_ioasic_hpt_read(void)
160{
161 /*
162 * The free-running counter is 32-bit which is good for about
163 * 2 minutes, 50 seconds at possible count rates of up to 25MHz.
164 */
165 return ioasic_read(IO_REG_FCTR);
166}
167
168static void dec_ioasic_hpt_init(unsigned int count)
169{
170 ioasic_write(IO_REG_FCTR, ioasic_read(IO_REG_FCTR) - count);
171}
172
173
174void __init dec_time_init(void)
175{
176 rtc_get_time = dec_rtc_get_time;
177 rtc_set_mmss = dec_rtc_set_mmss;
178
179 mips_timer_state = dec_timer_state;
180 mips_timer_ack = dec_timer_ack;
181
182 if (!cpu_has_counter && IOASIC) {
183 /* For pre-R4k systems we use the I/O ASIC's counter. */
184 mips_hpt_read = dec_ioasic_hpt_read;
185 mips_hpt_init = dec_ioasic_hpt_init;
186 }
187
188 /* Set up the rate of periodic DS1287 interrupts. */
189 CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - LOG_2_HZ), RTC_REG_A);
190}
191
192EXPORT_SYMBOL(do_settimeofday);
193
194void __init dec_timer_setup(struct irqaction *irq)
195{
196 setup_irq(dec_interrupt[DEC_IRQ_RTC], irq);
197
198 /* Enable periodic DS1287 interrupts. */
199 CMOS_WRITE(CMOS_READ(RTC_REG_B) | RTC_PIE, RTC_REG_B);
200}
diff --git a/arch/mips/dec/wbflush.c b/arch/mips/dec/wbflush.c
new file mode 100644
index 000000000000..925c0525344b
--- /dev/null
+++ b/arch/mips/dec/wbflush.c
@@ -0,0 +1,94 @@
1/*
2 * Setup the right wbflush routine for the different DECstations.
3 *
4 * Created with information from:
5 * DECstation 3100 Desktop Workstation Functional Specification
6 * DECstation 5000/200 KN02 System Module Functional Specification
7 * mipsel-linux-objdump --disassemble vmunix | grep "wbflush" :-)
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 *
13 * Copyright (C) 1998 Harald Koerfgen
14 * Copyright (C) 2002 Maciej W. Rozycki
15 */
16
17#include <linux/init.h>
18
19#include <asm/bootinfo.h>
20#include <asm/system.h>
21#include <asm/wbflush.h>
22
23static void wbflush_kn01(void);
24static void wbflush_kn210(void);
25static void wbflush_mips(void);
26
27void (*__wbflush) (void);
28
29void __init wbflush_setup(void)
30{
31 switch (mips_machtype) {
32 case MACH_DS23100:
33 case MACH_DS5000_200: /* DS5000 3max */
34 __wbflush = wbflush_kn01;
35 break;
36 case MACH_DS5100: /* DS5100 MIPSMATE */
37 __wbflush = wbflush_kn210;
38 break;
39 case MACH_DS5000_1XX: /* DS5000/100 3min */
40 case MACH_DS5000_XX: /* Personal DS5000/2x */
41 case MACH_DS5000_2X0: /* DS5000/240 3max+ */
42 case MACH_DS5900: /* DS5900 bigmax */
43 default:
44 __wbflush = wbflush_mips;
45 break;
46 }
47}
48
49/*
50 * For the DS3100 and DS5000/200 the R2020/R3220 writeback buffer functions
51 * as part of Coprocessor 0.
52 */
53static void wbflush_kn01(void)
54{
55 asm(".set\tpush\n\t"
56 ".set\tnoreorder\n\t"
57 "1:\tbc0f\t1b\n\t"
58 "nop\n\t"
59 ".set\tpop");
60}
61
62/*
63 * For the DS5100 the writeback buffer seems to be a part of Coprocessor 3.
64 * But CP3 has to enabled first.
65 */
66static void wbflush_kn210(void)
67{
68 asm(".set\tpush\n\t"
69 ".set\tnoreorder\n\t"
70 "mfc0\t$2,$12\n\t"
71 "lui\t$3,0x8000\n\t"
72 "or\t$3,$2,$3\n\t"
73 "mtc0\t$3,$12\n\t"
74 "nop\n"
75 "1:\tbc3f\t1b\n\t"
76 "nop\n\t"
77 "mtc0\t$2,$12\n\t"
78 "nop\n\t"
79 ".set\tpop"
80 : : : "$2", "$3");
81}
82
83/*
84 * I/O ASIC systems use a standard writeback buffer that gets flushed
85 * upon an uncached read.
86 */
87static void wbflush_mips(void)
88{
89 __fast_iob();
90}
91
92#include <linux/module.h>
93
94EXPORT_SYMBOL(__wbflush);
diff --git a/arch/mips/defconfig b/arch/mips/defconfig
new file mode 100644
index 000000000000..d55fe665926f
--- /dev/null
+++ b/arch/mips/defconfig
@@ -0,0 +1,962 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2
4# Wed Jan 26 02:48:59 2005
5#
6CONFIG_MIPS=y
7# CONFIG_MIPS64 is not set
8# CONFIG_64BIT is not set
9CONFIG_MIPS32=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16CONFIG_BROKEN_ON_SMP=y
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24# CONFIG_POSIX_MQUEUE is not set
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_KOBJECT_UEVENT=y
31CONFIG_IKCONFIG=y
32CONFIG_IKCONFIG_PROC=y
33CONFIG_EMBEDDED=y
34CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_FUTEX=y
37CONFIG_EPOLL=y
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SHMEM=y
40CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0
44# CONFIG_TINY_SHMEM is not set
45
46#
47# Loadable module support
48#
49CONFIG_MODULES=y
50CONFIG_MODULE_UNLOAD=y
51# CONFIG_MODULE_FORCE_UNLOAD is not set
52CONFIG_OBSOLETE_MODPARM=y
53CONFIG_MODVERSIONS=y
54CONFIG_MODULE_SRCVERSION_ALL=y
55CONFIG_KMOD=y
56
57#
58# Machine selection
59#
60# CONFIG_MACH_JAZZ is not set
61# CONFIG_MACH_VR41XX is not set
62# CONFIG_TOSHIBA_JMR3927 is not set
63# CONFIG_MIPS_COBALT is not set
64# CONFIG_MACH_DECSTATION is not set
65# CONFIG_MIPS_EV64120 is not set
66# CONFIG_MIPS_EV96100 is not set
67# CONFIG_MIPS_IVR is not set
68# CONFIG_LASAT is not set
69# CONFIG_MIPS_ITE8172 is not set
70# CONFIG_MIPS_ATLAS is not set
71# CONFIG_MIPS_MALTA is not set
72# CONFIG_MIPS_SEAD is not set
73# CONFIG_MOMENCO_OCELOT is not set
74# CONFIG_MOMENCO_OCELOT_G is not set
75# CONFIG_MOMENCO_OCELOT_C is not set
76# CONFIG_MOMENCO_OCELOT_3 is not set
77# CONFIG_MOMENCO_JAGUAR_ATX is not set
78# CONFIG_PMC_YOSEMITE is not set
79# CONFIG_DDB5074 is not set
80# CONFIG_DDB5476 is not set
81# CONFIG_DDB5477 is not set
82# CONFIG_NEC_OSPREY is not set
83CONFIG_SGI_IP22=y
84# CONFIG_SOC_AU1X00 is not set
85# CONFIG_SIBYTE_SB1xxx_SOC is not set
86# CONFIG_SNI_RM200_PCI is not set
87# CONFIG_TOSHIBA_RBTX4927 is not set
88CONFIG_RWSEM_GENERIC_SPINLOCK=y
89CONFIG_GENERIC_CALIBRATE_DELAY=y
90CONFIG_HAVE_DEC_LOCK=y
91CONFIG_ARC=y
92CONFIG_DMA_NONCOHERENT=y
93# CONFIG_CPU_LITTLE_ENDIAN is not set
94CONFIG_IRQ_CPU=y
95CONFIG_SWAP_IO_SPACE=y
96CONFIG_ARC32=y
97CONFIG_BOOT_ELF32=y
98CONFIG_MIPS_L1_CACHE_SHIFT=5
99CONFIG_ARC_CONSOLE=y
100CONFIG_ARC_PROMLIB=y
101
102#
103# CPU selection
104#
105# CONFIG_CPU_MIPS32 is not set
106# CONFIG_CPU_MIPS64 is not set
107# CONFIG_CPU_R3000 is not set
108# CONFIG_CPU_TX39XX is not set
109# CONFIG_CPU_VR41XX is not set
110# CONFIG_CPU_R4300 is not set
111# CONFIG_CPU_R4X00 is not set
112# CONFIG_CPU_TX49XX is not set
113CONFIG_CPU_R5000=y
114# CONFIG_CPU_R5432 is not set
115# CONFIG_CPU_R6000 is not set
116# CONFIG_CPU_NEVADA is not set
117# CONFIG_CPU_R8000 is not set
118# CONFIG_CPU_R10000 is not set
119# CONFIG_CPU_RM7000 is not set
120# CONFIG_CPU_RM9000 is not set
121# CONFIG_CPU_SB1 is not set
122CONFIG_PAGE_SIZE_4KB=y
123# CONFIG_PAGE_SIZE_8KB is not set
124# CONFIG_PAGE_SIZE_16KB is not set
125# CONFIG_PAGE_SIZE_64KB is not set
126CONFIG_BOARD_SCACHE=y
127CONFIG_IP22_CPU_SCACHE=y
128# CONFIG_64BIT_PHYS_ADDR is not set
129# CONFIG_CPU_ADVANCED is not set
130CONFIG_CPU_HAS_LLSC=y
131CONFIG_CPU_HAS_LLDSCD=y
132CONFIG_CPU_HAS_SYNC=y
133# CONFIG_PREEMPT is not set
134
135#
136# Bus options (PCI, PCMCIA, EISA, ISA, TC)
137#
138# CONFIG_EISA is not set
139CONFIG_MMU=y
140
141#
142# PCCARD (PCMCIA/CardBus) support
143#
144# CONFIG_PCCARD is not set
145
146#
147# PC-card bridges
148#
149
150#
151# PCI Hotplug Support
152#
153
154#
155# Executable file formats
156#
157CONFIG_BINFMT_ELF=y
158CONFIG_BINFMT_MISC=m
159CONFIG_TRAD_SIGNALS=y
160
161#
162# Device Drivers
163#
164
165#
166# Generic Driver Options
167#
168CONFIG_STANDALONE=y
169CONFIG_PREVENT_FIRMWARE_BUILD=y
170# CONFIG_FW_LOADER is not set
171
172#
173# Memory Technology Devices (MTD)
174#
175# CONFIG_MTD is not set
176
177#
178# Parallel port support
179#
180# CONFIG_PARPORT is not set
181
182#
183# Plug and Play support
184#
185
186#
187# Block devices
188#
189# CONFIG_BLK_DEV_FD is not set
190# CONFIG_BLK_DEV_COW_COMMON is not set
191# CONFIG_BLK_DEV_LOOP is not set
192# CONFIG_BLK_DEV_NBD is not set
193# CONFIG_BLK_DEV_RAM is not set
194CONFIG_BLK_DEV_RAM_COUNT=16
195CONFIG_INITRAMFS_SOURCE=""
196# CONFIG_LBD is not set
197CONFIG_CDROM_PKTCDVD=m
198CONFIG_CDROM_PKTCDVD_BUFFERS=8
199# CONFIG_CDROM_PKTCDVD_WCACHE is not set
200
201#
202# IO Schedulers
203#
204CONFIG_IOSCHED_NOOP=y
205CONFIG_IOSCHED_AS=y
206CONFIG_IOSCHED_DEADLINE=y
207CONFIG_IOSCHED_CFQ=y
208CONFIG_ATA_OVER_ETH=m
209
210#
211# ATA/ATAPI/MFM/RLL support
212#
213# CONFIG_IDE is not set
214
215#
216# SCSI device support
217#
218CONFIG_SCSI=y
219CONFIG_SCSI_PROC_FS=y
220
221#
222# SCSI support type (disk, tape, CD-ROM)
223#
224CONFIG_BLK_DEV_SD=y
225CONFIG_CHR_DEV_ST=y
226# CONFIG_CHR_DEV_OSST is not set
227CONFIG_BLK_DEV_SR=y
228# CONFIG_BLK_DEV_SR_VENDOR is not set
229# CONFIG_CHR_DEV_SG is not set
230
231#
232# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
233#
234# CONFIG_SCSI_MULTI_LUN is not set
235CONFIG_SCSI_CONSTANTS=y
236# CONFIG_SCSI_LOGGING is not set
237
238#
239# SCSI Transport Attributes
240#
241CONFIG_SCSI_SPI_ATTRS=m
242# CONFIG_SCSI_FC_ATTRS is not set
243CONFIG_SCSI_ISCSI_ATTRS=m
244
245#
246# SCSI low-level drivers
247#
248CONFIG_SGIWD93_SCSI=y
249# CONFIG_SCSI_SATA is not set
250# CONFIG_SCSI_DEBUG is not set
251
252#
253# Multi-device support (RAID and LVM)
254#
255# CONFIG_MD is not set
256
257#
258# Fusion MPT device support
259#
260
261#
262# IEEE 1394 (FireWire) support
263#
264
265#
266# I2O device support
267#
268
269#
270# Networking support
271#
272CONFIG_NET=y
273
274#
275# Networking options
276#
277CONFIG_PACKET=y
278CONFIG_PACKET_MMAP=y
279CONFIG_NETLINK_DEV=y
280CONFIG_UNIX=y
281CONFIG_NET_KEY=y
282CONFIG_INET=y
283CONFIG_IP_MULTICAST=y
284# CONFIG_IP_ADVANCED_ROUTER is not set
285CONFIG_IP_PNP=y
286# CONFIG_IP_PNP_DHCP is not set
287CONFIG_IP_PNP_BOOTP=y
288# CONFIG_IP_PNP_RARP is not set
289# CONFIG_NET_IPIP is not set
290# CONFIG_NET_IPGRE is not set
291# CONFIG_IP_MROUTE is not set
292# CONFIG_ARPD is not set
293# CONFIG_SYN_COOKIES is not set
294CONFIG_INET_AH=m
295CONFIG_INET_ESP=m
296CONFIG_INET_IPCOMP=m
297CONFIG_INET_TUNNEL=m
298CONFIG_IP_TCPDIAG=m
299CONFIG_IP_TCPDIAG_IPV6=y
300
301#
302# IP: Virtual Server Configuration
303#
304CONFIG_IP_VS=m
305# CONFIG_IP_VS_DEBUG is not set
306CONFIG_IP_VS_TAB_BITS=12
307
308#
309# IPVS transport protocol load balancing support
310#
311CONFIG_IP_VS_PROTO_TCP=y
312CONFIG_IP_VS_PROTO_UDP=y
313CONFIG_IP_VS_PROTO_ESP=y
314CONFIG_IP_VS_PROTO_AH=y
315
316#
317# IPVS scheduler
318#
319CONFIG_IP_VS_RR=m
320CONFIG_IP_VS_WRR=m
321CONFIG_IP_VS_LC=m
322CONFIG_IP_VS_WLC=m
323CONFIG_IP_VS_LBLC=m
324CONFIG_IP_VS_LBLCR=m
325CONFIG_IP_VS_DH=m
326CONFIG_IP_VS_SH=m
327CONFIG_IP_VS_SED=m
328CONFIG_IP_VS_NQ=m
329
330#
331# IPVS application helper
332#
333CONFIG_IP_VS_FTP=m
334CONFIG_IPV6=m
335CONFIG_IPV6_PRIVACY=y
336CONFIG_INET6_AH=m
337CONFIG_INET6_ESP=m
338CONFIG_INET6_IPCOMP=m
339CONFIG_INET6_TUNNEL=m
340CONFIG_IPV6_TUNNEL=m
341CONFIG_NETFILTER=y
342# CONFIG_NETFILTER_DEBUG is not set
343
344#
345# IP: Netfilter Configuration
346#
347CONFIG_IP_NF_CONNTRACK=m
348CONFIG_IP_NF_CT_ACCT=y
349CONFIG_IP_NF_CONNTRACK_MARK=y
350# CONFIG_IP_NF_CT_PROTO_SCTP is not set
351CONFIG_IP_NF_FTP=m
352CONFIG_IP_NF_IRC=m
353CONFIG_IP_NF_TFTP=m
354CONFIG_IP_NF_AMANDA=m
355CONFIG_IP_NF_QUEUE=m
356CONFIG_IP_NF_IPTABLES=m
357CONFIG_IP_NF_MATCH_LIMIT=m
358CONFIG_IP_NF_MATCH_IPRANGE=m
359CONFIG_IP_NF_MATCH_MAC=m
360CONFIG_IP_NF_MATCH_PKTTYPE=m
361CONFIG_IP_NF_MATCH_MARK=m
362CONFIG_IP_NF_MATCH_MULTIPORT=m
363CONFIG_IP_NF_MATCH_TOS=m
364CONFIG_IP_NF_MATCH_RECENT=m
365CONFIG_IP_NF_MATCH_ECN=m
366CONFIG_IP_NF_MATCH_DSCP=m
367CONFIG_IP_NF_MATCH_AH_ESP=m
368CONFIG_IP_NF_MATCH_LENGTH=m
369CONFIG_IP_NF_MATCH_TTL=m
370CONFIG_IP_NF_MATCH_TCPMSS=m
371CONFIG_IP_NF_MATCH_HELPER=m
372CONFIG_IP_NF_MATCH_STATE=m
373CONFIG_IP_NF_MATCH_CONNTRACK=m
374CONFIG_IP_NF_MATCH_OWNER=m
375CONFIG_IP_NF_MATCH_ADDRTYPE=m
376CONFIG_IP_NF_MATCH_REALM=m
377CONFIG_IP_NF_MATCH_SCTP=m
378CONFIG_IP_NF_MATCH_COMMENT=m
379CONFIG_IP_NF_MATCH_CONNMARK=m
380CONFIG_IP_NF_MATCH_HASHLIMIT=m
381CONFIG_IP_NF_FILTER=m
382CONFIG_IP_NF_TARGET_REJECT=m
383CONFIG_IP_NF_TARGET_LOG=m
384CONFIG_IP_NF_TARGET_ULOG=m
385CONFIG_IP_NF_TARGET_TCPMSS=m
386CONFIG_IP_NF_NAT=m
387CONFIG_IP_NF_NAT_NEEDED=y
388CONFIG_IP_NF_TARGET_MASQUERADE=m
389CONFIG_IP_NF_TARGET_REDIRECT=m
390CONFIG_IP_NF_TARGET_NETMAP=m
391CONFIG_IP_NF_TARGET_SAME=m
392CONFIG_IP_NF_NAT_SNMP_BASIC=m
393CONFIG_IP_NF_NAT_IRC=m
394CONFIG_IP_NF_NAT_FTP=m
395CONFIG_IP_NF_NAT_TFTP=m
396CONFIG_IP_NF_NAT_AMANDA=m
397CONFIG_IP_NF_MANGLE=m
398CONFIG_IP_NF_TARGET_TOS=m
399CONFIG_IP_NF_TARGET_ECN=m
400CONFIG_IP_NF_TARGET_DSCP=m
401CONFIG_IP_NF_TARGET_MARK=m
402CONFIG_IP_NF_TARGET_CLASSIFY=m
403CONFIG_IP_NF_TARGET_CONNMARK=m
404CONFIG_IP_NF_TARGET_CLUSTERIP=m
405CONFIG_IP_NF_RAW=m
406CONFIG_IP_NF_TARGET_NOTRACK=m
407CONFIG_IP_NF_ARPTABLES=m
408CONFIG_IP_NF_ARPFILTER=m
409CONFIG_IP_NF_ARP_MANGLE=m
410
411#
412# IPv6: Netfilter Configuration
413#
414CONFIG_IP6_NF_QUEUE=m
415CONFIG_IP6_NF_IPTABLES=m
416CONFIG_IP6_NF_MATCH_LIMIT=m
417CONFIG_IP6_NF_MATCH_MAC=m
418CONFIG_IP6_NF_MATCH_RT=m
419CONFIG_IP6_NF_MATCH_OPTS=m
420CONFIG_IP6_NF_MATCH_FRAG=m
421CONFIG_IP6_NF_MATCH_HL=m
422CONFIG_IP6_NF_MATCH_MULTIPORT=m
423CONFIG_IP6_NF_MATCH_OWNER=m
424CONFIG_IP6_NF_MATCH_MARK=m
425CONFIG_IP6_NF_MATCH_IPV6HEADER=m
426CONFIG_IP6_NF_MATCH_AHESP=m
427CONFIG_IP6_NF_MATCH_LENGTH=m
428CONFIG_IP6_NF_MATCH_EUI64=m
429CONFIG_IP6_NF_FILTER=m
430CONFIG_IP6_NF_TARGET_LOG=m
431CONFIG_IP6_NF_MANGLE=m
432CONFIG_IP6_NF_TARGET_MARK=m
433CONFIG_IP6_NF_RAW=m
434CONFIG_XFRM=y
435CONFIG_XFRM_USER=m
436
437#
438# SCTP Configuration (EXPERIMENTAL)
439#
440CONFIG_IP_SCTP=m
441# CONFIG_SCTP_DBG_MSG is not set
442# CONFIG_SCTP_DBG_OBJCNT is not set
443# CONFIG_SCTP_HMAC_NONE is not set
444# CONFIG_SCTP_HMAC_SHA1 is not set
445CONFIG_SCTP_HMAC_MD5=y
446# CONFIG_ATM is not set
447# CONFIG_BRIDGE is not set
448# CONFIG_VLAN_8021Q is not set
449# CONFIG_DECNET is not set
450# CONFIG_LLC2 is not set
451# CONFIG_IPX is not set
452# CONFIG_ATALK is not set
453# CONFIG_X25 is not set
454# CONFIG_LAPB is not set
455CONFIG_NET_DIVERT=y
456# CONFIG_ECONET is not set
457# CONFIG_WAN_ROUTER is not set
458
459#
460# QoS and/or fair queueing
461#
462CONFIG_NET_SCHED=y
463# CONFIG_NET_SCH_CLK_JIFFIES is not set
464CONFIG_NET_SCH_CLK_GETTIMEOFDAY=y
465# CONFIG_NET_SCH_CLK_CPU is not set
466CONFIG_NET_SCH_CBQ=m
467CONFIG_NET_SCH_HTB=m
468CONFIG_NET_SCH_HFSC=m
469CONFIG_NET_SCH_PRIO=m
470CONFIG_NET_SCH_RED=m
471CONFIG_NET_SCH_SFQ=m
472CONFIG_NET_SCH_TEQL=m
473CONFIG_NET_SCH_TBF=m
474CONFIG_NET_SCH_GRED=m
475CONFIG_NET_SCH_DSMARK=m
476CONFIG_NET_SCH_NETEM=m
477CONFIG_NET_SCH_INGRESS=m
478CONFIG_NET_QOS=y
479CONFIG_NET_ESTIMATOR=y
480CONFIG_NET_CLS=y
481CONFIG_NET_CLS_TCINDEX=m
482CONFIG_NET_CLS_ROUTE4=m
483CONFIG_NET_CLS_ROUTE=y
484CONFIG_NET_CLS_FW=m
485CONFIG_NET_CLS_U32=m
486# CONFIG_CLS_U32_PERF is not set
487# CONFIG_NET_CLS_IND is not set
488# CONFIG_CLS_U32_MARK is not set
489CONFIG_NET_CLS_RSVP=m
490CONFIG_NET_CLS_RSVP6=m
491# CONFIG_NET_CLS_ACT is not set
492CONFIG_NET_CLS_POLICE=y
493
494#
495# Network testing
496#
497# CONFIG_NET_PKTGEN is not set
498# CONFIG_NETPOLL is not set
499# CONFIG_NET_POLL_CONTROLLER is not set
500# CONFIG_HAMRADIO is not set
501# CONFIG_IRDA is not set
502# CONFIG_BT is not set
503CONFIG_NETDEVICES=y
504CONFIG_DUMMY=m
505CONFIG_BONDING=m
506CONFIG_EQUALIZER=m
507CONFIG_TUN=m
508CONFIG_ETHERTAP=m
509
510#
511# Ethernet (10 or 100Mbit)
512#
513CONFIG_NET_ETHERNET=y
514# CONFIG_MII is not set
515CONFIG_SGISEEQ=y
516
517#
518# Ethernet (1000 Mbit)
519#
520
521#
522# Ethernet (10000 Mbit)
523#
524
525#
526# Token Ring devices
527#
528
529#
530# Wireless LAN (non-hamradio)
531#
532# CONFIG_NET_RADIO is not set
533
534#
535# Wan interfaces
536#
537# CONFIG_WAN is not set
538# CONFIG_PPP is not set
539# CONFIG_SLIP is not set
540# CONFIG_SHAPER is not set
541# CONFIG_NETCONSOLE is not set
542
543#
544# ISDN subsystem
545#
546# CONFIG_ISDN is not set
547
548#
549# Telephony Support
550#
551# CONFIG_PHONE is not set
552
553#
554# Input device support
555#
556CONFIG_INPUT=y
557
558#
559# Userland interfaces
560#
561CONFIG_INPUT_MOUSEDEV=m
562CONFIG_INPUT_MOUSEDEV_PSAUX=y
563CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
564CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
565# CONFIG_INPUT_JOYDEV is not set
566# CONFIG_INPUT_TSDEV is not set
567# CONFIG_INPUT_EVDEV is not set
568# CONFIG_INPUT_EVBUG is not set
569
570#
571# Input I/O drivers
572#
573# CONFIG_GAMEPORT is not set
574CONFIG_SOUND_GAMEPORT=y
575CONFIG_SERIO=y
576CONFIG_SERIO_I8042=y
577CONFIG_SERIO_SERPORT=y
578# CONFIG_SERIO_CT82C710 is not set
579CONFIG_SERIO_LIBPS2=y
580CONFIG_SERIO_RAW=m
581
582#
583# Input Device Drivers
584#
585CONFIG_INPUT_KEYBOARD=y
586CONFIG_KEYBOARD_ATKBD=y
587# CONFIG_KEYBOARD_SUNKBD is not set
588# CONFIG_KEYBOARD_LKKBD is not set
589# CONFIG_KEYBOARD_XTKBD is not set
590# CONFIG_KEYBOARD_NEWTON is not set
591CONFIG_INPUT_MOUSE=y
592CONFIG_MOUSE_PS2=m
593CONFIG_MOUSE_SERIAL=m
594# CONFIG_MOUSE_VSXXXAA is not set
595# CONFIG_INPUT_JOYSTICK is not set
596# CONFIG_INPUT_TOUCHSCREEN is not set
597# CONFIG_INPUT_MISC is not set
598
599#
600# Character devices
601#
602CONFIG_VT=y
603CONFIG_VT_CONSOLE=y
604CONFIG_HW_CONSOLE=y
605# CONFIG_SERIAL_NONSTANDARD is not set
606
607#
608# Serial drivers
609#
610# CONFIG_SERIAL_8250 is not set
611
612#
613# Non-8250 serial port support
614#
615CONFIG_SERIAL_IP22_ZILOG=m
616CONFIG_SERIAL_CORE=m
617CONFIG_UNIX98_PTYS=y
618CONFIG_LEGACY_PTYS=y
619CONFIG_LEGACY_PTY_COUNT=256
620
621#
622# IPMI
623#
624# CONFIG_IPMI_HANDLER is not set
625
626#
627# Watchdog Cards
628#
629CONFIG_WATCHDOG=y
630# CONFIG_WATCHDOG_NOWAYOUT is not set
631
632#
633# Watchdog Device Drivers
634#
635# CONFIG_SOFT_WATCHDOG is not set
636CONFIG_INDYDOG=m
637# CONFIG_RTC is not set
638CONFIG_SGI_DS1286=m
639# CONFIG_GEN_RTC is not set
640# CONFIG_DTLK is not set
641# CONFIG_R3964 is not set
642
643#
644# Ftape, the floppy tape device driver
645#
646# CONFIG_DRM is not set
647CONFIG_RAW_DRIVER=m
648CONFIG_MAX_RAW_DEVS=256
649
650#
651# I2C support
652#
653# CONFIG_I2C is not set
654
655#
656# Dallas's 1-wire bus
657#
658# CONFIG_W1 is not set
659
660#
661# Misc devices
662#
663
664#
665# Multimedia devices
666#
667# CONFIG_VIDEO_DEV is not set
668
669#
670# Digital Video Broadcasting Devices
671#
672# CONFIG_DVB is not set
673
674#
675# Graphics support
676#
677# CONFIG_FB is not set
678
679#
680# Console display driver support
681#
682# CONFIG_VGA_CONSOLE is not set
683CONFIG_SGI_NEWPORT_CONSOLE=y
684CONFIG_DUMMY_CONSOLE=y
685CONFIG_FONT_8x16=y
686
687#
688# Logo configuration
689#
690CONFIG_LOGO=y
691# CONFIG_LOGO_LINUX_MONO is not set
692# CONFIG_LOGO_LINUX_VGA16 is not set
693# CONFIG_LOGO_LINUX_CLUT224 is not set
694CONFIG_LOGO_SGI_CLUT224=y
695# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
696
697#
698# Sound
699#
700# CONFIG_SOUND is not set
701
702#
703# USB support
704#
705# CONFIG_USB_ARCH_HAS_HCD is not set
706# CONFIG_USB_ARCH_HAS_OHCI is not set
707
708#
709# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
710#
711
712#
713# USB Gadget Support
714#
715# CONFIG_USB_GADGET is not set
716
717#
718# MMC/SD Card support
719#
720# CONFIG_MMC is not set
721
722#
723# InfiniBand support
724#
725# CONFIG_INFINIBAND is not set
726
727#
728# File systems
729#
730CONFIG_EXT2_FS=m
731# CONFIG_EXT2_FS_XATTR is not set
732CONFIG_EXT3_FS=y
733CONFIG_EXT3_FS_XATTR=y
734CONFIG_EXT3_FS_POSIX_ACL=y
735CONFIG_EXT3_FS_SECURITY=y
736CONFIG_JBD=y
737# CONFIG_JBD_DEBUG is not set
738CONFIG_FS_MBCACHE=y
739# CONFIG_REISERFS_FS is not set
740# CONFIG_JFS_FS is not set
741CONFIG_FS_POSIX_ACL=y
742CONFIG_XFS_FS=m
743# CONFIG_XFS_RT is not set
744CONFIG_XFS_QUOTA=y
745CONFIG_XFS_SECURITY=y
746# CONFIG_XFS_POSIX_ACL is not set
747CONFIG_MINIX_FS=m
748# CONFIG_ROMFS_FS is not set
749CONFIG_QUOTA=y
750# CONFIG_QFMT_V1 is not set
751CONFIG_QFMT_V2=m
752CONFIG_QUOTACTL=y
753CONFIG_DNOTIFY=y
754CONFIG_AUTOFS_FS=m
755CONFIG_AUTOFS4_FS=m
756
757#
758# CD-ROM/DVD Filesystems
759#
760CONFIG_ISO9660_FS=m
761CONFIG_JOLIET=y
762CONFIG_ZISOFS=y
763CONFIG_ZISOFS_FS=m
764CONFIG_UDF_FS=m
765CONFIG_UDF_NLS=y
766
767#
768# DOS/FAT/NT Filesystems
769#
770CONFIG_FAT_FS=m
771CONFIG_MSDOS_FS=m
772CONFIG_VFAT_FS=m
773CONFIG_FAT_DEFAULT_CODEPAGE=437
774CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
775# CONFIG_NTFS_FS is not set
776
777#
778# Pseudo filesystems
779#
780CONFIG_PROC_FS=y
781CONFIG_PROC_KCORE=y
782CONFIG_SYSFS=y
783# CONFIG_DEVFS_FS is not set
784CONFIG_DEVPTS_FS_XATTR=y
785CONFIG_DEVPTS_FS_SECURITY=y
786# CONFIG_TMPFS is not set
787# CONFIG_HUGETLB_PAGE is not set
788CONFIG_RAMFS=y
789
790#
791# Miscellaneous filesystems
792#
793# CONFIG_ADFS_FS is not set
794# CONFIG_AFFS_FS is not set
795# CONFIG_HFS_FS is not set
796# CONFIG_HFSPLUS_FS is not set
797# CONFIG_BEFS_FS is not set
798# CONFIG_BFS_FS is not set
799CONFIG_EFS_FS=m
800# CONFIG_CRAMFS is not set
801# CONFIG_VXFS_FS is not set
802# CONFIG_HPFS_FS is not set
803# CONFIG_QNX4FS_FS is not set
804# CONFIG_SYSV_FS is not set
805CONFIG_UFS_FS=m
806# CONFIG_UFS_FS_WRITE is not set
807
808#
809# Network File Systems
810#
811CONFIG_NFS_FS=m
812CONFIG_NFS_V3=y
813# CONFIG_NFS_V4 is not set
814# CONFIG_NFS_DIRECTIO is not set
815CONFIG_NFSD=m
816CONFIG_NFSD_V3=y
817# CONFIG_NFSD_V4 is not set
818CONFIG_NFSD_TCP=y
819CONFIG_LOCKD=m
820CONFIG_LOCKD_V4=y
821CONFIG_EXPORTFS=m
822CONFIG_SUNRPC=m
823CONFIG_SUNRPC_GSS=m
824CONFIG_RPCSEC_GSS_KRB5=m
825# CONFIG_RPCSEC_GSS_SPKM3 is not set
826CONFIG_SMB_FS=m
827CONFIG_SMB_NLS_DEFAULT=y
828CONFIG_SMB_NLS_REMOTE="cp437"
829CONFIG_CIFS=m
830# CONFIG_CIFS_STATS is not set
831# CONFIG_CIFS_XATTR is not set
832# CONFIG_CIFS_EXPERIMENTAL is not set
833# CONFIG_NCP_FS is not set
834CONFIG_CODA_FS=m
835# CONFIG_CODA_FS_OLD_API is not set
836# CONFIG_AFS_FS is not set
837
838#
839# Partition Types
840#
841CONFIG_PARTITION_ADVANCED=y
842# CONFIG_ACORN_PARTITION is not set
843# CONFIG_OSF_PARTITION is not set
844# CONFIG_AMIGA_PARTITION is not set
845# CONFIG_ATARI_PARTITION is not set
846# CONFIG_MAC_PARTITION is not set
847CONFIG_MSDOS_PARTITION=y
848# CONFIG_BSD_DISKLABEL is not set
849# CONFIG_MINIX_SUBPARTITION is not set
850# CONFIG_SOLARIS_X86_PARTITION is not set
851# CONFIG_UNIXWARE_DISKLABEL is not set
852# CONFIG_LDM_PARTITION is not set
853CONFIG_SGI_PARTITION=y
854# CONFIG_ULTRIX_PARTITION is not set
855# CONFIG_SUN_PARTITION is not set
856# CONFIG_EFI_PARTITION is not set
857
858#
859# Native Language Support
860#
861CONFIG_NLS=m
862CONFIG_NLS_DEFAULT="iso8859-1"
863CONFIG_NLS_CODEPAGE_437=m
864CONFIG_NLS_CODEPAGE_737=m
865CONFIG_NLS_CODEPAGE_775=m
866CONFIG_NLS_CODEPAGE_850=m
867CONFIG_NLS_CODEPAGE_852=m
868CONFIG_NLS_CODEPAGE_855=m
869CONFIG_NLS_CODEPAGE_857=m
870CONFIG_NLS_CODEPAGE_860=m
871CONFIG_NLS_CODEPAGE_861=m
872CONFIG_NLS_CODEPAGE_862=m
873CONFIG_NLS_CODEPAGE_863=m
874CONFIG_NLS_CODEPAGE_864=m
875CONFIG_NLS_CODEPAGE_865=m
876CONFIG_NLS_CODEPAGE_866=m
877CONFIG_NLS_CODEPAGE_869=m
878CONFIG_NLS_CODEPAGE_936=m
879CONFIG_NLS_CODEPAGE_950=m
880CONFIG_NLS_CODEPAGE_932=m
881CONFIG_NLS_CODEPAGE_949=m
882CONFIG_NLS_CODEPAGE_874=m
883CONFIG_NLS_ISO8859_8=m
884CONFIG_NLS_CODEPAGE_1250=m
885CONFIG_NLS_CODEPAGE_1251=m
886CONFIG_NLS_ASCII=m
887CONFIG_NLS_ISO8859_1=m
888CONFIG_NLS_ISO8859_2=m
889CONFIG_NLS_ISO8859_3=m
890CONFIG_NLS_ISO8859_4=m
891CONFIG_NLS_ISO8859_5=m
892CONFIG_NLS_ISO8859_6=m
893CONFIG_NLS_ISO8859_7=m
894CONFIG_NLS_ISO8859_9=m
895CONFIG_NLS_ISO8859_13=m
896CONFIG_NLS_ISO8859_14=m
897CONFIG_NLS_ISO8859_15=m
898CONFIG_NLS_KOI8_R=m
899CONFIG_NLS_KOI8_U=m
900CONFIG_NLS_UTF8=m
901
902#
903# Profiling support
904#
905# CONFIG_PROFILING is not set
906
907#
908# Kernel hacking
909#
910# CONFIG_DEBUG_KERNEL is not set
911CONFIG_CROSSCOMPILE=y
912CONFIG_CMDLINE=""
913
914#
915# Security options
916#
917CONFIG_KEYS=y
918CONFIG_KEYS_DEBUG_PROC_KEYS=y
919# CONFIG_SECURITY is not set
920
921#
922# Cryptographic options
923#
924CONFIG_CRYPTO=y
925CONFIG_CRYPTO_HMAC=y
926CONFIG_CRYPTO_NULL=m
927CONFIG_CRYPTO_MD4=m
928CONFIG_CRYPTO_MD5=m
929CONFIG_CRYPTO_SHA1=m
930CONFIG_CRYPTO_SHA256=m
931CONFIG_CRYPTO_SHA512=m
932CONFIG_CRYPTO_WP512=m
933CONFIG_CRYPTO_DES=m
934CONFIG_CRYPTO_BLOWFISH=m
935CONFIG_CRYPTO_TWOFISH=m
936CONFIG_CRYPTO_SERPENT=m
937CONFIG_CRYPTO_AES=m
938CONFIG_CRYPTO_CAST5=m
939CONFIG_CRYPTO_CAST6=m
940CONFIG_CRYPTO_TEA=m
941CONFIG_CRYPTO_ARC4=m
942CONFIG_CRYPTO_KHAZAD=m
943CONFIG_CRYPTO_ANUBIS=m
944CONFIG_CRYPTO_DEFLATE=y
945CONFIG_CRYPTO_MICHAEL_MIC=m
946CONFIG_CRYPTO_CRC32C=m
947CONFIG_CRYPTO_TEST=m
948
949#
950# Hardware crypto devices
951#
952
953#
954# Library routines
955#
956# CONFIG_CRC_CCITT is not set
957CONFIG_CRC32=m
958CONFIG_LIBCRC32C=m
959CONFIG_ZLIB_INFLATE=y
960CONFIG_ZLIB_DEFLATE=y
961CONFIG_GENERIC_HARDIRQS=y
962CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/mips/galileo-boards/ev96100/Makefile b/arch/mips/galileo-boards/ev96100/Makefile
new file mode 100644
index 000000000000..58c02f9db69d
--- /dev/null
+++ b/arch/mips/galileo-boards/ev96100/Makefile
@@ -0,0 +1,9 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Galileo EV96100 board.
7#
8
9obj-y += init.o irq.o puts.o reset.o time.o int-handler.o setup.o
diff --git a/arch/mips/galileo-boards/ev96100/init.c b/arch/mips/galileo-boards/ev96100/init.c
new file mode 100644
index 000000000000..a01fe9b36f2c
--- /dev/null
+++ b/arch/mips/galileo-boards/ev96100/init.c
@@ -0,0 +1,173 @@
1/*
2 * Copyright 2000 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ppopov@mvista.com or source@mvista.com
5 *
6 * This file was derived from Carsten Langgaard's
7 * arch/mips/mips-boards/generic/generic.c
8 *
9 * Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32#include <linux/init.h>
33#include <linux/mm.h>
34#include <linux/sched.h>
35#include <linux/bootmem.h>
36#include <linux/string.h>
37#include <linux/kernel.h>
38
39#include <asm/addrspace.h>
40#include <asm/bootinfo.h>
41#include <asm/gt64120.h>
42
43
44/* Environment variable */
45
46typedef struct {
47 char *name;
48 char *val;
49} t_env_var;
50
51int prom_argc;
52char **prom_argv, **prom_envp;
53
54int init_debug = 0;
55
56char * __init prom_getcmdline(void)
57{
58 return &(arcs_cmdline[0]);
59}
60
61unsigned long __init prom_free_prom_memory(void)
62{
63 return 0;
64}
65
66void __init prom_init_cmdline(void)
67{
68 char *cp;
69 int actr;
70
71 actr = 1; /* Always ignore argv[0] */
72
73 cp = &(arcs_cmdline[0]);
74 while(actr < prom_argc) {
75 strcpy(cp, prom_argv[actr]);
76 cp += strlen(prom_argv[actr]);
77 *cp++ = ' ';
78 actr++;
79 }
80 if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
81 --cp;
82 *cp = '\0';
83}
84
85char *prom_getenv(char *envname)
86{
87 /*
88 * Return a pointer to the given environment variable.
89 */
90
91 t_env_var *env = (t_env_var *) prom_envp;
92 int i;
93
94 i = strlen(envname);
95
96 while (env->name) {
97 if (strncmp(envname, env->name, i) == 0) {
98 return (env->val);
99 }
100 env++;
101 }
102 return (NULL);
103}
104
105static inline unsigned char str2hexnum(unsigned char c)
106{
107 if (c >= '0' && c <= '9')
108 return c - '0';
109 if (c >= 'a' && c <= 'f')
110 return c - 'a' + 10;
111 return 0; /* foo */
112}
113
114static inline void str2eaddr(unsigned char *ea, unsigned char *str)
115{
116 int i;
117
118 for (i = 0; i < 6; i++) {
119 unsigned char num;
120
121 if ((*str == '.') || (*str == ':'))
122 str++;
123 num = str2hexnum(*str++) << 4;
124 num |= (str2hexnum(*str++));
125 ea[i] = num;
126 }
127}
128
129int get_ethernet_addr(char *ethernet_addr)
130{
131 char *ethaddr_str;
132
133 ethaddr_str = prom_getenv("ethaddr");
134 if (!ethaddr_str) {
135 printk("ethaddr not set in boot prom\n");
136 return -1;
137 }
138 str2eaddr(ethernet_addr, ethaddr_str);
139
140 if (init_debug > 1) {
141 int i;
142 printk("get_ethernet_addr: ");
143 for (i = 0; i < 5; i++)
144 printk("%02x:",
145 (unsigned char) *(ethernet_addr + i));
146 printk("%02x\n", *(ethernet_addr + i));
147 }
148
149 return 0;
150}
151
152const char *get_system_type(void)
153{
154 return "Galileo EV96100";
155}
156
157void __init prom_init(void)
158{
159 volatile unsigned char *uart;
160 char ppbuf[8];
161
162 prom_argc = fw_arg0;
163 prom_argv = (char **) fw_arg1;
164 prom_envp = (char **) fw_arg2;
165
166 mips_machgroup = MACH_GROUP_GALILEO;
167 mips_machtype = MACH_EV96100;
168
169 prom_init_cmdline();
170
171 /* 32 MB upgradable */
172 add_memory_region(0, 32 << 20, BOOT_MEM_RAM);
173}
diff --git a/arch/mips/galileo-boards/ev96100/int-handler.S b/arch/mips/galileo-boards/ev96100/int-handler.S
new file mode 100644
index 000000000000..ff4d10a38859
--- /dev/null
+++ b/arch/mips/galileo-boards/ev96100/int-handler.S
@@ -0,0 +1,33 @@
1#include <asm/asm.h>
2#include <asm/mipsregs.h>
3#include <asm/regdef.h>
4#include <asm/stackframe.h>
5
6 .set noat
7 .align 5
8
9NESTED(ev96100IRQ, PT_SIZE, sp)
10 SAVE_ALL
11 CLI # Important: mark KERNEL mode !
12
13 mfc0 t0, CP0_CAUSE # get pending interrupts
14 mfc0 t1, CP0_STATUS # get enabled interrupts
15 and t0, t1 # isolate allowed ones
16
17 # FIX ME add R7000 extensions
18 andi t0,0xff00 # isolate pending bits
19 andi a0, t0, CAUSEF_IP7
20 beq a0, zero, 1f
21 move a0, sp
22 jal mips_timer_interrupt
23 j ret_from_irq
24
251: beqz t0, 3f # spurious interrupt
26
27 move a0, t0
28 move a1, sp
29 jal ev96100_cpu_irq
30 j ret_from_irq
31
323: j spurious_interrupt
33 END(ev96100IRQ)
diff --git a/arch/mips/galileo-boards/ev96100/irq.c b/arch/mips/galileo-boards/ev96100/irq.c
new file mode 100644
index 000000000000..97bf094da4fe
--- /dev/null
+++ b/arch/mips/galileo-boards/ev96100/irq.c
@@ -0,0 +1,66 @@
1/*
2 * Copyright 2000 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ppopov@mvista.com or source@mvista.com
5 *
6 * This file was derived from Carsten Langgaard's
7 * arch/mips/mips-boards/atlas/atlas_int.c.
8 *
9 * Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32#include <linux/errno.h>
33#include <linux/init.h>
34#include <linux/kernel_stat.h>
35#include <linux/irq.h>
36#include <linux/module.h>
37#include <linux/signal.h>
38#include <linux/sched.h>
39#include <linux/types.h>
40#include <linux/interrupt.h>
41#include <asm/irq_cpu.h>
42
43extern asmlinkage void ev96100IRQ(void);
44
45static inline unsigned int ffz8(unsigned int word)
46{
47 unsigned long k;
48
49 k = 7;
50 if (word & 0x0fUL) { k -= 4; word <<= 4; }
51 if (word & 0x30UL) { k -= 2; word <<= 2; }
52 if (word & 0x40UL) { k -= 1; }
53
54 return k;
55}
56
57asmlinkage void ev96100_cpu_irq(unsigned int pendin)
58{
59 do_IRQ(ffz8(pending >> 8), regs);
60}
61
62void __init arch_init_irq(void)
63{
64 set_except_vector(0, ev96100IRQ);
65 mips_cpu_irq_init(0);
66}
diff --git a/arch/mips/galileo-boards/ev96100/puts.c b/arch/mips/galileo-boards/ev96100/puts.c
new file mode 100644
index 000000000000..49dc6d137b9c
--- /dev/null
+++ b/arch/mips/galileo-boards/ev96100/puts.c
@@ -0,0 +1,138 @@
1
2/*
3 * Debug routines which directly access the uart.
4 */
5
6#include <linux/types.h>
7#include <asm/gt64120.h>
8
9
10//#define SERIAL_BASE EV96100_UART0_REGS_BASE
11#define SERIAL_BASE 0xBD000020
12#define NS16550_BASE SERIAL_BASE
13
14#define SERA_CMD 0x0D
15#define SERA_DATA 0x08
16//#define SERB_CMD 0x05
17#define SERB_CMD 20
18#define SERB_DATA 0x00
19#define TX_BUSY 0x20
20
21#define TIMEOUT 0xffff
22#undef SLOW_DOWN
23
24static const char digits[16] = "0123456789abcdef";
25static volatile unsigned char *const com1 = (unsigned char *) SERIAL_BASE;
26
27
28#ifdef SLOW_DOWN
29static inline void slow_down()
30{
31 int k;
32 for (k = 0; k < 10000; k++);
33}
34#else
35#define slow_down()
36#endif
37
38void putch(const unsigned char c)
39{
40 unsigned char ch;
41 int i = 0;
42
43 do {
44 ch = com1[SERB_CMD];
45 slow_down();
46 i++;
47 if (i > TIMEOUT) {
48 break;
49 }
50 } while (0 == (ch & TX_BUSY));
51 com1[SERB_DATA] = c;
52}
53
54void putchar(const unsigned char c)
55{
56 unsigned char ch;
57 int i = 0;
58
59 do {
60 ch = com1[SERB_CMD];
61 slow_down();
62 i++;
63 if (i > TIMEOUT) {
64 break;
65 }
66 } while (0 == (ch & TX_BUSY));
67 com1[SERB_DATA] = c;
68}
69
70void puts(unsigned char *cp)
71{
72 unsigned char ch;
73 int i = 0;
74
75 while (*cp) {
76 do {
77 ch = com1[SERB_CMD];
78 slow_down();
79 i++;
80 if (i > TIMEOUT) {
81 break;
82 }
83 } while (0 == (ch & TX_BUSY));
84 com1[SERB_DATA] = *cp++;
85 }
86 putch('\r');
87 putch('\n');
88}
89
90void fputs(unsigned char *cp)
91{
92 unsigned char ch;
93 int i = 0;
94
95 while (*cp) {
96
97 do {
98 ch = com1[SERB_CMD];
99 slow_down();
100 i++;
101 if (i > TIMEOUT) {
102 break;
103 }
104 } while (0 == (ch & TX_BUSY));
105 com1[SERB_DATA] = *cp++;
106 }
107}
108
109
110void put64(uint64_t ul)
111{
112 int cnt;
113 unsigned ch;
114
115 cnt = 16; /* 16 nibbles in a 64 bit long */
116 putch('0');
117 putch('x');
118 do {
119 cnt--;
120 ch = (unsigned char) (ul >> cnt * 4) & 0x0F;
121 putch(digits[ch]);
122 } while (cnt > 0);
123}
124
125void put32(unsigned u)
126{
127 int cnt;
128 unsigned ch;
129
130 cnt = 8; /* 8 nibbles in a 32 bit long */
131 putch('0');
132 putch('x');
133 do {
134 cnt--;
135 ch = (unsigned char) (u >> cnt * 4) & 0x0F;
136 putch(digits[ch]);
137 } while (cnt > 0);
138}
diff --git a/arch/mips/galileo-boards/ev96100/reset.c b/arch/mips/galileo-boards/ev96100/reset.c
new file mode 100644
index 000000000000..5ef9b7f896e6
--- /dev/null
+++ b/arch/mips/galileo-boards/ev96100/reset.c
@@ -0,0 +1,70 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Galileo EV96100 reset routines.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * This file was derived from Carsten Langgaard's
10 * arch/mips/mips-boards/generic/reset.c
11 *
12 * Carsten Langgaard, carstenl@mips.com
13 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35#include <linux/sched.h>
36#include <linux/mm.h>
37#include <asm/io.h>
38#include <asm/pgtable.h>
39#include <asm/processor.h>
40#include <asm/reboot.h>
41#include <asm/system.h>
42#include <asm/gt64120.h>
43
44static void mips_machine_restart(char *command);
45static void mips_machine_halt(void);
46
47static void mips_machine_restart(char *command)
48{
49 set_c0_status(ST0_BEV | ST0_ERL);
50 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
51 flush_cache_all();
52 write_c0_wired(0);
53 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
54 while (1);
55}
56
57static void mips_machine_halt(void)
58{
59 printk(KERN_NOTICE "You can safely turn off the power\n");
60 while (1)
61 __asm__(".set\tmips3\n\t"
62 "wait\n\t"
63 ".set\tmips0");
64}
65
66void mips_reboot_setup(void)
67{
68 _machine_restart = mips_machine_restart;
69 _machine_halt = mips_machine_halt;
70}
diff --git a/arch/mips/galileo-boards/ev96100/setup.c b/arch/mips/galileo-boards/ev96100/setup.c
new file mode 100644
index 000000000000..28bd908c6d55
--- /dev/null
+++ b/arch/mips/galileo-boards/ev96100/setup.c
@@ -0,0 +1,162 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Galileo EV96100 setup.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * This file was derived from Carsten Langgaard's
10 * arch/mips/mips-boards/atlas/atlas_setup.c.
11 *
12 * Carsten Langgaard, carstenl@mips.com
13 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35#include <linux/config.h>
36#include <linux/init.h>
37#include <linux/sched.h>
38#include <linux/ioport.h>
39#include <linux/string.h>
40#include <linux/ctype.h>
41#include <linux/pci.h>
42
43#include <asm/cpu.h>
44#include <asm/bootinfo.h>
45#include <asm/mipsregs.h>
46#include <asm/irq.h>
47#include <asm/delay.h>
48#include <asm/gt64120.h>
49#include <asm/galileo-boards/ev96100int.h>
50
51
52extern char *__init prom_getcmdline(void);
53
54extern void mips_reboot_setup(void);
55
56unsigned char mac_0_1[12];
57
58static void __init ev96100_setup(void)
59{
60 unsigned int config = read_c0_config();
61 unsigned int status = read_c0_status();
62 unsigned int info = read_c0_info();
63 u32 tmp;
64
65 char *argptr;
66
67 clear_c0_status(ST0_FR);
68
69 if (config & 0x8)
70 printk("Secondary cache is enabled\n");
71 else
72 printk("Secondary cache is disabled\n");
73
74 if (status & (1 << 27))
75 printk("User-mode cache ops enabled\n");
76 else
77 printk("User-mode cache ops disabled\n");
78
79 printk("CP0 info reg: %x\n", (unsigned) info);
80 if (info & (1 << 28))
81 printk("burst mode Scache RAMS\n");
82 else
83 printk("pipelined Scache RAMS\n");
84
85 if (info & 0x1)
86 printk("Atomic Enable is set\n");
87
88 argptr = prom_getcmdline();
89#ifdef CONFIG_SERIAL_CONSOLE
90 if (strstr(argptr, "console=") == NULL) {
91 argptr = prom_getcmdline();
92 strcat(argptr, " console=ttyS0,115200");
93 }
94#endif
95
96 mips_reboot_setup();
97
98 set_io_port_base(KSEG1);
99 ioport_resource.start = GT_PCI_IO_BASE;
100 ioport_resource.end = GT_PCI_IO_BASE + 0x01ffffff;
101
102#ifdef CONFIG_BLK_DEV_INITRD
103 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
104#endif
105
106
107 /*
108 * Setup GT controller master bit so we can do config cycles
109 */
110
111 /* Clear cause register bits */
112 GT_WRITE(GT_INTRCAUSE_OFS, ~(GT_INTRCAUSE_MASABORT0_BIT |
113 GT_INTRCAUSE_TARABORT0_BIT));
114 /* Setup address */
115 GT_WRITE(GT_PCI0_CFGADDR_OFS,
116 (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) |
117 (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
118 ((PCI_COMMAND / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
119 GT_PCI0_CFGADDR_CONFIGEN_BIT);
120
121 udelay(2);
122 tmp = GT_READ(GT_PCI0_CFGDATA_OFS);
123
124 tmp |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
125 PCI_COMMAND_MASTER | PCI_COMMAND_SERR);
126 GT_WRITE(GT_PCI0_CFGADDR_OFS,
127 (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) |
128 (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
129 ((PCI_COMMAND / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
130 GT_PCI0_CFGADDR_CONFIGEN_BIT);
131 udelay(2);
132 GT_WRITE(GT_PCI0_CFGDATA_OFS, tmp);
133
134 /* Setup address */
135 GT_WRITE(GT_PCI0_CFGADDR_OFS,
136 (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) |
137 (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
138 ((PCI_COMMAND / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
139 GT_PCI0_CFGADDR_CONFIGEN_BIT);
140
141 udelay(2);
142 tmp = GT_READ(GT_PCI0_CFGDATA_OFS);
143}
144
145early_initcall(ev96100_setup);
146
147unsigned short get_gt_devid(void)
148{
149 u32 gt_devid;
150
151 /* Figure out if this is a gt96100 or gt96100A */
152 GT_WRITE(GT_PCI0_CFGADDR_OFS,
153 (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) |
154 (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
155 ((PCI_VENDOR_ID / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
156 GT_PCI0_CFGADDR_CONFIGEN_BIT);
157
158 udelay(4);
159 gt_devid = GT_READ(GT_PCI0_CFGDATA_OFS);
160
161 return gt_devid >> 16;
162}
diff --git a/arch/mips/galileo-boards/ev96100/time.c b/arch/mips/galileo-boards/ev96100/time.c
new file mode 100644
index 000000000000..bff5b1c174e4
--- /dev/null
+++ b/arch/mips/galileo-boards/ev96100/time.c
@@ -0,0 +1,89 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Galileo EV96100 rtc routines.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * This file was derived from Carsten Langgaard's
10 * arch/mips/mips-boards/atlas/atlas_rtc.c.
11 *
12 * Carsten Langgaard, carstenl@mips.com
13 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35#include <linux/config.h>
36#include <linux/init.h>
37#include <linux/kernel_stat.h>
38#include <linux/module.h>
39#include <linux/sched.h>
40#include <linux/spinlock.h>
41#include <linux/timex.h>
42
43#include <asm/mipsregs.h>
44#include <asm/ptrace.h>
45#include <asm/time.h>
46
47
48#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
49
50extern volatile unsigned long wall_jiffies;
51unsigned long missed_heart_beats = 0;
52
53static unsigned long r4k_offset; /* Amount to increment compare reg each time */
54static unsigned long r4k_cur; /* What counter should be at next timer irq */
55
56static inline void ack_r4ktimer(unsigned long newval)
57{
58 write_c0_compare(newval);
59}
60
61/*
62 * There are a lot of conceptually broken versions of the MIPS timer interrupt
63 * handler floating around. This one is rather different, but the algorithm
64 * is probably more robust.
65 */
66void mips_timer_interrupt(struct pt_regs *regs)
67{
68 int irq = 7; /* FIX ME */
69
70 if (r4k_offset == 0) {
71 goto null;
72 }
73
74 do {
75 kstat_this_cpu.irqs[irq]++;
76 do_timer(regs);
77#ifndef CONFIG_SMP
78 update_process_times(user_mode(regs));
79#endif
80 r4k_cur += r4k_offset;
81 ack_r4ktimer(r4k_cur);
82
83 } while (((unsigned long)read_c0_count()
84 - r4k_cur) < 0x7fffffff);
85 return;
86
87null:
88 ack_r4ktimer(0);
89}
diff --git a/arch/mips/gt64120/common/Makefile b/arch/mips/gt64120/common/Makefile
new file mode 100644
index 000000000000..eba5051015a5
--- /dev/null
+++ b/arch/mips/gt64120/common/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for common code of gt64120-based boards.
3#
4
5obj-y += time.o
6obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/mips/gt64120/common/pci.c b/arch/mips/gt64120/common/pci.c
new file mode 100644
index 000000000000..e9e5419a0d53
--- /dev/null
+++ b/arch/mips/gt64120/common/pci.c
@@ -0,0 +1,147 @@
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 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35#include <linux/init.h>
36#include <linux/types.h>
37#include <linux/pci.h>
38#include <linux/kernel.h>
39#include <asm/gt64120.h>
40
41#define SELF 0
42
43/*
44 * pciXReadConfigReg - Read from a PCI configuration register
45 * - Make sure the GT is configured as a master before
46 * reading from another device on the PCI.
47 * - The function takes care of Big/Little endian conversion.
48 * INPUTS: regOffset: The register offset as it apears in the GT spec (or PCI
49 * spec)
50 * pciDevNum: The device number needs to be addressed.
51 * RETURNS: data , if the data == 0xffffffff check the master abort bit in the
52 * cause register to make sure the data is valid
53 *
54 * Configuration Address 0xCF8:
55 *
56 * 31 30 24 23 16 15 11 10 8 7 2 0 <=bit Number
57 * |congif|Reserved| Bus |Device|Function|Register|00|
58 * |Enable| |Number|Number| Number | Number | | <=field Name
59 *
60 */
61static unsigned int pci0ReadConfigReg(int offset, struct pci_dev *device)
62{
63 unsigned int DataForRegCf8;
64 unsigned int data;
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
71 /*
72 * The casual observer might wonder why the READ is duplicated here,
73 * rather than immediately following the WRITE, and just have the swap
74 * in the "if". That's because there is a latency problem with trying
75 * to read immediately after setting up the address register. The "if"
76 * check gives enough time for the address to stabilize, so the READ
77 * can work.
78 */
79 if (PCI_SLOT(device->devfn) == SELF) /* This board */
80 return GT_READ(GT_PCI0_CFGDATA_OFS);
81 else /* PCI is little endian so swap the Data. */
82 return __GT_READ(GT_PCI0_CFGDATA_OFS);
83}
84
85/*
86 * pciXWriteConfigReg - Write to a PCI configuration register
87 * - Make sure the GT is configured as a master before
88 * writingto another device on the PCI.
89 * - The function takes care of Big/Little endian conversion.
90 * Inputs: unsigned int regOffset: The register offset as it apears in the
91 * GT spec
92 * (or any other PCI device spec)
93 * pciDevNum: The device number needs to be addressed.
94 *
95 * Configuration Address 0xCF8:
96 *
97 * 31 30 24 23 16 15 11 10 8 7 2 0 <=bit Number
98 * |congif|Reserved| Bus |Device|Function|Register|00|
99 * |Enable| |Number|Number| Number | Number | | <=field Name
100 *
101 */
102static void pci0WriteConfigReg(unsigned int offset,
103 struct pci_dev *device, unsigned int data)
104{
105 unsigned int DataForRegCf8;
106
107 DataForRegCf8 = ((PCI_SLOT(device->devfn) << 11) |
108 (PCI_FUNC(device->devfn) << 8) |
109 (offset & ~0x3)) | 0x80000000;
110 GT_WRITE(GT_PCI0_CFGADDR_OFS, DataForRegCf8);
111
112 if (PCI_SLOT(device->devfn) == SELF) /* This board */
113 GT_WRITE(GT_PCI0_CFGDATA_OFS, data);
114 else /* configuration Transaction over the pci. */
115 __GT_WRITE(GT_PCI0_CFGDATA_OFS, data);
116}
117
118extern struct pci_ops gt64120_pci_ops;
119
120void __init pcibios_init(void)
121{
122 u32 tmp;
123 struct pci_dev controller;
124
125 controller.devfn = SELF;
126
127 tmp = GT_READ(GT_PCI0_CMD_OFS); /* Huh??? -- Ralf */
128 tmp = GT_READ(GT_PCI0_BARE_OFS);
129
130 /*
131 * You have to enable bus mastering to configure any other
132 * card on the bus.
133 */
134 tmp = pci0ReadConfigReg(PCI_COMMAND, &controller);
135 tmp |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_SERR;
136 pci0WriteConfigReg(PCI_COMMAND, &controller, tmp);
137
138 /*
139 * Reset PCI I/O and PCI MEM values to ones supported by EVM.
140 */
141 ioport_resource.start = GT_PCI_IO_BASE;
142 ioport_resource.end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1;
143 iomem_resource.start = GT_PCI_MEM_BASE;
144 iomem_resource.end = GT_PCI_MEM_BASE + GT_PCI_MEM_SIZE - 1;
145
146 pci_scan_bus(0, &gt64120_pci_ops, NULL);
147}
diff --git a/arch/mips/gt64120/common/time.c b/arch/mips/gt64120/common/time.c
new file mode 100644
index 000000000000..2287b59536e5
--- /dev/null
+++ b/arch/mips/gt64120/common/time.c
@@ -0,0 +1,100 @@
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/config.h>
12#include <linux/sched.h>
13#include <linux/kernel_stat.h>
14#include <asm/ptrace.h>
15#include <asm/gt64120.h>
16
17/*
18 * These are interrupt handlers for the GT on-chip interrupts. They all come
19 * in to the MIPS on a single interrupt line, and have to be handled and ack'ed
20 * differently than other MIPS interrupts.
21 */
22
23static void gt64120_irq(int irq, void *dev_id, struct pt_regs *regs)
24{
25 unsigned int irq_src, int_high_src, irq_src_mask, int_high_src_mask;
26 int handled = 0;
27
28 irq_src = GT_READ(GT_INTRCAUSE_OFS);
29 irq_src_mask = GT_READ(GT_INTRMASK_OFS);
30 int_high_src = GT_READ(GT_HINTRCAUSE_OFS);
31 int_high_src_mask = GT_READ(GT_HINTRMASK_OFS);
32 irq_src = irq_src & irq_src_mask;
33 int_high_src = int_high_src & int_high_src_mask;
34
35 if (irq_src & 0x00000800) { /* Check for timer interrupt */
36 handled = 1;
37 irq_src &= ~0x00000800;
38 do_timer(regs);
39#ifndef CONFIG_SMP
40 update_process_times(user_mode(regs));
41#endif
42 }
43
44 GT_WRITE(GT_INTRCAUSE_OFS, 0);
45 GT_WRITE(GT_HINTRCAUSE_OFS, 0);
46}
47
48/*
49 * Initializes timer using galileo's built in timer.
50 */
51#ifdef CONFIG_SYSCLK_100
52#define Sys_clock (100 * 1000000) // 100 MHz
53#endif
54#ifdef CONFIG_SYSCLK_83
55#define Sys_clock (83.333 * 1000000) // 83.333 MHz
56#endif
57#ifdef CONFIG_SYSCLK_75
58#define Sys_clock (75 * 1000000) // 75 MHz
59#endif
60
61/*
62 * This will ignore the standard MIPS timer interrupt handler that is passed in
63 * as *irq (=irq0 in ../kernel/time.c). We will do our own timer interrupt
64 * handling.
65 */
66void gt64120_time_init(void)
67{
68 static struct irqaction timer;
69
70 /* Disable timer first */
71 GT_WRITE(GT_TC_CONTROL_OFS, 0);
72 /* Load timer value for 100 Hz */
73 GT_WRITE(GT_TC3_OFS, Sys_clock / 100);
74
75 /*
76 * Create the IRQ structure entry for the timer. Since we're too early
77 * in the boot process to use the "request_irq()" call, we'll hard-code
78 * the values to the correct interrupt line.
79 */
80 timer.handler = gt64120_irq;
81 timer.flags = SA_SHIRQ | SA_INTERRUPT;
82 timer.name = "timer";
83 timer.dev_id = NULL;
84 timer.next = NULL;
85 timer.mask = CPU_MASK_NONE;
86 irq_desc[GT_TIMER].action = &timer;
87
88 enable_irq(GT_TIMER);
89
90 /* Enable timer ints */
91 GT_WRITE(GT_TC_CONTROL_OFS, 0xc0);
92 /* clear Cause register first */
93 GT_WRITE(GT_INTRCAUSE_OFS, 0x0);
94 /* Unmask timer int */
95 GT_WRITE(GT_INTRMASK_OFS, 0x800);
96 /* Clear High int register */
97 GT_WRITE(GT_HINTRCAUSE_OFS, 0x0);
98 /* Mask All interrupts at High cause interrupt */
99 GT_WRITE(GT_HINTRMASK_OFS, 0x0);
100}
diff --git a/arch/mips/gt64120/ev64120/Makefile b/arch/mips/gt64120/ev64120/Makefile
new file mode 100644
index 000000000000..ebe91c57e173
--- /dev/null
+++ b/arch/mips/gt64120/ev64120/Makefile
@@ -0,0 +1,11 @@
1#
2# Copyright 2000 RidgeRun, Inc.
3# Author: RidgeRun, Inc.
4# glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
5#
6# Makefile for the Galileo EV64120 board.
7#
8
9obj-y += int-handler.o irq.o promcon.o reset.o serialGT.o setup.o
10
11EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/gt64120/ev64120/int-handler.S b/arch/mips/gt64120/ev64120/int-handler.S
new file mode 100644
index 000000000000..752435faf2de
--- /dev/null
+++ b/arch/mips/gt64120/ev64120/int-handler.S
@@ -0,0 +1,113 @@
1/*
2 * int-handler.S
3 *
4 * Based on the cobalt handler.
5 */
6#include <asm/asm.h>
7#include <asm/mipsregs.h>
8#include <asm/addrspace.h>
9#include <asm/regdef.h>
10#include <asm/stackframe.h>
11
12/*
13 * galileo_handle_int -
14 * We check for the timer first, then check PCI ints A and D.
15 * Then check for serial IRQ and fall through.
16 */
17 .align 5
18 .set reorder
19 .set noat
20 NESTED(galileo_handle_int, PT_SIZE, sp)
21 SAVE_ALL
22 CLI
23 .set at
24 mfc0 t0,CP0_CAUSE
25 mfc0 t2,CP0_STATUS
26
27 and t0,t2
28
29 andi t1,t0,STATUSF_IP4 /* int2 hardware line (timer) */
30 bnez t1,ll_gt64120_irq
31 andi t1,t0,STATUSF_IP2 /* int0 hardware line */
32 bnez t1,ll_pci_intA
33 andi t1,t0,STATUSF_IP5 /* int3 hardware line */
34 bnez t1,ll_pci_intD
35 andi t1,t0,STATUSF_IP6 /* int4 hardware line */
36 bnez t1,ll_serial_irq
37 andi t1,t0,STATUSF_IP7 /* compare int */
38 bnez t1,ll_compare_irq
39 nop
40
41 /* wrong alarm or masked ... */
42 j spurious_interrupt
43 nop
44 END(galileo_handle_int)
45
46
47 .align 5
48 .set reorder
49ll_gt64120_irq:
50 li a0,4
51 move a1,sp
52 jal do_IRQ
53 nop
54 j ret_from_irq
55 nop
56
57 .align 5
58 .set reorder
59ll_compare_irq:
60 li a0,7
61 move a1,sp
62 jal do_IRQ
63 nop
64 j ret_from_irq
65 nop
66
67 .align 5
68 .set reorder
69ll_pci_intA:
70 move a0,sp
71 jal pci_intA
72 nop
73 j ret_from_irq
74 nop
75
76#if 0
77 .align 5
78 .set reorder
79ll_pci_intB:
80 move a0,sp
81 jal pci_intB
82 nop
83 j ret_from_irq
84 nop
85
86 .align 5
87 .set reorder
88ll_pci_intC:
89 move a0,sp
90 jal pci_intC
91 nop
92 j ret_from_irq
93 nop
94#endif
95
96 .align 5
97 .set reorder
98ll_pci_intD:
99 move a0,sp
100 jal pci_intD
101 nop
102 j ret_from_irq
103 nop
104
105 .align 5
106 .set reorder
107ll_serial_irq:
108 li a0,6
109 move a1,sp
110 jal do_IRQ
111 nop
112 j ret_from_irq
113 nop
diff --git a/arch/mips/gt64120/ev64120/irq.c b/arch/mips/gt64120/ev64120/irq.c
new file mode 100644
index 000000000000..3b186159b21a
--- /dev/null
+++ b/arch/mips/gt64120/ev64120/irq.c
@@ -0,0 +1,145 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Code to handle irqs on GT64120A boards
4 * Derived from mips/orion and Cort <cort@fsmlabs.com>
5 *
6 * Copyright (C) 2000 RidgeRun, Inc.
7 * Author: RidgeRun, Inc.
8 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
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#include <linux/errno.h>
31#include <linux/init.h>
32#include <linux/kernel_stat.h>
33#include <linux/module.h>
34#include <linux/signal.h>
35#include <linux/sched.h>
36#include <linux/types.h>
37#include <linux/interrupt.h>
38#include <linux/ioport.h>
39#include <linux/timex.h>
40#include <linux/slab.h>
41#include <linux/random.h>
42#include <linux/bitops.h>
43#include <asm/bootinfo.h>
44#include <asm/io.h>
45#include <asm/mipsregs.h>
46#include <asm/system.h>
47#include <asm/gt64120.h>
48
49asmlinkage inline void pci_intA(struct pt_regs *regs)
50{
51 do_IRQ(GT_INTA, regs);
52}
53
54asmlinkage inline void pci_intD(struct pt_regs *regs)
55{
56 do_IRQ(GT_INTD, regs);
57}
58
59static void disable_ev64120_irq(unsigned int irq_nr)
60{
61 unsigned long flags;
62
63 local_irq_save(flags);
64 if (irq_nr >= 8) { // All PCI interrupts are on line 5 or 2
65 clear_c0_status(9 << 10);
66 } else {
67 clear_c0_status(1 << (irq_nr + 8));
68 }
69 local_irq_restore(flags);
70}
71
72static void enable_ev64120_irq(unsigned int irq_nr)
73{
74 unsigned long flags;
75
76 local_irq_save(flags);
77 if (irq_nr >= 8) // All PCI interrupts are on line 5 or 2
78 set_c0_status(9 << 10);
79 else
80 set_c0_status(1 << (irq_nr + 8));
81 local_irq_restore(flags);
82}
83
84static unsigned int startup_ev64120_irq(unsigned int irq)
85{
86 enable_ev64120_irq(irq);
87 return 0; /* Never anything pending */
88}
89
90#define shutdown_ev64120_irq disable_ev64120_irq
91#define mask_and_ack_ev64120_irq disable_ev64120_irq
92
93static void end_ev64120_irq(unsigned int irq)
94{
95 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
96 enable_ev64120_irq(irq);
97}
98
99static struct hw_interrupt_type ev64120_irq_type = {
100 .typename = "EV64120",
101 .startup = startup_ev64120_irq,
102 .shutdown = shutdown_ev64120_irq,
103 .enable = enable_ev64120_irq,
104 .disable = disable_ev64120_irq,
105 .ack = mask_and_ack_ev64120_irq,
106 .end = end_ev64120_irq,
107 .set_affinity = NULL
108};
109
110void gt64120_irq_setup(void)
111{
112 extern asmlinkage void galileo_handle_int(void);
113
114 /*
115 * Clear all of the interrupts while we change the able around a bit.
116 */
117 clear_c0_status(ST0_IM);
118
119 /* Sets the exception_handler array. */
120 set_except_vector(0, galileo_handle_int);
121
122 local_irq_disable();
123
124 /*
125 * Enable timer. Other interrupts will be enabled as they are
126 * registered.
127 */
128 set_c0_status(IE_IRQ2);
129}
130
131void __init arch_init_irq(void)
132{
133 int i;
134
135 /* Let's initialize our IRQ descriptors */
136 for (i = 0; i < NR_IRQS; i++) {
137 irq_desc[i].status = 0;
138 irq_desc[i].handler = &no_irq_type;
139 irq_desc[i].action = NULL;
140 irq_desc[i].depth = 0;
141 spin_lock_init(&irq_desc[i].lock);
142 }
143
144 gt64120_irq_setup();
145}
diff --git a/arch/mips/gt64120/ev64120/promcon.c b/arch/mips/gt64120/ev64120/promcon.c
new file mode 100644
index 000000000000..b5937c4ba7db
--- /dev/null
+++ b/arch/mips/gt64120/ev64120/promcon.c
@@ -0,0 +1,53 @@
1/*
2 * Wrap-around code for a console using the
3 * SGI PROM io-routines.
4 *
5 * Copyright (c) 1999 Ulf Carlsson
6 *
7 * Derived from DECstation promcon.c
8 * Copyright (c) 1998 Harald Koerfgen
9 */
10#include <linux/tty.h>
11#include <linux/init.h>
12#include <linux/console.h>
13
14static void prom_console_write(struct console *co, const char *s,
15 unsigned count)
16{
17 extern int CONSOLE_CHANNEL; // The default serial port
18 unsigned i;
19
20 for (i = 0; i < count; i++) {
21 if (*s == 10)
22 serial_putc(CONSOLE_CHANNEL, 13);
23 serial_putc(CONSOLE_CHANNEL, *s++);
24 }
25}
26
27int prom_getchar(void)
28{
29 return 0;
30}
31
32static struct console sercons = {
33 .name = "ttyS",
34 .write = prom_console_write,
35 .flags = CON_PRINTBUFFER,
36 .index = -1,
37};
38
39/*
40 * Register console.
41 */
42
43static int gal_serial_console_init(void)
44{
45 // serial_init();
46 //serial_set(115200);
47
48 register_console(&sercons);
49
50 return 0;
51}
52
53console_initcall(gal_serial_console_init);
diff --git a/arch/mips/gt64120/ev64120/reset.c b/arch/mips/gt64120/ev64120/reset.c
new file mode 100644
index 000000000000..7b9f5e5bf21f
--- /dev/null
+++ b/arch/mips/gt64120/ev64120/reset.c
@@ -0,0 +1,45 @@
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) 1997 Ralf Baechle
7 */
8#include <linux/sched.h>
9#include <linux/mm.h>
10#include <asm/io.h>
11#include <asm/pgtable.h>
12#include <asm/processor.h>
13#include <asm/reboot.h>
14#include <asm/system.h>
15
16void galileo_machine_restart(char *command)
17{
18 *(volatile char *) 0xbc000000 = 0x0f;
19 /*
20 * Ouch, we're still alive ... This time we take the silver bullet ...
21 * ... and find that we leave the hardware in a state in which the
22 * kernel in the flush locks up somewhen during of after the PCI
23 * detection stuff.
24 */
25 set_c0_status(ST0_BEV | ST0_ERL);
26 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
27 flush_cache_all();
28 write_c0_wired(0);
29 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
30}
31
32void galileo_machine_halt(void)
33{
34 printk(KERN_NOTICE "You can safely turn off the power\n");
35 while (1)
36 __asm__(".set\tmips3\n\t"
37 "wait\n\t"
38 ".set\tmips0");
39
40}
41
42void galileo_machine_power_off(void)
43{
44 galileo_machine_halt();
45}
diff --git a/arch/mips/gt64120/ev64120/serialGT.c b/arch/mips/gt64120/ev64120/serialGT.c
new file mode 100644
index 000000000000..16e34a546e54
--- /dev/null
+++ b/arch/mips/gt64120/ev64120/serialGT.c
@@ -0,0 +1,212 @@
1/*
2 * serialGT.c
3 *
4 * BRIEF MODULE DESCRIPTION
5 * Low Level Serial Port control for use
6 * with the Galileo EVB64120A MIPS eval board and
7 * its on board two channel 16552 Uart.
8 *
9 * Copyright (C) 2000 RidgeRun, Inc.
10 * Author: RidgeRun, Inc.
11 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 *
33 */
34
35// Note:
36// Serial CHANNELS - 0 is the bottom connector of evb64120A.
37// (The one that maps to the "B" channel of the
38// board's uart)
39// 1 is the top connector of evb64120A.
40// (The one that maps to the "A" channel of the
41// board's uart)
42int DEBUG_CHANNEL = 0; // See Note Above
43int CONSOLE_CHANNEL = 1; // See Note Above
44
45#define DUART 0xBD000000 /* Base address of Uart. */
46#define CHANNELOFFSET 0x20 /* DUART+CHANNELOFFSET gets you to the ChanA
47 register set of the 16552 Uart device.
48 DUART+0 gets you to the ChanB register set.
49 */
50#define DUART_DELTA 0x4
51#define FIFO_ENABLE 0x07
52#define INT_ENABLE 0x04 /* default interrupt mask */
53
54#define RBR 0x00
55#define THR 0x00
56#define DLL 0x00
57#define IER 0x01
58#define DLM 0x01
59#define IIR 0x02
60#define FCR 0x02
61#define LCR 0x03
62#define MCR 0x04
63#define LSR 0x05
64#define MSR 0x06
65#define SCR 0x07
66
67#define LCR_DLAB 0x80
68#define XTAL 1843200
69#define LSR_THRE 0x20
70#define LSR_BI 0x10
71#define LSR_DR 0x01
72#define MCR_LOOP 0x10
73#define ACCESS_DELAY 0x10000
74
75/******************************
76 Routine:
77 Description:
78 ******************************/
79int inreg(int channel, int reg)
80{
81 int val;
82 val =
83 *((volatile unsigned char *) DUART +
84 (channel * CHANNELOFFSET) + (reg * DUART_DELTA));
85 return val;
86}
87
88/******************************
89 Routine:
90 Description:
91 ******************************/
92void outreg(int channel, int reg, unsigned char val)
93{
94 *((volatile unsigned char *) DUART + (channel * CHANNELOFFSET)
95 + (reg * DUART_DELTA)) = val;
96}
97
98/******************************
99 Routine:
100 Description:
101 Initialize the device driver.
102 ******************************/
103void serial_init(int channel)
104{
105 /*
106 * Configure active port, (CHANNELOFFSET already set.)
107 *
108 * Set 8 bits, 1 stop bit, no parity.
109 *
110 * LCR<7> 0 divisor latch access bit
111 * LCR<6> 0 break control (1=send break)
112 * LCR<5> 0 stick parity (0=space, 1=mark)
113 * LCR<4> 0 parity even (0=odd, 1=even)
114 * LCR<3> 0 parity enable (1=enabled)
115 * LCR<2> 0 # stop bits (0=1, 1=1.5)
116 * LCR<1:0> 11 bits per character(00=5, 01=6, 10=7, 11=8)
117 */
118 outreg(channel, LCR, 0x3);
119
120 outreg(channel, FCR, FIFO_ENABLE); /* Enable the FIFO */
121
122 outreg(channel, IER, INT_ENABLE); /* Enable appropriate interrupts */
123}
124
125/******************************
126 Routine:
127 Description:
128 Set the baud rate.
129 ******************************/
130void serial_set(int channel, unsigned long baud)
131{
132 unsigned char sav_lcr;
133
134 /*
135 * Enable access to the divisor latches by setting DLAB in LCR.
136 *
137 */
138 sav_lcr = inreg(channel, LCR);
139
140#if 0
141 /*
142 * Set baud rate
143 */
144 outreg(channel, LCR, LCR_DLAB | sav_lcr);
145 // outreg(DLL,(XTAL/(16*2*(baud))-2));
146 outreg(channel, DLL, XTAL / (16 * baud));
147 // outreg(DLM,(XTAL/(16*2*(baud))-2)>>8);
148 outreg(channel, DLM, (XTAL / (16 * baud)) >> 8);
149#else
150 /*
151 * Note: Set baud rate, hardcoded here for rate of 115200
152 * since became unsure of above "buad rate" algorithm (??).
153 */
154 outreg(channel, LCR, 0x83);
155 outreg(channel, DLM, 0x00); // See note above
156 outreg(channel, DLL, 0x02); // See note above.
157 outreg(channel, LCR, 0x03);
158#endif
159
160 /*
161 * Restore line control register
162 */
163 outreg(channel, LCR, sav_lcr);
164}
165
166
167/******************************
168 Routine:
169 Description:
170 Transmit a character.
171 ******************************/
172void serial_putc(int channel, int c)
173{
174 while ((inreg(channel, LSR) & LSR_THRE) == 0);
175 outreg(channel, THR, c);
176}
177
178/******************************
179 Routine:
180 Description:
181 Read a received character if one is
182 available. Return -1 otherwise.
183 ******************************/
184int serial_getc(int channel)
185{
186 if (inreg(channel, LSR) & LSR_DR) {
187 return inreg(channel, RBR);
188 }
189 return -1;
190}
191
192/******************************
193 Routine:
194 Description:
195 Used by embedded gdb client. (example; gdb-stub.c)
196 ******************************/
197char getDebugChar()
198{
199 int val;
200 while ((val = serial_getc(DEBUG_CHANNEL)) == -1); // loop until we get a character in.
201 return (char) val;
202}
203
204/******************************
205 Routine:
206 Description:
207 Used by embedded gdb target. (example; gdb-stub.c)
208 ******************************/
209void putDebugChar(char c)
210{
211 serial_putc(DEBUG_CHANNEL, (int) c);
212}
diff --git a/arch/mips/gt64120/ev64120/setup.c b/arch/mips/gt64120/ev64120/setup.c
new file mode 100644
index 000000000000..dba0961400cc
--- /dev/null
+++ b/arch/mips/gt64120/ev64120/setup.c
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2000 RidgeRun, Inc.
3 * Author: RidgeRun, Inc.
4 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 */
27#include <linux/init.h>
28#include <linux/kernel.h>
29#include <linux/types.h>
30#include <linux/mm.h>
31#include <linux/swap.h>
32#include <linux/ioport.h>
33#include <linux/sched.h>
34#include <linux/interrupt.h>
35#include <linux/pci.h>
36#include <linux/timex.h>
37#include <asm/bootinfo.h>
38#include <asm/page.h>
39#include <asm/io.h>
40#include <asm/irq.h>
41#include <asm/pci.h>
42#include <asm/processor.h>
43#include <asm/ptrace.h>
44#include <asm/time.h>
45#include <asm/reboot.h>
46#include <asm/traps.h>
47#include <linux/bootmem.h>
48
49unsigned long gt64120_base = KSEG1ADDR(0x14000000);
50
51/* These functions are used for rebooting or halting the machine*/
52extern void galileo_machine_restart(char *command);
53extern void galileo_machine_halt(void);
54extern void galileo_machine_power_off(void);
55/*
56 *This structure holds pointers to the pci configuration space accesses
57 *and interrupts allocating routine for device over the PCI
58 */
59extern struct pci_ops galileo_pci_ops;
60
61unsigned long __init prom_free_prom_memory(void)
62{
63 return 0;
64}
65
66/*
67 * Initializes basic routines and structures pointers, memory size (as
68 * given by the bios and saves the command line.
69 */
70extern void gt64120_time_init(void);
71
72static void __init ev64120_setup(void)
73{
74 _machine_restart = galileo_machine_restart;
75 _machine_halt = galileo_machine_halt;
76 _machine_power_off = galileo_machine_power_off;
77
78 board_time_init = gt64120_time_init;
79 set_io_port_base(KSEG1);
80}
81
82early_initcall(ev64120_setup);
83
84const char *get_system_type(void)
85{
86 return "Galileo EV64120A";
87}
88
89/*
90 * Kernel arguments passed by the firmware
91 *
92 * $a0 - nothing
93 * $a1 - holds a pointer to the eprom parameters
94 * $a2 - nothing
95 */
96
97void __init prom_init(void)
98{
99 mips_machgroup = MACH_GROUP_GALILEO;
100 mips_machtype = MACH_EV64120A;
101
102 add_memory_region(0, 32 << 20, BOOT_MEM_RAM);
103}
diff --git a/arch/mips/gt64120/momenco_ocelot/Makefile b/arch/mips/gt64120/momenco_ocelot/Makefile
new file mode 100644
index 000000000000..7b59c6567c79
--- /dev/null
+++ b/arch/mips/gt64120/momenco_ocelot/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for Momentum's Ocelot board.
3#
4
5obj-y += int-handler.o irq.o prom.o reset.o setup.o
6
7obj-$(CONFIG_KGDB) += dbg_io.o
8
9EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/gt64120/momenco_ocelot/dbg_io.c b/arch/mips/gt64120/momenco_ocelot/dbg_io.c
new file mode 100644
index 000000000000..8720bccfdea2
--- /dev/null
+++ b/arch/mips/gt64120/momenco_ocelot/dbg_io.c
@@ -0,0 +1,126 @@
1#include <linux/config.h>
2
3#ifdef CONFIG_KGDB
4
5#include <asm/serial.h> /* For the serial port location and base baud */
6
7/* --- CONFIG --- */
8
9typedef unsigned char uint8;
10typedef unsigned int uint32;
11
12/* --- END OF CONFIG --- */
13
14#define UART16550_BAUD_2400 2400
15#define UART16550_BAUD_4800 4800
16#define UART16550_BAUD_9600 9600
17#define UART16550_BAUD_19200 19200
18#define UART16550_BAUD_38400 38400
19#define UART16550_BAUD_57600 57600
20#define UART16550_BAUD_115200 115200
21
22#define UART16550_PARITY_NONE 0
23#define UART16550_PARITY_ODD 0x08
24#define UART16550_PARITY_EVEN 0x18
25#define UART16550_PARITY_MARK 0x28
26#define UART16550_PARITY_SPACE 0x38
27
28#define UART16550_DATA_5BIT 0x0
29#define UART16550_DATA_6BIT 0x1
30#define UART16550_DATA_7BIT 0x2
31#define UART16550_DATA_8BIT 0x3
32
33#define UART16550_STOP_1BIT 0x0
34#define UART16550_STOP_2BIT 0x4
35
36/* ----------------------------------------------------- */
37
38/* === CONFIG === */
39
40/* [jsun] we use the second serial port for kdb */
41#define BASE OCELOT_SERIAL1_BASE
42#define MAX_BAUD OCELOT_BASE_BAUD
43
44/* === END OF CONFIG === */
45
46#define REG_OFFSET 4
47
48/* register offset */
49#define OFS_RCV_BUFFER 0
50#define OFS_TRANS_HOLD 0
51#define OFS_SEND_BUFFER 0
52#define OFS_INTR_ENABLE (1*REG_OFFSET)
53#define OFS_INTR_ID (2*REG_OFFSET)
54#define OFS_DATA_FORMAT (3*REG_OFFSET)
55#define OFS_LINE_CONTROL (3*REG_OFFSET)
56#define OFS_MODEM_CONTROL (4*REG_OFFSET)
57#define OFS_RS232_OUTPUT (4*REG_OFFSET)
58#define OFS_LINE_STATUS (5*REG_OFFSET)
59#define OFS_MODEM_STATUS (6*REG_OFFSET)
60#define OFS_RS232_INPUT (6*REG_OFFSET)
61#define OFS_SCRATCH_PAD (7*REG_OFFSET)
62
63#define OFS_DIVISOR_LSB (0*REG_OFFSET)
64#define OFS_DIVISOR_MSB (1*REG_OFFSET)
65
66
67/* memory-mapped read/write of the port */
68#define UART16550_READ(y) (*((volatile uint8*)(BASE + y)))
69#define UART16550_WRITE(y, z) ((*((volatile uint8*)(BASE + y))) = z)
70
71void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
72{
73 /* disable interrupts */
74 UART16550_WRITE(OFS_INTR_ENABLE, 0);
75
76 /* set up buad rate */
77 {
78 uint32 divisor;
79
80 /* set DIAB bit */
81 UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
82
83 /* set divisor */
84 divisor = MAX_BAUD / baud;
85 UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
86 UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
87
88 /* clear DIAB bit */
89 UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
90 }
91
92 /* set data format */
93 UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
94}
95
96static int remoteDebugInitialized = 0;
97
98uint8 getDebugChar(void)
99{
100 if (!remoteDebugInitialized) {
101 remoteDebugInitialized = 1;
102 debugInit(UART16550_BAUD_38400,
103 UART16550_DATA_8BIT,
104 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
105 }
106
107 while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
108 return UART16550_READ(OFS_RCV_BUFFER);
109}
110
111
112int putDebugChar(uint8 byte)
113{
114 if (!remoteDebugInitialized) {
115 remoteDebugInitialized = 1;
116 debugInit(UART16550_BAUD_38400,
117 UART16550_DATA_8BIT,
118 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
119 }
120
121 while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
122 UART16550_WRITE(OFS_SEND_BUFFER, byte);
123 return 1;
124}
125
126#endif
diff --git a/arch/mips/gt64120/momenco_ocelot/int-handler.S b/arch/mips/gt64120/momenco_ocelot/int-handler.S
new file mode 100644
index 000000000000..808acef248cc
--- /dev/null
+++ b/arch/mips/gt64120/momenco_ocelot/int-handler.S
@@ -0,0 +1,131 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * First-level interrupt dispatcher for ocelot board.
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#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17
18/*
19 * first level interrupt dispatcher for ocelot board -
20 * We check for the timer first, then check PCI ints A and D.
21 * Then check for serial IRQ and fall through.
22 */
23 .align 5
24 NESTED(ocelot_handle_int, PT_SIZE, sp)
25 SAVE_ALL
26 CLI
27 .set at
28 mfc0 t0, CP0_CAUSE
29 mfc0 t2, CP0_STATUS
30
31 and t0, t2
32
33 andi t1, t0, STATUSF_IP2 /* int0 hardware line */
34 bnez t1, ll_pri_enet_irq
35 andi t1, t0, STATUSF_IP3 /* int1 hardware line */
36 bnez t1, ll_sec_enet_irq
37 andi t1, t0, STATUSF_IP4 /* int2 hardware line */
38 bnez t1, ll_uart1_irq
39 andi t1, t0, STATUSF_IP5 /* int3 hardware line */
40 bnez t1, ll_cpci_irq
41 andi t1, t0, STATUSF_IP6 /* int4 hardware line */
42 bnez t1, ll_galileo_irq
43 andi t1, t0, STATUSF_IP7 /* cpu timer */
44 bnez t1, ll_cputimer_irq
45
46 /* now look at the extended interrupts */
47 mfc0 t0, CP0_CAUSE
48 cfc0 t1, CP0_S1_INTCONTROL
49
50 /* shift the mask 8 bits left to line up the bits */
51 sll t2, t1, 8
52
53 and t0, t2
54 srl t0, t0, 16
55
56 andi t1, t0, STATUSF_IP8 /* int6 hardware line */
57 bnez t1, ll_pmc1_irq
58 andi t1, t0, STATUSF_IP9 /* int7 hardware line */
59 bnez t1, ll_pmc2_irq
60 andi t1, t0, STATUSF_IP10 /* int8 hardware line */
61 bnez t1, ll_cpci_abcd_irq
62 andi t1, t0, STATUSF_IP11 /* int9 hardware line */
63 bnez t1, ll_uart2_irq
64
65 .set reorder
66
67 /* wrong alarm or masked ... */
68 j spurious_interrupt
69 nop
70 END(ocelot_handle_int)
71
72 .align 5
73ll_pri_enet_irq:
74 li a0, 2
75 move a1, sp
76 jal do_IRQ
77 j ret_from_irq
78
79ll_sec_enet_irq:
80 li a0, 3
81 move a1, sp
82 jal do_IRQ
83 j ret_from_irq
84
85ll_uart1_irq:
86 li a0, 4
87 move a1, sp
88 jal do_IRQ
89 j ret_from_irq
90
91ll_cpci_irq:
92 li a0, 5
93 move a1, sp
94 jal do_IRQ
95 j ret_from_irq
96
97ll_galileo_irq:
98 li a0, 6
99 move a1, sp
100 jal do_IRQ
101 j ret_from_irq
102
103ll_cputimer_irq:
104 li a0, 7
105 move a1, sp
106 jal do_IRQ
107 j ret_from_irq
108
109ll_pmc1_irq:
110 li a0, 8
111 move a1, sp
112 jal do_IRQ
113 j ret_from_irq
114
115ll_pmc2_irq:
116 li a0, 9
117 move a1, sp
118 jal do_IRQ
119 j ret_from_irq
120
121ll_cpci_abcd_irq:
122 li a0, 10
123 move a1, sp
124 jal do_IRQ
125 j ret_from_irq
126
127ll_uart2_irq:
128 li a0, 11
129 move a1, sp
130 jal do_IRQ
131 j ret_from_irq
diff --git a/arch/mips/gt64120/momenco_ocelot/irq.c b/arch/mips/gt64120/momenco_ocelot/irq.c
new file mode 100644
index 000000000000..4f108da71b23
--- /dev/null
+++ b/arch/mips/gt64120/momenco_ocelot/irq.c
@@ -0,0 +1,67 @@
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
51extern asmlinkage void ocelot_handle_int(void);
52
53void __init arch_init_irq(void)
54{
55 /*
56 * Clear all of the interrupts while we change the able around a bit.
57 * int-handler is not on bootstrap
58 */
59 clear_c0_status(ST0_IM);
60 local_irq_disable();
61
62 /* Sets the first-level interrupt dispatcher. */
63 set_except_vector(0, ocelot_handle_int);
64
65 mips_cpu_irq_init(0);
66 rm7k_cpu_irq_init(8);
67}
diff --git a/arch/mips/gt64120/momenco_ocelot/ocelot_pld.h b/arch/mips/gt64120/momenco_ocelot/ocelot_pld.h
new file mode 100644
index 000000000000..11f02c402b2a
--- /dev/null
+++ b/arch/mips/gt64120/momenco_ocelot/ocelot_pld.h
@@ -0,0 +1,30 @@
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
new file mode 100644
index 000000000000..8677b6d3ada7
--- /dev/null
+++ b/arch/mips/gt64120/momenco_ocelot/prom.c
@@ -0,0 +1,73 @@
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 uint32_t tmp;
36 int i;
37
38 /* save the PROM vectors for debugging use */
39 debug_vectors = cv;
40
41 /* arg[0] is "g", the rest is boot parameters */
42 arcs_cmdline[0] = '\0';
43 for (i = 1; i < argc; i++) {
44 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
45 >= sizeof(arcs_cmdline))
46 break;
47 strcat(arcs_cmdline, arg[i]);
48 strcat(arcs_cmdline, " ");
49 }
50
51 mips_machgroup = MACH_GROUP_MOMENCO;
52 mips_machtype = MACH_MOMENCO_OCELOT;
53
54 while (*env) {
55 if (strncmp("gtbase", *env, 6) == 0) {
56 gt64120_base = simple_strtol(*env + strlen("gtbase="),
57 NULL, 16);
58 break;
59 }
60 *env++;
61 }
62
63 debug_vectors->printf("Booting Linux kernel...\n");
64
65 /* All the boards have at least 64MiB. If there's more, we
66 detect and register it later */
67 add_memory_region(0, 64 << 20, BOOT_MEM_RAM);
68}
69
70unsigned long __init prom_free_prom_memory(void)
71{
72 return 0;
73}
diff --git a/arch/mips/gt64120/momenco_ocelot/reset.c b/arch/mips/gt64120/momenco_ocelot/reset.c
new file mode 100644
index 000000000000..3fd499adf4cf
--- /dev/null
+++ b/arch/mips/gt64120/momenco_ocelot/reset.c
@@ -0,0 +1,47 @@
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
new file mode 100644
index 000000000000..d610f8c17c81
--- /dev/null
+++ b/arch/mips/gt64120/momenco_ocelot/setup.c
@@ -0,0 +1,369 @@
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 Ralf Baechle
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 <asm/time.h>
51#include <asm/bootinfo.h>
52#include <asm/page.h>
53#include <asm/io.h>
54#include <asm/irq.h>
55#include <asm/pci.h>
56#include <asm/processor.h>
57#include <asm/ptrace.h>
58#include <asm/reboot.h>
59#include <asm/traps.h>
60#include <linux/bootmem.h>
61#include <linux/initrd.h>
62#include <asm/gt64120.h>
63#include "ocelot_pld.h"
64
65unsigned long gt64120_base = KSEG1ADDR(GT_DEF_BASE);
66
67/* These functions are used for rebooting or halting the machine*/
68extern void momenco_ocelot_restart(char *command);
69extern void momenco_ocelot_halt(void);
70extern void momenco_ocelot_power_off(void);
71
72extern void gt64120_time_init(void);
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 */
82void PMON_v1_setup()
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
153static void __init momenco_ocelot_setup(void)
154{
155 void (*l3func)(unsigned long)=KSEG1ADDR(&setup_l3cache);
156 unsigned int tmpword;
157
158 board_time_init = gt64120_time_init;
159
160 _machine_restart = momenco_ocelot_restart;
161 _machine_halt = momenco_ocelot_halt;
162 _machine_power_off = momenco_ocelot_power_off;
163
164 /*
165 * initrd_start = (ulong)ocelot_initrd_start;
166 * initrd_end = (ulong)ocelot_initrd_start + (ulong)ocelot_initrd_size;
167 * initrd_below_start_ok = 1;
168 */
169
170 /* do handoff reconfiguration */
171 if (gt64120_base == KSEG1ADDR(GT_DEF_BASE))
172 PMON_v1_setup();
173 else
174 PMON_v2_setup();
175
176 /* Turn off the Bit-Error LED */
177 OCELOT_PLD_WRITE(0x80, INTCLR);
178
179 /* Relocate all the PCI1 stuff, not that we use it */
180 GT_WRITE(GT_PCI1IOLD_OFS, 0x30000000 >> 21);
181 GT_WRITE(GT_PCI1M0LD_OFS, 0x32000000 >> 21);
182 GT_WRITE(GT_PCI1M1LD_OFS, 0x34000000 >> 21);
183
184 /* Relocate PCI0 I/O and Mem0 */
185 GT_WRITE(GT_PCI0IOLD_OFS, 0x20000000 >> 21);
186 GT_WRITE(GT_PCI0M0LD_OFS, 0x22000000 >> 21);
187
188 /* Relocate PCI0 Mem1 */
189 GT_WRITE(GT_PCI0M1LD_OFS, 0x36000000 >> 21);
190
191 /* For the initial programming, we assume 512MB configuration */
192 /* Relocate the CPU's view of the RAM... */
193 GT_WRITE(GT_SCS10LD_OFS, 0);
194 GT_WRITE(GT_SCS10HD_OFS, 0x0fe00000 >> 21);
195 GT_WRITE(GT_SCS32LD_OFS, 0x10000000 >> 21);
196 GT_WRITE(GT_SCS32HD_OFS, 0x0fe00000 >> 21);
197
198 GT_WRITE(GT_SCS1LD_OFS, 0xff);
199 GT_WRITE(GT_SCS1HD_OFS, 0x00);
200 GT_WRITE(GT_SCS0LD_OFS, 0);
201 GT_WRITE(GT_SCS0HD_OFS, 0xff);
202 GT_WRITE(GT_SCS3LD_OFS, 0xff);
203 GT_WRITE(GT_SCS3HD_OFS, 0x00);
204 GT_WRITE(GT_SCS2LD_OFS, 0);
205 GT_WRITE(GT_SCS2HD_OFS, 0xff);
206
207 /* ...and the PCI0 view of it. */
208 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000010);
209 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x00000000);
210 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
211 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x10000000);
212 GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x0ffff000);
213 GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x0ffff000);
214
215 tmpword = OCELOT_PLD_READ(BOARDREV);
216 if (tmpword < 26)
217 printk("Momenco Ocelot: Board Assembly Rev. %c\n", 'A'+tmpword);
218 else
219 printk("Momenco Ocelot: Board Assembly Revision #0x%x\n", tmpword);
220
221 tmpword = OCELOT_PLD_READ(PLD1_ID);
222 printk("PLD 1 ID: %d.%d\n", tmpword>>4, tmpword&15);
223 tmpword = OCELOT_PLD_READ(PLD2_ID);
224 printk("PLD 2 ID: %d.%d\n", tmpword>>4, tmpword&15);
225 tmpword = OCELOT_PLD_READ(RESET_STATUS);
226 printk("Reset reason: 0x%x\n", tmpword);
227 reset_reason = tmpword;
228 OCELOT_PLD_WRITE(0xff, RESET_STATUS);
229
230 tmpword = OCELOT_PLD_READ(BOARD_STATUS);
231 printk("Board Status register: 0x%02x\n", tmpword);
232 printk(" - User jumper: %s\n", (tmpword & 0x80)?"installed":"absent");
233 printk(" - Boot flash write jumper: %s\n", (tmpword&0x40)?"installed":"absent");
234 printk(" - Tulip PHY %s connected\n", (tmpword&0x10)?"is":"not");
235 printk(" - L3 Cache size: %d MiB\n", (1<<((tmpword&12) >> 2))&~1);
236 printk(" - SDRAM size: %d MiB\n", 1<<(6+(tmpword&3)));
237
238 if (tmpword&12)
239 l3func((1<<(((tmpword&12) >> 2)+20)));
240
241 switch(tmpword &3) {
242 case 3:
243 /* 512MiB */
244 /* Decoders are allready set -- just add the
245 * appropriate region */
246 add_memory_region( 0x40<<20, 0xC0<<20, BOOT_MEM_RAM);
247 add_memory_region(0x100<<20, 0x100<<20, BOOT_MEM_RAM);
248 break;
249 case 2:
250 /* 256MiB -- two banks of 128MiB */
251 GT_WRITE(GT_SCS10HD_OFS, 0x07e00000 >> 21);
252 GT_WRITE(GT_SCS32LD_OFS, 0x08000000 >> 21);
253 GT_WRITE(GT_SCS32HD_OFS, 0x0fe00000 >> 21);
254
255 GT_WRITE(GT_SCS0HD_OFS, 0x7f);
256 GT_WRITE(GT_SCS2LD_OFS, 0x80);
257 GT_WRITE(GT_SCS2HD_OFS, 0xff);
258
259 /* reconfigure the PCI0 interface view of memory */
260 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
261 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x08000000);
262 GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x0ffff000);
263 GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x0ffff000);
264
265 add_memory_region(0x40<<20, 0x40<<20, BOOT_MEM_RAM);
266 add_memory_region(0x80<<20, 0x80<<20, BOOT_MEM_RAM);
267 break;
268 case 1:
269 /* 128MiB -- 64MiB per bank */
270 GT_WRITE(GT_SCS10HD_OFS, 0x03e00000 >> 21);
271 GT_WRITE(GT_SCS32LD_OFS, 0x04000000 >> 21);
272 GT_WRITE(GT_SCS32HD_OFS, 0x07e00000 >> 21);
273
274 GT_WRITE(GT_SCS0HD_OFS, 0x3f);
275 GT_WRITE(GT_SCS2LD_OFS, 0x40);
276 GT_WRITE(GT_SCS2HD_OFS, 0x7f);
277
278 /* reconfigure the PCI0 interface view of memory */
279 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
280 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x04000000);
281 GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x03fff000);
282 GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x03fff000);
283
284 /* add the appropriate region */
285 add_memory_region(0x40<<20, 0x40<<20, BOOT_MEM_RAM);
286 break;
287 case 0:
288 /* 64MiB */
289 GT_WRITE(GT_SCS10HD_OFS, 0x01e00000 >> 21);
290 GT_WRITE(GT_SCS32LD_OFS, 0x02000000 >> 21);
291 GT_WRITE(GT_SCS32HD_OFS, 0x03e00000 >> 21);
292
293 GT_WRITE(GT_SCS0HD_OFS, 0x1f);
294 GT_WRITE(GT_SCS2LD_OFS, 0x20);
295 GT_WRITE(GT_SCS2HD_OFS, 0x3f);
296
297 /* reconfigure the PCI0 interface view of memory */
298 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
299 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x04000000);
300 GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x01fff000);
301 GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x01fff000);
302
303 break;
304 }
305
306 /* Fix up the DiskOnChip mapping */
307 GT_WRITE(GT_DEV_B3_OFS, 0xfef73);
308}
309
310early_initcall(momenco_ocelot_setup);
311
312extern int rm7k_tcache_enabled;
313/*
314 * This runs in KSEG1. See the verbiage in rm7k.c::probe_scache()
315 */
316#define Page_Invalidate_T 0x16
317static void __init setup_l3cache(unsigned long size)
318{
319 int register i;
320 unsigned long tmp;
321
322 printk("Enabling L3 cache...");
323
324 /* Enable the L3 cache in the GT64120A's CPU Configuration register */
325 tmp = GT_READ(GT_CPU_OFS);
326 GT_WRITE(GT_CPU_OFS, tmp | (1<<14));
327
328 /* Enable the L3 cache in the CPU */
329 set_c0_config(1<<12 /* CONF_TE */);
330
331 /* Clear the cache */
332 write_c0_taglo(0);
333 write_c0_taghi(0);
334
335 for (i=0; i < size; i+= 4096) {
336 __asm__ __volatile__ (
337 ".set noreorder\n\t"
338 ".set mips3\n\t"
339 "cache %1, (%0)\n\t"
340 ".set mips0\n\t"
341 ".set reorder"
342 :
343 : "r" (KSEG0ADDR(i)),
344 "i" (Page_Invalidate_T));
345 }
346
347 /* Let the RM7000 MM code know that the tertiary cache is enabled */
348 rm7k_tcache_enabled = 1;
349
350 printk("Done\n");
351}
352
353
354/* This needs to be one of the first initcalls, because no I/O port access
355 can work before this */
356
357static int io_base_ioremap(void)
358{
359 void *io_remap_range = ioremap(GT_PCI_IO_BASE, GT_PCI_IO_SIZE);
360
361 if (!io_remap_range) {
362 panic("Could not ioremap I/O port range");
363 }
364 set_io_port_base(io_remap_range - GT_PCI_IO_BASE);
365
366 return 0;
367}
368
369module_init(io_base_ioremap);
diff --git a/arch/mips/ite-boards/generic/Makefile b/arch/mips/ite-boards/generic/Makefile
new file mode 100644
index 000000000000..0e7853f43983
--- /dev/null
+++ b/arch/mips/ite-boards/generic/Makefile
@@ -0,0 +1,15 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the ITE 8172 (qed-4n-s01b) board, generic files.
7#
8
9obj-y += it8172_setup.o irq.o int-handler.o pmon_prom.o \
10 time.o lpc.o puts.o reset.o
11
12obj-$(CONFIG_IT8172_CIR)+= it8172_cir.o
13obj-$(CONFIG_KGDB) += dbg_io.o
14
15EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/ite-boards/generic/dbg_io.c b/arch/mips/ite-boards/generic/dbg_io.c
new file mode 100644
index 000000000000..c4f8530fd07e
--- /dev/null
+++ b/arch/mips/ite-boards/generic/dbg_io.c
@@ -0,0 +1,125 @@
1
2#include <linux/config.h>
3
4#ifdef CONFIG_KGDB
5
6/* --- CONFIG --- */
7
8/* we need uint32 uint8 */
9/* #include "types.h" */
10typedef unsigned char uint8;
11typedef unsigned int uint32;
12
13/* --- END OF CONFIG --- */
14
15#define UART16550_BAUD_2400 2400
16#define UART16550_BAUD_4800 4800
17#define UART16550_BAUD_9600 9600
18#define UART16550_BAUD_19200 19200
19#define UART16550_BAUD_38400 38400
20#define UART16550_BAUD_57600 57600
21#define UART16550_BAUD_115200 115200
22
23#define UART16550_PARITY_NONE 0
24#define UART16550_PARITY_ODD 0x08
25#define UART16550_PARITY_EVEN 0x18
26#define UART16550_PARITY_MARK 0x28
27#define UART16550_PARITY_SPACE 0x38
28
29#define UART16550_DATA_5BIT 0x0
30#define UART16550_DATA_6BIT 0x1
31#define UART16550_DATA_7BIT 0x2
32#define UART16550_DATA_8BIT 0x3
33
34#define UART16550_STOP_1BIT 0x0
35#define UART16550_STOP_2BIT 0x4
36
37/* ----------------------------------------------------- */
38
39/* === CONFIG === */
40
41/* [stevel] we use the IT8712 serial port for kgdb */
42#define DEBUG_BASE 0xB40003F8 /* 8712 serial port 1 base address */
43#define MAX_BAUD 115200
44
45/* === END OF CONFIG === */
46
47/* register offset */
48#define OFS_RCV_BUFFER 0
49#define OFS_TRANS_HOLD 0
50#define OFS_SEND_BUFFER 0
51#define OFS_INTR_ENABLE 1
52#define OFS_INTR_ID 2
53#define OFS_DATA_FORMAT 3
54#define OFS_LINE_CONTROL 3
55#define OFS_MODEM_CONTROL 4
56#define OFS_RS232_OUTPUT 4
57#define OFS_LINE_STATUS 5
58#define OFS_MODEM_STATUS 6
59#define OFS_RS232_INPUT 6
60#define OFS_SCRATCH_PAD 7
61
62#define OFS_DIVISOR_LSB 0
63#define OFS_DIVISOR_MSB 1
64
65
66/* memory-mapped read/write of the port */
67#define UART16550_READ(y) (*((volatile uint8*)(DEBUG_BASE + y)))
68#define UART16550_WRITE(y,z) ((*((volatile uint8*)(DEBUG_BASE + y))) = z)
69
70void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
71{
72 /* disable interrupts */
73 UART16550_WRITE(OFS_INTR_ENABLE, 0);
74
75 /* set up buad rate */
76 {
77 uint32 divisor;
78
79 /* set DIAB bit */
80 UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
81
82 /* set divisor */
83 divisor = MAX_BAUD / baud;
84 UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
85 UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
86
87 /* clear DIAB bit */
88 UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
89 }
90
91 /* set data format */
92 UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
93}
94
95static int remoteDebugInitialized = 0;
96
97uint8 getDebugChar(void)
98{
99 if (!remoteDebugInitialized) {
100 remoteDebugInitialized = 1;
101 debugInit(UART16550_BAUD_115200,
102 UART16550_DATA_8BIT,
103 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
104 }
105
106 while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
107 return UART16550_READ(OFS_RCV_BUFFER);
108}
109
110
111int putDebugChar(uint8 byte)
112{
113 if (!remoteDebugInitialized) {
114 remoteDebugInitialized = 1;
115 debugInit(UART16550_BAUD_115200,
116 UART16550_DATA_8BIT,
117 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
118 }
119
120 while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
121 UART16550_WRITE(OFS_SEND_BUFFER, byte);
122 return 1;
123}
124
125#endif
diff --git a/arch/mips/ite-boards/generic/int-handler.S b/arch/mips/ite-boards/generic/int-handler.S
new file mode 100644
index 000000000000..d190d8add9cb
--- /dev/null
+++ b/arch/mips/ite-boards/generic/int-handler.S
@@ -0,0 +1,63 @@
1#include <asm/asm.h>
2#include <asm/mipsregs.h>
3#include <asm/regdef.h>
4#include <asm/stackframe.h>
5
6 .text
7 .set macro
8 .set noat
9 .align 5
10
11NESTED(it8172_IRQ, PT_SIZE, sp)
12 SAVE_ALL
13 CLI # Important: mark KERNEL mode !
14
15 /* We're working with 'reorder' set at this point. */
16 /*
17 * Get pending interrupts
18 */
19
20 mfc0 t0,CP0_CAUSE # get pending interrupts
21 mfc0 t1,CP0_STATUS # get enabled interrupts
22 and t0,t1 # isolate allowed ones
23
24 andi t0,0xff00 # isolate pending bits
25 beqz t0, 3f # spurious interrupt
26
27 andi a0, t0, CAUSEF_IP7
28 beq a0, zero, 1f
29
30 li a0, 127 # MIPS_CPU_TIMER_IRQ = (NR_IRQS-1)
31 move a1, sp
32 jal ll_timer_interrupt
33 j ret_from_irq
34 nop
35
361:
37 andi a0, t0, CAUSEF_IP2 # the only int we expect at this time
38 beq a0, zero, 3f
39 move a0,sp
40 jal it8172_hw0_irqdispatch
41
42 mfc0 t0,CP0_STATUS # disable interrupts
43 ori t0,1
44 xori t0,1
45 mtc0 t0,CP0_STATUS
46 nop
47 nop
48 nop
49
50 la a1, ret_from_irq
51 jr a1
52 nop
53
543:
55 move a0, sp
56 jal mips_spurious_interrupt
57 nop
58 la a1, ret_from_irq
59 jr a1
60 nop
61
62END(it8172_IRQ)
63
diff --git a/arch/mips/ite-boards/generic/irq.c b/arch/mips/ite-boards/generic/irq.c
new file mode 100644
index 000000000000..cb71b9024d6f
--- /dev/null
+++ b/arch/mips/ite-boards/generic/irq.c
@@ -0,0 +1,304 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * ITE 8172G interrupt/setup routines.
4 *
5 * Copyright 2000,2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * Part of this file was derived from Carsten Langgaard's
10 * arch/mips/mips-boards/atlas/atlas_int.c.
11 *
12 * Carsten Langgaard, carstenl@mips.com
13 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35#include <linux/errno.h>
36#include <linux/init.h>
37#include <linux/irq.h>
38#include <linux/kernel_stat.h>
39#include <linux/module.h>
40#include <linux/signal.h>
41#include <linux/sched.h>
42#include <linux/types.h>
43#include <linux/interrupt.h>
44#include <linux/ioport.h>
45#include <linux/timex.h>
46#include <linux/slab.h>
47#include <linux/random.h>
48#include <linux/serial_reg.h>
49#include <linux/bitops.h>
50
51#include <asm/bootinfo.h>
52#include <asm/io.h>
53#include <asm/mipsregs.h>
54#include <asm/system.h>
55#include <asm/it8172/it8172.h>
56#include <asm/it8172/it8172_int.h>
57#include <asm/it8172/it8172_dbg.h>
58
59/* revisit */
60#define EXT_IRQ0_TO_IP 2 /* IP 2 */
61#define EXT_IRQ5_TO_IP 7 /* IP 7 */
62
63#define ALLINTS_NOTIMER (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
64
65void disable_it8172_irq(unsigned int irq_nr);
66void enable_it8172_irq(unsigned int irq_nr);
67
68extern void set_debug_traps(void);
69extern void mips_timer_interrupt(int irq, struct pt_regs *regs);
70extern asmlinkage void it8172_IRQ(void);
71
72struct it8172_intc_regs volatile *it8172_hw0_icregs =
73 (struct it8172_intc_regs volatile *)(KSEG1ADDR(IT8172_PCI_IO_BASE + IT_INTC_BASE));
74
75static void disable_it8172_irq(unsigned int irq_nr)
76{
77 if ( (irq_nr >= IT8172_LPC_IRQ_BASE) && (irq_nr <= IT8172_SERIRQ_15)) {
78 /* LPC interrupt */
79 it8172_hw0_icregs->lpc_mask |=
80 (1 << (irq_nr - IT8172_LPC_IRQ_BASE));
81 } else if ( (irq_nr >= IT8172_LB_IRQ_BASE) && (irq_nr <= IT8172_IOCHK_IRQ)) {
82 /* Local Bus interrupt */
83 it8172_hw0_icregs->lb_mask |=
84 (1 << (irq_nr - IT8172_LB_IRQ_BASE));
85 } else if ( (irq_nr >= IT8172_PCI_DEV_IRQ_BASE) && (irq_nr <= IT8172_DMA_IRQ)) {
86 /* PCI and other interrupts */
87 it8172_hw0_icregs->pci_mask |=
88 (1 << (irq_nr - IT8172_PCI_DEV_IRQ_BASE));
89 } else if ( (irq_nr >= IT8172_NMI_IRQ_BASE) && (irq_nr <= IT8172_POWER_NMI_IRQ)) {
90 /* NMI interrupts */
91 it8172_hw0_icregs->nmi_mask |=
92 (1 << (irq_nr - IT8172_NMI_IRQ_BASE));
93 } else {
94 panic("disable_it8172_irq: bad irq %d", irq_nr);
95 }
96}
97
98static void enable_it8172_irq(unsigned int irq_nr)
99{
100 if ( (irq_nr >= IT8172_LPC_IRQ_BASE) && (irq_nr <= IT8172_SERIRQ_15)) {
101 /* LPC interrupt */
102 it8172_hw0_icregs->lpc_mask &=
103 ~(1 << (irq_nr - IT8172_LPC_IRQ_BASE));
104 }
105 else if ( (irq_nr >= IT8172_LB_IRQ_BASE) && (irq_nr <= IT8172_IOCHK_IRQ)) {
106 /* Local Bus interrupt */
107 it8172_hw0_icregs->lb_mask &=
108 ~(1 << (irq_nr - IT8172_LB_IRQ_BASE));
109 }
110 else if ( (irq_nr >= IT8172_PCI_DEV_IRQ_BASE) && (irq_nr <= IT8172_DMA_IRQ)) {
111 /* PCI and other interrupts */
112 it8172_hw0_icregs->pci_mask &=
113 ~(1 << (irq_nr - IT8172_PCI_DEV_IRQ_BASE));
114 }
115 else if ( (irq_nr >= IT8172_NMI_IRQ_BASE) && (irq_nr <= IT8172_POWER_NMI_IRQ)) {
116 /* NMI interrupts */
117 it8172_hw0_icregs->nmi_mask &=
118 ~(1 << (irq_nr - IT8172_NMI_IRQ_BASE));
119 }
120 else {
121 panic("enable_it8172_irq: bad irq %d", irq_nr);
122 }
123}
124
125static unsigned int startup_ite_irq(unsigned int irq)
126{
127 enable_it8172_irq(irq);
128 return 0;
129}
130
131#define shutdown_ite_irq disable_it8172_irq
132#define mask_and_ack_ite_irq disable_it8172_irq
133
134static void end_ite_irq(unsigned int irq)
135{
136 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
137 enable_it8172_irq(irq);
138}
139
140static struct hw_interrupt_type it8172_irq_type = {
141 "ITE8172",
142 startup_ite_irq,
143 shutdown_ite_irq,
144 enable_it8172_irq,
145 disable_it8172_irq,
146 mask_and_ack_ite_irq,
147 end_ite_irq,
148 NULL
149};
150
151
152static void enable_none(unsigned int irq) { }
153static unsigned int startup_none(unsigned int irq) { return 0; }
154static void disable_none(unsigned int irq) { }
155static void ack_none(unsigned int irq) { }
156
157/* startup is the same as "enable", shutdown is same as "disable" */
158#define shutdown_none disable_none
159#define end_none enable_none
160
161static struct hw_interrupt_type cp0_irq_type = {
162 "CP0 Count",
163 startup_none,
164 shutdown_none,
165 enable_none,
166 disable_none,
167 ack_none,
168 end_none
169};
170
171void enable_cpu_timer(void)
172{
173 unsigned long flags;
174
175 local_irq_save(flags);
176 set_c0_status(0x100 << EXT_IRQ5_TO_IP);
177 local_irq_restore(flags);
178}
179
180void __init arch_init_irq(void)
181{
182 int i;
183 unsigned long flags;
184
185 memset(irq_desc, 0, sizeof(irq_desc));
186 set_except_vector(0, it8172_IRQ);
187
188 /* mask all interrupts */
189 it8172_hw0_icregs->lb_mask = 0xffff;
190 it8172_hw0_icregs->lpc_mask = 0xffff;
191 it8172_hw0_icregs->pci_mask = 0xffff;
192 it8172_hw0_icregs->nmi_mask = 0xffff;
193
194 /* make all interrupts level triggered */
195 it8172_hw0_icregs->lb_trigger = 0;
196 it8172_hw0_icregs->lpc_trigger = 0;
197 it8172_hw0_icregs->pci_trigger = 0;
198 it8172_hw0_icregs->nmi_trigger = 0;
199
200 /* active level setting */
201 /* uart, keyboard, and mouse are active high */
202 it8172_hw0_icregs->lpc_level = (0x10 | 0x2 | 0x1000);
203 it8172_hw0_icregs->lb_level |= 0x20;
204
205 /* keyboard and mouse are edge triggered */
206 it8172_hw0_icregs->lpc_trigger |= (0x2 | 0x1000);
207
208
209#if 0
210 // Enable this piece of code to make internal USB interrupt
211 // edge triggered.
212 it8172_hw0_icregs->pci_trigger |=
213 (1 << (IT8172_USB_IRQ - IT8172_PCI_DEV_IRQ_BASE));
214 it8172_hw0_icregs->pci_level &=
215 ~(1 << (IT8172_USB_IRQ - IT8172_PCI_DEV_IRQ_BASE));
216#endif
217
218 for (i = 0; i <= IT8172_LAST_IRQ; i++) {
219 irq_desc[i].handler = &it8172_irq_type;
220 spin_lock_init(&irq_desc[i].lock);
221 }
222 irq_desc[MIPS_CPU_TIMER_IRQ].handler = &cp0_irq_type;
223 set_c0_status(ALLINTS_NOTIMER);
224}
225
226void mips_spurious_interrupt(struct pt_regs *regs)
227{
228#if 1
229 return;
230#else
231 unsigned long status, cause;
232
233 printk("got spurious interrupt\n");
234 status = read_c0_status();
235 cause = read_c0_cause();
236 printk("status %x cause %x\n", status, cause);
237 printk("epc %x badvaddr %x \n", regs->cp0_epc, regs->cp0_badvaddr);
238#endif
239}
240
241void it8172_hw0_irqdispatch(struct pt_regs *regs)
242{
243 int irq;
244 unsigned short intstatus = 0, status = 0;
245
246 intstatus = it8172_hw0_icregs->intstatus;
247 if (intstatus & 0x8) {
248 panic("Got NMI interrupt");
249 } else if (intstatus & 0x4) {
250 /* PCI interrupt */
251 irq = 0;
252 status |= it8172_hw0_icregs->pci_req;
253 while (!(status & 0x1)) {
254 irq++;
255 status >>= 1;
256 }
257 irq += IT8172_PCI_DEV_IRQ_BASE;
258 } else if (intstatus & 0x1) {
259 /* Local Bus interrupt */
260 irq = 0;
261 status |= it8172_hw0_icregs->lb_req;
262 while (!(status & 0x1)) {
263 irq++;
264 status >>= 1;
265 }
266 irq += IT8172_LB_IRQ_BASE;
267 } else if (intstatus & 0x2) {
268 /* LPC interrupt */
269 /* Since some lpc interrupts are edge triggered,
270 * we could lose an interrupt this way because
271 * we acknowledge all ints at onces. Revisit.
272 */
273 status |= it8172_hw0_icregs->lpc_req;
274 it8172_hw0_icregs->lpc_req = 0; /* acknowledge ints */
275 irq = 0;
276 while (!(status & 0x1)) {
277 irq++;
278 status >>= 1;
279 }
280 irq += IT8172_LPC_IRQ_BASE;
281 } else
282 return;
283
284 do_IRQ(irq, regs);
285}
286
287void show_pending_irqs(void)
288{
289 fputs("intstatus: ");
290 put32(it8172_hw0_icregs->intstatus);
291 puts("");
292
293 fputs("pci_req: ");
294 put32(it8172_hw0_icregs->pci_req);
295 puts("");
296
297 fputs("lb_req: ");
298 put32(it8172_hw0_icregs->lb_req);
299 puts("");
300
301 fputs("lpc_req: ");
302 put32(it8172_hw0_icregs->lpc_req);
303 puts("");
304}
diff --git a/arch/mips/ite-boards/generic/it8172_cir.c b/arch/mips/ite-boards/generic/it8172_cir.c
new file mode 100644
index 000000000000..19deb153d005
--- /dev/null
+++ b/arch/mips/ite-boards/generic/it8172_cir.c
@@ -0,0 +1,171 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 Consumer IR port generic routines.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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/config.h>
32
33#ifdef CONFIG_IT8172_CIR
34
35#include <linux/types.h>
36#include <linux/pci.h>
37#include <linux/kernel.h>
38#include <linux/init.h>
39
40#include <asm/it8172/it8172.h>
41#include <asm/it8172/it8172_cir.h>
42
43
44volatile struct it8172_cir_regs *cir_regs[NUM_CIR_PORTS] = {
45 (volatile struct it8172_cir_regs *)(KSEG1ADDR(IT8172_PCI_IO_BASE + IT_CIR0_BASE)),
46 (volatile struct it8172_cir_regs *)(KSEG1ADDR(IT8172_PCI_IO_BASE + IT_CIR1_BASE))};
47
48
49/*
50 * Initialize Consumer IR Port.
51 */
52int cir_port_init(struct cir_port *cir)
53{
54 int port = cir->port;
55 unsigned char data;
56
57 /* set baud rate */
58 cir_regs[port]->bdlr = cir->baud_rate & 0xff;
59 cir_regs[port]->bdhr = (cir->baud_rate >> 8) & 0xff;
60
61 /* set receiver control register */
62 cir_regs[port]->rcr = (CIR_SET_RDWOS(cir->rdwos) | CIR_SET_RXDCR(cir->rxdcr));
63
64 /* set carrier frequency register */
65 cir_regs[port]->cfr = (CIR_SET_CF(cir->cfq) | CIR_SET_HS(cir->hcfs));
66
67 /* set fifo threshold */
68 data = cir_regs[port]->mstcr & 0xf3;
69 data |= CIR_SET_FIFO_TL(cir->fifo_tl);
70 cir_regs[port]->mstcr = data;
71
72 clear_fifo(cir);
73 enable_receiver(cir);
74 disable_rx_demodulation(cir);
75
76 set_rx_active(cir);
77 int_enable(cir);
78 rx_int_enable(cir);
79
80 return 0;
81}
82
83
84void clear_fifo(struct cir_port *cir)
85{
86 cir_regs[cir->port]->mstcr |= CIR_FIFO_CLEAR;
87}
88
89void enable_receiver(struct cir_port *cir)
90{
91 cir_regs[cir->port]->rcr |= CIR_RXEN;
92}
93
94void disable_receiver(struct cir_port *cir)
95{
96 cir_regs[cir->port]->rcr &= ~CIR_RXEN;
97}
98
99void enable_rx_demodulation(struct cir_port *cir)
100{
101 cir_regs[cir->port]->rcr |= CIR_RXEND;
102}
103
104void disable_rx_demodulation(struct cir_port *cir)
105{
106 cir_regs[cir->port]->rcr &= ~CIR_RXEND;
107}
108
109void set_rx_active(struct cir_port *cir)
110{
111 cir_regs[cir->port]->rcr |= CIR_RXACT;
112}
113
114void int_enable(struct cir_port *cir)
115{
116 cir_regs[cir->port]->ier |= CIR_IEC;
117}
118
119void rx_int_enable(struct cir_port *cir)
120{
121 cir_regs[cir->port]->ier |= CIR_RDAIE;
122}
123
124void dump_regs(struct cir_port *cir)
125{
126 printk("mstcr %x ier %x iir %x cfr %x rcr %x tcr %x tfsr %x rfsr %x\n",
127 cir_regs[cir->port]->mstcr,
128 cir_regs[cir->port]->ier,
129 cir_regs[cir->port]->iir,
130 cir_regs[cir->port]->cfr,
131 cir_regs[cir->port]->rcr,
132 cir_regs[cir->port]->tcr,
133 cir_regs[cir->port]->tfsr,
134 cir_regs[cir->port]->rfsr);
135
136 while (cir_regs[cir->port]->iir & CIR_RDAI) {
137 printk("data %x\n", cir_regs[cir->port]->dr);
138 }
139}
140
141void dump_reg_addr(struct cir_port *cir)
142{
143 printk("dr %x mstcr %x ier %x iir %x cfr %x rcr %x tcr %x bdlr %x bdhr %x tfsr %x rfsr %x\n",
144 (unsigned)&cir_regs[cir->port]->dr,
145 (unsigned)&cir_regs[cir->port]->mstcr,
146 (unsigned)&cir_regs[cir->port]->ier,
147 (unsigned)&cir_regs[cir->port]->iir,
148 (unsigned)&cir_regs[cir->port]->cfr,
149 (unsigned)&cir_regs[cir->port]->rcr,
150 (unsigned)&cir_regs[cir->port]->tcr,
151 (unsigned)&cir_regs[cir->port]->bdlr,
152 (unsigned)&cir_regs[cir->port]->bdhr,
153 (unsigned)&cir_regs[cir->port]->tfsr,
154 (unsigned)&cir_regs[cir->port]->rfsr);
155}
156
157int cir_get_rx_count(struct cir_port *cir)
158{
159 return cir_regs[cir->port]->rfsr & CIR_RXFBC_MASK;
160}
161
162char cir_read_data(struct cir_port *cir)
163{
164 return cir_regs[cir->port]->dr;
165}
166
167char get_int_status(struct cir_port *cir)
168{
169 return cir_regs[cir->port]->iir;
170}
171#endif
diff --git a/arch/mips/ite-boards/generic/it8172_setup.c b/arch/mips/ite-boards/generic/it8172_setup.c
new file mode 100644
index 000000000000..d808a67294b8
--- /dev/null
+++ b/arch/mips/ite-boards/generic/it8172_setup.c
@@ -0,0 +1,309 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * IT8172/QED5231 board setup.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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#include <linux/config.h>
30#include <linux/init.h>
31#include <linux/sched.h>
32#include <linux/ioport.h>
33#include <linux/serial_reg.h>
34#include <linux/major.h>
35#include <linux/kdev_t.h>
36#include <linux/root_dev.h>
37
38#include <asm/cpu.h>
39#include <asm/time.h>
40#include <asm/io.h>
41#include <asm/bootinfo.h>
42#include <asm/irq.h>
43#include <asm/mipsregs.h>
44#include <asm/reboot.h>
45#include <asm/traps.h>
46#include <asm/it8172/it8172.h>
47#include <asm/it8712.h>
48
49extern struct resource ioport_resource;
50#ifdef CONFIG_SERIO_I8042
51int init_8712_keyboard(void);
52#endif
53
54extern int SearchIT8712(void);
55extern void InitLPCInterface(void);
56extern char * __init prom_getcmdline(void);
57extern void it8172_restart(char *command);
58extern void it8172_halt(void);
59extern void it8172_power_off(void);
60
61extern void (*board_time_init)(void);
62extern void (*board_timer_setup)(struct irqaction *irq);
63extern void it8172_time_init(void);
64extern void it8172_timer_setup(struct irqaction *irq);
65
66#ifdef CONFIG_IT8172_REVC
67struct {
68 struct resource ram;
69 struct resource pci_mem;
70 struct resource pci_io;
71 struct resource flash;
72 struct resource boot;
73} it8172_resources = {
74 { "RAM", 0, 0, IORESOURCE_MEM }, /* to be initted */
75 { "PCI Mem", 0x10000000, 0x13FFFFFF, IORESOURCE_MEM },
76 { "PCI I/O", 0x14000000, 0x17FFFFFF },
77 { "Flash", 0x08000000, 0x0CFFFFFF },
78 { "Boot ROM", 0x1FC00000, 0x1FFFFFFF }
79};
80#else
81struct {
82 struct resource ram;
83 struct resource pci_mem0;
84 struct resource pci_mem1;
85 struct resource pci_io;
86 struct resource pci_mem2;
87 struct resource pci_mem3;
88 struct resource flash;
89 struct resource boot;
90} it8172_resources = {
91 { "RAM", 0, 0, IORESOURCE_MEM }, /* to be initted */
92 { "PCI Mem0", 0x0C000000, 0x0FFFFFFF, IORESOURCE_MEM },
93 { "PCI Mem1", 0x10000000, 0x13FFFFFF, IORESOURCE_MEM },
94 { "PCI I/O", 0x14000000, 0x17FFFFFF },
95 { "PCI Mem2", 0x1A000000, 0x1BFFFFFF, IORESOURCE_MEM },
96 { "PCI Mem3", 0x1C000000, 0x1FBFFFFF, IORESOURCE_MEM },
97 { "Flash", 0x08000000, 0x0CFFFFFF },
98 { "Boot ROM", 0x1FC00000, 0x1FFFFFFF }
99};
100#endif
101
102
103void __init it8172_init_ram_resource(unsigned long memsize)
104{
105 it8172_resources.ram.end = memsize;
106}
107
108static void __init it8172_setup(void)
109{
110 unsigned short dsr;
111 char *argptr;
112
113 argptr = prom_getcmdline();
114#ifdef CONFIG_SERIAL_CONSOLE
115 if ((argptr = strstr(argptr, "console=")) == NULL) {
116 argptr = prom_getcmdline();
117 strcat(argptr, " console=ttyS0,115200");
118 }
119#endif
120
121 clear_c0_status(ST0_FR);
122
123 board_time_init = it8172_time_init;
124 board_timer_setup = it8172_timer_setup;
125
126 _machine_restart = it8172_restart;
127 _machine_halt = it8172_halt;
128 _machine_power_off = it8172_power_off;
129
130 /*
131 * IO/MEM resources.
132 *
133 * revisit this area.
134 */
135 set_io_port_base(KSEG1);
136 ioport_resource.start = it8172_resources.pci_io.start;
137 ioport_resource.end = it8172_resources.pci_io.end;
138#ifdef CONFIG_IT8172_REVC
139 iomem_resource.start = it8172_resources.pci_mem.start;
140 iomem_resource.end = it8172_resources.pci_mem.end;
141#else
142 iomem_resource.start = it8172_resources.pci_mem0.start;
143 iomem_resource.end = it8172_resources.pci_mem3.end;
144#endif
145
146#ifdef CONFIG_BLK_DEV_INITRD
147 ROOT_DEV = Root_RAM0;
148#endif
149
150 /*
151 * Pull enabled devices out of standby
152 */
153 IT_IO_READ16(IT_PM_DSR, dsr);
154
155 /*
156 * Fixme: This breaks when these drivers are modules!!!
157 */
158#ifdef CONFIG_SOUND_IT8172
159 dsr &= ~IT_PM_DSR_ACSB;
160#else
161 dsr |= IT_PM_DSR_ACSB;
162#endif
163#ifdef CONFIG_BLK_DEV_IT8172
164 dsr &= ~IT_PM_DSR_IDESB;
165#else
166 dsr |= IT_PM_DSR_IDESB;
167#endif
168 IT_IO_WRITE16(IT_PM_DSR, dsr);
169
170 InitLPCInterface();
171
172#ifdef CONFIG_MIPS_ITE8172
173 if (SearchIT8712()) {
174 printk("Found IT8712 Super IO\n");
175 /* enable IT8712 serial port */
176 LPCSetConfig(LDN_SERIAL1, 0x30, 0x01); /* enable */
177 LPCSetConfig(LDN_SERIAL1, 0x23, 0x01); /* clock selection */
178#ifdef CONFIG_SERIO_I8042
179 if (init_8712_keyboard()) {
180 printk("Unable to initialize keyboard\n");
181 LPCSetConfig(LDN_KEYBOARD, 0x30, 0x0); /* disable keyboard */
182 } else {
183 LPCSetConfig(LDN_KEYBOARD, 0x30, 0x1); /* enable keyboard */
184 LPCSetConfig(LDN_KEYBOARD, 0xf0, 0x2);
185 LPCSetConfig(LDN_KEYBOARD, 0x71, 0x3);
186
187 LPCSetConfig(LDN_MOUSE, 0x30, 0x1); /* enable mouse */
188
189 LPCSetConfig(0x4, 0x30, 0x1);
190 LPCSetConfig(0x4, 0xf4, LPCGetConfig(0x4, 0xf4) | 0x80);
191
192 if ((LPCGetConfig(LDN_KEYBOARD, 0x30) == 0) ||
193 (LPCGetConfig(LDN_MOUSE, 0x30) == 0))
194 printk("Error: keyboard or mouse not enabled\n");
195
196 }
197#endif
198 }
199 else {
200 printk("IT8712 Super IO not found\n");
201 }
202#endif
203
204#ifdef CONFIG_IT8172_CIR
205 {
206 unsigned long data;
207 //printk("Enabling CIR0\n");
208 IT_IO_READ16(IT_PM_DSR, data);
209 data &= ~IT_PM_DSR_CIR0SB;
210 IT_IO_WRITE16(IT_PM_DSR, data);
211 //printk("DSR register: %x\n", (unsigned)IT_IO_READ16(IT_PM_DSR, data));
212 }
213#endif
214#ifdef CONFIG_IT8172_SCR0
215 {
216 unsigned i;
217 /* Enable Smart Card Reader 0 */
218 /* First power it up */
219 IT_IO_READ16(IT_PM_DSR, i);
220 i &= ~IT_PM_DSR_SCR0SB;
221 IT_IO_WRITE16(IT_PM_DSR, i);
222 /* Then initialize its registers */
223 outb(( IT_SCR_SFR_GATE_UART_OFF << IT_SCR_SFR_GATE_UART_BIT
224 |IT_SCR_SFR_FET_CHARGE_213_US << IT_SCR_SFR_FET_CHARGE_BIT
225 |IT_SCR_SFR_CARD_FREQ_3_5_MHZ << IT_SCR_SFR_CARD_FREQ_BIT
226 |IT_SCR_SFR_FET_ACTIVE_INVERT << IT_SCR_SFR_FET_ACTIVE_BIT
227 |IT_SCR_SFR_ENABLE_ON << IT_SCR_SFR_ENABLE_BIT),
228 IT8172_PCI_IO_BASE + IT_SCR0_BASE + IT_SCR_SFR);
229 outb(IT_SCR_SCDR_RESET_MODE_ASYNC << IT_SCR_SCDR_RESET_MODE_BIT,
230 IT8172_PCI_IO_BASE + IT_SCR0_BASE + IT_SCR_SCDR);
231 }
232#endif /* CONFIG_IT8172_SCR0 */
233#ifdef CONFIG_IT8172_SCR1
234 {
235 unsigned i;
236 /* Enable Smart Card Reader 1 */
237 /* First power it up */
238 IT_IO_READ16(IT_PM_DSR, i);
239 i &= ~IT_PM_DSR_SCR1SB;
240 IT_IO_WRITE16(IT_PM_DSR, i);
241 /* Then initialize its registers */
242 outb(( IT_SCR_SFR_GATE_UART_OFF << IT_SCR_SFR_GATE_UART_BIT
243 |IT_SCR_SFR_FET_CHARGE_213_US << IT_SCR_SFR_FET_CHARGE_BIT
244 |IT_SCR_SFR_CARD_FREQ_3_5_MHZ << IT_SCR_SFR_CARD_FREQ_BIT
245 |IT_SCR_SFR_FET_ACTIVE_INVERT << IT_SCR_SFR_FET_ACTIVE_BIT
246 |IT_SCR_SFR_ENABLE_ON << IT_SCR_SFR_ENABLE_BIT),
247 IT8172_PCI_IO_BASE + IT_SCR1_BASE + IT_SCR_SFR);
248 outb(IT_SCR_SCDR_RESET_MODE_ASYNC << IT_SCR_SCDR_RESET_MODE_BIT,
249 IT8172_PCI_IO_BASE + IT_SCR1_BASE + IT_SCR_SCDR);
250 }
251#endif /* CONFIG_IT8172_SCR1 */
252}
253
254early_initcall(it8172_setup);
255
256#ifdef CONFIG_SERIO_I8042
257/*
258 * According to the ITE Special BIOS Note for waking up the
259 * keyboard controller...
260 */
261static int init_8712_keyboard(void)
262{
263 unsigned int cmd_port = 0x14000064;
264 unsigned int data_port = 0x14000060;
265 ^^^^^^^^^^^
266 Somebody here doesn't grok the concept of io ports.
267
268 unsigned char data;
269 int i;
270
271 outb(0xaa, cmd_port); /* send self-test cmd */
272 i = 0;
273 while (!(inb(cmd_port) & 0x1)) { /* wait output buffer full */
274 i++;
275 if (i > 0xffffff)
276 return 1;
277 }
278
279 data = inb(data_port);
280 outb(0xcb, cmd_port); /* set ps2 mode */
281 while (inb(cmd_port) & 0x2) { /* wait while input buffer full */
282 i++;
283 if (i > 0xffffff)
284 return 1;
285 }
286 outb(0x01, data_port);
287 while (inb(cmd_port) & 0x2) { /* wait while input buffer full */
288 i++;
289 if (i > 0xffffff)
290 return 1;
291 }
292
293 outb(0x60, cmd_port); /* write 8042 command byte */
294 while (inb(cmd_port) & 0x2) { /* wait while input buffer full */
295 i++;
296 if (i > 0xffffff)
297 return 1;
298 }
299 outb(0x45, data_port); /* at interface, keyboard enabled, system flag */
300 while (inb(cmd_port) & 0x2) { /* wait while input buffer full */
301 i++;
302 if (i > 0xffffff)
303 return 1;
304 }
305
306 outb(0xae, cmd_port); /* enable interface */
307 return 0;
308}
309#endif
diff --git a/arch/mips/ite-boards/generic/lpc.c b/arch/mips/ite-boards/generic/lpc.c
new file mode 100644
index 000000000000..cc7584fbef8a
--- /dev/null
+++ b/arch/mips/ite-boards/generic/lpc.c
@@ -0,0 +1,144 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * ITE Semi IT8712 Super I/O functions.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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 <asm/io.h>
32#include <asm/types.h>
33#include <asm/it8712.h>
34#include <asm/it8172/it8172.h>
35
36#ifndef TRUE
37#define TRUE 1
38#endif
39
40#ifndef FALSE
41#define FALSE 0
42#endif
43
44void LPCEnterMBPnP(void)
45{
46 int i;
47 unsigned char key[4] = {0x87, 0x01, 0x55, 0x55};
48
49 for (i = 0; i<4; i++)
50 outb(key[i], LPC_KEY_ADDR);
51
52}
53
54void LPCExitMBPnP(void)
55{
56 outb(0x02, LPC_KEY_ADDR);
57 outb(0x02, LPC_DATA_ADDR);
58}
59
60void LPCSetConfig(char LdnNumber, char Index, char data)
61{
62 LPCEnterMBPnP(); // Enter IT8712 MB PnP mode
63 outb(0x07, LPC_KEY_ADDR);
64 outb(LdnNumber, LPC_DATA_ADDR);
65 outb(Index, LPC_KEY_ADDR);
66 outb(data, LPC_DATA_ADDR);
67 LPCExitMBPnP();
68}
69
70char LPCGetConfig(char LdnNumber, char Index)
71{
72 char rtn;
73
74 LPCEnterMBPnP(); // Enter IT8712 MB PnP mode
75 outb(0x07, LPC_KEY_ADDR);
76 outb(LdnNumber, LPC_DATA_ADDR);
77 outb(Index, LPC_KEY_ADDR);
78 rtn = inb(LPC_DATA_ADDR);
79 LPCExitMBPnP();
80 return rtn;
81}
82
83int SearchIT8712(void)
84{
85 unsigned char Id1, Id2;
86 unsigned short Id;
87
88 LPCEnterMBPnP();
89 outb(0x20, LPC_KEY_ADDR); /* chip id byte 1 */
90 Id1 = inb(LPC_DATA_ADDR);
91 outb(0x21, LPC_KEY_ADDR); /* chip id byte 2 */
92 Id2 = inb(LPC_DATA_ADDR);
93 Id = (Id1 << 8) | Id2;
94 LPCExitMBPnP();
95 if (Id == 0x8712)
96 return TRUE;
97 else
98 return FALSE;
99}
100
101void InitLPCInterface(void)
102{
103 unsigned char bus, dev_fn;
104 unsigned long data;
105
106 bus = 0;
107 dev_fn = 1<<3 | 4;
108
109
110 /* pci cmd, SERR# Enable */
111 IT_WRITE(IT_CONFADDR,
112 (bus << IT_BUSNUM_SHF) |
113 (dev_fn << IT_FUNCNUM_SHF) |
114 ((0x4 / 4) << IT_REGNUM_SHF));
115 IT_READ(IT_CONFDATA, data);
116 data |= 0x0100;
117 IT_WRITE(IT_CONFADDR,
118 (bus << IT_BUSNUM_SHF) |
119 (dev_fn << IT_FUNCNUM_SHF) |
120 ((0x4 / 4) << IT_REGNUM_SHF));
121 IT_WRITE(IT_CONFDATA, data);
122
123 /* setup serial irq control register */
124 IT_WRITE(IT_CONFADDR,
125 (bus << IT_BUSNUM_SHF) |
126 (dev_fn << IT_FUNCNUM_SHF) |
127 ((0x48 / 4) << IT_REGNUM_SHF));
128 IT_READ(IT_CONFDATA, data);
129 data = (data & 0xffff00ff) | 0xc400;
130 IT_WRITE(IT_CONFADDR,
131 (bus << IT_BUSNUM_SHF) |
132 (dev_fn << IT_FUNCNUM_SHF) |
133 ((0x48 / 4) << IT_REGNUM_SHF));
134 IT_WRITE(IT_CONFDATA, data);
135
136
137 /* Enable I/O Space Subtractive Decode */
138 /* default 0x4C is 0x3f220000 */
139 IT_WRITE(IT_CONFADDR,
140 (bus << IT_BUSNUM_SHF) |
141 (dev_fn << IT_FUNCNUM_SHF) |
142 ((0x4C / 4) << IT_REGNUM_SHF));
143 IT_WRITE(IT_CONFDATA, 0x3f2200f3);
144}
diff --git a/arch/mips/ite-boards/generic/pmon_prom.c b/arch/mips/ite-boards/generic/pmon_prom.c
new file mode 100644
index 000000000000..6e505af0cc08
--- /dev/null
+++ b/arch/mips/ite-boards/generic/pmon_prom.c
@@ -0,0 +1,136 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PROM library initialisation code, assuming a version of
5 * pmon is the boot code.
6 *
7 * Copyright 2000 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc.
9 * ppopov@mvista.com or source@mvista.com
10 *
11 * This file was derived from Carsten Langgaard's
12 * arch/mips/mips-boards/xx files.
13 *
14 * Carsten Langgaard, carstenl@mips.com
15 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
16 *
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2 of the License, or (at your
20 * option) any later version.
21 *
22 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
25 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 * You should have received a copy of the GNU General Public License along
34 * with this program; if not, write to the Free Software Foundation, Inc.,
35 * 675 Mass Ave, Cambridge, MA 02139, USA.
36 */
37
38#include <linux/config.h>
39#include <linux/kernel.h>
40#include <linux/init.h>
41#include <linux/string.h>
42
43#include <asm/bootinfo.h>
44
45extern int prom_argc;
46extern char **prom_argv, **prom_envp;
47
48typedef struct
49{
50 char *name;
51/* char *val; */
52}t_env_var;
53
54
55char * __init prom_getcmdline(void)
56{
57 return &(arcs_cmdline[0]);
58}
59
60void __init prom_init_cmdline(void)
61{
62 char *cp;
63 int actr;
64
65 actr = 1; /* Always ignore argv[0] */
66
67 cp = &(arcs_cmdline[0]);
68 while(actr < prom_argc) {
69 strcpy(cp, prom_argv[actr]);
70 cp += strlen(prom_argv[actr]);
71 *cp++ = ' ';
72 actr++;
73 }
74 if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
75 --cp;
76 *cp = '\0';
77
78}
79
80
81char *prom_getenv(char *envname)
82{
83 /*
84 * Return a pointer to the given environment variable.
85 * Environment variables are stored in the form of "memsize=64".
86 */
87
88 t_env_var *env = (t_env_var *)prom_envp;
89 int i;
90
91 i = strlen(envname);
92
93 while(env->name) {
94 if(strncmp(envname, env->name, i) == 0) {
95 return(env->name + strlen(envname) + 1);
96 }
97 env++;
98 }
99 return(NULL);
100}
101
102static inline unsigned char str2hexnum(unsigned char c)
103{
104 if(c >= '0' && c <= '9')
105 return c - '0';
106 if(c >= 'a' && c <= 'f')
107 return c - 'a' + 10;
108 return 0; /* foo */
109}
110
111unsigned long __init prom_free_prom_memory(void)
112{
113 return 0;
114}
115
116unsigned long __init prom_get_memsize(void)
117{
118 char *memsize_str;
119 unsigned int memsize;
120
121 memsize_str = prom_getenv("memsize");
122 if (!memsize_str) {
123#ifdef CONFIG_MIPS_ITE8172
124 memsize = 32;
125#elif defined(CONFIG_MIPS_IVR)
126 memsize = 64;
127#else
128 memsize = 8;
129#endif
130 printk("memsize unknown: setting to %dMB\n", memsize);
131 } else {
132 printk("memsize: %s\n", memsize_str);
133 memsize = simple_strtol(memsize_str, NULL, 0);
134 }
135 return memsize;
136}
diff --git a/arch/mips/ite-boards/generic/puts.c b/arch/mips/ite-boards/generic/puts.c
new file mode 100644
index 000000000000..20b02df6b414
--- /dev/null
+++ b/arch/mips/ite-boards/generic/puts.c
@@ -0,0 +1,139 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Low level uart routines to directly access a 16550 uart.
5 *
6 * Copyright 2000,2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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/types.h>
32
33#define SERIAL_BASE 0xB4011800 /* it8172 */
34#define SER_CMD 5
35#define SER_DATA 0x00
36#define TX_BUSY 0x20
37
38#define TIMEOUT 0xffff
39#undef SLOW_DOWN
40
41static const char digits[16] = "0123456789abcdef";
42static volatile unsigned char *const com1 = (unsigned char *) SERIAL_BASE;
43
44
45#ifdef SLOW_DOWN
46static inline void slow_down()
47{
48 int k;
49 for (k = 0; k < 10000; k++);
50}
51#else
52#define slow_down()
53#endif
54
55void putch(const unsigned char c)
56{
57 unsigned char ch;
58 int i = 0;
59
60 do {
61 ch = com1[SER_CMD];
62 slow_down();
63 i++;
64 if (i > TIMEOUT) {
65 break;
66 }
67 } while (0 == (ch & TX_BUSY));
68 com1[SER_DATA] = c;
69}
70
71void puts(unsigned char *cp)
72{
73 unsigned char ch;
74 int i = 0;
75
76 while (*cp) {
77 do {
78 ch = com1[SER_CMD];
79 slow_down();
80 i++;
81 if (i > TIMEOUT) {
82 break;
83 }
84 } while (0 == (ch & TX_BUSY));
85 com1[SER_DATA] = *cp++;
86 }
87 putch('\r');
88 putch('\n');
89}
90
91void fputs(unsigned char *cp)
92{
93 unsigned char ch;
94 int i = 0;
95
96 while (*cp) {
97
98 do {
99 ch = com1[SER_CMD];
100 slow_down();
101 i++;
102 if (i > TIMEOUT) {
103 break;
104 }
105 } while (0 == (ch & TX_BUSY));
106 com1[SER_DATA] = *cp++;
107 }
108}
109
110
111void put64(uint64_t ul)
112{
113 int cnt;
114 unsigned ch;
115
116 cnt = 16; /* 16 nibbles in a 64 bit long */
117 putch('0');
118 putch('x');
119 do {
120 cnt--;
121 ch = (unsigned char) (ul >> cnt * 4) & 0x0F;
122 putch(digits[ch]);
123 } while (cnt > 0);
124}
125
126void put32(unsigned u)
127{
128 int cnt;
129 unsigned ch;
130
131 cnt = 8; /* 8 nibbles in a 32 bit long */
132 putch('0');
133 putch('x');
134 do {
135 cnt--;
136 ch = (unsigned char) (u >> cnt * 4) & 0x0F;
137 putch(digits[ch]);
138 } while (cnt > 0);
139}
diff --git a/arch/mips/ite-boards/generic/reset.c b/arch/mips/ite-boards/generic/reset.c
new file mode 100644
index 000000000000..03bd5ba8c913
--- /dev/null
+++ b/arch/mips/ite-boards/generic/reset.c
@@ -0,0 +1,60 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * ITE 8172 reset routines.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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/sched.h>
32#include <linux/mm.h>
33#include <asm/cacheflush.h>
34#include <asm/io.h>
35#include <asm/processor.h>
36#include <asm/reboot.h>
37#include <asm/system.h>
38
39void it8172_restart()
40{
41 set_c0_status(ST0_BEV | ST0_ERL);
42 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
43 flush_cache_all();
44 write_c0_wired(0);
45 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
46}
47
48void it8172_halt(void)
49{
50 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
51 while (1)
52 __asm__(".set\tmips3\n\t"
53 "wait\n\t"
54 ".set\tmips0");
55}
56
57void it8172_power_off(void)
58{
59 it8172_halt();
60}
diff --git a/arch/mips/ite-boards/generic/time.c b/arch/mips/ite-boards/generic/time.c
new file mode 100644
index 000000000000..30a6c0d5fc50
--- /dev/null
+++ b/arch/mips/ite-boards/generic/time.c
@@ -0,0 +1,247 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * Copyright (C) 2003 MontaVista Software Inc.
6 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 *
25 * Setting up the clock on the MIPS boards.
26 */
27#include <linux/init.h>
28#include <linux/kernel_stat.h>
29#include <linux/sched.h>
30#include <linux/time.h>
31#include <linux/spinlock.h>
32
33#include <asm/time.h>
34#include <asm/mipsregs.h>
35#include <asm/ptrace.h>
36#include <asm/it8172/it8172.h>
37#include <asm/it8172/it8172_int.h>
38#include <asm/debug.h>
39
40#define IT8172_RTC_ADR_REG (IT8172_PCI_IO_BASE + IT_RTC_BASE)
41#define IT8172_RTC_DAT_REG (IT8172_RTC_ADR_REG + 1)
42#define IT8172_RTC_CENTURY_REG (IT8172_PCI_IO_BASE + IT_RTC_CENTURY)
43
44static volatile char *rtc_adr_reg = (char*)KSEG1ADDR(IT8172_RTC_ADR_REG);
45static volatile char *rtc_dat_reg = (char*)KSEG1ADDR(IT8172_RTC_DAT_REG);
46static volatile char *rtc_century_reg = (char*)KSEG1ADDR(IT8172_RTC_CENTURY_REG);
47
48unsigned char it8172_rtc_read_data(unsigned long addr)
49{
50 unsigned char retval;
51
52 *rtc_adr_reg = addr;
53 retval = *rtc_dat_reg;
54 return retval;
55}
56
57void it8172_rtc_write_data(unsigned char data, unsigned long addr)
58{
59 *rtc_adr_reg = addr;
60 *rtc_dat_reg = data;
61}
62
63#undef CMOS_READ
64#undef CMOS_WRITE
65#define CMOS_READ(addr) it8172_rtc_read_data(addr)
66#define CMOS_WRITE(data, addr) it8172_rtc_write_data(data, addr)
67
68static unsigned char saved_control; /* remember rtc control reg */
69static inline int rtc_24h(void) { return saved_control & RTC_24H; }
70static inline int rtc_dm_binary(void) { return saved_control & RTC_DM_BINARY; }
71
72static inline unsigned char
73bin_to_hw(unsigned char c)
74{
75 if (rtc_dm_binary())
76 return c;
77 else
78 return ((c/10) << 4) + (c%10);
79}
80
81static inline unsigned char
82hw_to_bin(unsigned char c)
83{
84 if (rtc_dm_binary())
85 return c;
86 else
87 return (c>>4)*10 + (c &0xf);
88}
89
90/* 0x80 bit indicates pm in 12-hour format */
91static inline unsigned char
92hour_bin_to_hw(unsigned char c)
93{
94 if (rtc_24h())
95 return bin_to_hw(c);
96 if (c >= 12)
97 return 0x80 | bin_to_hw((c==12)?12:c-12); /* 12 is 12pm */
98 else
99 return bin_to_hw((c==0)?12:c); /* 0 is 12 AM, not 0 am */
100}
101
102static inline unsigned char
103hour_hw_to_bin(unsigned char c)
104{
105 unsigned char tmp = hw_to_bin(c&0x3f);
106 if (rtc_24h())
107 return tmp;
108 if (c & 0x80)
109 return (tmp==12)?12:tmp+12; /* 12pm is 12, not 24 */
110 else
111 return (tmp==12)?0:tmp; /* 12am is 0 */
112}
113
114static unsigned long r4k_offset; /* Amount to increment compare reg each time */
115static unsigned long r4k_cur; /* What counter should be at next timer irq */
116extern unsigned int mips_hpt_frequency;
117
118/*
119 * Figure out the r4k offset, the amount to increment the compare
120 * register for each time tick.
121 * Use the RTC to calculate offset.
122 */
123static unsigned long __init cal_r4koff(void)
124{
125 unsigned int flags;
126
127 local_irq_save(flags);
128
129 /* Start counter exactly on falling edge of update flag */
130 while (CMOS_READ(RTC_REG_A) & RTC_UIP);
131 while (!(CMOS_READ(RTC_REG_A) & RTC_UIP));
132
133 /* Start r4k counter. */
134 write_c0_count(0);
135
136 /* Read counter exactly on falling edge of update flag */
137 while (CMOS_READ(RTC_REG_A) & RTC_UIP);
138 while (!(CMOS_READ(RTC_REG_A) & RTC_UIP));
139
140 mips_hpt_frequency = read_c0_count();
141
142 /* restore interrupts */
143 local_irq_restore(flags);
144
145 return (mips_hpt_frequency / HZ);
146}
147
148static unsigned long
149it8172_rtc_get_time(void)
150{
151 unsigned int year, mon, day, hour, min, sec;
152 unsigned int flags;
153
154 /* avoid update-in-progress. */
155 for (;;) {
156 local_irq_save(flags);
157 if (! (CMOS_READ(RTC_REG_A) & RTC_UIP))
158 break;
159 /* don't hold intr closed all the time */
160 local_irq_restore(flags);
161 }
162
163 /* Read regs. */
164 sec = hw_to_bin(CMOS_READ(RTC_SECONDS));
165 min = hw_to_bin(CMOS_READ(RTC_MINUTES));
166 hour = hour_hw_to_bin(CMOS_READ(RTC_HOURS));
167 day = hw_to_bin(CMOS_READ(RTC_DAY_OF_MONTH));
168 mon = hw_to_bin(CMOS_READ(RTC_MONTH));
169 year = hw_to_bin(CMOS_READ(RTC_YEAR)) +
170 hw_to_bin(*rtc_century_reg) * 100;
171
172 /* restore interrupts */
173 local_irq_restore(flags);
174
175 return mktime(year, mon, day, hour, min, sec);
176}
177
178static int
179it8172_rtc_set_time(unsigned long t)
180{
181 struct rtc_time tm;
182 unsigned int flags;
183
184 /* convert */
185 to_tm(t, &tm);
186
187 /* avoid update-in-progress. */
188 for (;;) {
189 local_irq_save(flags);
190 if (! (CMOS_READ(RTC_REG_A) & RTC_UIP))
191 break;
192 /* don't hold intr closed all the time */
193 local_irq_restore(flags);
194 }
195
196 *rtc_century_reg = bin_to_hw(tm.tm_year/100);
197 CMOS_WRITE(bin_to_hw(tm.tm_sec), RTC_SECONDS);
198 CMOS_WRITE(bin_to_hw(tm.tm_min), RTC_MINUTES);
199 CMOS_WRITE(hour_bin_to_hw(tm.tm_hour), RTC_HOURS);
200 CMOS_WRITE(bin_to_hw(tm.tm_mday), RTC_DAY_OF_MONTH);
201 CMOS_WRITE(bin_to_hw(tm.tm_mon+1), RTC_MONTH); /* tm_mon starts from 0 */
202 CMOS_WRITE(bin_to_hw(tm.tm_year%100), RTC_YEAR);
203
204 /* restore interrupts */
205 local_irq_restore(flags);
206
207 return 0;
208}
209
210void __init it8172_time_init(void)
211{
212 unsigned int est_freq, flags;
213
214 local_irq_save(flags);
215
216 saved_control = CMOS_READ(RTC_CONTROL);
217
218 printk("calculating r4koff... ");
219 r4k_offset = cal_r4koff();
220 printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);
221
222 est_freq = 2*r4k_offset*HZ;
223 est_freq += 5000; /* round */
224 est_freq -= est_freq%10000;
225 printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
226 (est_freq%1000000)*100/1000000);
227
228 local_irq_restore(flags);
229
230 rtc_get_time = it8172_rtc_get_time;
231 rtc_set_time = it8172_rtc_set_time;
232}
233
234#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
235void __init it8172_timer_setup(struct irqaction *irq)
236{
237 puts("timer_setup\n");
238 put32(NR_IRQS);
239 puts("");
240 /* we are using the cpu counter for timer interrupts */
241 setup_irq(MIPS_CPU_TIMER_IRQ, irq);
242
243 /* to generate the first timer interrupt */
244 r4k_cur = (read_c0_count() + r4k_offset);
245 write_c0_compare(r4k_cur);
246 set_c0_status(ALLINTS);
247}
diff --git a/arch/mips/ite-boards/ivr/Makefile b/arch/mips/ite-boards/ivr/Makefile
new file mode 100644
index 000000000000..e4fa6042b472
--- /dev/null
+++ b/arch/mips/ite-boards/ivr/Makefile
@@ -0,0 +1,10 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Globespan IVR board,
7# board-specific files.
8#
9
10obj-y += init.o
diff --git a/arch/mips/ite-boards/ivr/README b/arch/mips/ite-boards/ivr/README
new file mode 100644
index 000000000000..aa7d8db855bb
--- /dev/null
+++ b/arch/mips/ite-boards/ivr/README
@@ -0,0 +1,3 @@
1This is not really a board made by ITE Semi, but it's very
2similar to the ITE QED-4N-S01B board. The IVR board is made
3by Globespan and it's a reference board for the PVR chip.
diff --git a/arch/mips/ite-boards/ivr/init.c b/arch/mips/ite-boards/ivr/init.c
new file mode 100644
index 000000000000..ea4e1935fec5
--- /dev/null
+++ b/arch/mips/ite-boards/ivr/init.c
@@ -0,0 +1,84 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * IVR board setup.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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#include <linux/init.h>
30#include <linux/mm.h>
31#include <linux/sched.h>
32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h>
36#include <linux/kernel.h>
37#include <asm/it8172/it8172.h>
38#include <asm/it8172/it8172_dbg.h>
39
40int prom_argc;
41char **prom_argv, **prom_envp;
42
43extern char _end;
44extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize);
47
48#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
49#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
50
51const char *get_system_type(void)
52{
53 return "Globespan IVR";
54}
55
56void __init prom_init(void)
57{
58 unsigned long mem_size;
59 unsigned long pcicr;
60
61 prom_argc = fw_arg0;
62 prom_argv = (char **) fw_arg1;
63 prom_envp = (int *) fw_arg3;
64
65 mips_machgroup = MACH_GROUP_GLOBESPAN;
66 mips_machtype = MACH_IVR; /* Globespan's iTVC15 reference board */
67
68 prom_init_cmdline();
69
70 /* pmon does not set memsize */
71 mem_size = prom_get_memsize();
72 mem_size = mem_size << 20;
73
74 /*
75 * make the entire physical memory visible to pci bus masters
76 */
77 IT_READ(IT_MC_PCICR, pcicr);
78 pcicr &= ~0x1f;
79 pcicr |= (mem_size - 1) >> 22;
80 IT_WRITE(IT_MC_PCICR, pcicr);
81
82 it8172_init_ram_resource(mem_size);
83 add_memory_region(0, mem_size, BOOT_MEM_RAM);
84}
diff --git a/arch/mips/ite-boards/qed-4n-s01b/Makefile b/arch/mips/ite-boards/qed-4n-s01b/Makefile
new file mode 100644
index 000000000000..bb9972ad9c45
--- /dev/null
+++ b/arch/mips/ite-boards/qed-4n-s01b/Makefile
@@ -0,0 +1,10 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the ITE 8172 (qed-4n-s01b) board, board
7# specific files.
8#
9
10obj-y := init.o
diff --git a/arch/mips/ite-boards/qed-4n-s01b/README b/arch/mips/ite-boards/qed-4n-s01b/README
new file mode 100644
index 000000000000..fb4b5197e800
--- /dev/null
+++ b/arch/mips/ite-boards/qed-4n-s01b/README
@@ -0,0 +1,2 @@
1This is an ITE (www.iteusa.com) eval board for the ITE 8172G
2system controller, with a QED 5231 CPU.
diff --git a/arch/mips/ite-boards/qed-4n-s01b/init.c b/arch/mips/ite-boards/qed-4n-s01b/init.c
new file mode 100644
index 000000000000..56dca7e0c21d
--- /dev/null
+++ b/arch/mips/ite-boards/qed-4n-s01b/init.c
@@ -0,0 +1,85 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * IT8172/QED5231 board setup.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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#include <linux/init.h>
30#include <linux/mm.h>
31#include <linux/sched.h>
32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h>
36#include <linux/kernel.h>
37#include <asm/it8172/it8172.h>
38#include <asm/it8172/it8172_dbg.h>
39
40int prom_argc;
41char **prom_argv, **prom_envp;
42
43extern char _end;
44extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize);
47
48#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
49#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
50
51const char *get_system_type(void)
52{
53 return "ITE QED-4N-S01B";
54}
55
56void __init prom_init(void)
57{
58 unsigned long mem_size;
59 unsigned long pcicr;
60
61 prom_argc = fw_arg0;
62 prom_argv = (char **) fw_arg1;
63 prom_envp = (int *) fw_arg3;
64
65 mips_machgroup = MACH_GROUP_ITE;
66 mips_machtype = MACH_QED_4N_S01B; /* ITE board name/number */
67
68 prom_init_cmdline();
69 mem_size = prom_get_memsize();
70
71 printk("Memory size: %dMB\n", (unsigned)mem_size);
72
73 mem_size <<= 20; /* MB */
74
75 /*
76 * make the entire physical memory visible to pci bus masters
77 */
78 IT_READ(IT_MC_PCICR, pcicr);
79 pcicr &= ~0x1f;
80 pcicr |= (mem_size - 1) >> 22;
81 IT_WRITE(IT_MC_PCICR, pcicr);
82
83 it8172_init_ram_resource(mem_size);
84 add_memory_region(0, mem_size, BOOT_MEM_RAM);
85}
diff --git a/arch/mips/jazz/Makefile b/arch/mips/jazz/Makefile
new file mode 100644
index 000000000000..85749246a671
--- /dev/null
+++ b/arch/mips/jazz/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for the Jazz family specific parts of the kernel
3#
4
5obj-y := int-handler.o irq.o jazzdma.o reset.o setup.o
6
7EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/jazz/int-handler.S b/arch/mips/jazz/int-handler.S
new file mode 100644
index 000000000000..4dbcf91db884
--- /dev/null
+++ b/arch/mips/jazz/int-handler.S
@@ -0,0 +1,282 @@
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) 1995, 1996, 1997, 1998 by Ralf Baechle and Andreas Busse
7 *
8 * Jazz family specific interrupt stuff
9 *
10 * To do: On Jazz machines we remap some non-ISA interrupts to ISA
11 * interrupts. These interrupts should use their own vectors.
12 * Squeeze the last cycles out of the handlers. Only a dead
13 * cycle is a good cycle.
14 */
15#include <asm/asm.h>
16#include <asm/mipsregs.h>
17#include <asm/jazz.h>
18#include <asm/regdef.h>
19#include <asm/stackframe.h>
20
21/*
22 * jazz_handle_int: Interrupt handler for the ACER Pica-61 boards
23 */
24 .set noreorder
25
26 NESTED(jazz_handle_int, PT_SIZE, ra)
27 .set noat
28 SAVE_ALL
29 CLI
30 .set at
31
32 /*
33 * Get pending interrupts
34 */
35 mfc0 t0,CP0_CAUSE # get pending interrupts
36 mfc0 t1,CP0_STATUS # get enabled interrupts
37 and t0,t1 # isolate allowed ones
38 andi t0,0xff00 # isolate pending bits
39 beqz t0,3f
40 sll t0,16 # delay slot
41
42 /*
43 * Find irq with highest priority
44 * FIXME: This is slow - use binary search
45 */
46 la t1,ll_vectors
471: bltz t0,2f # found pending irq
48 sll t0,1
49 b 1b
50 subu t1,PTRSIZE # delay slot
51
52 /*
53 * Do the low-level stuff
54 */
552: lw t0,(t1)
56 jr t0
57 nop # delay slot
58 END(jazz_handle_int)
59
60ll_sw0: li s1,~IE_SW0
61 mfc0 t0,CP0_CAUSE
62 and t0,s1
63 mtc0 t0,CP0_CAUSE
64 PANIC("Unimplemented sw0 handler")
65
66ll_sw1: li s1,~IE_SW1
67 mfc0 t0,CP0_CAUSE
68 and t0,s1
69 mtc0 t0,CP0_CAUSE
70 PANIC("Unimplemented sw1 handler")
71
72ll_local_dma: li s1,~IE_IRQ0
73 PANIC("Unimplemented local_dma handler")
74
75ll_local_dev: lbu t0,JAZZ_IO_IRQ_SOURCE
76#if PTRSIZE == 8 /* True 64 bit kernel */
77 dsll t0,1
78#endif
79 .set reorder
80 LONG_L t0,local_vector(t0)
81 jr t0
82 .set noreorder
83
84/*
85 * The braindead PICA hardware gives us no way to distinguish if we really
86 * received interrupt 7 from the (E)ISA bus or if we just received an
87 * interrupt with no findable cause. This sometimes happens with braindead
88 * cards. Oh well - for all the Jazz boxes slots are more or less just
89 * whistles and bells and we're aware of the problem.
90 */
91ll_isa_irq: lw a0, JAZZ_EISA_IRQ_ACK
92
93 jal do_IRQ
94 move a1,sp
95
96 j ret_from_irq
97 nop
98
99/*
100 * Hmm... This is not just a plain PC clone so the question is
101 * which devices on Jazz machines can generate an (E)ISA NMI?
102 * (Writing to nonexistent memory?)
103 */
104ll_isa_nmi: li s1,~IE_IRQ3
105 PANIC("Unimplemented isa_nmi handler")
106
107/*
108 * Timer IRQ - remapped to be more similar to an IBM compatible.
109 *
110 * The timer interrupt is handled specially to ensure that the jiffies
111 * variable is updated at all times. Specifically, the timer interrupt is
112 * just like the complete handlers except that it is invoked with interrupts
113 * disabled and should never re-enable them. If other interrupts were
114 * allowed to be processed while the timer interrupt is active, then the
115 * other interrupts would have to avoid using the jiffies variable for delay
116 * and interval timing operations to avoid hanging the system.
117 */
118ll_timer: lw zero,JAZZ_TIMER_REGISTER # timer irq cleared on read
119 li s1,~IE_IRQ4
120
121 li a0, JAZZ_TIMER_IRQ
122 jal do_IRQ
123 move a1,sp
124
125 mfc0 t0,CP0_STATUS # disable interrupts again
126 ori t0,1
127 xori t0,1
128 mtc0 t0,CP0_STATUS
129
130 j ret_from_irq
131 nop
132
133/*
134 * CPU count/compare IRQ (unused)
135 */
136ll_count: j ret_from_irq
137 mtc0 zero,CP0_COMPARE
138
139#if 0
140/*
141 * Call the handler for the interrupt
142 * (Currently unused)
143 */
144call_real: /*
145 * temporarily disable interrupt
146 */
147 mfc0 t2,CP0_STATUS
148 and t2,s1
149 mtc0 t2,CP0_STATUS
150 nor s1,zero,s1
151 jal do_IRQ
152
153 /*
154 * reenable interrupt
155 */
156 mfc0 t2,CP0_STATUS
157 or t2,s1
158 mtc0 t2,CP0_STATUS
159 j ret_from_irq
160#endif
161
162 .data
163 PTR ll_sw0 # SW0
164 PTR ll_sw1 # SW1
165 PTR ll_local_dma # Local DMA
166 PTR ll_local_dev # Local devices
167 PTR ll_isa_irq # ISA IRQ
168 PTR ll_isa_nmi # ISA NMI
169 PTR ll_timer # Timer
170ll_vectors: PTR ll_count # Count/Compare IRQ
171
172 /*
173 * Interrupt handlers for local devices.
174 */
175 .text
176 .set reorder
177loc_no_irq: PANIC("Unimplemented loc_no_irq handler")
178/*
179 * Parallel port IRQ
180 */
181loc_parallel: li s1,~JAZZ_IE_PARALLEL
182 li a0,JAZZ_PARALLEL_IRQ
183 b loc_call
184
185/*
186 * Floppy IRQ
187 */
188loc_floppy: li s1,~JAZZ_IE_FLOPPY
189 li a0,JAZZ_FLOPPY_IRQ
190 b loc_call
191
192/*
193 * Sound IRQ
194 */
195loc_sound: PANIC("Unimplemented loc_sound handler")
196loc_video: PANIC("Unimplemented loc_video handler")
197
198/*
199 * Ethernet interrupt handler
200 */
201loc_ethernet: li s1,~JAZZ_IE_ETHERNET
202 li a0,JAZZ_ETHERNET_IRQ
203 b loc_call
204
205/*
206 * SCSI interrupt handler
207 */
208loc_scsi: li s1,~JAZZ_IE_SCSI
209 li a0,JAZZ_SCSI_IRQ
210 b loc_call
211
212/*
213 * Keyboard interrupt handler
214 */
215loc_keyboard: li s1,~JAZZ_IE_KEYBOARD
216 li a0,JAZZ_KEYBOARD_IRQ
217 b loc_call
218
219/*
220 * Mouse interrupt handler
221 */
222loc_mouse: li s1,~JAZZ_IE_MOUSE
223 li a0,JAZZ_MOUSE_IRQ
224 b loc_call
225
226/*
227 * Serial port 1 IRQ
228 */
229loc_serial1: li s1,~JAZZ_IE_SERIAL1
230 li a0,JAZZ_SERIAL1_IRQ
231 b loc_call
232
233/*
234 * Serial port 2 IRQ
235 */
236loc_serial2: li s1,~JAZZ_IE_SERIAL2
237 li a0,JAZZ_SERIAL2_IRQ
238 b loc_call
239
240/*
241 * Call the interrupt handler for an interrupt generated by a
242 * local device.
243 */
244loc_call: /*
245 * Temporarily disable interrupt source
246 */
247 lhu t2,JAZZ_IO_IRQ_ENABLE
248 and t2,s1
249 sh t2,JAZZ_IO_IRQ_ENABLE
250
251 nor s1,zero,s1
252 jal do_IRQ
253
254 /*
255 * Reenable interrupt
256 */
257 lhu t2,JAZZ_IO_IRQ_ENABLE
258 or t2,s1
259 sh t2,JAZZ_IO_IRQ_ENABLE
260
261 j ret_from_irq
262
263/*
264 * "Jump extender" to reach spurious_interrupt
265 */
2663: j spurious_interrupt
267
268/*
269 * Vectors for interrupts generated by local devices
270 */
271 .data
272local_vector: PTR loc_no_irq
273 PTR loc_parallel
274 PTR loc_floppy
275 PTR loc_sound
276 PTR loc_video
277 PTR loc_ethernet
278 PTR loc_scsi
279 PTR loc_keyboard
280 PTR loc_mouse
281 PTR loc_serial1
282 PTR loc_serial2
diff --git a/arch/mips/jazz/io.c b/arch/mips/jazz/io.c
new file mode 100644
index 000000000000..e86904454c89
--- /dev/null
+++ b/arch/mips/jazz/io.c
@@ -0,0 +1,135 @@
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 * Low level I/O functions for Jazz family machines.
7 *
8 * Copyright (C) 1997 by Ralf Baechle.
9 */
10#include <linux/string.h>
11#include <linux/spinlock.h>
12#include <asm/addrspace.h>
13#include <asm/system.h>
14#include <asm/jazz.h>
15
16/*
17 * Map an 16mb segment of the EISA address space to 0xe3000000;
18 */
19static inline void map_eisa_address(unsigned long address)
20{
21 /* XXX */
22 /* We've got an wired entry in the TLB. We just need to modify it.
23 fast and clean. But since we want to get rid of wired entries
24 things are a little bit more complicated ... */
25}
26
27static unsigned char jazz_readb(unsigned long addr)
28{
29 unsigned char res;
30
31 map_eisa_address(addr);
32 addr &= 0xffffff;
33 res = *(volatile unsigned char *) (JAZZ_EISA_BASE + addr);
34
35 return res;
36}
37
38static unsigned short jazz_readw(unsigned long addr)
39{
40 unsigned short res;
41
42 map_eisa_address(addr);
43 addr &= 0xffffff;
44 res = *(volatile unsigned char *) (JAZZ_EISA_BASE + addr);
45
46 return res;
47}
48
49static unsigned int jazz_readl(unsigned long addr)
50{
51 unsigned int res;
52
53 map_eisa_address(addr);
54 addr &= 0xffffff;
55 res = *(volatile unsigned char *) (JAZZ_EISA_BASE + addr);
56
57 return res;
58}
59
60static void jazz_writeb(unsigned char val, unsigned long addr)
61{
62 map_eisa_address(addr);
63 addr &= 0xffffff;
64 *(volatile unsigned char *) (JAZZ_EISA_BASE + addr) = val;
65}
66
67static void jazz_writew(unsigned short val, unsigned long addr)
68{
69 map_eisa_address(addr);
70 addr &= 0xffffff;
71 *(volatile unsigned char *) (JAZZ_EISA_BASE + addr) = val;
72}
73
74static void jazz_writel(unsigned int val, unsigned long addr)
75{
76 map_eisa_address(addr);
77 addr &= 0xffffff;
78 *(volatile unsigned char *) (JAZZ_EISA_BASE + addr) = val;
79}
80
81static void jazz_memset_io(unsigned long addr, int val, unsigned long len)
82{
83 unsigned long waddr;
84
85 waddr = JAZZ_EISA_BASE | (addr & 0xffffff);
86 while(len) {
87 unsigned long fraglen;
88
89 fraglen = (~addr + 1) & 0xffffff;
90 fraglen = (fraglen < len) ? fraglen : len;
91 map_eisa_address(addr);
92 memset((char *)waddr, val, fraglen);
93 addr += fraglen;
94 waddr = waddr + fraglen - 0x1000000;
95 len -= fraglen;
96 }
97}
98
99static void jazz_memcpy_fromio(unsigned long to, unsigned long from, unsigned long len)
100{
101 unsigned long waddr;
102
103 waddr = JAZZ_EISA_BASE | (from & 0xffffff);
104 while(len) {
105 unsigned long fraglen;
106
107 fraglen = (~from + 1) & 0xffffff;
108 fraglen = (fraglen < len) ? fraglen : len;
109 map_eisa_address(from);
110 memcpy((void *)to, (void *)waddr, fraglen);
111 to += fraglen;
112 from += fraglen;
113 waddr = waddr + fraglen - 0x1000000;
114 len -= fraglen;
115 }
116}
117
118static void jazz_memcpy_toio(unsigned long to, unsigned long from, unsigned long len)
119{
120 unsigned long waddr;
121
122 waddr = JAZZ_EISA_BASE | (to & 0xffffff);
123 while(len) {
124 unsigned long fraglen;
125
126 fraglen = (~to + 1) & 0xffffff;
127 fraglen = (fraglen < len) ? fraglen : len;
128 map_eisa_address(to);
129 memcpy((char *)to + JAZZ_EISA_BASE, (void *)from, fraglen);
130 to += fraglen;
131 from += fraglen;
132 waddr = waddr + fraglen - 0x1000000;
133 len -= fraglen;
134 }
135}
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
new file mode 100644
index 000000000000..0b608fa98d5a
--- /dev/null
+++ b/arch/mips/jazz/irq.c
@@ -0,0 +1,100 @@
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) 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2001, 2003 Ralf Baechle
8 */
9#include <linux/init.h>
10#include <linux/interrupt.h>
11#include <linux/kernel.h>
12#include <linux/spinlock.h>
13
14#include <asm/i8259.h>
15#include <asm/io.h>
16#include <asm/jazz.h>
17
18extern asmlinkage void jazz_handle_int(void);
19
20static DEFINE_SPINLOCK(r4030_lock);
21
22static void enable_r4030_irq(unsigned int irq)
23{
24 unsigned int mask = 1 << (irq - JAZZ_PARALLEL_IRQ);
25 unsigned long flags;
26
27 spin_lock_irqsave(&r4030_lock, flags);
28 mask |= r4030_read_reg16(JAZZ_IO_IRQ_ENABLE);
29 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, mask);
30 spin_unlock_irqrestore(&r4030_lock, flags);
31}
32
33static unsigned int startup_r4030_irq(unsigned int irq)
34{
35 enable_r4030_irq(irq);
36 return 0; /* never anything pending */
37}
38
39#define shutdown_r4030_irq disable_r4030_irq
40
41void disable_r4030_irq(unsigned int irq)
42{
43 unsigned int mask = ~(1 << (irq - JAZZ_PARALLEL_IRQ));
44 unsigned long flags;
45
46 spin_lock_irqsave(&r4030_lock, flags);
47 mask &= r4030_read_reg16(JAZZ_IO_IRQ_ENABLE);
48 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, mask);
49 spin_unlock_irqrestore(&r4030_lock, flags);
50}
51
52#define mask_and_ack_r4030_irq disable_r4030_irq
53
54static void end_r4030_irq(unsigned int irq)
55{
56 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
57 enable_r4030_irq(irq);
58}
59
60static struct hw_interrupt_type r4030_irq_type = {
61 "R4030",
62 startup_r4030_irq,
63 shutdown_r4030_irq,
64 enable_r4030_irq,
65 disable_r4030_irq,
66 mask_and_ack_r4030_irq,
67 end_r4030_irq,
68 NULL
69};
70
71void __init init_r4030_ints(void)
72{
73 int i;
74
75 for (i = JAZZ_PARALLEL_IRQ; i <= JAZZ_TIMER_IRQ; i++) {
76 irq_desc[i].status = IRQ_DISABLED;
77 irq_desc[i].action = 0;
78 irq_desc[i].depth = 1;
79 irq_desc[i].handler = &r4030_irq_type;
80 }
81
82 r4030_write_reg16(JAZZ_IO_IRQ_ENABLE, 0);
83 r4030_read_reg16(JAZZ_IO_IRQ_SOURCE); /* clear pending IRQs */
84 r4030_read_reg32(JAZZ_R4030_INVAL_ADDR); /* clear error bits */
85}
86
87/*
88 * On systems with i8259-style interrupt controllers we assume for
89 * driver compatibility reasons interrupts 0 - 15 to be the i8259
90 * interrupts even if the hardware uses a different interrupt numbering.
91 */
92void __init arch_init_irq(void)
93{
94 set_except_vector(0, jazz_handle_int);
95
96 init_i8259_irqs(); /* Integrated i8259 */
97 init_r4030_ints();
98
99 change_c0_status(ST0_IM, IE_IRQ4 | IE_IRQ3 | IE_IRQ2 | IE_IRQ1);
100}
diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c
new file mode 100644
index 000000000000..46e421e14348
--- /dev/null
+++ b/arch/mips/jazz/jazzdma.c
@@ -0,0 +1,565 @@
1/*
2 * Mips Jazz DMA controller support
3 * Copyright (C) 1995, 1996 by Andreas Busse
4 *
5 * NOTE: Some of the argument checking could be removed when
6 * things have settled down. Also, instead of returning 0xffffffff
7 * on failure of vdma_alloc() one could leave page #0 unused
8 * and return the more usual NULL pointer as logical address.
9 */
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/module.h>
13#include <linux/errno.h>
14#include <linux/mm.h>
15#include <linux/bootmem.h>
16#include <linux/spinlock.h>
17#include <asm/mipsregs.h>
18#include <asm/jazz.h>
19#include <asm/io.h>
20#include <asm/uaccess.h>
21#include <asm/dma.h>
22#include <asm/jazzdma.h>
23#include <asm/pgtable.h>
24
25/*
26 * Set this to one to enable additional vdma debug code.
27 */
28#define CONF_DEBUG_VDMA 0
29
30static unsigned long vdma_pagetable_start;
31
32static DEFINE_SPINLOCK(vdma_lock);
33
34/*
35 * Debug stuff
36 */
37#define vdma_debug ((CONF_DEBUG_VDMA) ? debuglvl : 0)
38
39static int debuglvl = 3;
40
41/*
42 * Initialize the pagetable with a one-to-one mapping of
43 * the first 16 Mbytes of main memory and declare all
44 * entries to be unused. Using this method will at least
45 * allow some early device driver operations to work.
46 */
47static inline void vdma_pgtbl_init(void)
48{
49 VDMA_PGTBL_ENTRY *pgtbl = (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
50 unsigned long paddr = 0;
51 int i;
52
53 for (i = 0; i < VDMA_PGTBL_ENTRIES; i++) {
54 pgtbl[i].frame = paddr;
55 pgtbl[i].owner = VDMA_PAGE_EMPTY;
56 paddr += VDMA_PAGESIZE;
57 }
58}
59
60/*
61 * Initialize the Jazz R4030 dma controller
62 */
63void __init vdma_init(void)
64{
65 /*
66 * Allocate 32k of memory for DMA page tables. This needs to be page
67 * aligned and should be uncached to avoid cache flushing after every
68 * update.
69 */
70 vdma_pagetable_start = alloc_bootmem_low_pages(VDMA_PGTBL_SIZE);
71 if (!vdma_pagetable_start)
72 BUG();
73 dma_cache_wback_inv(vdma_pagetable_start, VDMA_PGTBL_SIZE);
74 vdma_pagetable_start = KSEG1ADDR(vdma_pagetable_start);
75
76 /*
77 * Clear the R4030 translation table
78 */
79 vdma_pgtbl_init();
80
81 r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE,
82 CPHYSADDR(vdma_pagetable_start));
83 r4030_write_reg32(JAZZ_R4030_TRSTBL_LIM, VDMA_PGTBL_SIZE);
84 r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0);
85
86 printk("VDMA: R4030 DMA pagetables initialized.\n");
87}
88
89/*
90 * Allocate DMA pagetables using a simple first-fit algorithm
91 */
92unsigned long vdma_alloc(unsigned long paddr, unsigned long size)
93{
94 VDMA_PGTBL_ENTRY *entry = (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
95 int first, last, pages, frame, i;
96 unsigned long laddr, flags;
97
98 /* check arguments */
99
100 if (paddr > 0x1fffffff) {
101 if (vdma_debug)
102 printk("vdma_alloc: Invalid physical address: %08lx\n",
103 paddr);
104 return VDMA_ERROR; /* invalid physical address */
105 }
106 if (size > 0x400000 || size == 0) {
107 if (vdma_debug)
108 printk("vdma_alloc: Invalid size: %08lx\n", size);
109 return VDMA_ERROR; /* invalid physical address */
110 }
111
112 spin_lock_irqsave(&vdma_lock, flags);
113 /*
114 * Find free chunk
115 */
116 pages = (size + 4095) >> 12; /* no. of pages to allocate */
117 first = 0;
118 while (1) {
119 while (entry[first].owner != VDMA_PAGE_EMPTY &&
120 first < VDMA_PGTBL_ENTRIES) first++;
121 if (first + pages > VDMA_PGTBL_ENTRIES) { /* nothing free */
122 spin_unlock_irqrestore(&vdma_lock, flags);
123 return VDMA_ERROR;
124 }
125
126 last = first + 1;
127 while (entry[last].owner == VDMA_PAGE_EMPTY
128 && last - first < pages)
129 last++;
130
131 if (last - first == pages)
132 break; /* found */
133 }
134
135 /*
136 * Mark pages as allocated
137 */
138 laddr = (first << 12) + (paddr & (VDMA_PAGESIZE - 1));
139 frame = paddr & ~(VDMA_PAGESIZE - 1);
140
141 for (i = first; i < last; i++) {
142 entry[i].frame = frame;
143 entry[i].owner = laddr;
144 frame += VDMA_PAGESIZE;
145 }
146
147 /*
148 * Update translation table and return logical start address
149 */
150 r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0);
151
152 if (vdma_debug > 1)
153 printk("vdma_alloc: Allocated %d pages starting from %08lx\n",
154 pages, laddr);
155
156 if (vdma_debug > 2) {
157 printk("LADDR: ");
158 for (i = first; i < last; i++)
159 printk("%08x ", i << 12);
160 printk("\nPADDR: ");
161 for (i = first; i < last; i++)
162 printk("%08x ", entry[i].frame);
163 printk("\nOWNER: ");
164 for (i = first; i < last; i++)
165 printk("%08x ", entry[i].owner);
166 printk("\n");
167 }
168
169 spin_unlock_irqrestore(&vdma_lock, flags);
170
171 return laddr;
172}
173
174EXPORT_SYMBOL(vdma_alloc);
175
176/*
177 * Free previously allocated dma translation pages
178 * Note that this does NOT change the translation table,
179 * it just marks the free'd pages as unused!
180 */
181int vdma_free(unsigned long laddr)
182{
183 VDMA_PGTBL_ENTRY *pgtbl = (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
184 int i;
185
186 i = laddr >> 12;
187
188 if (pgtbl[i].owner != laddr) {
189 printk
190 ("vdma_free: trying to free other's dma pages, laddr=%8lx\n",
191 laddr);
192 return -1;
193 }
194
195 while (pgtbl[i].owner == laddr && i < VDMA_PGTBL_ENTRIES) {
196 pgtbl[i].owner = VDMA_PAGE_EMPTY;
197 i++;
198 }
199
200 if (vdma_debug > 1)
201 printk("vdma_free: freed %ld pages starting from %08lx\n",
202 i - (laddr >> 12), laddr);
203
204 return 0;
205}
206
207EXPORT_SYMBOL(vdma_free);
208
209/*
210 * Map certain page(s) to another physical address.
211 * Caller must have allocated the page(s) before.
212 */
213int vdma_remap(unsigned long laddr, unsigned long paddr, unsigned long size)
214{
215 VDMA_PGTBL_ENTRY *pgtbl =
216 (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
217 int first, pages, npages;
218
219 if (laddr > 0xffffff) {
220 if (vdma_debug)
221 printk
222 ("vdma_map: Invalid logical address: %08lx\n",
223 laddr);
224 return -EINVAL; /* invalid logical address */
225 }
226 if (paddr > 0x1fffffff) {
227 if (vdma_debug)
228 printk
229 ("vdma_map: Invalid physical address: %08lx\n",
230 paddr);
231 return -EINVAL; /* invalid physical address */
232 }
233
234 npages = pages =
235 (((paddr & (VDMA_PAGESIZE - 1)) + size) >> 12) + 1;
236 first = laddr >> 12;
237 if (vdma_debug)
238 printk("vdma_remap: first=%x, pages=%x\n", first, pages);
239 if (first + pages > VDMA_PGTBL_ENTRIES) {
240 if (vdma_debug)
241 printk("vdma_alloc: Invalid size: %08lx\n", size);
242 return -EINVAL;
243 }
244
245 paddr &= ~(VDMA_PAGESIZE - 1);
246 while (pages > 0 && first < VDMA_PGTBL_ENTRIES) {
247 if (pgtbl[first].owner != laddr) {
248 if (vdma_debug)
249 printk("Trying to remap other's pages.\n");
250 return -EPERM; /* not owner */
251 }
252 pgtbl[first].frame = paddr;
253 paddr += VDMA_PAGESIZE;
254 first++;
255 pages--;
256 }
257
258 /*
259 * Update translation table
260 */
261 r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0);
262
263 if (vdma_debug > 2) {
264 int i;
265 pages = (((paddr & (VDMA_PAGESIZE - 1)) + size) >> 12) + 1;
266 first = laddr >> 12;
267 printk("LADDR: ");
268 for (i = first; i < first + pages; i++)
269 printk("%08x ", i << 12);
270 printk("\nPADDR: ");
271 for (i = first; i < first + pages; i++)
272 printk("%08x ", pgtbl[i].frame);
273 printk("\nOWNER: ");
274 for (i = first; i < first + pages; i++)
275 printk("%08x ", pgtbl[i].owner);
276 printk("\n");
277 }
278
279 return 0;
280}
281
282/*
283 * Translate a physical address to a logical address.
284 * This will return the logical address of the first
285 * match.
286 */
287unsigned long vdma_phys2log(unsigned long paddr)
288{
289 int i;
290 int frame;
291 VDMA_PGTBL_ENTRY *pgtbl =
292 (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
293
294 frame = paddr & ~(VDMA_PAGESIZE - 1);
295
296 for (i = 0; i < VDMA_PGTBL_ENTRIES; i++) {
297 if (pgtbl[i].frame == frame)
298 break;
299 }
300
301 if (i == VDMA_PGTBL_ENTRIES)
302 return ~0UL;
303
304 return (i << 12) + (paddr & (VDMA_PAGESIZE - 1));
305}
306
307EXPORT_SYMBOL(vdma_phys2log);
308
309/*
310 * Translate a logical DMA address to a physical address
311 */
312unsigned long vdma_log2phys(unsigned long laddr)
313{
314 VDMA_PGTBL_ENTRY *pgtbl =
315 (VDMA_PGTBL_ENTRY *) vdma_pagetable_start;
316
317 return pgtbl[laddr >> 12].frame + (laddr & (VDMA_PAGESIZE - 1));
318}
319
320EXPORT_SYMBOL(vdma_log2phys);
321
322/*
323 * Print DMA statistics
324 */
325void vdma_stats(void)
326{
327 int i;
328
329 printk("vdma_stats: CONFIG: %08x\n",
330 r4030_read_reg32(JAZZ_R4030_CONFIG));
331 printk("R4030 translation table base: %08x\n",
332 r4030_read_reg32(JAZZ_R4030_TRSTBL_BASE));
333 printk("R4030 translation table limit: %08x\n",
334 r4030_read_reg32(JAZZ_R4030_TRSTBL_LIM));
335 printk("vdma_stats: INV_ADDR: %08x\n",
336 r4030_read_reg32(JAZZ_R4030_INV_ADDR));
337 printk("vdma_stats: R_FAIL_ADDR: %08x\n",
338 r4030_read_reg32(JAZZ_R4030_R_FAIL_ADDR));
339 printk("vdma_stats: M_FAIL_ADDR: %08x\n",
340 r4030_read_reg32(JAZZ_R4030_M_FAIL_ADDR));
341 printk("vdma_stats: IRQ_SOURCE: %08x\n",
342 r4030_read_reg32(JAZZ_R4030_IRQ_SOURCE));
343 printk("vdma_stats: I386_ERROR: %08x\n",
344 r4030_read_reg32(JAZZ_R4030_I386_ERROR));
345 printk("vdma_chnl_modes: ");
346 for (i = 0; i < 8; i++)
347 printk("%04x ",
348 (unsigned) r4030_read_reg32(JAZZ_R4030_CHNL_MODE +
349 (i << 5)));
350 printk("\n");
351 printk("vdma_chnl_enables: ");
352 for (i = 0; i < 8; i++)
353 printk("%04x ",
354 (unsigned) r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE +
355 (i << 5)));
356 printk("\n");
357}
358
359/*
360 * DMA transfer functions
361 */
362
363/*
364 * Enable a DMA channel. Also clear any error conditions.
365 */
366void vdma_enable(int channel)
367{
368 int status;
369
370 if (vdma_debug)
371 printk("vdma_enable: channel %d\n", channel);
372
373 /*
374 * Check error conditions first
375 */
376 status = r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE + (channel << 5));
377 if (status & 0x400)
378 printk("VDMA: Channel %d: Address error!\n", channel);
379 if (status & 0x200)
380 printk("VDMA: Channel %d: Memory error!\n", channel);
381
382 /*
383 * Clear all interrupt flags
384 */
385 r4030_write_reg32(JAZZ_R4030_CHNL_ENABLE + (channel << 5),
386 r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE +
387 (channel << 5)) | R4030_TC_INTR
388 | R4030_MEM_INTR | R4030_ADDR_INTR);
389
390 /*
391 * Enable the desired channel
392 */
393 r4030_write_reg32(JAZZ_R4030_CHNL_ENABLE + (channel << 5),
394 r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE +
395 (channel << 5)) |
396 R4030_CHNL_ENABLE);
397}
398
399EXPORT_SYMBOL(vdma_enable);
400
401/*
402 * Disable a DMA channel
403 */
404void vdma_disable(int channel)
405{
406 if (vdma_debug) {
407 int status =
408 r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE +
409 (channel << 5));
410
411 printk("vdma_disable: channel %d\n", channel);
412 printk("VDMA: channel %d status: %04x (%s) mode: "
413 "%02x addr: %06x count: %06x\n",
414 channel, status,
415 ((status & 0x600) ? "ERROR" : "OK"),
416 (unsigned) r4030_read_reg32(JAZZ_R4030_CHNL_MODE +
417 (channel << 5)),
418 (unsigned) r4030_read_reg32(JAZZ_R4030_CHNL_ADDR +
419 (channel << 5)),
420 (unsigned) r4030_read_reg32(JAZZ_R4030_CHNL_COUNT +
421 (channel << 5)));
422 }
423
424 r4030_write_reg32(JAZZ_R4030_CHNL_ENABLE + (channel << 5),
425 r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE +
426 (channel << 5)) &
427 ~R4030_CHNL_ENABLE);
428
429 /*
430 * After disabling a DMA channel a remote bus register should be
431 * read to ensure that the current DMA acknowledge cycle is completed.
432 */
433 *((volatile unsigned int *) JAZZ_DUMMY_DEVICE);
434}
435
436EXPORT_SYMBOL(vdma_disable);
437
438/*
439 * Set DMA mode. This function accepts the mode values used
440 * to set a PC-style DMA controller. For the SCSI and FDC
441 * channels, we also set the default modes each time we're
442 * called.
443 * NOTE: The FAST and BURST dma modes are supported by the
444 * R4030 Rev. 2 and PICA chipsets only. I leave them disabled
445 * for now.
446 */
447void vdma_set_mode(int channel, int mode)
448{
449 if (vdma_debug)
450 printk("vdma_set_mode: channel %d, mode 0x%x\n", channel,
451 mode);
452
453 switch (channel) {
454 case JAZZ_SCSI_DMA: /* scsi */
455 r4030_write_reg32(JAZZ_R4030_CHNL_MODE + (channel << 5),
456/* R4030_MODE_FAST | */
457/* R4030_MODE_BURST | */
458 R4030_MODE_INTR_EN |
459 R4030_MODE_WIDTH_16 |
460 R4030_MODE_ATIME_80);
461 break;
462
463 case JAZZ_FLOPPY_DMA: /* floppy */
464 r4030_write_reg32(JAZZ_R4030_CHNL_MODE + (channel << 5),
465/* R4030_MODE_FAST | */
466/* R4030_MODE_BURST | */
467 R4030_MODE_INTR_EN |
468 R4030_MODE_WIDTH_8 |
469 R4030_MODE_ATIME_120);
470 break;
471
472 case JAZZ_AUDIOL_DMA:
473 case JAZZ_AUDIOR_DMA:
474 printk("VDMA: Audio DMA not supported yet.\n");
475 break;
476
477 default:
478 printk
479 ("VDMA: vdma_set_mode() called with unsupported channel %d!\n",
480 channel);
481 }
482
483 switch (mode) {
484 case DMA_MODE_READ:
485 r4030_write_reg32(JAZZ_R4030_CHNL_ENABLE + (channel << 5),
486 r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE +
487 (channel << 5)) &
488 ~R4030_CHNL_WRITE);
489 break;
490
491 case DMA_MODE_WRITE:
492 r4030_write_reg32(JAZZ_R4030_CHNL_ENABLE + (channel << 5),
493 r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE +
494 (channel << 5)) |
495 R4030_CHNL_WRITE);
496 break;
497
498 default:
499 printk
500 ("VDMA: vdma_set_mode() called with unknown dma mode 0x%x\n",
501 mode);
502 }
503}
504
505EXPORT_SYMBOL(vdma_set_mode);
506
507/*
508 * Set Transfer Address
509 */
510void vdma_set_addr(int channel, long addr)
511{
512 if (vdma_debug)
513 printk("vdma_set_addr: channel %d, addr %lx\n", channel,
514 addr);
515
516 r4030_write_reg32(JAZZ_R4030_CHNL_ADDR + (channel << 5), addr);
517}
518
519EXPORT_SYMBOL(vdma_set_addr);
520
521/*
522 * Set Transfer Count
523 */
524void vdma_set_count(int channel, int count)
525{
526 if (vdma_debug)
527 printk("vdma_set_count: channel %d, count %08x\n", channel,
528 (unsigned) count);
529
530 r4030_write_reg32(JAZZ_R4030_CHNL_COUNT + (channel << 5), count);
531}
532
533EXPORT_SYMBOL(vdma_set_count);
534
535/*
536 * Get Residual
537 */
538int vdma_get_residue(int channel)
539{
540 int residual;
541
542 residual = r4030_read_reg32(JAZZ_R4030_CHNL_COUNT + (channel << 5));
543
544 if (vdma_debug)
545 printk("vdma_get_residual: channel %d: residual=%d\n",
546 channel, residual);
547
548 return residual;
549}
550
551/*
552 * Get DMA channel enable register
553 */
554int vdma_get_enable(int channel)
555{
556 int enable;
557
558 enable = r4030_read_reg32(JAZZ_R4030_CHNL_ENABLE + (channel << 5));
559
560 if (vdma_debug)
561 printk("vdma_get_enable: channel %d: enable=%d\n", channel,
562 enable);
563
564 return enable;
565}
diff --git a/arch/mips/jazz/reset.c b/arch/mips/jazz/reset.c
new file mode 100644
index 000000000000..2a9754750bc8
--- /dev/null
+++ b/arch/mips/jazz/reset.c
@@ -0,0 +1,69 @@
1/*
2 * Reset a Jazz machine.
3 *
4 * We don't trust the firmware so we do it the classic way by poking and
5 * stabbing at the keyboard controller ...
6 */
7#include <linux/jiffies.h>
8#include <asm/jazz.h>
9#include <asm/io.h>
10#include <asm/system.h>
11#include <asm/reboot.h>
12#include <asm/delay.h>
13
14#define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */
15
16static void jazz_write_output(unsigned char val)
17{
18 int status;
19
20 do {
21 status = jazz_kh->command;
22 } while (status & KBD_STAT_IBF);
23 jazz_kh->data = val;
24}
25
26static void jazz_write_command(unsigned char val)
27{
28 int status;
29
30 do {
31 status = jazz_kh->command;
32 } while (status & KBD_STAT_IBF);
33 jazz_kh->command = val;
34}
35
36static unsigned char jazz_read_status(void)
37{
38 return jazz_kh->command;
39}
40
41static inline void kb_wait(void)
42{
43 unsigned long start = jiffies;
44 unsigned long timeout = start + HZ/2;
45
46 do {
47 if (! (jazz_read_status() & 0x02))
48 return;
49 } while (time_before_eq(jiffies, timeout));
50}
51
52void jazz_machine_restart(char *command)
53{
54 while(1) {
55 kb_wait();
56 jazz_write_command (0xd1);
57 kb_wait();
58 jazz_write_output (0x00);
59 }
60}
61
62void jazz_machine_halt(void)
63{
64}
65
66void jazz_machine_power_off(void)
67{
68 /* Jazz machines don't have a software power switch */
69}
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
new file mode 100644
index 000000000000..fccb06fe209d
--- /dev/null
+++ b/arch/mips/jazz/setup.c
@@ -0,0 +1,101 @@
1/*
2 * Setup pointers to hardware-dependent routines.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 1997, 1998, 2001 by Ralf Baechle
9 * Copyright (C) 2001 MIPS Technologies, Inc.
10 */
11#include <linux/config.h>
12#include <linux/eisa.h>
13#include <linux/hdreg.h>
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <linux/sched.h>
17#include <linux/interrupt.h>
18#include <linux/mm.h>
19#include <linux/console.h>
20#include <linux/fb.h>
21#include <linux/ide.h>
22#include <asm/bootinfo.h>
23#include <asm/irq.h>
24#include <asm/jazz.h>
25#include <asm/jazzdma.h>
26#include <asm/ptrace.h>
27#include <asm/reboot.h>
28#include <asm/io.h>
29#include <asm/pgtable.h>
30#include <asm/time.h>
31#include <asm/traps.h>
32
33extern asmlinkage void jazz_handle_int(void);
34
35extern void jazz_machine_restart(char *command);
36extern void jazz_machine_halt(void);
37extern void jazz_machine_power_off(void);
38
39static void __init jazz_time_init(struct irqaction *irq)
40{
41 /* set the clock to 100 Hz */
42 r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
43 setup_irq(JAZZ_TIMER_IRQ, irq);
44}
45
46static struct resource jazz_io_resources[] = {
47 { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
48 { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
49 { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
50 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
51};
52
53static void __init jazz_setup(void)
54{
55 int i;
56
57 /* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
58 add_wired_entry (0x02000017, 0x03c00017, 0xe0000000, PM_64K);
59
60 /* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
61 add_wired_entry (0x02400017, 0x02440017, 0xe2000000, PM_16M);
62
63 /* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
64 add_wired_entry (0x01800017, 0x01000017, 0xe4000000, PM_4M);
65
66 set_io_port_base(JAZZ_PORT_BASE);
67#ifdef CONFIG_EISA
68 if (mips_machtype == MACH_MIPS_MAGNUM_4000)
69 EISA_bus = 1;
70#endif
71 isa_slot_offset = 0xe3000000;
72
73 /* request I/O space for devices used on all i[345]86 PCs */
74 for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
75 request_resource(&ioport_resource, jazz_io_resources + i);
76
77 board_timer_setup = jazz_time_init;
78 /* The RTC is outside the port address space */
79
80 _machine_restart = jazz_machine_restart;
81 _machine_halt = jazz_machine_halt;
82 _machine_power_off = jazz_machine_power_off;
83
84#warning "Somebody should check if screen_info is ok for Jazz."
85
86 screen_info = (struct screen_info) {
87 0, 0, /* orig-x, orig-y */
88 0, /* unused */
89 0, /* orig_video_page */
90 0, /* orig_video_mode */
91 160, /* orig_video_cols */
92 0, 0, 0, /* unused, ega_bx, unused */
93 64, /* orig_video_lines */
94 0, /* orig_video_isVGA */
95 16 /* orig_video_points */
96 };
97
98 vdma_init();
99}
100
101early_initcall(jazz_setup);
diff --git a/arch/mips/jmr3927/common/Makefile b/arch/mips/jmr3927/common/Makefile
new file mode 100644
index 000000000000..cb09a8eede15
--- /dev/null
+++ b/arch/mips/jmr3927/common/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the common code of TOSHIBA JMR-TX3927 board
3#
4
5obj-y += prom.o puts.o rtc_ds1742.o
diff --git a/arch/mips/jmr3927/common/prom.c b/arch/mips/jmr3927/common/prom.c
new file mode 100644
index 000000000000..5d5838f41d23
--- /dev/null
+++ b/arch/mips/jmr3927/common/prom.c
@@ -0,0 +1,81 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * PROM library initialisation code, assuming a version of
4 * pmon is the boot code.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ahennessy@mvista.com
9 *
10 * Based on arch/mips/au1000/common/prom.c
11 *
12 * This file was derived from Carsten Langgaard's
13 * arch/mips/mips-boards/xx files.
14 *
15 * Carsten Langgaard, carstenl@mips.com
16 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
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/kernel.h>
39#include <linux/init.h>
40#include <linux/string.h>
41
42#include <asm/bootinfo.h>
43
44extern int prom_argc;
45extern char **prom_argv, **prom_envp;
46
47typedef struct
48{
49 char *name;
50/* char *val; */
51}t_env_var;
52
53
54char * __init prom_getcmdline(void)
55{
56 return &(arcs_cmdline[0]);
57}
58
59void __init prom_init_cmdline(void)
60{
61 char *cp;
62 int actr;
63
64 actr = 1; /* Always ignore argv[0] */
65
66 cp = &(arcs_cmdline[0]);
67 while(actr < prom_argc) {
68 strcpy(cp, prom_argv[actr]);
69 cp += strlen(prom_argv[actr]);
70 *cp++ = ' ';
71 actr++;
72 }
73 if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
74 --cp;
75 *cp = '\0';
76}
77
78unsigned long __init prom_free_prom_memory(void)
79{
80 return 0;
81}
diff --git a/arch/mips/jmr3927/common/puts.c b/arch/mips/jmr3927/common/puts.c
new file mode 100644
index 000000000000..1c1cad9cd078
--- /dev/null
+++ b/arch/mips/jmr3927/common/puts.c
@@ -0,0 +1,168 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Low level uart routines to directly access a TX[34]927 SIO.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ahennessy@mvista.com or source@mvista.com
9 *
10 * Copyright (C) 2000-2001 Toshiba Corporation
11 *
12 * Based on arch/mips/au1000/common/puts.c
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version.
18 *
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
22 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * You should have received a copy of the GNU General Public License along
31 * with this program; if not, write to the Free Software Foundation, Inc.,
32 * 675 Mass Ave, Cambridge, MA 02139, USA.
33 */
34
35#include <linux/types.h>
36#include <asm/jmr3927/txx927.h>
37#include <asm/jmr3927/tx3927.h>
38#include <asm/jmr3927/jmr3927.h>
39
40#define TIMEOUT 0xffffff
41#define SLOW_DOWN
42
43static const char digits[16] = "0123456789abcdef";
44
45#ifdef SLOW_DOWN
46#define slow_down() { int k; for (k=0; k<10000; k++); }
47#else
48#define slow_down()
49#endif
50
51void
52putch(const unsigned char c)
53{
54 int i = 0;
55
56 do {
57 slow_down();
58 i++;
59 if (i>TIMEOUT) {
60 break;
61 }
62 } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS));
63 tx3927_sioptr(1)->tfifo = c;
64 return;
65}
66
67unsigned char getch(void)
68{
69 int i = 0;
70 int dicr;
71 char c;
72
73 /* diable RX int. */
74 dicr = tx3927_sioptr(1)->dicr;
75 tx3927_sioptr(1)->dicr = 0;
76
77 do {
78 slow_down();
79 i++;
80 if (i>TIMEOUT) {
81 break;
82 }
83 } while (tx3927_sioptr(1)->disr & TXx927_SIDISR_UVALID)
84 ;
85 c = tx3927_sioptr(1)->rfifo;
86
87 /* clear RX int. status */
88 tx3927_sioptr(1)->disr &= ~TXx927_SIDISR_RDIS;
89 /* enable RX int. */
90 tx3927_sioptr(1)->dicr = dicr;
91
92 return c;
93}
94void
95do_jmr3927_led_set(char n)
96{
97 /* and with current leds */
98 jmr3927_led_and_set(n);
99}
100
101void
102puts(unsigned char *cp)
103{
104 int i = 0;
105
106 while (*cp) {
107 do {
108 slow_down();
109 i++;
110 if (i>TIMEOUT) {
111 break;
112 }
113 } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS));
114 tx3927_sioptr(1)->tfifo = *cp++;
115 }
116 putch('\r');
117 putch('\n');
118}
119
120void
121fputs(unsigned char *cp)
122{
123 int i = 0;
124
125 while (*cp) {
126 do {
127 slow_down();
128 i++;
129 if (i>TIMEOUT) {
130 break;
131 }
132 } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS));
133 tx3927_sioptr(1)->tfifo = *cp++;
134 }
135}
136
137
138void
139put64(uint64_t ul)
140{
141 int cnt;
142 unsigned ch;
143
144 cnt = 16; /* 16 nibbles in a 64 bit long */
145 putch('0');
146 putch('x');
147 do {
148 cnt--;
149 ch = (unsigned char)(ul >> cnt * 4) & 0x0F;
150 putch(digits[ch]);
151 } while (cnt > 0);
152}
153
154void
155put32(unsigned u)
156{
157 int cnt;
158 unsigned ch;
159
160 cnt = 8; /* 8 nibbles in a 32 bit long */
161 putch('0');
162 putch('x');
163 do {
164 cnt--;
165 ch = (unsigned char)(u >> cnt * 4) & 0x0F;
166 putch(digits[ch]);
167 } while (cnt > 0);
168}
diff --git a/arch/mips/jmr3927/common/rtc_ds1742.c b/arch/mips/jmr3927/common/rtc_ds1742.c
new file mode 100644
index 000000000000..1ae4318e1358
--- /dev/null
+++ b/arch/mips/jmr3927/common/rtc_ds1742.c
@@ -0,0 +1,165 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ahennessy@mvista.com
5 *
6 * arch/mips/jmr3927/common/rtc_ds1742.c
7 * Based on arch/mips/ddb5xxx/common/rtc_ds1386.c
8 * low-level RTC hookups for s for Dallas 1742 chip.
9 *
10 * Copyright (C) 2000-2001 Toshiba Corporation
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33
34/*
35 * This file exports a function, rtc_ds1386_init(), which expects an
36 * uncached base address as the argument. It will set the two function
37 * pointers expected by the MIPS generic timer code.
38 */
39
40#include <linux/bcd.h>
41#include <linux/types.h>
42#include <linux/time.h>
43#include <linux/rtc.h>
44
45#include <asm/time.h>
46#include <asm/addrspace.h>
47
48#include <asm/jmr3927/ds1742rtc.h>
49#include <asm/debug.h>
50
51#define EPOCH 2000
52
53static unsigned long rtc_base;
54
55static unsigned long
56rtc_ds1742_get_time(void)
57{
58 unsigned int year, month, day, hour, minute, second;
59 unsigned int century;
60
61 CMOS_WRITE(RTC_READ, RTC_CONTROL);
62 second = BCD2BIN(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK);
63 minute = BCD2BIN(CMOS_READ(RTC_MINUTES));
64 hour = BCD2BIN(CMOS_READ(RTC_HOURS));
65 day = BCD2BIN(CMOS_READ(RTC_DATE));
66 month = BCD2BIN(CMOS_READ(RTC_MONTH));
67 year = BCD2BIN(CMOS_READ(RTC_YEAR));
68 century = BCD2BIN(CMOS_READ(RTC_CENTURY) & RTC_CENTURY_MASK);
69 CMOS_WRITE(0, RTC_CONTROL);
70
71 year += century * 100;
72
73 return mktime(year, month, day, hour, minute, second);
74}
75extern void to_tm(unsigned long tim, struct rtc_time * tm);
76
77static int
78rtc_ds1742_set_time(unsigned long t)
79{
80 struct rtc_time tm;
81 u8 year, month, day, hour, minute, second;
82 u8 cmos_year, cmos_month, cmos_day, cmos_hour, cmos_minute, cmos_second;
83 int cmos_century;
84
85 CMOS_WRITE(RTC_READ, RTC_CONTROL);
86 cmos_second = (u8)(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK);
87 cmos_minute = (u8)CMOS_READ(RTC_MINUTES);
88 cmos_hour = (u8)CMOS_READ(RTC_HOURS);
89 cmos_day = (u8)CMOS_READ(RTC_DATE);
90 cmos_month = (u8)CMOS_READ(RTC_MONTH);
91 cmos_year = (u8)CMOS_READ(RTC_YEAR);
92 cmos_century = CMOS_READ(RTC_CENTURY) & RTC_CENTURY_MASK;
93
94 CMOS_WRITE(RTC_WRITE, RTC_CONTROL);
95
96 /* convert */
97 to_tm(t, &tm);
98
99 /* check each field one by one */
100 year = BIN2BCD(tm.tm_year - EPOCH);
101 if (year != cmos_year) {
102 CMOS_WRITE(year,RTC_YEAR);
103 }
104
105 month = BIN2BCD(tm.tm_mon);
106 if (month != (cmos_month & 0x1f)) {
107 CMOS_WRITE((month & 0x1f) | (cmos_month & ~0x1f),RTC_MONTH);
108 }
109
110 day = BIN2BCD(tm.tm_mday);
111 if (day != cmos_day) {
112
113 CMOS_WRITE(day, RTC_DATE);
114 }
115
116 if (cmos_hour & 0x40) {
117 /* 12 hour format */
118 hour = 0x40;
119 if (tm.tm_hour > 12) {
120 hour |= 0x20 | (BIN2BCD(hour-12) & 0x1f);
121 } else {
122 hour |= BIN2BCD(tm.tm_hour);
123 }
124 } else {
125 /* 24 hour format */
126 hour = BIN2BCD(tm.tm_hour) & 0x3f;
127 }
128 if (hour != cmos_hour) CMOS_WRITE(hour, RTC_HOURS);
129
130 minute = BIN2BCD(tm.tm_min);
131 if (minute != cmos_minute) {
132 CMOS_WRITE(minute, RTC_MINUTES);
133 }
134
135 second = BIN2BCD(tm.tm_sec);
136 if (second != cmos_second) {
137 CMOS_WRITE(second & RTC_SECONDS_MASK,RTC_SECONDS);
138 }
139
140 /* RTC_CENTURY and RTC_CONTROL share same address... */
141 CMOS_WRITE(cmos_century, RTC_CONTROL);
142
143 return 0;
144}
145
146void
147rtc_ds1742_init(unsigned long base)
148{
149 u8 cmos_second;
150
151 /* remember the base */
152 rtc_base = base;
153 db_assert((rtc_base & 0xe0000000) == KSEG1);
154
155 /* set the function pointers */
156 rtc_get_time = rtc_ds1742_get_time;
157 rtc_set_time = rtc_ds1742_set_time;
158
159 /* clear oscillator stop bit */
160 CMOS_WRITE(RTC_READ, RTC_CONTROL);
161 cmos_second = (u8)(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK);
162 CMOS_WRITE(RTC_WRITE, RTC_CONTROL);
163 CMOS_WRITE(cmos_second, RTC_SECONDS); /* clear msb */
164 CMOS_WRITE(0, RTC_CONTROL);
165}
diff --git a/arch/mips/jmr3927/rbhma3100/Makefile b/arch/mips/jmr3927/rbhma3100/Makefile
new file mode 100644
index 000000000000..75bf418b94c0
--- /dev/null
+++ b/arch/mips/jmr3927/rbhma3100/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for TOSHIBA JMR-TX3927 board
3#
4
5obj-y += init.o int-handler.o irq.o setup.o
6obj-$(CONFIG_RUNTIME_DEBUG) += debug.o
7obj-$(CONFIG_KGDB) += kgdb_io.o
8
9EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/jmr3927/rbhma3100/init.c b/arch/mips/jmr3927/rbhma3100/init.c
new file mode 100644
index 000000000000..a0674d73962f
--- /dev/null
+++ b/arch/mips/jmr3927/rbhma3100/init.c
@@ -0,0 +1,77 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ahennessy@mvista.com
5 *
6 * arch/mips/jmr3927/common/init.c
7 *
8 * Copyright (C) 2000-2001 Toshiba Corporation
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#include <linux/config.h>
31#include <linux/init.h>
32#include <linux/mm.h>
33#include <linux/sched.h>
34#include <linux/bootmem.h>
35
36#include <asm/addrspace.h>
37#include <asm/bootinfo.h>
38#include <asm/mipsregs.h>
39#include <asm/jmr3927/jmr3927.h>
40
41int prom_argc;
42char **prom_argv, **prom_envp;
43extern void __init prom_init_cmdline(void);
44extern char *prom_getenv(char *envname);
45unsigned long mips_nofpu = 0;
46
47const char *get_system_type(void)
48{
49 return "Toshiba"
50#ifdef CONFIG_TOSHIBA_JMR3927
51 " JMR_TX3927"
52#endif
53 ;
54}
55
56extern void puts(unsigned char *cp);
57
58void __init prom_init(void)
59{
60#ifdef CONFIG_TOSHIBA_JMR3927
61 /* CCFG */
62 if ((tx3927_ccfgptr->ccfg & TX3927_CCFG_TLBOFF) == 0)
63 puts("Warning: TX3927 TLB off\n");
64#endif
65 prom_argc = fw_arg0;
66 prom_argv = (char **) fw_arg1;
67 prom_envp = (char **) fw_arg2;
68
69 mips_machgroup = MACH_GROUP_TOSHIBA;
70
71#ifdef CONFIG_TOSHIBA_JMR3927
72 mips_machtype = MACH_TOSHIBA_JMR3927;
73#endif
74
75 prom_init_cmdline();
76 add_memory_region(0, JMR3927_SDRAM_SIZE, BOOT_MEM_RAM);
77}
diff --git a/arch/mips/jmr3927/rbhma3100/int-handler.S b/arch/mips/jmr3927/rbhma3100/int-handler.S
new file mode 100644
index 000000000000..f85bbf407542
--- /dev/null
+++ b/arch/mips/jmr3927/rbhma3100/int-handler.S
@@ -0,0 +1,74 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ahennessy@mvista.com
5 *
6 * Based on arch/mips/tsdb/kernel/int-handler.S
7 *
8 * Copyright (C) 2000-2001 Toshiba Corporation
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 <asm/asm.h>
32#include <asm/mipsregs.h>
33#include <asm/regdef.h>
34#include <asm/stackframe.h>
35#include <asm/jmr3927/jmr3927.h>
36
37 /* A lot of complication here is taken away because:
38 *
39 * 1) We handle one interrupt and return, sitting in a loop
40 * and moving across all the pending IRQ bits in the cause
41 * register is _NOT_ the answer, the common case is one
42 * pending IRQ so optimize in that direction.
43 *
44 * 2) We need not check against bits in the status register
45 * IRQ mask, that would make this routine slow as hell.
46 *
47 * 3) Linux only thinks in terms of all IRQs on or all IRQs
48 * off, nothing in between like BSD spl() brain-damage.
49 *
50 */
51
52/* Flush write buffer (needed?)
53 * NOTE: TX39xx performs "non-blocking load", so explicitly use the target
54 * register of LBU to flush immediately.
55 */
56#define FLUSH_WB(tmp) \
57 la tmp, JMR3927_IOC_REV_ADDR; \
58 lbu tmp, (tmp); \
59 move tmp, zero;
60
61 .text
62 .set noreorder
63 .set noat
64 .align 5
65 NESTED(jmr3927_IRQ, PT_SIZE, sp)
66 SAVE_ALL
67 CLI
68 .set at
69 jal jmr3927_irc_irqdispatch
70 move a0, sp
71 FLUSH_WB(t0)
72 j ret_from_irq
73 nop
74 END(jmr3927_IRQ)
diff --git a/arch/mips/jmr3927/rbhma3100/irq.c b/arch/mips/jmr3927/rbhma3100/irq.c
new file mode 100644
index 000000000000..b9799b86fc79
--- /dev/null
+++ b/arch/mips/jmr3927/rbhma3100/irq.c
@@ -0,0 +1,466 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ahennessy@mvista.com
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 * Copyright (C) 2000-2001 Toshiba Corporation
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32#include <linux/config.h>
33#include <linux/init.h>
34
35#include <linux/errno.h>
36#include <linux/irq.h>
37#include <linux/kernel_stat.h>
38#include <linux/signal.h>
39#include <linux/sched.h>
40#include <linux/types.h>
41#include <linux/interrupt.h>
42#include <linux/ioport.h>
43#include <linux/timex.h>
44#include <linux/slab.h>
45#include <linux/random.h>
46#include <linux/smp.h>
47#include <linux/smp_lock.h>
48#include <linux/bitops.h>
49
50#include <asm/io.h>
51#include <asm/mipsregs.h>
52#include <asm/system.h>
53
54#include <asm/ptrace.h>
55#include <asm/processor.h>
56#include <asm/jmr3927/irq.h>
57#include <asm/debug.h>
58#include <asm/jmr3927/jmr3927.h>
59
60#if JMR3927_IRQ_END > NR_IRQS
61#error JMR3927_IRQ_END > NR_IRQS
62#endif
63
64struct tb_irq_space* tb_irq_spaces;
65
66static int jmr3927_irq_base = -1;
67
68#ifdef CONFIG_PCI
69static int jmr3927_gen_iack(void)
70{
71 /* generate ACK cycle */
72#ifdef __BIG_ENDIAN
73 return (tx3927_pcicptr->iiadp >> 24) & 0xff;
74#else
75 return tx3927_pcicptr->iiadp & 0xff;
76#endif
77}
78#endif
79
80extern asmlinkage void jmr3927_IRQ(void);
81
82#define irc_dlevel 0
83#define irc_elevel 1
84
85static unsigned char irc_level[TX3927_NUM_IR] = {
86 5, 5, 5, 5, 5, 5, /* INT[5:0] */
87 7, 7, /* SIO */
88 5, 5, 5, 0, 0, /* DMA, PIO, PCI */
89 6, 6, 6 /* TMR */
90};
91
92static void jmr3927_irq_disable(unsigned int irq_nr);
93static void jmr3927_irq_enable(unsigned int irq_nr);
94
95static DEFINE_SPINLOCK(jmr3927_irq_lock);
96
97static unsigned int jmr3927_irq_startup(unsigned int irq)
98{
99 jmr3927_irq_enable(irq);
100
101 return 0;
102}
103
104#define jmr3927_irq_shutdown jmr3927_irq_disable
105
106static void jmr3927_irq_ack(unsigned int irq)
107{
108 if (irq == JMR3927_IRQ_IRC_TMR0)
109 jmr3927_tmrptr->tisr = 0; /* ack interrupt */
110
111 jmr3927_irq_disable(irq);
112}
113
114static void jmr3927_irq_end(unsigned int irq)
115{
116 jmr3927_irq_enable(irq);
117}
118
119static void jmr3927_irq_disable(unsigned int irq_nr)
120{
121 struct tb_irq_space* sp;
122 unsigned long flags;
123
124 spinlock_irqsave(&jmr3927_irq_lock, flags);
125 for (sp = tb_irq_spaces; sp; sp = sp->next) {
126 if (sp->start_irqno <= irq_nr &&
127 irq_nr < sp->start_irqno + sp->nr_irqs) {
128 if (sp->mask_func)
129 sp->mask_func(irq_nr - sp->start_irqno,
130 sp->space_id);
131 break;
132 }
133 }
134 spinlock_irqrestore(&jmr3927_irq_lock, flags);
135}
136
137static void jmr3927_irq_enable(unsigned int irq_nr)
138{
139 struct tb_irq_space* sp;
140 unsigned long flags;
141
142 spinlock_irqsave(&jmr3927_irq_lock, flags);
143 for (sp = tb_irq_spaces; sp; sp = sp->next) {
144 if (sp->start_irqno <= irq_nr &&
145 irq_nr < sp->start_irqno + sp->nr_irqs) {
146 if (sp->unmask_func)
147 sp->unmask_func(irq_nr - sp->start_irqno,
148 sp->space_id);
149 break;
150 }
151 }
152 spinlock_irqrestore(&jmr3927_irq_lock, flags);
153}
154
155/*
156 * CP0_STATUS is a thread's resource (saved/restored on context switch).
157 * So disable_irq/enable_irq MUST handle IOC/ISAC/IRC registers.
158 */
159static void mask_irq_isac(int irq_nr, int space_id)
160{
161 /* 0: mask */
162 unsigned char imask =
163 jmr3927_isac_reg_in(JMR3927_ISAC_INTM_ADDR);
164 unsigned int bit = 1 << irq_nr;
165 jmr3927_isac_reg_out(imask & ~bit, JMR3927_ISAC_INTM_ADDR);
166 /* flush write buffer */
167 (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR);
168}
169static void unmask_irq_isac(int irq_nr, int space_id)
170{
171 /* 0: mask */
172 unsigned char imask = jmr3927_isac_reg_in(JMR3927_ISAC_INTM_ADDR);
173 unsigned int bit = 1 << irq_nr;
174 jmr3927_isac_reg_out(imask | bit, JMR3927_ISAC_INTM_ADDR);
175 /* flush write buffer */
176 (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR);
177}
178
179static void mask_irq_ioc(int irq_nr, int space_id)
180{
181 /* 0: mask */
182 unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR);
183 unsigned int bit = 1 << irq_nr;
184 jmr3927_ioc_reg_out(imask & ~bit, JMR3927_IOC_INTM_ADDR);
185 /* flush write buffer */
186 (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR);
187}
188static void unmask_irq_ioc(int irq_nr, int space_id)
189{
190 /* 0: mask */
191 unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR);
192 unsigned int bit = 1 << irq_nr;
193 jmr3927_ioc_reg_out(imask | bit, JMR3927_IOC_INTM_ADDR);
194 /* flush write buffer */
195 (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR);
196}
197
198static void mask_irq_irc(int irq_nr, int space_id)
199{
200 volatile unsigned long *ilrp = &tx3927_ircptr->ilr[irq_nr / 2];
201 if (irq_nr & 1)
202 *ilrp = (*ilrp & 0x00ff) | (irc_dlevel << 8);
203 else
204 *ilrp = (*ilrp & 0xff00) | irc_dlevel;
205 /* update IRCSR */
206 tx3927_ircptr->imr = 0;
207 tx3927_ircptr->imr = irc_elevel;
208}
209static void unmask_irq_irc(int irq_nr, int space_id)
210{
211 volatile unsigned long *ilrp = &tx3927_ircptr->ilr[irq_nr / 2];
212 if (irq_nr & 1)
213 *ilrp = (*ilrp & 0x00ff) | (irc_level[irq_nr] << 8);
214 else
215 *ilrp = (*ilrp & 0xff00) | irc_level[irq_nr];
216 /* update IRCSR */
217 tx3927_ircptr->imr = 0;
218 tx3927_ircptr->imr = irc_elevel;
219}
220
221struct tb_irq_space jmr3927_isac_irqspace = {
222 .next = NULL,
223 .start_irqno = JMR3927_IRQ_ISAC,
224 nr_irqs : JMR3927_NR_IRQ_ISAC,
225 .mask_func = mask_irq_isac,
226 .unmask_func = unmask_irq_isac,
227 .name = "ISAC",
228 .space_id = 0,
229 can_share : 0
230};
231struct tb_irq_space jmr3927_ioc_irqspace = {
232 .next = NULL,
233 .start_irqno = JMR3927_IRQ_IOC,
234 nr_irqs : JMR3927_NR_IRQ_IOC,
235 .mask_func = mask_irq_ioc,
236 .unmask_func = unmask_irq_ioc,
237 .name = "IOC",
238 .space_id = 0,
239 can_share : 1
240};
241struct tb_irq_space jmr3927_irc_irqspace = {
242 .next = NULL,
243 .start_irqno = JMR3927_IRQ_IRC,
244 nr_irqs : JMR3927_NR_IRQ_IRC,
245 .mask_func = mask_irq_irc,
246 .unmask_func = unmask_irq_irc,
247 .name = "on-chip",
248 .space_id = 0,
249 can_share : 0
250};
251
252void jmr3927_spurious(struct pt_regs *regs)
253{
254#ifdef CONFIG_TX_BRANCH_LIKELY_BUG_WORKAROUND
255 tx_branch_likely_bug_fixup(regs);
256#endif
257 printk(KERN_WARNING "spurious interrupt (cause 0x%lx, pc 0x%lx, ra 0x%lx).\n",
258 regs->cp0_cause, regs->cp0_epc, regs->regs[31]);
259}
260
261void jmr3927_irc_irqdispatch(struct pt_regs *regs)
262{
263 int irq;
264
265#ifdef CONFIG_TX_BRANCH_LIKELY_BUG_WORKAROUND
266 tx_branch_likely_bug_fixup(regs);
267#endif
268 if ((regs->cp0_cause & CAUSEF_IP7) == 0) {
269#if 0
270 jmr3927_spurious(regs);
271#endif
272 return;
273 }
274 irq = (regs->cp0_cause >> CAUSEB_IP2) & 0x0f;
275
276 do_IRQ(irq + JMR3927_IRQ_IRC, regs);
277}
278
279static void jmr3927_ioc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
280{
281 unsigned char istat = jmr3927_ioc_reg_in(JMR3927_IOC_INTS2_ADDR);
282 int i;
283
284 for (i = 0; i < JMR3927_NR_IRQ_IOC; i++) {
285 if (istat & (1 << i)) {
286 irq = JMR3927_IRQ_IOC + i;
287 do_IRQ(irq, regs);
288 }
289 }
290}
291
292static struct irqaction ioc_action = {
293 jmr3927_ioc_interrupt, 0, CPU_MASK_NONE, "IOC", NULL, NULL,
294};
295
296static void jmr3927_isac_interrupt(int irq, void *dev_id, struct pt_regs *regs)
297{
298 unsigned char istat = jmr3927_isac_reg_in(JMR3927_ISAC_INTS2_ADDR);
299 int i;
300
301 for (i = 0; i < JMR3927_NR_IRQ_ISAC; i++) {
302 if (istat & (1 << i)) {
303 irq = JMR3927_IRQ_ISAC + i;
304 do_IRQ(irq, regs);
305 }
306 }
307}
308
309static struct irqaction isac_action = {
310 jmr3927_isac_interrupt, 0, CPU_MASK_NONE, "ISAC", NULL, NULL,
311};
312
313
314static void jmr3927_isaerr_interrupt(int irq, void * dev_id, struct pt_regs * regs)
315{
316 printk(KERN_WARNING "ISA error interrupt (irq 0x%x).\n", irq);
317}
318static struct irqaction isaerr_action = {
319 jmr3927_isaerr_interrupt, 0, CPU_MASK_NONE, "ISA error", NULL, NULL,
320};
321
322static void jmr3927_pcierr_interrupt(int irq, void * dev_id, struct pt_regs * regs)
323{
324 printk(KERN_WARNING "PCI error interrupt (irq 0x%x).\n", irq);
325 printk(KERN_WARNING "pcistat:%02x, lbstat:%04lx\n",
326 tx3927_pcicptr->pcistat, tx3927_pcicptr->lbstat);
327}
328static struct irqaction pcierr_action = {
329 jmr3927_pcierr_interrupt, 0, CPU_MASK_NONE, "PCI error", NULL, NULL,
330};
331
332int jmr3927_ether1_irq = 0;
333
334void jmr3927_irq_init(u32 irq_base);
335
336void __init arch_init_irq(void)
337{
338 /* look for io board's presence */
339 int have_isac = jmr3927_have_isac();
340
341 /* Now, interrupt control disabled, */
342 /* all IRC interrupts are masked, */
343 /* all IRC interrupt mode are Low Active. */
344
345 if (have_isac) {
346
347 /* ETHER1 (NE2000 compatible 10M-Ether) parameter setup */
348 /* temporary enable interrupt control */
349 tx3927_ircptr->cer = 1;
350 /* ETHER1 Int. Is High-Active. */
351 if (tx3927_ircptr->ssr & (1 << 0))
352 jmr3927_ether1_irq = JMR3927_IRQ_IRC_INT0;
353#if 0 /* INT3 may be asserted by ether0 (even after reboot...) */
354 else if (tx3927_ircptr->ssr & (1 << 3))
355 jmr3927_ether1_irq = JMR3927_IRQ_IRC_INT3;
356#endif
357 /* disable interrupt control */
358 tx3927_ircptr->cer = 0;
359
360 /* Ether1: High Active */
361 if (jmr3927_ether1_irq) {
362 int ether1_irc = jmr3927_ether1_irq - JMR3927_IRQ_IRC;
363 tx3927_ircptr->cr[ether1_irc / 8] |=
364 TX3927_IRCR_HIGH << ((ether1_irc % 8) * 2);
365 }
366 }
367
368 /* mask all IOC interrupts */
369 jmr3927_ioc_reg_out(0, JMR3927_IOC_INTM_ADDR);
370 /* setup IOC interrupt mode (SOFT:High Active, Others:Low Active) */
371 jmr3927_ioc_reg_out(JMR3927_IOC_INTF_SOFT, JMR3927_IOC_INTP_ADDR);
372
373 if (have_isac) {
374 /* mask all ISAC interrupts */
375 jmr3927_isac_reg_out(0, JMR3927_ISAC_INTM_ADDR);
376 /* setup ISAC interrupt mode (ISAIRQ3,ISAIRQ5:Low Active ???) */
377 jmr3927_isac_reg_out(JMR3927_ISAC_INTF_IRQ3|JMR3927_ISAC_INTF_IRQ5, JMR3927_ISAC_INTP_ADDR);
378 }
379
380 /* clear PCI Soft interrupts */
381 jmr3927_ioc_reg_out(0, JMR3927_IOC_INTS1_ADDR);
382 /* clear PCI Reset interrupts */
383 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
384
385 /* enable interrupt control */
386 tx3927_ircptr->cer = TX3927_IRCER_ICE;
387 tx3927_ircptr->imr = irc_elevel;
388
389 jmr3927_irq_init(NR_ISA_IRQS);
390
391 set_except_vector(0, jmr3927_IRQ);
392
393 /* setup irq space */
394 add_tb_irq_space(&jmr3927_isac_irqspace);
395 add_tb_irq_space(&jmr3927_ioc_irqspace);
396 add_tb_irq_space(&jmr3927_irc_irqspace);
397
398 /* setup IOC interrupt 1 (PCI, MODEM) */
399 setup_irq(JMR3927_IRQ_IOCINT, &ioc_action);
400
401 if (have_isac) {
402 setup_irq(JMR3927_IRQ_ISACINT, &isac_action);
403 setup_irq(JMR3927_IRQ_ISAC_ISAER, &isaerr_action);
404 }
405
406#ifdef CONFIG_PCI
407 setup_irq(JMR3927_IRQ_IRC_PCI, &pcierr_action);
408#endif
409
410 /* enable all CPU interrupt bits. */
411 set_c0_status(ST0_IM); /* IE bit is still 0. */
412}
413
414static hw_irq_controller jmr3927_irq_controller = {
415 "jmr3927_irq",
416 jmr3927_irq_startup,
417 jmr3927_irq_shutdown,
418 jmr3927_irq_enable,
419 jmr3927_irq_disable,
420 jmr3927_irq_ack,
421 jmr3927_irq_end,
422};
423
424void jmr3927_irq_init(u32 irq_base)
425{
426 u32 i;
427
428 for (i= irq_base; i< irq_base + JMR3927_NR_IRQ_IRC + JMR3927_NR_IRQ_IOC; i++) {
429 irq_desc[i].status = IRQ_DISABLED;
430 irq_desc[i].action = NULL;
431 irq_desc[i].depth = 1;
432 irq_desc[i].handler = &jmr3927_irq_controller;
433 }
434
435 jmr3927_irq_base = irq_base;
436}
437
438#ifdef CONFIG_TX_BRANCH_LIKELY_BUG_WORKAROUND
439static int tx_branch_likely_bug_count = 0;
440static int have_tx_branch_likely_bug = 0;
441void tx_branch_likely_bug_fixup(struct pt_regs *regs)
442{
443 /* TX39/49-BUG: Under this condition, the insn in delay slot
444 of the branch likely insn is executed (not nullified) even
445 the branch condition is false. */
446 if (!have_tx_branch_likely_bug)
447 return;
448 if ((regs->cp0_epc & 0xfff) == 0xffc &&
449 KSEGX(regs->cp0_epc) != KSEG0 &&
450 KSEGX(regs->cp0_epc) != KSEG1) {
451 unsigned int insn = *(unsigned int*)(regs->cp0_epc - 4);
452 /* beql,bnel,blezl,bgtzl */
453 /* bltzl,bgezl,blezall,bgezall */
454 /* bczfl, bcztl */
455 if ((insn & 0xf0000000) == 0x50000000 ||
456 (insn & 0xfc0e0000) == 0x04020000 ||
457 (insn & 0xf3fe0000) == 0x41020000) {
458 regs->cp0_epc -= 4;
459 tx_branch_likely_bug_count++;
460 printk(KERN_INFO
461 "fix branch-likery bug in %s (insn %08x)\n",
462 current->comm, insn);
463 }
464 }
465}
466#endif
diff --git a/arch/mips/jmr3927/rbhma3100/kgdb_io.c b/arch/mips/jmr3927/rbhma3100/kgdb_io.c
new file mode 100644
index 000000000000..269a42deae06
--- /dev/null
+++ b/arch/mips/jmr3927/rbhma3100/kgdb_io.c
@@ -0,0 +1,155 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Low level uart routines to directly access a TX[34]927 SIO.
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ahennessy@mvista.com or source@mvista.com
8 *
9 * Based on arch/mips/ddb5xxx/ddb5477/kgdb_io.c
10 *
11 * Copyright (C) 2000-2001 Toshiba Corporation
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */
33
34#include <linux/types.h>
35#include <asm/jmr3927/txx927.h>
36#include <asm/jmr3927/tx3927.h>
37#include <asm/jmr3927/jmr3927.h>
38
39#define TIMEOUT 0xffffff
40#define SLOW_DOWN
41
42static const char digits[16] = "0123456789abcdef";
43
44#ifdef SLOW_DOWN
45#define slow_down() { int k; for (k=0; k<10000; k++); }
46#else
47#define slow_down()
48#endif
49
50static int remoteDebugInitialized = 0;
51
52int putDebugChar(unsigned char c)
53{
54 int i = 0;
55
56 if (!remoteDebugInitialized) {
57 remoteDebugInitialized = 1;
58 debugInit(38400);
59 }
60
61 do {
62 slow_down();
63 i++;
64 if (i>TIMEOUT) {
65 break;
66 }
67 } while (!(tx3927_sioptr(0)->cisr & TXx927_SICISR_TXALS));
68 tx3927_sioptr(0)->tfifo = c;
69
70 return 1;
71}
72
73unsigned char getDebugChar(void)
74{
75 int i = 0;
76 int dicr;
77 char c;
78
79 if (!remoteDebugInitialized) {
80 remoteDebugInitialized = 1;
81 debugInit(38400);
82 }
83
84 /* diable RX int. */
85 dicr = tx3927_sioptr(0)->dicr;
86 tx3927_sioptr(0)->dicr = 0;
87
88 do {
89 slow_down();
90 i++;
91 if (i>TIMEOUT) {
92 break;
93 }
94 } while (tx3927_sioptr(0)->disr & TXx927_SIDISR_UVALID)
95 ;
96 c = tx3927_sioptr(0)->rfifo;
97
98 /* clear RX int. status */
99 tx3927_sioptr(0)->disr &= ~TXx927_SIDISR_RDIS;
100 /* enable RX int. */
101 tx3927_sioptr(0)->dicr = dicr;
102
103 return c;
104}
105
106void debugInit(int baud)
107{
108 /*
109 volatile unsigned long lcr;
110 volatile unsigned long dicr;
111 volatile unsigned long disr;
112 volatile unsigned long cisr;
113 volatile unsigned long fcr;
114 volatile unsigned long flcr;
115 volatile unsigned long bgr;
116 volatile unsigned long tfifo;
117 volatile unsigned long rfifo;
118 */
119
120 tx3927_sioptr(0)->lcr = 0x020;
121 tx3927_sioptr(0)->dicr = 0;
122 tx3927_sioptr(0)->disr = 0x4100;
123 tx3927_sioptr(0)->cisr = 0x014;
124 tx3927_sioptr(0)->fcr = 0;
125 tx3927_sioptr(0)->flcr = 0x02;
126 tx3927_sioptr(0)->bgr = ((JMR3927_BASE_BAUD + baud / 2) / baud) |
127 TXx927_SIBGR_BCLK_T0;
128#if 0
129 /*
130 * Reset the UART.
131 */
132 tx3927_sioptr(0)->fcr = TXx927_SIFCR_SWRST;
133 while (tx3927_sioptr(0)->fcr & TXx927_SIFCR_SWRST)
134 ;
135
136 /*
137 * and set the speed of the serial port
138 * (currently hardwired to 9600 8N1
139 */
140
141 tx3927_sioptr(0)->lcr = TXx927_SILCR_UMODE_8BIT |
142 TXx927_SILCR_USBL_1BIT |
143 TXx927_SILCR_SCS_IMCLK_BG;
144 tx3927_sioptr(0)->bgr =
145 ((JMR3927_BASE_BAUD + baud / 2) / baud) |
146 TXx927_SIBGR_BCLK_T0;
147
148 /* HW RTS/CTS control */
149 if (ser->flags & ASYNC_HAVE_CTS_LINE)
150 tx3927_sioptr(0)->flcr = TXx927_SIFLCR_RCS | TXx927_SIFLCR_TES |
151 TXx927_SIFLCR_RTSTL_MAX /* 15 */;
152 /* Enable RX/TX */
153 tx3927_sioptr(0)->flcr &= ~(TXx927_SIFLCR_RSDE | TXx927_SIFLCR_TSDE);
154#endif
155}
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
new file mode 100644
index 000000000000..32039bb2f440
--- /dev/null
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -0,0 +1,510 @@
1/***********************************************************************
2 *
3 * Copyright 2001 MontaVista Software Inc.
4 * Author: MontaVista Software, Inc.
5 * ahennessy@mvista.com
6 *
7 * Based on arch/mips/ddb5xxx/ddb5477/setup.c
8 *
9 * Setup file for JMR3927.
10 *
11 * Copyright (C) 2000-2001 Toshiba Corporation
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 *
33 ***********************************************************************
34 */
35
36#include <linux/config.h>
37#include <linux/init.h>
38#include <linux/kernel.h>
39#include <linux/kdev_t.h>
40#include <linux/types.h>
41#include <linux/sched.h>
42#include <linux/pci.h>
43#include <linux/ide.h>
44#include <linux/ioport.h>
45#include <linux/param.h> /* for HZ */
46#include <linux/delay.h>
47
48#include <asm/addrspace.h>
49#include <asm/time.h>
50#include <asm/bcache.h>
51#include <asm/irq.h>
52#include <asm/reboot.h>
53#include <asm/gdb-stub.h>
54#include <asm/jmr3927/jmr3927.h>
55#include <asm/mipsregs.h>
56#include <asm/traps.h>
57
58/* Tick Timer divider */
59#define JMR3927_TIMER_CCD 0 /* 1/2 */
60#define JMR3927_TIMER_CLK (JMR3927_IMCLK / (2 << JMR3927_TIMER_CCD))
61
62unsigned char led_state = 0xf;
63
64struct {
65 struct resource ram0;
66 struct resource ram1;
67 struct resource pcimem;
68 struct resource iob;
69 struct resource ioc;
70 struct resource pciio;
71 struct resource jmy1394;
72 struct resource rom1;
73 struct resource rom0;
74 struct resource sio0;
75 struct resource sio1;
76} jmr3927_resources = {
77 { "RAM0", 0, 0x01FFFFFF, IORESOURCE_MEM },
78 { "RAM1", 0x02000000, 0x03FFFFFF, IORESOURCE_MEM },
79 { "PCIMEM", 0x08000000, 0x07FFFFFF, IORESOURCE_MEM },
80 { "IOB", 0x10000000, 0x13FFFFFF },
81 { "IOC", 0x14000000, 0x14FFFFFF },
82 { "PCIIO", 0x15000000, 0x15FFFFFF },
83 { "JMY1394", 0x1D000000, 0x1D3FFFFF },
84 { "ROM1", 0x1E000000, 0x1E3FFFFF },
85 { "ROM0", 0x1FC00000, 0x1FFFFFFF },
86 { "SIO0", 0xFFFEF300, 0xFFFEF3FF },
87 { "SIO1", 0xFFFEF400, 0xFFFEF4FF },
88};
89
90/* don't enable - see errata */
91int jmr3927_ccfg_toeon = 0;
92
93static inline void do_reset(void)
94{
95#ifdef CONFIG_TC35815
96 extern void tc35815_killall(void);
97 tc35815_killall();
98#endif
99#if 1 /* Resetting PCI bus */
100 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
101 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR);
102 (void)jmr3927_ioc_reg_in(JMR3927_IOC_RESET_ADDR); /* flush WB */
103 mdelay(1);
104 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
105#endif
106 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_CPU, JMR3927_IOC_RESET_ADDR);
107}
108
109static void jmr3927_machine_restart(char *command)
110{
111 local_irq_disable();
112 puts("Rebooting...");
113 do_reset();
114}
115
116static void jmr3927_machine_halt(void)
117{
118 puts("JMR-TX3927 halted.\n");
119 while (1);
120}
121
122static void jmr3927_machine_power_off(void)
123{
124 puts("JMR-TX3927 halted. Please turn off the power.\n");
125 while (1);
126}
127
128#define USE_RTC_DS1742
129#ifdef USE_RTC_DS1742
130extern void rtc_ds1742_init(unsigned long base);
131#endif
132static void __init jmr3927_time_init(void)
133{
134#ifdef USE_RTC_DS1742
135 if (jmr3927_have_nvram()) {
136 rtc_ds1742_init(JMR3927_IOC_NVRAMB_ADDR);
137 }
138#endif
139}
140
141unsigned long jmr3927_do_gettimeoffset(void);
142extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
143
144static void __init jmr3927_timer_setup(struct irqaction *irq)
145{
146 do_gettimeoffset = jmr3927_do_gettimeoffset;
147
148 jmr3927_tmrptr->cpra = JMR3927_TIMER_CLK / HZ;
149 jmr3927_tmrptr->itmr = TXx927_TMTITMR_TIIE | TXx927_TMTITMR_TZCE;
150 jmr3927_tmrptr->ccdr = JMR3927_TIMER_CCD;
151 jmr3927_tmrptr->tcr =
152 TXx927_TMTCR_TCE | TXx927_TMTCR_CCDE | TXx927_TMTCR_TMODE_ITVL;
153
154 setup_irq(JMR3927_IRQ_TICK, irq);
155}
156
157#define USECS_PER_JIFFY (1000000/HZ)
158
159unsigned long jmr3927_do_gettimeoffset(void)
160{
161 unsigned long count;
162 unsigned long res = 0;
163
164 /* MUST read TRR before TISR. */
165 count = jmr3927_tmrptr->trr;
166
167 if (jmr3927_tmrptr->tisr & TXx927_TMTISR_TIIS) {
168 /* timer interrupt is pending. use Max value. */
169 res = USECS_PER_JIFFY - 1;
170 } else {
171 /* convert to usec */
172 /* res = count / (JMR3927_TIMER_CLK / 1000000); */
173 res = (count << 7) / ((JMR3927_TIMER_CLK << 7) / 1000000);
174
175 /*
176 * Due to possible jiffies inconsistencies, we need to check
177 * the result so that we'll get a timer that is monotonic.
178 */
179 if (res >= USECS_PER_JIFFY)
180 res = USECS_PER_JIFFY-1;
181 }
182
183 return res;
184}
185
186
187//#undef DO_WRITE_THROUGH
188#define DO_WRITE_THROUGH
189#define DO_ENABLE_CACHE
190
191extern char * __init prom_getcmdline(void);
192static void jmr3927_board_init(void);
193extern struct resource pci_io_resource;
194extern struct resource pci_mem_resource;
195
196static void __init jmr3927_setup(void)
197{
198 char *argptr;
199
200 set_io_port_base(JMR3927_PORT_BASE + JMR3927_PCIIO);
201
202 board_time_init = jmr3927_time_init;
203 board_timer_setup = jmr3927_timer_setup;
204
205 _machine_restart = jmr3927_machine_restart;
206 _machine_halt = jmr3927_machine_halt;
207 _machine_power_off = jmr3927_machine_power_off;
208
209 /*
210 * IO/MEM resources.
211 */
212 ioport_resource.start = pci_io_resource.start;
213 ioport_resource.end = pci_io_resource.end;
214 iomem_resource.start = pci_mem_resource.start;
215 iomem_resource.end = pci_mem_resource.end;
216
217 /* Reboot on panic */
218 panic_timeout = 180;
219
220 {
221 unsigned int conf;
222 conf = read_c0_conf();
223 }
224
225#if 1
226 /* cache setup */
227 {
228 unsigned int conf;
229#ifdef DO_ENABLE_CACHE
230 int mips_ic_disable = 0, mips_dc_disable = 0;
231#else
232 int mips_ic_disable = 1, mips_dc_disable = 1;
233#endif
234#ifdef DO_WRITE_THROUGH
235 int mips_config_cwfon = 0;
236 int mips_config_wbon = 0;
237#else
238 int mips_config_cwfon = 1;
239 int mips_config_wbon = 1;
240#endif
241
242 conf = read_c0_conf();
243 conf &= ~(TX39_CONF_ICE | TX39_CONF_DCE | TX39_CONF_WBON | TX39_CONF_CWFON);
244 conf |= mips_ic_disable ? 0 : TX39_CONF_ICE;
245 conf |= mips_dc_disable ? 0 : TX39_CONF_DCE;
246 conf |= mips_config_wbon ? TX39_CONF_WBON : 0;
247 conf |= mips_config_cwfon ? TX39_CONF_CWFON : 0;
248
249 write_c0_conf(conf);
250 write_c0_cache(0);
251 }
252#endif
253
254 /* initialize board */
255 jmr3927_board_init();
256
257 argptr = prom_getcmdline();
258
259 if ((argptr = strstr(argptr, "toeon")) != NULL) {
260 jmr3927_ccfg_toeon = 1;
261 }
262 argptr = prom_getcmdline();
263 if ((argptr = strstr(argptr, "ip=")) == NULL) {
264 argptr = prom_getcmdline();
265 strcat(argptr, " ip=bootp");
266 }
267
268#ifdef CONFIG_TXX927_SERIAL_CONSOLE
269 argptr = prom_getcmdline();
270 if ((argptr = strstr(argptr, "console=")) == NULL) {
271 argptr = prom_getcmdline();
272 strcat(argptr, " console=ttyS1,115200");
273 }
274#endif
275}
276
277early_initcall(jmr3927_setup);
278
279
280static void tx3927_setup(void);
281
282#ifdef CONFIG_PCI
283unsigned long mips_pci_io_base;
284unsigned long mips_pci_io_size;
285unsigned long mips_pci_mem_base;
286unsigned long mips_pci_mem_size;
287/* for legacy I/O, PCI I/O PCI Bus address must be 0 */
288unsigned long mips_pci_io_pciaddr = 0;
289#endif
290
291static void __init jmr3927_board_init(void)
292{
293 char *argptr;
294
295#ifdef CONFIG_PCI
296 mips_pci_io_base = JMR3927_PCIIO;
297 mips_pci_io_size = JMR3927_PCIIO_SIZE;
298 mips_pci_mem_base = JMR3927_PCIMEM;
299 mips_pci_mem_size = JMR3927_PCIMEM_SIZE;
300#endif
301
302 tx3927_setup();
303
304 if (jmr3927_have_isac()) {
305
306#ifdef CONFIG_FB_E1355
307 argptr = prom_getcmdline();
308 if ((argptr = strstr(argptr, "video=")) == NULL) {
309 argptr = prom_getcmdline();
310 strcat(argptr, " video=e1355fb:crt16h");
311 }
312#endif
313
314#ifdef CONFIG_BLK_DEV_IDE
315 /* overrides PCI-IDE */
316#endif
317 }
318
319 /* SIO0 DTR on */
320 jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR);
321
322 jmr3927_led_set(0);
323
324
325 if (jmr3927_have_isac())
326 jmr3927_io_led_set(0);
327 printk("JMR-TX3927 (Rev %d) --- IOC(Rev %d) DIPSW:%d,%d,%d,%d\n",
328 jmr3927_ioc_reg_in(JMR3927_IOC_BREV_ADDR) & JMR3927_REV_MASK,
329 jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_REV_MASK,
330 jmr3927_dipsw1(), jmr3927_dipsw2(),
331 jmr3927_dipsw3(), jmr3927_dipsw4());
332 if (jmr3927_have_isac())
333 printk("JMI-3927IO2 --- ISAC(Rev %d) DIPSW:%01x\n",
334 jmr3927_isac_reg_in(JMR3927_ISAC_REV_ADDR) & JMR3927_REV_MASK,
335 jmr3927_io_dipsw());
336}
337
338static void __init tx3927_setup(void)
339{
340 int i;
341
342 /* SDRAMC are configured by PROM */
343
344 /* ROMC */
345 tx3927_romcptr->cr[1] = JMR3927_ROMCE1 | 0x00030048;
346 tx3927_romcptr->cr[2] = JMR3927_ROMCE2 | 0x000064c8;
347 tx3927_romcptr->cr[3] = JMR3927_ROMCE3 | 0x0003f698;
348 tx3927_romcptr->cr[5] = JMR3927_ROMCE5 | 0x0000f218;
349
350 /* CCFG */
351 /* enable Timeout BusError */
352 if (jmr3927_ccfg_toeon)
353 tx3927_ccfgptr->ccfg |= TX3927_CCFG_TOE;
354
355 /* clear BusErrorOnWrite flag */
356 tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_BEOW;
357 /* Disable PCI snoop */
358 tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_PSNP;
359
360#ifdef DO_WRITE_THROUGH
361 /* Enable PCI SNOOP - with write through only */
362 tx3927_ccfgptr->ccfg |= TX3927_CCFG_PSNP;
363#endif
364
365 /* Pin selection */
366 tx3927_ccfgptr->pcfg &= ~TX3927_PCFG_SELALL;
367 tx3927_ccfgptr->pcfg |=
368 TX3927_PCFG_SELSIOC(0) | TX3927_PCFG_SELSIO_ALL |
369 (TX3927_PCFG_SELDMA_ALL & ~TX3927_PCFG_SELDMA(1));
370
371 printk("TX3927 -- CRIR:%08lx CCFG:%08lx PCFG:%08lx\n",
372 tx3927_ccfgptr->crir,
373 tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg);
374
375 /* IRC */
376 /* disable interrupt control */
377 tx3927_ircptr->cer = 0;
378 /* mask all IRC interrupts */
379 tx3927_ircptr->imr = 0;
380 for (i = 0; i < TX3927_NUM_IR / 2; i++) {
381 tx3927_ircptr->ilr[i] = 0;
382 }
383 /* setup IRC interrupt mode (Low Active) */
384 for (i = 0; i < TX3927_NUM_IR / 8; i++) {
385 tx3927_ircptr->cr[i] = 0;
386 }
387
388 /* TMR */
389 /* disable all timers */
390 for (i = 0; i < TX3927_NR_TMR; i++) {
391 tx3927_tmrptr(i)->tcr = TXx927_TMTCR_CRE;
392 tx3927_tmrptr(i)->tisr = 0;
393 tx3927_tmrptr(i)->cpra = 0xffffffff;
394 tx3927_tmrptr(i)->itmr = 0;
395 tx3927_tmrptr(i)->ccdr = 0;
396 tx3927_tmrptr(i)->pgmr = 0;
397 }
398
399 /* DMA */
400 tx3927_dmaptr->mcr = 0;
401 for (i = 0; i < sizeof(tx3927_dmaptr->ch) / sizeof(tx3927_dmaptr->ch[0]); i++) {
402 /* reset channel */
403 tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST;
404 tx3927_dmaptr->ch[i].ccr = 0;
405 }
406 /* enable DMA */
407#ifdef __BIG_ENDIAN
408 tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN;
409#else
410 tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN | TX3927_DMA_MCR_LE;
411#endif
412
413#ifdef CONFIG_PCI
414 /* PCIC */
415 printk("TX3927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:",
416 tx3927_pcicptr->did, tx3927_pcicptr->vid,
417 tx3927_pcicptr->rid);
418 if (!(tx3927_ccfgptr->ccfg & TX3927_CCFG_PCIXARB)) {
419 printk("External\n");
420 /* XXX */
421 } else {
422 printk("Internal\n");
423
424 /* Reset PCI Bus */
425 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
426 udelay(100);
427 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI,
428 JMR3927_IOC_RESET_ADDR);
429 udelay(100);
430 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
431
432
433 /* Disable External PCI Config. Access */
434 tx3927_pcicptr->lbc = TX3927_PCIC_LBC_EPCAD;
435#ifdef __BIG_ENDIAN
436 tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_IBSE |
437 TX3927_PCIC_LBC_TIBSE |
438 TX3927_PCIC_LBC_TMFBSE | TX3927_PCIC_LBC_MSDSE;
439#endif
440 /* LB->PCI mappings */
441 tx3927_pcicptr->iomas = ~(mips_pci_io_size - 1);
442 tx3927_pcicptr->ilbioma = mips_pci_io_base;
443 tx3927_pcicptr->ipbioma = mips_pci_io_pciaddr;
444 tx3927_pcicptr->mmas = ~(mips_pci_mem_size - 1);
445 tx3927_pcicptr->ilbmma = mips_pci_mem_base;
446 tx3927_pcicptr->ipbmma = mips_pci_mem_base;
447 /* PCI->LB mappings */
448 tx3927_pcicptr->iobas = 0xffffffff;
449 tx3927_pcicptr->ioba = 0;
450 tx3927_pcicptr->tlbioma = 0;
451 tx3927_pcicptr->mbas = ~(mips_pci_mem_size - 1);
452 tx3927_pcicptr->mba = 0;
453 tx3927_pcicptr->tlbmma = 0;
454#ifndef JMR3927_INIT_INDIRECT_PCI
455 /* Enable Direct mapping Address Space Decoder */
456 tx3927_pcicptr->lbc |= TX3927_PCIC_LBC_ILMDE | TX3927_PCIC_LBC_ILIDE;
457#endif
458
459 /* Clear All Local Bus Status */
460 tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL;
461 /* Enable All Local Bus Interrupts */
462 tx3927_pcicptr->lbim = TX3927_PCIC_LBIM_ALL;
463 /* Clear All PCI Status Error */
464 tx3927_pcicptr->pcistat = TX3927_PCIC_PCISTATIM_ALL;
465 /* Enable All PCI Status Error Interrupts */
466 tx3927_pcicptr->pcistatim = TX3927_PCIC_PCISTATIM_ALL;
467
468 /* PCIC Int => IRC IRQ10 */
469 tx3927_pcicptr->il = TX3927_IR_PCI;
470#if 1
471 /* Target Control (per errata) */
472 tx3927_pcicptr->tc = TX3927_PCIC_TC_OF8E | TX3927_PCIC_TC_IF8E;
473#endif
474
475 /* Enable Bus Arbiter */
476#if 0
477 tx3927_pcicptr->req_trace = 0x73737373;
478#endif
479 tx3927_pcicptr->pbapmc = TX3927_PCIC_PBAPMC_PBAEN;
480
481 tx3927_pcicptr->pcicmd = PCI_COMMAND_MASTER |
482 PCI_COMMAND_MEMORY |
483#if 1
484 PCI_COMMAND_IO |
485#endif
486 PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
487 }
488#endif /* CONFIG_PCI */
489
490 /* PIO */
491 /* PIO[15:12] connected to LEDs */
492 tx3927_pioptr->dir = 0x0000f000;
493 tx3927_pioptr->maskcpu = 0;
494 tx3927_pioptr->maskext = 0;
495 {
496 unsigned int conf;
497
498 conf = read_c0_conf();
499 if (!(conf & TX39_CONF_ICE))
500 printk("TX3927 I-Cache disabled.\n");
501 if (!(conf & TX39_CONF_DCE))
502 printk("TX3927 D-Cache disabled.\n");
503 else if (!(conf & TX39_CONF_WBON))
504 printk("TX3927 D-Cache WriteThrough.\n");
505 else if (!(conf & TX39_CONF_CWFON))
506 printk("TX3927 D-Cache WriteBack.\n");
507 else
508 printk("TX3927 D-Cache WriteBack (CWF) .\n");
509 }
510}
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
new file mode 100644
index 000000000000..a0230ee0f7f4
--- /dev/null
+++ b/arch/mips/kernel/Makefile
@@ -0,0 +1,65 @@
1#
2# Makefile for the Linux/MIPS kernel.
3#
4
5extra-y := head.o init_task.o vmlinux.lds
6
7obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
8 ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
9 time.o traps.o unaligned.o
10
11binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
12 irix5sys.o sysirix.o
13
14ifdef CONFIG_MODULES
15obj-y += mips_ksyms.o module.o
16obj-$(CONFIG_MIPS32) += module-elf32.o
17obj-$(CONFIG_MIPS64) += module-elf64.o
18endif
19
20obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o
21obj-$(CONFIG_CPU_TX39XX) += r2300_fpu.o r2300_switch.o
22obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o
23obj-$(CONFIG_CPU_R4000) += r4k_fpu.o r4k_switch.o
24obj-$(CONFIG_CPU_VR41XX) += r4k_fpu.o r4k_switch.o
25obj-$(CONFIG_CPU_R4300) += r4k_fpu.o r4k_switch.o
26obj-$(CONFIG_CPU_R4X00) += r4k_fpu.o r4k_switch.o
27obj-$(CONFIG_CPU_R5000) += r4k_fpu.o r4k_switch.o
28obj-$(CONFIG_CPU_R5432) += r4k_fpu.o r4k_switch.o
29obj-$(CONFIG_CPU_R8000) += r4k_fpu.o r4k_switch.o
30obj-$(CONFIG_CPU_RM7000) += r4k_fpu.o r4k_switch.o
31obj-$(CONFIG_CPU_RM9000) += r4k_fpu.o r4k_switch.o
32obj-$(CONFIG_CPU_NEVADA) += r4k_fpu.o r4k_switch.o
33obj-$(CONFIG_CPU_R10000) += r4k_fpu.o r4k_switch.o
34obj-$(CONFIG_CPU_SB1) += r4k_fpu.o r4k_switch.o
35obj-$(CONFIG_CPU_MIPS32) += r4k_fpu.o r4k_switch.o
36obj-$(CONFIG_CPU_MIPS64) += r4k_fpu.o r4k_switch.o
37obj-$(CONFIG_CPU_R6000) += r6000_fpu.o r4k_switch.o
38
39obj-$(CONFIG_SMP) += smp.o
40
41obj-$(CONFIG_NO_ISA) += dma-no-isa.o
42obj-$(CONFIG_I8259) += i8259.o
43obj-$(CONFIG_IRQ_CPU) += irq_cpu.o
44obj-$(CONFIG_IRQ_CPU_RM7K) += irq-rm7000.o
45obj-$(CONFIG_IRQ_CPU_RM9K) += irq-rm9000.o
46obj-$(CONFIG_IRQ_MV64340) += irq-mv6434x.o
47
48obj-$(CONFIG_MIPS32) += scall32-o32.o
49obj-$(CONFIG_MIPS64) += scall64-64.o
50obj-$(CONFIG_BINFMT_IRIX) += binfmt_irix.o
51obj-$(CONFIG_MIPS32_COMPAT) += ioctl32.o linux32.o signal32.o
52obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o
53obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o ptrace32.o
54
55obj-$(CONFIG_KGDB) += gdb-low.o gdb-stub.o
56obj-$(CONFIG_PROC_FS) += proc.o
57
58obj-$(CONFIG_MIPS64) += cpu-bugs64.o
59
60obj-$(CONFIG_GEN_RTC) += genrtc.o
61
62CFLAGS_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)
63CFLAGS_ioctl32.o += -Ifs/
64
65EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c
new file mode 100644
index 000000000000..ed47041f3030
--- /dev/null
+++ b/arch/mips/kernel/binfmt_elfn32.c
@@ -0,0 +1,119 @@
1/*
2 * Support for n32 Linux/MIPS ELF binaries.
3 *
4 * Copyright (C) 1999, 2001 Ralf Baechle
5 * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
6 *
7 * Heavily inspired by the 32-bit Sparc compat code which is
8 * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com)
9 * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz)
10 */
11
12#define ELF_ARCH EM_MIPS
13#define ELF_CLASS ELFCLASS32
14#ifdef __MIPSEB__
15#define ELF_DATA ELFDATA2MSB;
16#else /* __MIPSEL__ */
17#define ELF_DATA ELFDATA2LSB;
18#endif
19
20/* ELF register definitions */
21#define ELF_NGREG 45
22#define ELF_NFPREG 33
23
24typedef unsigned long elf_greg_t;
25typedef elf_greg_t elf_gregset_t[ELF_NGREG];
26
27typedef double elf_fpreg_t;
28typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
29
30/*
31 * This is used to ensure we don't load something for the wrong architecture.
32 */
33#define elf_check_arch(hdr) \
34({ \
35 int __res = 1; \
36 struct elfhdr *__h = (hdr); \
37 \
38 if (__h->e_machine != EM_MIPS) \
39 __res = 0; \
40 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
41 __res = 0; \
42 if (((__h->e_flags & EF_MIPS_ABI2) == 0) || \
43 ((__h->e_flags & EF_MIPS_ABI) != 0)) \
44 __res = 0; \
45 \
46 __res; \
47})
48
49#define TASK32_SIZE 0x7fff8000UL
50#undef ELF_ET_DYN_BASE
51#define ELF_ET_DYN_BASE (TASK32_SIZE / 3 * 2)
52
53#include <asm/processor.h>
54#include <linux/module.h>
55#include <linux/config.h>
56#include <linux/elfcore.h>
57#include <linux/compat.h>
58
59#define elf_prstatus elf_prstatus32
60struct elf_prstatus32
61{
62 struct elf_siginfo pr_info; /* Info associated with signal */
63 short pr_cursig; /* Current signal */
64 unsigned int pr_sigpend; /* Set of pending signals */
65 unsigned int pr_sighold; /* Set of held signals */
66 pid_t pr_pid;
67 pid_t pr_ppid;
68 pid_t pr_pgrp;
69 pid_t pr_sid;
70 struct compat_timeval pr_utime; /* User time */
71 struct compat_timeval pr_stime; /* System time */
72 struct compat_timeval pr_cutime;/* Cumulative user time */
73 struct compat_timeval pr_cstime;/* Cumulative system time */
74 elf_gregset_t pr_reg; /* GP registers */
75 int pr_fpvalid; /* True if math co-processor being used. */
76};
77
78#define elf_prpsinfo elf_prpsinfo32
79struct elf_prpsinfo32
80{
81 char pr_state; /* numeric process state */
82 char pr_sname; /* char for pr_state */
83 char pr_zomb; /* zombie */
84 char pr_nice; /* nice val */
85 unsigned int pr_flag; /* flags */
86 __kernel_uid_t pr_uid;
87 __kernel_gid_t pr_gid;
88 pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
89 /* Lots missing */
90 char pr_fname[16]; /* filename of executable */
91 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
92};
93
94#define elf_addr_t u32
95#define elf_caddr_t u32
96#define init_elf_binfmt init_elfn32_binfmt
97
98#define jiffies_to_timeval jiffies_to_compat_timeval
99static __inline__ void
100jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
101{
102 /*
103 * Convert jiffies to nanoseconds and seperate with
104 * one divide.
105 */
106 u64 nsec = (u64)jiffies * TICK_NSEC;
107 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec);
108 value->tv_usec /= NSEC_PER_USEC;
109}
110
111#define ELF_CORE_EFLAGS EF_MIPS_ABI2
112
113MODULE_DESCRIPTION("Binary format loader for compatibility with n32 Linux/MIPS binaries");
114MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)");
115
116#undef MODULE_DESCRIPTION
117#undef MODULE_AUTHOR
118
119#include "../../../fs/binfmt_elf.c"
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
new file mode 100644
index 000000000000..ee21b18c37a8
--- /dev/null
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -0,0 +1,139 @@
1/*
2 * Support for o32 Linux/MIPS ELF binaries.
3 *
4 * Copyright (C) 1999, 2001 Ralf Baechle
5 * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
6 *
7 * Heavily inspired by the 32-bit Sparc compat code which is
8 * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com)
9 * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz)
10 */
11
12#define ELF_ARCH EM_MIPS
13#define ELF_CLASS ELFCLASS32
14#ifdef __MIPSEB__
15#define ELF_DATA ELFDATA2MSB;
16#else /* __MIPSEL__ */
17#define ELF_DATA ELFDATA2LSB;
18#endif
19
20/* ELF register definitions */
21#define ELF_NGREG 45
22#define ELF_NFPREG 33
23
24typedef unsigned int elf_greg_t;
25typedef elf_greg_t elf_gregset_t[ELF_NGREG];
26
27typedef double elf_fpreg_t;
28typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
29
30/*
31 * This is used to ensure we don't load something for the wrong architecture.
32 */
33#define elf_check_arch(hdr) \
34({ \
35 int __res = 1; \
36 struct elfhdr *__h = (hdr); \
37 \
38 if (__h->e_machine != EM_MIPS) \
39 __res = 0; \
40 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
41 __res = 0; \
42 if ((__h->e_flags & EF_MIPS_ABI2) != 0) \
43 __res = 0; \
44 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
45 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
46 __res = 0; \
47 \
48 __res; \
49})
50
51#define TASK32_SIZE 0x7fff8000UL
52#undef ELF_ET_DYN_BASE
53#define ELF_ET_DYN_BASE (TASK32_SIZE / 3 * 2)
54
55#include <asm/processor.h>
56#include <linux/module.h>
57#include <linux/config.h>
58#include <linux/elfcore.h>
59#include <linux/compat.h>
60
61#define elf_prstatus elf_prstatus32
62struct elf_prstatus32
63{
64 struct elf_siginfo pr_info; /* Info associated with signal */
65 short pr_cursig; /* Current signal */
66 unsigned int pr_sigpend; /* Set of pending signals */
67 unsigned int pr_sighold; /* Set of held signals */
68 pid_t pr_pid;
69 pid_t pr_ppid;
70 pid_t pr_pgrp;
71 pid_t pr_sid;
72 struct compat_timeval pr_utime; /* User time */
73 struct compat_timeval pr_stime; /* System time */
74 struct compat_timeval pr_cutime;/* Cumulative user time */
75 struct compat_timeval pr_cstime;/* Cumulative system time */
76 elf_gregset_t pr_reg; /* GP registers */
77 int pr_fpvalid; /* True if math co-processor being used. */
78};
79
80#define elf_prpsinfo elf_prpsinfo32
81struct elf_prpsinfo32
82{
83 char pr_state; /* numeric process state */
84 char pr_sname; /* char for pr_state */
85 char pr_zomb; /* zombie */
86 char pr_nice; /* nice val */
87 unsigned int pr_flag; /* flags */
88 __kernel_uid_t pr_uid;
89 __kernel_gid_t pr_gid;
90 pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
91 /* Lots missing */
92 char pr_fname[16]; /* filename of executable */
93 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
94};
95
96#define elf_addr_t u32
97#define elf_caddr_t u32
98#define init_elf_binfmt init_elf32_binfmt
99
100#define jiffies_to_timeval jiffies_to_compat_timeval
101static __inline__ void
102jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
103{
104 /*
105 * Convert jiffies to nanoseconds and seperate with
106 * one divide.
107 */
108 u64 nsec = (u64)jiffies * TICK_NSEC;
109 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec);
110 value->tv_usec /= NSEC_PER_USEC;
111}
112
113#undef ELF_CORE_COPY_REGS
114#define ELF_CORE_COPY_REGS(_dest,_regs) elf32_core_copy_regs(_dest,_regs);
115
116void elf32_core_copy_regs(elf_gregset_t _dest, struct pt_regs *_regs)
117{
118 int i;
119
120 memset(_dest, 0, sizeof(elf_gregset_t));
121
122 /* XXXKW the 6 is from EF_REG0 in gdb/gdb/mips-linux-tdep.c, include/asm-mips/reg.h */
123 for (i=6; i<38; i++)
124 _dest[i] = (elf_greg_t) _regs->regs[i-6];
125 _dest[i++] = (elf_greg_t) _regs->lo;
126 _dest[i++] = (elf_greg_t) _regs->hi;
127 _dest[i++] = (elf_greg_t) _regs->cp0_epc;
128 _dest[i++] = (elf_greg_t) _regs->cp0_badvaddr;
129 _dest[i++] = (elf_greg_t) _regs->cp0_status;
130 _dest[i++] = (elf_greg_t) _regs->cp0_cause;
131}
132
133MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries");
134MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)");
135
136#undef MODULE_DESCRIPTION
137#undef MODULE_AUTHOR
138
139#include "../../../fs/binfmt_elf.c"
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
new file mode 100644
index 000000000000..01117e977a7f
--- /dev/null
+++ b/arch/mips/kernel/branch.c
@@ -0,0 +1,199 @@
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) 1996, 97, 2000, 2001 by Ralf Baechle
7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 */
9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <linux/signal.h>
12#include <asm/branch.h>
13#include <asm/cpu.h>
14#include <asm/cpu-features.h>
15#include <asm/inst.h>
16#include <asm/ptrace.h>
17#include <asm/uaccess.h>
18
19/*
20 * Compute the return address and do emulate branch simulation, if required.
21 */
22int __compute_return_epc(struct pt_regs *regs)
23{
24 unsigned int *addr, bit, fcr31;
25 long epc;
26 union mips_instruction insn;
27
28 epc = regs->cp0_epc;
29 if (epc & 3)
30 goto unaligned;
31
32 /*
33 * Read the instruction
34 */
35 addr = (unsigned int *) epc;
36 if (__get_user(insn.word, addr)) {
37 force_sig(SIGSEGV, current);
38 return -EFAULT;
39 }
40
41 regs->regs[0] = 0;
42 switch (insn.i_format.opcode) {
43 /*
44 * jr and jalr are in r_format format.
45 */
46 case spec_op:
47 switch (insn.r_format.func) {
48 case jalr_op:
49 regs->regs[insn.r_format.rd] = epc + 8;
50 /* Fall through */
51 case jr_op:
52 regs->cp0_epc = regs->regs[insn.r_format.rs];
53 break;
54 }
55 break;
56
57 /*
58 * This group contains:
59 * bltz_op, bgez_op, bltzl_op, bgezl_op,
60 * bltzal_op, bgezal_op, bltzall_op, bgezall_op.
61 */
62 case bcond_op:
63 switch (insn.i_format.rt) {
64 case bltz_op:
65 case bltzl_op:
66 if ((long)regs->regs[insn.i_format.rs] < 0)
67 epc = epc + 4 + (insn.i_format.simmediate << 2);
68 else
69 epc += 8;
70 regs->cp0_epc = epc;
71 break;
72
73 case bgez_op:
74 case bgezl_op:
75 if ((long)regs->regs[insn.i_format.rs] >= 0)
76 epc = epc + 4 + (insn.i_format.simmediate << 2);
77 else
78 epc += 8;
79 regs->cp0_epc = epc;
80 break;
81
82 case bltzal_op:
83 case bltzall_op:
84 regs->regs[31] = epc + 8;
85 if ((long)regs->regs[insn.i_format.rs] < 0)
86 epc = epc + 4 + (insn.i_format.simmediate << 2);
87 else
88 epc += 8;
89 regs->cp0_epc = epc;
90 break;
91
92 case bgezal_op:
93 case bgezall_op:
94 regs->regs[31] = epc + 8;
95 if ((long)regs->regs[insn.i_format.rs] >= 0)
96 epc = epc + 4 + (insn.i_format.simmediate << 2);
97 else
98 epc += 8;
99 regs->cp0_epc = epc;
100 break;
101 }
102 break;
103
104 /*
105 * These are unconditional and in j_format.
106 */
107 case jal_op:
108 regs->regs[31] = regs->cp0_epc + 8;
109 case j_op:
110 epc += 4;
111 epc >>= 28;
112 epc <<= 28;
113 epc |= (insn.j_format.target << 2);
114 regs->cp0_epc = epc;
115 break;
116
117 /*
118 * These are conditional and in i_format.
119 */
120 case beq_op:
121 case beql_op:
122 if (regs->regs[insn.i_format.rs] ==
123 regs->regs[insn.i_format.rt])
124 epc = epc + 4 + (insn.i_format.simmediate << 2);
125 else
126 epc += 8;
127 regs->cp0_epc = epc;
128 break;
129
130 case bne_op:
131 case bnel_op:
132 if (regs->regs[insn.i_format.rs] !=
133 regs->regs[insn.i_format.rt])
134 epc = epc + 4 + (insn.i_format.simmediate << 2);
135 else
136 epc += 8;
137 regs->cp0_epc = epc;
138 break;
139
140 case blez_op: /* not really i_format */
141 case blezl_op:
142 /* rt field assumed to be zero */
143 if ((long)regs->regs[insn.i_format.rs] <= 0)
144 epc = epc + 4 + (insn.i_format.simmediate << 2);
145 else
146 epc += 8;
147 regs->cp0_epc = epc;
148 break;
149
150 case bgtz_op:
151 case bgtzl_op:
152 /* rt field assumed to be zero */
153 if ((long)regs->regs[insn.i_format.rs] > 0)
154 epc = epc + 4 + (insn.i_format.simmediate << 2);
155 else
156 epc += 8;
157 regs->cp0_epc = epc;
158 break;
159
160 /*
161 * And now the FPA/cp1 branch instructions.
162 */
163 case cop1_op:
164 if (!cpu_has_fpu)
165 fcr31 = current->thread.fpu.soft.fcr31;
166 else
167 asm volatile("cfc1\t%0,$31" : "=r" (fcr31));
168 bit = (insn.i_format.rt >> 2);
169 bit += (bit != 0);
170 bit += 23;
171 switch (insn.i_format.rt) {
172 case 0: /* bc1f */
173 case 2: /* bc1fl */
174 if (~fcr31 & (1 << bit))
175 epc = epc + 4 + (insn.i_format.simmediate << 2);
176 else
177 epc += 8;
178 regs->cp0_epc = epc;
179 break;
180
181 case 1: /* bc1t */
182 case 3: /* bc1tl */
183 if (fcr31 & (1 << bit))
184 epc = epc + 4 + (insn.i_format.simmediate << 2);
185 else
186 epc += 8;
187 regs->cp0_epc = epc;
188 break;
189 }
190 break;
191 }
192
193 return 0;
194
195unaligned:
196 printk("%s: unaligned epc - sending SIGBUS.\n", current->comm);
197 force_sig(SIGBUS, current);
198 return -EFAULT;
199}
diff --git a/arch/mips/kernel/cpu-bugs64.c b/arch/mips/kernel/cpu-bugs64.c
new file mode 100644
index 000000000000..11ebe5d4c446
--- /dev/null
+++ b/arch/mips/kernel/cpu-bugs64.c
@@ -0,0 +1,321 @@
1/*
2 * Copyright (C) 2003, 2004 Maciej W. Rozycki
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/config.h>
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/ptrace.h>
13#include <linux/stddef.h>
14
15#include <asm/bugs.h>
16#include <asm/compiler.h>
17#include <asm/cpu.h>
18#include <asm/fpu.h>
19#include <asm/mipsregs.h>
20#include <asm/system.h>
21
22static inline void align_mod(const int align, const int mod)
23{
24 asm volatile(
25 ".set push\n\t"
26 ".set noreorder\n\t"
27 ".balign %0\n\t"
28 ".rept %1\n\t"
29 "nop\n\t"
30 ".endr\n\t"
31 ".set pop"
32 :
33 : "n" (align), "n" (mod));
34}
35
36static inline void mult_sh_align_mod(long *v1, long *v2, long *w,
37 const int align, const int mod)
38{
39 unsigned long flags;
40 int m1, m2;
41 long p, s, lv1, lv2, lw;
42
43 /*
44 * We want the multiply and the shift to be isolated from the
45 * rest of the code to disable gcc optimizations. Hence the
46 * asm statements that execute nothing, but make gcc not know
47 * what the values of m1, m2 and s are and what lv2 and p are
48 * used for.
49 */
50
51 local_irq_save(flags);
52 /*
53 * The following code leads to a wrong result of the first
54 * dsll32 when executed on R4000 rev. 2.2 or 3.0 (PRId
55 * 00000422 or 00000430, respectively).
56 *
57 * See "MIPS R4000PC/SC Errata, Processor Revision 2.2 and
58 * 3.0" by MIPS Technologies, Inc., errata #16 and #28 for
59 * details. I got no permission to duplicate them here,
60 * sigh... --macro
61 */
62 asm volatile(
63 ""
64 : "=r" (m1), "=r" (m2), "=r" (s)
65 : "0" (5), "1" (8), "2" (5));
66 align_mod(align, mod);
67 /*
68 * The trailing nop is needed to fullfill the two-instruction
69 * requirement between reading hi/lo and staring a mult/div.
70 * Leaving it out may cause gas insert a nop itself breaking
71 * the desired alignment of the next chunk.
72 */
73 asm volatile(
74 ".set push\n\t"
75 ".set noat\n\t"
76 ".set noreorder\n\t"
77 ".set nomacro\n\t"
78 "mult %2, %3\n\t"
79 "dsll32 %0, %4, %5\n\t"
80 "mflo $0\n\t"
81 "dsll32 %1, %4, %5\n\t"
82 "nop\n\t"
83 ".set pop"
84 : "=&r" (lv1), "=r" (lw)
85 : "r" (m1), "r" (m2), "r" (s), "I" (0)
86 : "hi", "lo", GCC_REG_ACCUM);
87 /* We have to use single integers for m1 and m2 and a double
88 * one for p to be sure the mulsidi3 gcc's RTL multiplication
89 * instruction has the workaround applied. Older versions of
90 * gcc have correct umulsi3 and mulsi3, but other
91 * multiplication variants lack the workaround.
92 */
93 asm volatile(
94 ""
95 : "=r" (m1), "=r" (m2), "=r" (s)
96 : "0" (m1), "1" (m2), "2" (s));
97 align_mod(align, mod);
98 p = m1 * m2;
99 lv2 = s << 32;
100 asm volatile(
101 ""
102 : "=r" (lv2)
103 : "0" (lv2), "r" (p));
104 local_irq_restore(flags);
105
106 *v1 = lv1;
107 *v2 = lv2;
108 *w = lw;
109}
110
111static inline void check_mult_sh(void)
112{
113 long v1[8], v2[8], w[8];
114 int bug, fix, i;
115
116 printk("Checking for the multiply/shift bug... ");
117
118 /*
119 * Testing discovered false negatives for certain code offsets
120 * into cache lines. Hence we test all possible offsets for
121 * the worst assumption of an R4000 I-cache line width of 32
122 * bytes.
123 *
124 * We can't use a loop as alignment directives need to be
125 * immediates.
126 */
127 mult_sh_align_mod(&v1[0], &v2[0], &w[0], 32, 0);
128 mult_sh_align_mod(&v1[1], &v2[1], &w[1], 32, 1);
129 mult_sh_align_mod(&v1[2], &v2[2], &w[2], 32, 2);
130 mult_sh_align_mod(&v1[3], &v2[3], &w[3], 32, 3);
131 mult_sh_align_mod(&v1[4], &v2[4], &w[4], 32, 4);
132 mult_sh_align_mod(&v1[5], &v2[5], &w[5], 32, 5);
133 mult_sh_align_mod(&v1[6], &v2[6], &w[6], 32, 6);
134 mult_sh_align_mod(&v1[7], &v2[7], &w[7], 32, 7);
135
136 bug = 0;
137 for (i = 0; i < 8; i++)
138 if (v1[i] != w[i])
139 bug = 1;
140
141 if (bug == 0) {
142 printk("no.\n");
143 return;
144 }
145
146 printk("yes, workaround... ");
147
148 fix = 1;
149 for (i = 0; i < 8; i++)
150 if (v2[i] != w[i])
151 fix = 0;
152
153 if (fix == 1) {
154 printk("yes.\n");
155 return;
156 }
157
158 printk("no.\n");
159 panic("Reliable operation impossible!\n"
160#ifndef CONFIG_CPU_R4000
161 "Configure for R4000 to enable the workaround."
162#else
163 "Please report to <linux-mips@linux-mips.org>."
164#endif
165 );
166}
167
168static volatile int daddi_ov __initdata = 0;
169
170asmlinkage void __init do_daddi_ov(struct pt_regs *regs)
171{
172 daddi_ov = 1;
173 regs->cp0_epc += 4;
174}
175
176static inline void check_daddi(void)
177{
178 extern asmlinkage void handle_daddi_ov(void);
179 unsigned long flags;
180 void *handler;
181 long v, tmp;
182
183 printk("Checking for the daddi bug... ");
184
185 local_irq_save(flags);
186 handler = set_except_vector(12, handle_daddi_ov);
187 /*
188 * The following code fails to trigger an overflow exception
189 * when executed on R4000 rev. 2.2 or 3.0 (PRId 00000422 or
190 * 00000430, respectively).
191 *
192 * See "MIPS R4000PC/SC Errata, Processor Revision 2.2 and
193 * 3.0" by MIPS Technologies, Inc., erratum #23 for details.
194 * I got no permission to duplicate it here, sigh... --macro
195 */
196 asm volatile(
197 ".set push\n\t"
198 ".set noat\n\t"
199 ".set noreorder\n\t"
200 ".set nomacro\n\t"
201 "addiu %1, $0, %2\n\t"
202 "dsrl %1, %1, 1\n\t"
203#ifdef HAVE_AS_SET_DADDI
204 ".set daddi\n\t"
205#endif
206 "daddi %0, %1, %3\n\t"
207 ".set pop"
208 : "=r" (v), "=&r" (tmp)
209 : "I" (0xffffffffffffdb9a), "I" (0x1234));
210 set_except_vector(12, handler);
211 local_irq_restore(flags);
212
213 if (daddi_ov) {
214 printk("no.\n");
215 return;
216 }
217
218 printk("yes, workaround... ");
219
220 local_irq_save(flags);
221 handler = set_except_vector(12, handle_daddi_ov);
222 asm volatile(
223 "addiu %1, $0, %2\n\t"
224 "dsrl %1, %1, 1\n\t"
225 "daddi %0, %1, %3"
226 : "=r" (v), "=&r" (tmp)
227 : "I" (0xffffffffffffdb9a), "I" (0x1234));
228 set_except_vector(12, handler);
229 local_irq_restore(flags);
230
231 if (daddi_ov) {
232 printk("yes.\n");
233 return;
234 }
235
236 printk("no.\n");
237 panic("Reliable operation impossible!\n"
238#if !defined(CONFIG_CPU_R4000) && !defined(CONFIG_CPU_R4400)
239 "Configure for R4000 or R4400 to enable the workaround."
240#else
241 "Please report to <linux-mips@linux-mips.org>."
242#endif
243 );
244}
245
246static inline void check_daddiu(void)
247{
248 long v, w, tmp;
249
250 printk("Checking for the daddiu bug... ");
251
252 /*
253 * The following code leads to a wrong result of daddiu when
254 * executed on R4400 rev. 1.0 (PRId 00000440).
255 *
256 * See "MIPS R4400PC/SC Errata, Processor Revision 1.0" by
257 * MIPS Technologies, Inc., erratum #7 for details.
258 *
259 * According to "MIPS R4000PC/SC Errata, Processor Revision
260 * 2.2 and 3.0" by MIPS Technologies, Inc., erratum #41 this
261 * problem affects R4000 rev. 2.2 and 3.0 (PRId 00000422 and
262 * 00000430, respectively), too. Testing failed to trigger it
263 * so far.
264 *
265 * I got no permission to duplicate the errata here, sigh...
266 * --macro
267 */
268 asm volatile(
269 ".set push\n\t"
270 ".set noat\n\t"
271 ".set noreorder\n\t"
272 ".set nomacro\n\t"
273 "addiu %2, $0, %3\n\t"
274 "dsrl %2, %2, 1\n\t"
275#ifdef HAVE_AS_SET_DADDI
276 ".set daddi\n\t"
277#endif
278 "daddiu %0, %2, %4\n\t"
279 "addiu %1, $0, %4\n\t"
280 "daddu %1, %2\n\t"
281 ".set pop"
282 : "=&r" (v), "=&r" (w), "=&r" (tmp)
283 : "I" (0xffffffffffffdb9a), "I" (0x1234));
284
285 if (v == w) {
286 printk("no.\n");
287 return;
288 }
289
290 printk("yes, workaround... ");
291
292 asm volatile(
293 "addiu %2, $0, %3\n\t"
294 "dsrl %2, %2, 1\n\t"
295 "daddiu %0, %2, %4\n\t"
296 "addiu %1, $0, %4\n\t"
297 "daddu %1, %2"
298 : "=&r" (v), "=&r" (w), "=&r" (tmp)
299 : "I" (0xffffffffffffdb9a), "I" (0x1234));
300
301 if (v == w) {
302 printk("yes.\n");
303 return;
304 }
305
306 printk("no.\n");
307 panic("Reliable operation impossible!\n"
308#if !defined(CONFIG_CPU_R4000) && !defined(CONFIG_CPU_R4400)
309 "Configure for R4000 or R4400 to enable the workaround."
310#else
311 "Please report to <linux-mips@linux-mips.org>."
312#endif
313 );
314}
315
316void __init check_bugs64(void)
317{
318 check_mult_sh();
319 check_daddi();
320 check_daddiu();
321}
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
new file mode 100644
index 000000000000..4bb849582314
--- /dev/null
+++ b/arch/mips/kernel/cpu-probe.c
@@ -0,0 +1,598 @@
1/*
2 * Processor capabilities determination functions.
3 *
4 * Copyright (C) xxxx the Anonymous
5 * Copyright (C) 2003 Maciej W. Rozycki
6 * Copyright (C) 1994 - 2003 Ralf Baechle
7 * Copyright (C) 2001 MIPS Inc.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/ptrace.h>
18#include <linux/stddef.h>
19
20#include <asm/bugs.h>
21#include <asm/cpu.h>
22#include <asm/fpu.h>
23#include <asm/mipsregs.h>
24#include <asm/system.h>
25
26/*
27 * Not all of the MIPS CPUs have the "wait" instruction available. Moreover,
28 * the implementation of the "wait" feature differs between CPU families. This
29 * points to the function that implements CPU specific wait.
30 * The wait instruction stops the pipeline and reduces the power consumption of
31 * the CPU very much.
32 */
33void (*cpu_wait)(void) = NULL;
34
35static void r3081_wait(void)
36{
37 unsigned long cfg = read_c0_conf();
38 write_c0_conf(cfg | R30XX_CONF_HALT);
39}
40
41static void r39xx_wait(void)
42{
43 unsigned long cfg = read_c0_conf();
44 write_c0_conf(cfg | TX39_CONF_HALT);
45}
46
47static void r4k_wait(void)
48{
49 __asm__(".set\tmips3\n\t"
50 "wait\n\t"
51 ".set\tmips0");
52}
53
54/*
55 * The Au1xxx wait is available only if we run CONFIG_PM and
56 * the timer setup found we had a 32KHz counter available.
57 * There are still problems with functions that may call au1k_wait
58 * directly, but that will be discovered pretty quickly.
59 */
60extern void (*au1k_wait_ptr)(void);
61
62void au1k_wait(void)
63{
64#ifdef CONFIG_PM
65 /* using the wait instruction makes CP0 counter unusable */
66 __asm__(".set\tmips3\n\t"
67 "wait\n\t"
68 "nop\n\t"
69 "nop\n\t"
70 "nop\n\t"
71 "nop\n\t"
72 ".set\tmips0");
73#else
74 __asm__("nop\n\t"
75 "nop");
76#endif
77}
78
79static inline void check_wait(void)
80{
81 struct cpuinfo_mips *c = &current_cpu_data;
82
83 printk("Checking for 'wait' instruction... ");
84 switch (c->cputype) {
85 case CPU_R3081:
86 case CPU_R3081E:
87 cpu_wait = r3081_wait;
88 printk(" available.\n");
89 break;
90 case CPU_TX3927:
91 cpu_wait = r39xx_wait;
92 printk(" available.\n");
93 break;
94 case CPU_R4200:
95/* case CPU_R4300: */
96 case CPU_R4600:
97 case CPU_R4640:
98 case CPU_R4650:
99 case CPU_R4700:
100 case CPU_R5000:
101 case CPU_NEVADA:
102 case CPU_RM7000:
103 case CPU_RM9000:
104 case CPU_TX49XX:
105 case CPU_4KC:
106 case CPU_4KEC:
107 case CPU_4KSC:
108 case CPU_5KC:
109/* case CPU_20KC:*/
110 case CPU_24K:
111 case CPU_25KF:
112 cpu_wait = r4k_wait;
113 printk(" available.\n");
114 break;
115#ifdef CONFIG_PM
116 case CPU_AU1000:
117 case CPU_AU1100:
118 case CPU_AU1500:
119 if (au1k_wait_ptr != NULL) {
120 cpu_wait = au1k_wait_ptr;
121 printk(" available.\n");
122 }
123 else {
124 printk(" unavailable.\n");
125 }
126 break;
127#endif
128 default:
129 printk(" unavailable.\n");
130 break;
131 }
132}
133
134void __init check_bugs32(void)
135{
136 check_wait();
137}
138
139/*
140 * Probe whether cpu has config register by trying to play with
141 * alternate cache bit and see whether it matters.
142 * It's used by cpu_probe to distinguish between R3000A and R3081.
143 */
144static inline int cpu_has_confreg(void)
145{
146#ifdef CONFIG_CPU_R3000
147 extern unsigned long r3k_cache_size(unsigned long);
148 unsigned long size1, size2;
149 unsigned long cfg = read_c0_conf();
150
151 size1 = r3k_cache_size(ST0_ISC);
152 write_c0_conf(cfg ^ R30XX_CONF_AC);
153 size2 = r3k_cache_size(ST0_ISC);
154 write_c0_conf(cfg);
155 return size1 != size2;
156#else
157 return 0;
158#endif
159}
160
161/*
162 * Get the FPU Implementation/Revision.
163 */
164static inline unsigned long cpu_get_fpu_id(void)
165{
166 unsigned long tmp, fpu_id;
167
168 tmp = read_c0_status();
169 __enable_fpu();
170 fpu_id = read_32bit_cp1_register(CP1_REVISION);
171 write_c0_status(tmp);
172 return fpu_id;
173}
174
175/*
176 * Check the CPU has an FPU the official way.
177 */
178static inline int __cpu_has_fpu(void)
179{
180 return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE);
181}
182
183#define R4K_OPTS (MIPS_CPU_TLB | MIPS_CPU_4KEX | MIPS_CPU_4KTLB \
184 | MIPS_CPU_COUNTER)
185
186static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
187{
188 switch (c->processor_id & 0xff00) {
189 case PRID_IMP_R2000:
190 c->cputype = CPU_R2000;
191 c->isa_level = MIPS_CPU_ISA_I;
192 c->options = MIPS_CPU_TLB | MIPS_CPU_NOFPUEX;
193 if (__cpu_has_fpu())
194 c->options |= MIPS_CPU_FPU;
195 c->tlbsize = 64;
196 break;
197 case PRID_IMP_R3000:
198 if ((c->processor_id & 0xff) == PRID_REV_R3000A)
199 if (cpu_has_confreg())
200 c->cputype = CPU_R3081E;
201 else
202 c->cputype = CPU_R3000A;
203 else
204 c->cputype = CPU_R3000;
205 c->isa_level = MIPS_CPU_ISA_I;
206 c->options = MIPS_CPU_TLB | MIPS_CPU_NOFPUEX;
207 if (__cpu_has_fpu())
208 c->options |= MIPS_CPU_FPU;
209 c->tlbsize = 64;
210 break;
211 case PRID_IMP_R4000:
212 if (read_c0_config() & CONF_SC) {
213 if ((c->processor_id & 0xff) >= PRID_REV_R4400)
214 c->cputype = CPU_R4400PC;
215 else
216 c->cputype = CPU_R4000PC;
217 } else {
218 if ((c->processor_id & 0xff) >= PRID_REV_R4400)
219 c->cputype = CPU_R4400SC;
220 else
221 c->cputype = CPU_R4000SC;
222 }
223
224 c->isa_level = MIPS_CPU_ISA_III;
225 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
226 MIPS_CPU_WATCH | MIPS_CPU_VCE |
227 MIPS_CPU_LLSC;
228 c->tlbsize = 48;
229 break;
230 case PRID_IMP_VR41XX:
231 switch (c->processor_id & 0xf0) {
232#ifndef CONFIG_VR4181
233 case PRID_REV_VR4111:
234 c->cputype = CPU_VR4111;
235 break;
236#else
237 case PRID_REV_VR4181:
238 c->cputype = CPU_VR4181;
239 break;
240#endif
241 case PRID_REV_VR4121:
242 c->cputype = CPU_VR4121;
243 break;
244 case PRID_REV_VR4122:
245 if ((c->processor_id & 0xf) < 0x3)
246 c->cputype = CPU_VR4122;
247 else
248 c->cputype = CPU_VR4181A;
249 break;
250 case PRID_REV_VR4130:
251 if ((c->processor_id & 0xf) < 0x4)
252 c->cputype = CPU_VR4131;
253 else
254 c->cputype = CPU_VR4133;
255 break;
256 default:
257 printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
258 c->cputype = CPU_VR41XX;
259 break;
260 }
261 c->isa_level = MIPS_CPU_ISA_III;
262 c->options = R4K_OPTS;
263 c->tlbsize = 32;
264 break;
265 case PRID_IMP_R4300:
266 c->cputype = CPU_R4300;
267 c->isa_level = MIPS_CPU_ISA_III;
268 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
269 MIPS_CPU_LLSC;
270 c->tlbsize = 32;
271 break;
272 case PRID_IMP_R4600:
273 c->cputype = CPU_R4600;
274 c->isa_level = MIPS_CPU_ISA_III;
275 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
276 c->tlbsize = 48;
277 break;
278 #if 0
279 case PRID_IMP_R4650:
280 /*
281 * This processor doesn't have an MMU, so it's not
282 * "real easy" to run Linux on it. It is left purely
283 * for documentation. Commented out because it shares
284 * it's c0_prid id number with the TX3900.
285 */
286 c->cputype = CPU_R4650;
287 c->isa_level = MIPS_CPU_ISA_III;
288 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC;
289 c->tlbsize = 48;
290 break;
291 #endif
292 case PRID_IMP_TX39:
293 c->isa_level = MIPS_CPU_ISA_I;
294 c->options = MIPS_CPU_TLB;
295
296 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
297 c->cputype = CPU_TX3927;
298 c->tlbsize = 64;
299 } else {
300 switch (c->processor_id & 0xff) {
301 case PRID_REV_TX3912:
302 c->cputype = CPU_TX3912;
303 c->tlbsize = 32;
304 break;
305 case PRID_REV_TX3922:
306 c->cputype = CPU_TX3922;
307 c->tlbsize = 64;
308 break;
309 default:
310 c->cputype = CPU_UNKNOWN;
311 break;
312 }
313 }
314 break;
315 case PRID_IMP_R4700:
316 c->cputype = CPU_R4700;
317 c->isa_level = MIPS_CPU_ISA_III;
318 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
319 MIPS_CPU_LLSC;
320 c->tlbsize = 48;
321 break;
322 case PRID_IMP_TX49:
323 c->cputype = CPU_TX49XX;
324 c->isa_level = MIPS_CPU_ISA_III;
325 c->options = R4K_OPTS | MIPS_CPU_LLSC;
326 if (!(c->processor_id & 0x08))
327 c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR;
328 c->tlbsize = 48;
329 break;
330 case PRID_IMP_R5000:
331 c->cputype = CPU_R5000;
332 c->isa_level = MIPS_CPU_ISA_IV;
333 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
334 MIPS_CPU_LLSC;
335 c->tlbsize = 48;
336 break;
337 case PRID_IMP_R5432:
338 c->cputype = CPU_R5432;
339 c->isa_level = MIPS_CPU_ISA_IV;
340 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
341 MIPS_CPU_WATCH | MIPS_CPU_LLSC;
342 c->tlbsize = 48;
343 break;
344 case PRID_IMP_R5500:
345 c->cputype = CPU_R5500;
346 c->isa_level = MIPS_CPU_ISA_IV;
347 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
348 MIPS_CPU_WATCH | MIPS_CPU_LLSC;
349 c->tlbsize = 48;
350 break;
351 case PRID_IMP_NEVADA:
352 c->cputype = CPU_NEVADA;
353 c->isa_level = MIPS_CPU_ISA_IV;
354 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
355 MIPS_CPU_DIVEC | MIPS_CPU_LLSC;
356 c->tlbsize = 48;
357 break;
358 case PRID_IMP_R6000:
359 c->cputype = CPU_R6000;
360 c->isa_level = MIPS_CPU_ISA_II;
361 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
362 MIPS_CPU_LLSC;
363 c->tlbsize = 32;
364 break;
365 case PRID_IMP_R6000A:
366 c->cputype = CPU_R6000A;
367 c->isa_level = MIPS_CPU_ISA_II;
368 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU |
369 MIPS_CPU_LLSC;
370 c->tlbsize = 32;
371 break;
372 case PRID_IMP_RM7000:
373 c->cputype = CPU_RM7000;
374 c->isa_level = MIPS_CPU_ISA_IV;
375 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
376 MIPS_CPU_LLSC;
377 /*
378 * Undocumented RM7000: Bit 29 in the info register of
379 * the RM7000 v2.0 indicates if the TLB has 48 or 64
380 * entries.
381 *
382 * 29 1 => 64 entry JTLB
383 * 0 => 48 entry JTLB
384 */
385 c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
386 break;
387 case PRID_IMP_RM9000:
388 c->cputype = CPU_RM9000;
389 c->isa_level = MIPS_CPU_ISA_IV;
390 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR |
391 MIPS_CPU_LLSC;
392 /*
393 * Bit 29 in the info register of the RM9000
394 * indicates if the TLB has 48 or 64 entries.
395 *
396 * 29 1 => 64 entry JTLB
397 * 0 => 48 entry JTLB
398 */
399 c->tlbsize = (read_c0_info() & (1 << 29)) ? 64 : 48;
400 break;
401 case PRID_IMP_R8000:
402 c->cputype = CPU_R8000;
403 c->isa_level = MIPS_CPU_ISA_IV;
404 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
405 MIPS_CPU_FPU | MIPS_CPU_32FPR |
406 MIPS_CPU_LLSC;
407 c->tlbsize = 384; /* has weird TLB: 3-way x 128 */
408 break;
409 case PRID_IMP_R10000:
410 c->cputype = CPU_R10000;
411 c->isa_level = MIPS_CPU_ISA_IV;
412 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
413 MIPS_CPU_FPU | MIPS_CPU_32FPR |
414 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
415 MIPS_CPU_LLSC;
416 c->tlbsize = 64;
417 break;
418 case PRID_IMP_R12000:
419 c->cputype = CPU_R12000;
420 c->isa_level = MIPS_CPU_ISA_IV;
421 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
422 MIPS_CPU_FPU | MIPS_CPU_32FPR |
423 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
424 MIPS_CPU_LLSC;
425 c->tlbsize = 64;
426 break;
427 }
428}
429
430static inline void decode_config1(struct cpuinfo_mips *c)
431{
432 unsigned long config0 = read_c0_config();
433 unsigned long config1;
434
435 if ((config0 & (1 << 31)) == 0)
436 return; /* actually wort a panic() */
437
438 /* MIPS32 or MIPS64 compliant CPU. Read Config 1 register. */
439 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
440 MIPS_CPU_4KTLB | MIPS_CPU_COUNTER | MIPS_CPU_DIVEC |
441 MIPS_CPU_LLSC | MIPS_CPU_MCHECK;
442 config1 = read_c0_config1();
443 if (config1 & (1 << 3))
444 c->options |= MIPS_CPU_WATCH;
445 if (config1 & (1 << 2))
446 c->options |= MIPS_CPU_MIPS16;
447 if (config1 & (1 << 1))
448 c->options |= MIPS_CPU_EJTAG;
449 if (config1 & 1) {
450 c->options |= MIPS_CPU_FPU;
451 c->options |= MIPS_CPU_32FPR;
452 }
453 c->scache.flags = MIPS_CACHE_NOT_PRESENT;
454
455 c->tlbsize = ((config1 >> 25) & 0x3f) + 1;
456}
457
458static inline void cpu_probe_mips(struct cpuinfo_mips *c)
459{
460 decode_config1(c);
461 switch (c->processor_id & 0xff00) {
462 case PRID_IMP_4KC:
463 c->cputype = CPU_4KC;
464 c->isa_level = MIPS_CPU_ISA_M32;
465 break;
466 case PRID_IMP_4KEC:
467 c->cputype = CPU_4KEC;
468 c->isa_level = MIPS_CPU_ISA_M32;
469 break;
470 case PRID_IMP_4KSC:
471 c->cputype = CPU_4KSC;
472 c->isa_level = MIPS_CPU_ISA_M32;
473 break;
474 case PRID_IMP_5KC:
475 c->cputype = CPU_5KC;
476 c->isa_level = MIPS_CPU_ISA_M64;
477 break;
478 case PRID_IMP_20KC:
479 c->cputype = CPU_20KC;
480 c->isa_level = MIPS_CPU_ISA_M64;
481 break;
482 case PRID_IMP_24K:
483 c->cputype = CPU_24K;
484 c->isa_level = MIPS_CPU_ISA_M32;
485 break;
486 case PRID_IMP_25KF:
487 c->cputype = CPU_25KF;
488 c->isa_level = MIPS_CPU_ISA_M64;
489 /* Probe for L2 cache */
490 c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
491 break;
492 }
493}
494
495static inline void cpu_probe_alchemy(struct cpuinfo_mips *c)
496{
497 decode_config1(c);
498 switch (c->processor_id & 0xff00) {
499 case PRID_IMP_AU1_REV1:
500 case PRID_IMP_AU1_REV2:
501 switch ((c->processor_id >> 24) & 0xff) {
502 case 0:
503 c->cputype = CPU_AU1000;
504 break;
505 case 1:
506 c->cputype = CPU_AU1500;
507 break;
508 case 2:
509 c->cputype = CPU_AU1100;
510 break;
511 case 3:
512 c->cputype = CPU_AU1550;
513 break;
514 default:
515 panic("Unknown Au Core!");
516 break;
517 }
518 c->isa_level = MIPS_CPU_ISA_M32;
519 break;
520 }
521}
522
523static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
524{
525 decode_config1(c);
526 switch (c->processor_id & 0xff00) {
527 case PRID_IMP_SB1:
528 c->cputype = CPU_SB1;
529 c->isa_level = MIPS_CPU_ISA_M64;
530 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
531 MIPS_CPU_COUNTER | MIPS_CPU_DIVEC |
532 MIPS_CPU_MCHECK | MIPS_CPU_EJTAG |
533 MIPS_CPU_WATCH | MIPS_CPU_LLSC;
534#ifndef CONFIG_SB1_PASS_1_WORKAROUNDS
535 /* FPU in pass1 is known to have issues. */
536 c->options |= MIPS_CPU_FPU | MIPS_CPU_32FPR;
537#endif
538 break;
539 }
540}
541
542static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
543{
544 decode_config1(c);
545 switch (c->processor_id & 0xff00) {
546 case PRID_IMP_SR71000:
547 c->cputype = CPU_SR71000;
548 c->isa_level = MIPS_CPU_ISA_M64;
549 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
550 MIPS_CPU_4KTLB | MIPS_CPU_FPU |
551 MIPS_CPU_COUNTER | MIPS_CPU_MCHECK;
552 c->scache.ways = 8;
553 c->tlbsize = 64;
554 break;
555 }
556}
557
558__init void cpu_probe(void)
559{
560 struct cpuinfo_mips *c = &current_cpu_data;
561
562 c->processor_id = PRID_IMP_UNKNOWN;
563 c->fpu_id = FPIR_IMP_NONE;
564 c->cputype = CPU_UNKNOWN;
565
566 c->processor_id = read_c0_prid();
567 switch (c->processor_id & 0xff0000) {
568 case PRID_COMP_LEGACY:
569 cpu_probe_legacy(c);
570 break;
571 case PRID_COMP_MIPS:
572 cpu_probe_mips(c);
573 break;
574 case PRID_COMP_ALCHEMY:
575 cpu_probe_alchemy(c);
576 break;
577 case PRID_COMP_SIBYTE:
578 cpu_probe_sibyte(c);
579 break;
580
581 case PRID_COMP_SANDCRAFT:
582 cpu_probe_sandcraft(c);
583 break;
584 default:
585 c->cputype = CPU_UNKNOWN;
586 }
587 if (c->options & MIPS_CPU_FPU)
588 c->fpu_id = cpu_get_fpu_id();
589}
590
591__init void cpu_report(void)
592{
593 struct cpuinfo_mips *c = &current_cpu_data;
594
595 printk("CPU revision is: %08x\n", c->processor_id);
596 if (c->options & MIPS_CPU_FPU)
597 printk("FPU revision is: %08x\n", c->fpu_id);
598}
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S
new file mode 100644
index 000000000000..5eb429137e06
--- /dev/null
+++ b/arch/mips/kernel/entry.S
@@ -0,0 +1,155 @@
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) 1994 - 2000, 2001, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#include <linux/config.h>
11
12#include <asm/asm.h>
13#include <asm/asmmacro.h>
14#include <asm/regdef.h>
15#include <asm/mipsregs.h>
16#include <asm/stackframe.h>
17#include <asm/isadep.h>
18#include <asm/thread_info.h>
19#include <asm/war.h>
20
21#ifdef CONFIG_PREEMPT
22 .macro preempt_stop reg=t0
23 .endm
24#else
25 .macro preempt_stop reg=t0
26 local_irq_disable \reg
27 .endm
28#define resume_kernel restore_all
29#endif
30
31 .text
32 .align 5
33FEXPORT(ret_from_exception)
34 preempt_stop
35FEXPORT(ret_from_irq)
36 LONG_L t0, PT_STATUS(sp) # returning to kernel mode?
37 andi t0, t0, KU_USER
38 beqz t0, resume_kernel
39
40FEXPORT(resume_userspace)
41 local_irq_disable t0 # make sure we dont miss an
42 # interrupt setting need_resched
43 # between sampling and return
44 LONG_L a2, TI_FLAGS($28) # current->work
45 andi a2, _TIF_WORK_MASK # (ignoring syscall_trace)
46 bnez a2, work_pending
47 j restore_all
48
49#ifdef CONFIG_PREEMPT
50ENTRY(resume_kernel)
51 lw t0, TI_PRE_COUNT($28)
52 bnez t0, restore_all
53need_resched:
54 LONG_L t0, TI_FLAGS($28)
55 andi t1, t0, _TIF_NEED_RESCHED
56 beqz t1, restore_all
57 LONG_L t0, PT_STATUS(sp) # Interrupts off?
58 andi t0, 1
59 beqz t0, restore_all
60 li t0, PREEMPT_ACTIVE
61 sw t0, TI_PRE_COUNT($28)
62 local_irq_enable t0
63 jal schedule
64 sw zero, TI_PRE_COUNT($28)
65 local_irq_disable t0
66 b need_resched
67#endif
68
69FEXPORT(ret_from_fork)
70 jal schedule_tail # a0 = task_t *prev
71
72FEXPORT(syscall_exit)
73 local_irq_disable # make sure need_resched and
74 # signals dont change between
75 # sampling and return
76 LONG_L a2, TI_FLAGS($28) # current->work
77 li t0, _TIF_ALLWORK_MASK
78 and t0, a2, t0
79 bnez t0, syscall_exit_work
80
81FEXPORT(restore_all) # restore full frame
82 .set noat
83 RESTORE_TEMP
84 RESTORE_AT
85 RESTORE_STATIC
86FEXPORT(restore_partial) # restore partial frame
87 RESTORE_SOME
88 RESTORE_SP_AND_RET
89 .set at
90
91FEXPORT(work_pending)
92 andi t0, a2, _TIF_NEED_RESCHED
93 beqz t0, work_notifysig
94work_resched:
95 jal schedule
96
97 local_irq_disable t0 # make sure need_resched and
98 # signals dont change between
99 # sampling and return
100 LONG_L a2, TI_FLAGS($28)
101 andi t0, a2, _TIF_WORK_MASK # is there any work to be done
102 # other than syscall tracing?
103 beqz t0, restore_all
104 andi t0, a2, _TIF_NEED_RESCHED
105 bnez t0, work_resched
106
107work_notifysig: # deal with pending signals and
108 # notify-resume requests
109 move a0, sp
110 li a1, 0
111 jal do_notify_resume # a2 already loaded
112 j restore_all
113
114FEXPORT(syscall_exit_work_partial)
115 SAVE_STATIC
116FEXPORT(syscall_exit_work)
117 LONG_L t0, TI_FLAGS($28)
118 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
119 and t0, t1
120 beqz t0, work_pending # trace bit is set
121 local_irq_enable # could let do_syscall_trace()
122 # call schedule() instead
123 move a0, sp
124 li a1, 1
125 jal do_syscall_trace
126 b resume_userspace
127
128/*
129 * Common spurious interrupt handler.
130 */
131 .text
132 .align 5
133LEAF(spurious_interrupt)
134 /*
135 * Someone tried to fool us by sending an interrupt but we
136 * couldn't find a cause for it.
137 */
138#ifdef CONFIG_SMP
139 lui t1, %hi(irq_err_count)
1401: ll t0, %lo(irq_err_count)(t1)
141 addiu t0, 1
142 sc t0, %lo(irq_err_count)(t1)
143#if R10000_LLSC_WAR
144 beqzl t0, 1b
145#else
146 beqz t0, 1b
147#endif
148#else
149 lui t1, %hi(irq_err_count)
150 lw t0, %lo(irq_err_count)(t1)
151 addiu t0, 1
152 sw t0, %lo(irq_err_count)(t1)
153#endif
154 j ret_from_irq
155 END(spurious_interrupt)
diff --git a/arch/mips/kernel/gdb-low.S b/arch/mips/kernel/gdb-low.S
new file mode 100644
index 000000000000..ece6ddaf7011
--- /dev/null
+++ b/arch/mips/kernel/gdb-low.S
@@ -0,0 +1,370 @@
1/*
2 * gdb-low.S contains the low-level trap handler for the GDB stub.
3 *
4 * Copyright (C) 1995 Andreas Busse
5 */
6#include <linux/config.h>
7#include <linux/sys.h>
8
9#include <asm/asm.h>
10#include <asm/errno.h>
11#include <asm/mipsregs.h>
12#include <asm/regdef.h>
13#include <asm/stackframe.h>
14#include <asm/gdb-stub.h>
15
16#ifdef CONFIG_MIPS32
17#define DMFC0 mfc0
18#define DMTC0 mtc0
19#define LDC1 lwc1
20#define SDC1 lwc1
21#endif
22#ifdef CONFIG_MIPS64
23#define DMFC0 dmfc0
24#define DMTC0 dmtc0
25#define LDC1 ldc1
26#define SDC1 ldc1
27#endif
28
29/*
30 * [jsun] We reserves about 2x GDB_FR_SIZE in stack. The lower (addressed)
31 * part is used to store registers and passed to exception handler.
32 * The upper part is reserved for "call func" feature where gdb client
33 * saves some of the regs, setups call frame and passes args.
34 *
35 * A trace shows about 200 bytes are used to store about half of all regs.
36 * The rest should be big enough for frame setup and passing args.
37 */
38
39/*
40 * The low level trap handler
41 */
42 .align 5
43 NESTED(trap_low, GDB_FR_SIZE, sp)
44 .set noat
45 .set noreorder
46
47 mfc0 k0, CP0_STATUS
48 sll k0, 3 /* extract cu0 bit */
49 bltz k0, 1f
50 move k1, sp
51
52 /*
53 * Called from user mode, go somewhere else.
54 */
55 lui k1, %hi(saved_vectors)
56 mfc0 k0, CP0_CAUSE
57 andi k0, k0, 0x7c
58 add k1, k1, k0
59 lw k0, %lo(saved_vectors)(k1)
60 jr k0
61 nop
621:
63 move k0, sp
64 subu sp, k1, GDB_FR_SIZE*2 # see comment above
65 LONG_S k0, GDB_FR_REG29(sp)
66 LONG_S $2, GDB_FR_REG2(sp)
67
68/*
69 * First save the CP0 and special registers
70 */
71
72 mfc0 v0, CP0_STATUS
73 LONG_S v0, GDB_FR_STATUS(sp)
74 mfc0 v0, CP0_CAUSE
75 LONG_S v0, GDB_FR_CAUSE(sp)
76 DMFC0 v0, CP0_EPC
77 LONG_S v0, GDB_FR_EPC(sp)
78 DMFC0 v0, CP0_BADVADDR
79 LONG_S v0, GDB_FR_BADVADDR(sp)
80 mfhi v0
81 LONG_S v0, GDB_FR_HI(sp)
82 mflo v0
83 LONG_S v0, GDB_FR_LO(sp)
84
85/*
86 * Now the integer registers
87 */
88
89 LONG_S zero, GDB_FR_REG0(sp) /* I know... */
90 LONG_S $1, GDB_FR_REG1(sp)
91 /* v0 already saved */
92 LONG_S $3, GDB_FR_REG3(sp)
93 LONG_S $4, GDB_FR_REG4(sp)
94 LONG_S $5, GDB_FR_REG5(sp)
95 LONG_S $6, GDB_FR_REG6(sp)
96 LONG_S $7, GDB_FR_REG7(sp)
97 LONG_S $8, GDB_FR_REG8(sp)
98 LONG_S $9, GDB_FR_REG9(sp)
99 LONG_S $10, GDB_FR_REG10(sp)
100 LONG_S $11, GDB_FR_REG11(sp)
101 LONG_S $12, GDB_FR_REG12(sp)
102 LONG_S $13, GDB_FR_REG13(sp)
103 LONG_S $14, GDB_FR_REG14(sp)
104 LONG_S $15, GDB_FR_REG15(sp)
105 LONG_S $16, GDB_FR_REG16(sp)
106 LONG_S $17, GDB_FR_REG17(sp)
107 LONG_S $18, GDB_FR_REG18(sp)
108 LONG_S $19, GDB_FR_REG19(sp)
109 LONG_S $20, GDB_FR_REG20(sp)
110 LONG_S $21, GDB_FR_REG21(sp)
111 LONG_S $22, GDB_FR_REG22(sp)
112 LONG_S $23, GDB_FR_REG23(sp)
113 LONG_S $24, GDB_FR_REG24(sp)
114 LONG_S $25, GDB_FR_REG25(sp)
115 LONG_S $26, GDB_FR_REG26(sp)
116 LONG_S $27, GDB_FR_REG27(sp)
117 LONG_S $28, GDB_FR_REG28(sp)
118 /* sp already saved */
119 LONG_S $30, GDB_FR_REG30(sp)
120 LONG_S $31, GDB_FR_REG31(sp)
121
122 CLI /* disable interrupts */
123
124/*
125 * Followed by the floating point registers
126 */
127 mfc0 v0, CP0_STATUS /* FPU enabled? */
128 srl v0, v0, 16
129 andi v0, v0, (ST0_CU1 >> 16)
130
131 beqz v0,2f /* disabled, skip */
132 nop
133
134 SDC1 $0, GDB_FR_FPR0(sp)
135 SDC1 $1, GDB_FR_FPR1(sp)
136 SDC1 $2, GDB_FR_FPR2(sp)
137 SDC1 $3, GDB_FR_FPR3(sp)
138 SDC1 $4, GDB_FR_FPR4(sp)
139 SDC1 $5, GDB_FR_FPR5(sp)
140 SDC1 $6, GDB_FR_FPR6(sp)
141 SDC1 $7, GDB_FR_FPR7(sp)
142 SDC1 $8, GDB_FR_FPR8(sp)
143 SDC1 $9, GDB_FR_FPR9(sp)
144 SDC1 $10, GDB_FR_FPR10(sp)
145 SDC1 $11, GDB_FR_FPR11(sp)
146 SDC1 $12, GDB_FR_FPR12(sp)
147 SDC1 $13, GDB_FR_FPR13(sp)
148 SDC1 $14, GDB_FR_FPR14(sp)
149 SDC1 $15, GDB_FR_FPR15(sp)
150 SDC1 $16, GDB_FR_FPR16(sp)
151 SDC1 $17, GDB_FR_FPR17(sp)
152 SDC1 $18, GDB_FR_FPR18(sp)
153 SDC1 $19, GDB_FR_FPR19(sp)
154 SDC1 $20, GDB_FR_FPR20(sp)
155 SDC1 $21, GDB_FR_FPR21(sp)
156 SDC1 $22, GDB_FR_FPR22(sp)
157 SDC1 $23, GDB_FR_FPR23(sp)
158 SDC1 $24, GDB_FR_FPR24(sp)
159 SDC1 $25, GDB_FR_FPR25(sp)
160 SDC1 $26, GDB_FR_FPR26(sp)
161 SDC1 $27, GDB_FR_FPR27(sp)
162 SDC1 $28, GDB_FR_FPR28(sp)
163 SDC1 $29, GDB_FR_FPR29(sp)
164 SDC1 $30, GDB_FR_FPR30(sp)
165 SDC1 $31, GDB_FR_FPR31(sp)
166
167/*
168 * FPU control registers
169 */
170
171 cfc1 v0, CP1_STATUS
172 LONG_S v0, GDB_FR_FSR(sp)
173 cfc1 v0, CP1_REVISION
174 LONG_S v0, GDB_FR_FIR(sp)
175
176/*
177 * Current stack frame ptr
178 */
179
1802:
181 LONG_S sp, GDB_FR_FRP(sp)
182
183/*
184 * CP0 registers (R4000/R4400 unused registers skipped)
185 */
186
187 mfc0 v0, CP0_INDEX
188 LONG_S v0, GDB_FR_CP0_INDEX(sp)
189 mfc0 v0, CP0_RANDOM
190 LONG_S v0, GDB_FR_CP0_RANDOM(sp)
191 DMFC0 v0, CP0_ENTRYLO0
192 LONG_S v0, GDB_FR_CP0_ENTRYLO0(sp)
193 DMFC0 v0, CP0_ENTRYLO1
194 LONG_S v0, GDB_FR_CP0_ENTRYLO1(sp)
195 DMFC0 v0, CP0_CONTEXT
196 LONG_S v0, GDB_FR_CP0_CONTEXT(sp)
197 mfc0 v0, CP0_PAGEMASK
198 LONG_S v0, GDB_FR_CP0_PAGEMASK(sp)
199 mfc0 v0, CP0_WIRED
200 LONG_S v0, GDB_FR_CP0_WIRED(sp)
201 DMFC0 v0, CP0_ENTRYHI
202 LONG_S v0, GDB_FR_CP0_ENTRYHI(sp)
203 mfc0 v0, CP0_PRID
204 LONG_S v0, GDB_FR_CP0_PRID(sp)
205
206 .set at
207
208/*
209 * Continue with the higher level handler
210 */
211
212 move a0,sp
213
214 jal handle_exception
215 nop
216
217/*
218 * Restore all writable registers, in reverse order
219 */
220
221 .set noat
222
223 LONG_L v0, GDB_FR_CP0_ENTRYHI(sp)
224 LONG_L v1, GDB_FR_CP0_WIRED(sp)
225 DMTC0 v0, CP0_ENTRYHI
226 mtc0 v1, CP0_WIRED
227 LONG_L v0, GDB_FR_CP0_PAGEMASK(sp)
228 LONG_L v1, GDB_FR_CP0_ENTRYLO1(sp)
229 mtc0 v0, CP0_PAGEMASK
230 DMTC0 v1, CP0_ENTRYLO1
231 LONG_L v0, GDB_FR_CP0_ENTRYLO0(sp)
232 LONG_L v1, GDB_FR_CP0_INDEX(sp)
233 DMTC0 v0, CP0_ENTRYLO0
234 LONG_L v0, GDB_FR_CP0_CONTEXT(sp)
235 mtc0 v1, CP0_INDEX
236 DMTC0 v0, CP0_CONTEXT
237
238
239/*
240 * Next, the floating point registers
241 */
242 mfc0 v0, CP0_STATUS /* check if the FPU is enabled */
243 srl v0, v0, 16
244 andi v0, v0, (ST0_CU1 >> 16)
245
246 beqz v0, 3f /* disabled, skip */
247 nop
248
249 LDC1 $31, GDB_FR_FPR31(sp)
250 LDC1 $30, GDB_FR_FPR30(sp)
251 LDC1 $29, GDB_FR_FPR29(sp)
252 LDC1 $28, GDB_FR_FPR28(sp)
253 LDC1 $27, GDB_FR_FPR27(sp)
254 LDC1 $26, GDB_FR_FPR26(sp)
255 LDC1 $25, GDB_FR_FPR25(sp)
256 LDC1 $24, GDB_FR_FPR24(sp)
257 LDC1 $23, GDB_FR_FPR23(sp)
258 LDC1 $22, GDB_FR_FPR22(sp)
259 LDC1 $21, GDB_FR_FPR21(sp)
260 LDC1 $20, GDB_FR_FPR20(sp)
261 LDC1 $19, GDB_FR_FPR19(sp)
262 LDC1 $18, GDB_FR_FPR18(sp)
263 LDC1 $17, GDB_FR_FPR17(sp)
264 LDC1 $16, GDB_FR_FPR16(sp)
265 LDC1 $15, GDB_FR_FPR15(sp)
266 LDC1 $14, GDB_FR_FPR14(sp)
267 LDC1 $13, GDB_FR_FPR13(sp)
268 LDC1 $12, GDB_FR_FPR12(sp)
269 LDC1 $11, GDB_FR_FPR11(sp)
270 LDC1 $10, GDB_FR_FPR10(sp)
271 LDC1 $9, GDB_FR_FPR9(sp)
272 LDC1 $8, GDB_FR_FPR8(sp)
273 LDC1 $7, GDB_FR_FPR7(sp)
274 LDC1 $6, GDB_FR_FPR6(sp)
275 LDC1 $5, GDB_FR_FPR5(sp)
276 LDC1 $4, GDB_FR_FPR4(sp)
277 LDC1 $3, GDB_FR_FPR3(sp)
278 LDC1 $2, GDB_FR_FPR2(sp)
279 LDC1 $1, GDB_FR_FPR1(sp)
280 LDC1 $0, GDB_FR_FPR0(sp)
281
282/*
283 * Now the CP0 and integer registers
284 */
285
2863:
287 mfc0 t0, CP0_STATUS
288 ori t0, 0x1f
289 xori t0, 0x1f
290 mtc0 t0, CP0_STATUS
291
292 LONG_L v0, GDB_FR_STATUS(sp)
293 LONG_L v1, GDB_FR_EPC(sp)
294 mtc0 v0, CP0_STATUS
295 DMTC0 v1, CP0_EPC
296 LONG_L v0, GDB_FR_HI(sp)
297 LONG_L v1, GDB_FR_LO(sp)
298 mthi v0
299 mtlo v1
300 LONG_L $31, GDB_FR_REG31(sp)
301 LONG_L $30, GDB_FR_REG30(sp)
302 LONG_L $28, GDB_FR_REG28(sp)
303 LONG_L $27, GDB_FR_REG27(sp)
304 LONG_L $26, GDB_FR_REG26(sp)
305 LONG_L $25, GDB_FR_REG25(sp)
306 LONG_L $24, GDB_FR_REG24(sp)
307 LONG_L $23, GDB_FR_REG23(sp)
308 LONG_L $22, GDB_FR_REG22(sp)
309 LONG_L $21, GDB_FR_REG21(sp)
310 LONG_L $20, GDB_FR_REG20(sp)
311 LONG_L $19, GDB_FR_REG19(sp)
312 LONG_L $18, GDB_FR_REG18(sp)
313 LONG_L $17, GDB_FR_REG17(sp)
314 LONG_L $16, GDB_FR_REG16(sp)
315 LONG_L $15, GDB_FR_REG15(sp)
316 LONG_L $14, GDB_FR_REG14(sp)
317 LONG_L $13, GDB_FR_REG13(sp)
318 LONG_L $12, GDB_FR_REG12(sp)
319 LONG_L $11, GDB_FR_REG11(sp)
320 LONG_L $10, GDB_FR_REG10(sp)
321 LONG_L $9, GDB_FR_REG9(sp)
322 LONG_L $8, GDB_FR_REG8(sp)
323 LONG_L $7, GDB_FR_REG7(sp)
324 LONG_L $6, GDB_FR_REG6(sp)
325 LONG_L $5, GDB_FR_REG5(sp)
326 LONG_L $4, GDB_FR_REG4(sp)
327 LONG_L $3, GDB_FR_REG3(sp)
328 LONG_L $2, GDB_FR_REG2(sp)
329 LONG_L $1, GDB_FR_REG1(sp)
330#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
331 LONG_L k0, GDB_FR_EPC(sp)
332 LONG_L $29, GDB_FR_REG29(sp) /* Deallocate stack */
333 jr k0
334 rfe
335#else
336 LONG_L sp, GDB_FR_REG29(sp) /* Deallocate stack */
337
338 .set mips3
339 eret
340 .set mips0
341#endif
342 .set at
343 .set reorder
344 END(trap_low)
345
346LEAF(kgdb_read_byte)
3474: lb t0, (a0)
348 sb t0, (a1)
349 li v0, 0
350 jr ra
351 .section __ex_table,"a"
352 PTR 4b, kgdbfault
353 .previous
354 END(kgdb_read_byte)
355
356LEAF(kgdb_write_byte)
3575: sb a0, (a1)
358 li v0, 0
359 jr ra
360 .section __ex_table,"a"
361 PTR 5b, kgdbfault
362 .previous
363 END(kgdb_write_byte)
364
365 .type kgdbfault@function
366 .ent kgdbfault
367
368kgdbfault: li v0, -EFAULT
369 jr ra
370 .end kgdbfault
diff --git a/arch/mips/kernel/gdb-stub.c b/arch/mips/kernel/gdb-stub.c
new file mode 100644
index 000000000000..269889302a27
--- /dev/null
+++ b/arch/mips/kernel/gdb-stub.c
@@ -0,0 +1,1091 @@
1/*
2 * arch/mips/kernel/gdb-stub.c
3 *
4 * Originally written by Glenn Engel, Lake Stevens Instrument Division
5 *
6 * Contributed by HP Systems
7 *
8 * Modified for SPARC by Stu Grossman, Cygnus Support.
9 *
10 * Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
11 * Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
12 *
13 * Copyright (C) 1995 Andreas Busse
14 *
15 * Copyright (C) 2003 MontaVista Software Inc.
16 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
17 */
18
19/*
20 * To enable debugger support, two things need to happen. One, a
21 * call to set_debug_traps() is necessary in order to allow any breakpoints
22 * or error conditions to be properly intercepted and reported to gdb.
23 * Two, a breakpoint needs to be generated to begin communication. This
24 * is most easily accomplished by a call to breakpoint(). Breakpoint()
25 * simulates a breakpoint by executing a BREAK instruction.
26 *
27 *
28 * The following gdb commands are supported:
29 *
30 * command function Return value
31 *
32 * g return the value of the CPU registers hex data or ENN
33 * G set the value of the CPU registers OK or ENN
34 *
35 * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
36 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
37 *
38 * c Resume at current address SNN ( signal NN)
39 * cAA..AA Continue at address AA..AA SNN
40 *
41 * s Step one instruction SNN
42 * sAA..AA Step one instruction from AA..AA SNN
43 *
44 * k kill
45 *
46 * ? What was the last sigval ? SNN (signal NN)
47 *
48 * bBB..BB Set baud rate to BB..BB OK or BNN, then sets
49 * baud rate
50 *
51 * All commands and responses are sent with a packet which includes a
52 * checksum. A packet consists of
53 *
54 * $<packet info>#<checksum>.
55 *
56 * where
57 * <packet info> :: <characters representing the command or response>
58 * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>>
59 *
60 * When a packet is received, it is first acknowledged with either '+' or '-'.
61 * '+' indicates a successful transfer. '-' indicates a failed transfer.
62 *
63 * Example:
64 *
65 * Host: Reply:
66 * $m0,10#2a +$00010203040506070809101112131415#42
67 *
68 *
69 * ==============
70 * MORE EXAMPLES:
71 * ==============
72 *
73 * For reference -- the following are the steps that one
74 * company took (RidgeRun Inc) to get remote gdb debugging
75 * going. In this scenario the host machine was a PC and the
76 * target platform was a Galileo EVB64120A MIPS evaluation
77 * board.
78 *
79 * Step 1:
80 * First download gdb-5.0.tar.gz from the internet.
81 * and then build/install the package.
82 *
83 * Example:
84 * $ tar zxf gdb-5.0.tar.gz
85 * $ cd gdb-5.0
86 * $ ./configure --target=mips-linux-elf
87 * $ make
88 * $ install
89 * $ which mips-linux-elf-gdb
90 * /usr/local/bin/mips-linux-elf-gdb
91 *
92 * Step 2:
93 * Configure linux for remote debugging and build it.
94 *
95 * Example:
96 * $ cd ~/linux
97 * $ make menuconfig <go to "Kernel Hacking" and turn on remote debugging>
98 * $ make
99 *
100 * Step 3:
101 * Download the kernel to the remote target and start
102 * the kernel running. It will promptly halt and wait
103 * for the host gdb session to connect. It does this
104 * since the "Kernel Hacking" option has defined
105 * CONFIG_KGDB which in turn enables your calls
106 * to:
107 * set_debug_traps();
108 * breakpoint();
109 *
110 * Step 4:
111 * Start the gdb session on the host.
112 *
113 * Example:
114 * $ mips-linux-elf-gdb vmlinux
115 * (gdb) set remotebaud 115200
116 * (gdb) target remote /dev/ttyS1
117 * ...at this point you are connected to
118 * the remote target and can use gdb
119 * in the normal fasion. Setting
120 * breakpoints, single stepping,
121 * printing variables, etc.
122 */
123#include <linux/config.h>
124#include <linux/string.h>
125#include <linux/kernel.h>
126#include <linux/signal.h>
127#include <linux/sched.h>
128#include <linux/mm.h>
129#include <linux/console.h>
130#include <linux/init.h>
131#include <linux/smp.h>
132#include <linux/spinlock.h>
133#include <linux/slab.h>
134#include <linux/reboot.h>
135
136#include <asm/asm.h>
137#include <asm/cacheflush.h>
138#include <asm/mipsregs.h>
139#include <asm/pgtable.h>
140#include <asm/system.h>
141#include <asm/gdb-stub.h>
142#include <asm/inst.h>
143
144/*
145 * external low-level support routines
146 */
147
148extern int putDebugChar(char c); /* write a single character */
149extern char getDebugChar(void); /* read and return a single char */
150extern void trap_low(void);
151
152/*
153 * breakpoint and test functions
154 */
155extern void breakpoint(void);
156extern void breakinst(void);
157extern void async_breakpoint(void);
158extern void async_breakinst(void);
159extern void adel(void);
160
161/*
162 * local prototypes
163 */
164
165static void getpacket(char *buffer);
166static void putpacket(char *buffer);
167static int computeSignal(int tt);
168static int hex(unsigned char ch);
169static int hexToInt(char **ptr, int *intValue);
170static int hexToLong(char **ptr, long *longValue);
171static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault);
172void handle_exception(struct gdb_regs *regs);
173
174int kgdb_enabled;
175
176/*
177 * spin locks for smp case
178 */
179static spinlock_t kgdb_lock = SPIN_LOCK_UNLOCKED;
180static spinlock_t kgdb_cpulock[NR_CPUS] = { [0 ... NR_CPUS-1] = SPIN_LOCK_UNLOCKED};
181
182/*
183 * BUFMAX defines the maximum number of characters in inbound/outbound buffers
184 * at least NUMREGBYTES*2 are needed for register packets
185 */
186#define BUFMAX 2048
187
188static char input_buffer[BUFMAX];
189static char output_buffer[BUFMAX];
190static int initialized; /* !0 means we've been initialized */
191static int kgdb_started;
192static const char hexchars[]="0123456789abcdef";
193
194/* Used to prevent crashes in memory access. Note that they'll crash anyway if
195 we haven't set up fault handlers yet... */
196int kgdb_read_byte(unsigned char *address, unsigned char *dest);
197int kgdb_write_byte(unsigned char val, unsigned char *dest);
198
199/*
200 * Convert ch from a hex digit to an int
201 */
202static int hex(unsigned char ch)
203{
204 if (ch >= 'a' && ch <= 'f')
205 return ch-'a'+10;
206 if (ch >= '0' && ch <= '9')
207 return ch-'0';
208 if (ch >= 'A' && ch <= 'F')
209 return ch-'A'+10;
210 return -1;
211}
212
213/*
214 * scan for the sequence $<data>#<checksum>
215 */
216static void getpacket(char *buffer)
217{
218 unsigned char checksum;
219 unsigned char xmitcsum;
220 int i;
221 int count;
222 unsigned char ch;
223
224 do {
225 /*
226 * wait around for the start character,
227 * ignore all other characters
228 */
229 while ((ch = (getDebugChar() & 0x7f)) != '$') ;
230
231 checksum = 0;
232 xmitcsum = -1;
233 count = 0;
234
235 /*
236 * now, read until a # or end of buffer is found
237 */
238 while (count < BUFMAX) {
239 ch = getDebugChar();
240 if (ch == '#')
241 break;
242 checksum = checksum + ch;
243 buffer[count] = ch;
244 count = count + 1;
245 }
246
247 if (count >= BUFMAX)
248 continue;
249
250 buffer[count] = 0;
251
252 if (ch == '#') {
253 xmitcsum = hex(getDebugChar() & 0x7f) << 4;
254 xmitcsum |= hex(getDebugChar() & 0x7f);
255
256 if (checksum != xmitcsum)
257 putDebugChar('-'); /* failed checksum */
258 else {
259 putDebugChar('+'); /* successful transfer */
260
261 /*
262 * if a sequence char is present,
263 * reply the sequence ID
264 */
265 if (buffer[2] == ':') {
266 putDebugChar(buffer[0]);
267 putDebugChar(buffer[1]);
268
269 /*
270 * remove sequence chars from buffer
271 */
272 count = strlen(buffer);
273 for (i=3; i <= count; i++)
274 buffer[i-3] = buffer[i];
275 }
276 }
277 }
278 }
279 while (checksum != xmitcsum);
280}
281
282/*
283 * send the packet in buffer.
284 */
285static void putpacket(char *buffer)
286{
287 unsigned char checksum;
288 int count;
289 unsigned char ch;
290
291 /*
292 * $<packet info>#<checksum>.
293 */
294
295 do {
296 putDebugChar('$');
297 checksum = 0;
298 count = 0;
299
300 while ((ch = buffer[count]) != 0) {
301 if (!(putDebugChar(ch)))
302 return;
303 checksum += ch;
304 count += 1;
305 }
306
307 putDebugChar('#');
308 putDebugChar(hexchars[checksum >> 4]);
309 putDebugChar(hexchars[checksum & 0xf]);
310
311 }
312 while ((getDebugChar() & 0x7f) != '+');
313}
314
315
316/*
317 * Convert the memory pointed to by mem into hex, placing result in buf.
318 * Return a pointer to the last char put in buf (null), in case of mem fault,
319 * return 0.
320 * may_fault is non-zero if we are reading from arbitrary memory, but is currently
321 * not used.
322 */
323static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault)
324{
325 unsigned char ch;
326
327 while (count-- > 0) {
328 if (kgdb_read_byte(mem++, &ch) != 0)
329 return 0;
330 *buf++ = hexchars[ch >> 4];
331 *buf++ = hexchars[ch & 0xf];
332 }
333
334 *buf = 0;
335
336 return buf;
337}
338
339/*
340 * convert the hex array pointed to by buf into binary to be placed in mem
341 * return a pointer to the character AFTER the last byte written
342 * may_fault is non-zero if we are reading from arbitrary memory, but is currently
343 * not used.
344 */
345static char *hex2mem(char *buf, char *mem, int count, int binary, int may_fault)
346{
347 int i;
348 unsigned char ch;
349
350 for (i=0; i<count; i++)
351 {
352 if (binary) {
353 ch = *buf++;
354 if (ch == 0x7d)
355 ch = 0x20 ^ *buf++;
356 }
357 else {
358 ch = hex(*buf++) << 4;
359 ch |= hex(*buf++);
360 }
361 if (kgdb_write_byte(ch, mem++) != 0)
362 return 0;
363 }
364
365 return mem;
366}
367
368/*
369 * This table contains the mapping between SPARC hardware trap types, and
370 * signals, which are primarily what GDB understands. It also indicates
371 * which hardware traps we need to commandeer when initializing the stub.
372 */
373static struct hard_trap_info {
374 unsigned char tt; /* Trap type code for MIPS R3xxx and R4xxx */
375 unsigned char signo; /* Signal that we map this trap into */
376} hard_trap_info[] = {
377 { 6, SIGBUS }, /* instruction bus error */
378 { 7, SIGBUS }, /* data bus error */
379 { 9, SIGTRAP }, /* break */
380 { 10, SIGILL }, /* reserved instruction */
381/* { 11, SIGILL }, */ /* CPU unusable */
382 { 12, SIGFPE }, /* overflow */
383 { 13, SIGTRAP }, /* trap */
384 { 14, SIGSEGV }, /* virtual instruction cache coherency */
385 { 15, SIGFPE }, /* floating point exception */
386 { 23, SIGSEGV }, /* watch */
387 { 31, SIGSEGV }, /* virtual data cache coherency */
388 { 0, 0} /* Must be last */
389};
390
391/* Save the normal trap handlers for user-mode traps. */
392void *saved_vectors[32];
393
394/*
395 * Set up exception handlers for tracing and breakpoints
396 */
397void set_debug_traps(void)
398{
399 struct hard_trap_info *ht;
400 unsigned long flags;
401 unsigned char c;
402
403 local_irq_save(flags);
404 for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
405 saved_vectors[ht->tt] = set_except_vector(ht->tt, trap_low);
406
407 putDebugChar('+'); /* 'hello world' */
408 /*
409 * In case GDB is started before us, ack any packets
410 * (presumably "$?#xx") sitting there.
411 */
412 while((c = getDebugChar()) != '$');
413 while((c = getDebugChar()) != '#');
414 c = getDebugChar(); /* eat first csum byte */
415 c = getDebugChar(); /* eat second csum byte */
416 putDebugChar('+'); /* ack it */
417
418 initialized = 1;
419 local_irq_restore(flags);
420}
421
422void restore_debug_traps(void)
423{
424 struct hard_trap_info *ht;
425 unsigned long flags;
426
427 local_irq_save(flags);
428 for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
429 set_except_vector(ht->tt, saved_vectors[ht->tt]);
430 local_irq_restore(flags);
431}
432
433/*
434 * Convert the MIPS hardware trap type code to a Unix signal number.
435 */
436static int computeSignal(int tt)
437{
438 struct hard_trap_info *ht;
439
440 for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
441 if (ht->tt == tt)
442 return ht->signo;
443
444 return SIGHUP; /* default for things we don't know about */
445}
446
447/*
448 * While we find nice hex chars, build an int.
449 * Return number of chars processed.
450 */
451static int hexToInt(char **ptr, int *intValue)
452{
453 int numChars = 0;
454 int hexValue;
455
456 *intValue = 0;
457
458 while (**ptr) {
459 hexValue = hex(**ptr);
460 if (hexValue < 0)
461 break;
462
463 *intValue = (*intValue << 4) | hexValue;
464 numChars ++;
465
466 (*ptr)++;
467 }
468
469 return (numChars);
470}
471
472static int hexToLong(char **ptr, long *longValue)
473{
474 int numChars = 0;
475 int hexValue;
476
477 *longValue = 0;
478
479 while (**ptr) {
480 hexValue = hex(**ptr);
481 if (hexValue < 0)
482 break;
483
484 *longValue = (*longValue << 4) | hexValue;
485 numChars ++;
486
487 (*ptr)++;
488 }
489
490 return numChars;
491}
492
493
494#if 0
495/*
496 * Print registers (on target console)
497 * Used only to debug the stub...
498 */
499void show_gdbregs(struct gdb_regs * regs)
500{
501 /*
502 * Saved main processor registers
503 */
504 printk("$0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
505 regs->reg0, regs->reg1, regs->reg2, regs->reg3,
506 regs->reg4, regs->reg5, regs->reg6, regs->reg7);
507 printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
508 regs->reg8, regs->reg9, regs->reg10, regs->reg11,
509 regs->reg12, regs->reg13, regs->reg14, regs->reg15);
510 printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
511 regs->reg16, regs->reg17, regs->reg18, regs->reg19,
512 regs->reg20, regs->reg21, regs->reg22, regs->reg23);
513 printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
514 regs->reg24, regs->reg25, regs->reg26, regs->reg27,
515 regs->reg28, regs->reg29, regs->reg30, regs->reg31);
516
517 /*
518 * Saved cp0 registers
519 */
520 printk("epc : %08lx\nStatus: %08lx\nCause : %08lx\n",
521 regs->cp0_epc, regs->cp0_status, regs->cp0_cause);
522}
523#endif /* dead code */
524
525/*
526 * We single-step by setting breakpoints. When an exception
527 * is handled, we need to restore the instructions hoisted
528 * when the breakpoints were set.
529 *
530 * This is where we save the original instructions.
531 */
532static struct gdb_bp_save {
533 unsigned long addr;
534 unsigned int val;
535} step_bp[2];
536
537#define BP 0x0000000d /* break opcode */
538
539/*
540 * Set breakpoint instructions for single stepping.
541 */
542static void single_step(struct gdb_regs *regs)
543{
544 union mips_instruction insn;
545 unsigned long targ;
546 int is_branch, is_cond, i;
547
548 targ = regs->cp0_epc;
549 insn.word = *(unsigned int *)targ;
550 is_branch = is_cond = 0;
551
552 switch (insn.i_format.opcode) {
553 /*
554 * jr and jalr are in r_format format.
555 */
556 case spec_op:
557 switch (insn.r_format.func) {
558 case jalr_op:
559 case jr_op:
560 targ = *(&regs->reg0 + insn.r_format.rs);
561 is_branch = 1;
562 break;
563 }
564 break;
565
566 /*
567 * This group contains:
568 * bltz_op, bgez_op, bltzl_op, bgezl_op,
569 * bltzal_op, bgezal_op, bltzall_op, bgezall_op.
570 */
571 case bcond_op:
572 is_branch = is_cond = 1;
573 targ += 4 + (insn.i_format.simmediate << 2);
574 break;
575
576 /*
577 * These are unconditional and in j_format.
578 */
579 case jal_op:
580 case j_op:
581 is_branch = 1;
582 targ += 4;
583 targ >>= 28;
584 targ <<= 28;
585 targ |= (insn.j_format.target << 2);
586 break;
587
588 /*
589 * These are conditional.
590 */
591 case beq_op:
592 case beql_op:
593 case bne_op:
594 case bnel_op:
595 case blez_op:
596 case blezl_op:
597 case bgtz_op:
598 case bgtzl_op:
599 case cop0_op:
600 case cop1_op:
601 case cop2_op:
602 case cop1x_op:
603 is_branch = is_cond = 1;
604 targ += 4 + (insn.i_format.simmediate << 2);
605 break;
606 }
607
608 if (is_branch) {
609 i = 0;
610 if (is_cond && targ != (regs->cp0_epc + 8)) {
611 step_bp[i].addr = regs->cp0_epc + 8;
612 step_bp[i++].val = *(unsigned *)(regs->cp0_epc + 8);
613 *(unsigned *)(regs->cp0_epc + 8) = BP;
614 }
615 step_bp[i].addr = targ;
616 step_bp[i].val = *(unsigned *)targ;
617 *(unsigned *)targ = BP;
618 } else {
619 step_bp[0].addr = regs->cp0_epc + 4;
620 step_bp[0].val = *(unsigned *)(regs->cp0_epc + 4);
621 *(unsigned *)(regs->cp0_epc + 4) = BP;
622 }
623}
624
625/*
626 * If asynchronously interrupted by gdb, then we need to set a breakpoint
627 * at the interrupted instruction so that we wind up stopped with a
628 * reasonable stack frame.
629 */
630static struct gdb_bp_save async_bp;
631
632/*
633 * Swap the interrupted EPC with our asynchronous breakpoint routine.
634 * This is safer than stuffing the breakpoint in-place, since no cache
635 * flushes (or resulting smp_call_functions) are required. The
636 * assumption is that only one CPU will be handling asynchronous bp's,
637 * and only one can be active at a time.
638 */
639extern spinlock_t smp_call_lock;
640void set_async_breakpoint(unsigned long *epc)
641{
642 /* skip breaking into userland */
643 if ((*epc & 0x80000000) == 0)
644 return;
645
646 /* avoid deadlock if someone is make IPC */
647 if (spin_is_locked(&smp_call_lock))
648 return;
649
650 async_bp.addr = *epc;
651 *epc = (unsigned long)async_breakpoint;
652}
653
654void kgdb_wait(void *arg)
655{
656 unsigned flags;
657 int cpu = smp_processor_id();
658
659 local_irq_save(flags);
660
661 spin_lock(&kgdb_cpulock[cpu]);
662 spin_unlock(&kgdb_cpulock[cpu]);
663
664 local_irq_restore(flags);
665}
666
667
668/*
669 * This function does all command processing for interfacing to gdb. It
670 * returns 1 if you should skip the instruction at the trap address, 0
671 * otherwise.
672 */
673void handle_exception (struct gdb_regs *regs)
674{
675 int trap; /* Trap type */
676 int sigval;
677 long addr;
678 int length;
679 char *ptr;
680 unsigned long *stack;
681 int i;
682 int bflag = 0;
683
684 kgdb_started = 1;
685
686 /*
687 * acquire the big kgdb spinlock
688 */
689 if (!spin_trylock(&kgdb_lock)) {
690 /*
691 * some other CPU has the lock, we should go back to
692 * receive the gdb_wait IPC
693 */
694 return;
695 }
696
697 /*
698 * If we're in async_breakpoint(), restore the real EPC from
699 * the breakpoint.
700 */
701 if (regs->cp0_epc == (unsigned long)async_breakinst) {
702 regs->cp0_epc = async_bp.addr;
703 async_bp.addr = 0;
704 }
705
706 /*
707 * acquire the CPU spinlocks
708 */
709 for (i = num_online_cpus()-1; i >= 0; i--)
710 if (spin_trylock(&kgdb_cpulock[i]) == 0)
711 panic("kgdb: couldn't get cpulock %d\n", i);
712
713 /*
714 * force other cpus to enter kgdb
715 */
716 smp_call_function(kgdb_wait, NULL, 0, 0);
717
718 /*
719 * If we're in breakpoint() increment the PC
720 */
721 trap = (regs->cp0_cause & 0x7c) >> 2;
722 if (trap == 9 && regs->cp0_epc == (unsigned long)breakinst)
723 regs->cp0_epc += 4;
724
725 /*
726 * If we were single_stepping, restore the opcodes hoisted
727 * for the breakpoint[s].
728 */
729 if (step_bp[0].addr) {
730 *(unsigned *)step_bp[0].addr = step_bp[0].val;
731 step_bp[0].addr = 0;
732
733 if (step_bp[1].addr) {
734 *(unsigned *)step_bp[1].addr = step_bp[1].val;
735 step_bp[1].addr = 0;
736 }
737 }
738
739 stack = (long *)regs->reg29; /* stack ptr */
740 sigval = computeSignal(trap);
741
742 /*
743 * reply to host that an exception has occurred
744 */
745 ptr = output_buffer;
746
747 /*
748 * Send trap type (converted to signal)
749 */
750 *ptr++ = 'T';
751 *ptr++ = hexchars[sigval >> 4];
752 *ptr++ = hexchars[sigval & 0xf];
753
754 /*
755 * Send Error PC
756 */
757 *ptr++ = hexchars[REG_EPC >> 4];
758 *ptr++ = hexchars[REG_EPC & 0xf];
759 *ptr++ = ':';
760 ptr = mem2hex((char *)&regs->cp0_epc, ptr, sizeof(long), 0);
761 *ptr++ = ';';
762
763 /*
764 * Send frame pointer
765 */
766 *ptr++ = hexchars[REG_FP >> 4];
767 *ptr++ = hexchars[REG_FP & 0xf];
768 *ptr++ = ':';
769 ptr = mem2hex((char *)&regs->reg30, ptr, sizeof(long), 0);
770 *ptr++ = ';';
771
772 /*
773 * Send stack pointer
774 */
775 *ptr++ = hexchars[REG_SP >> 4];
776 *ptr++ = hexchars[REG_SP & 0xf];
777 *ptr++ = ':';
778 ptr = mem2hex((char *)&regs->reg29, ptr, sizeof(long), 0);
779 *ptr++ = ';';
780
781 *ptr++ = 0;
782 putpacket(output_buffer); /* send it off... */
783
784 /*
785 * Wait for input from remote GDB
786 */
787 while (1) {
788 output_buffer[0] = 0;
789 getpacket(input_buffer);
790
791 switch (input_buffer[0])
792 {
793 case '?':
794 output_buffer[0] = 'S';
795 output_buffer[1] = hexchars[sigval >> 4];
796 output_buffer[2] = hexchars[sigval & 0xf];
797 output_buffer[3] = 0;
798 break;
799
800 /*
801 * Detach debugger; let CPU run
802 */
803 case 'D':
804 putpacket(output_buffer);
805 goto finish_kgdb;
806 break;
807
808 case 'd':
809 /* toggle debug flag */
810 break;
811
812 /*
813 * Return the value of the CPU registers
814 */
815 case 'g':
816 ptr = output_buffer;
817 ptr = mem2hex((char *)&regs->reg0, ptr, 32*sizeof(long), 0); /* r0...r31 */
818 ptr = mem2hex((char *)&regs->cp0_status, ptr, 6*sizeof(long), 0); /* cp0 */
819 ptr = mem2hex((char *)&regs->fpr0, ptr, 32*sizeof(long), 0); /* f0...31 */
820 ptr = mem2hex((char *)&regs->cp1_fsr, ptr, 2*sizeof(long), 0); /* cp1 */
821 ptr = mem2hex((char *)&regs->frame_ptr, ptr, 2*sizeof(long), 0); /* frp */
822 ptr = mem2hex((char *)&regs->cp0_index, ptr, 16*sizeof(long), 0); /* cp0 */
823 break;
824
825 /*
826 * set the value of the CPU registers - return OK
827 */
828 case 'G':
829 {
830 ptr = &input_buffer[1];
831 hex2mem(ptr, (char *)&regs->reg0, 32*sizeof(long), 0, 0);
832 ptr += 32*(2*sizeof(long));
833 hex2mem(ptr, (char *)&regs->cp0_status, 6*sizeof(long), 0, 0);
834 ptr += 6*(2*sizeof(long));
835 hex2mem(ptr, (char *)&regs->fpr0, 32*sizeof(long), 0, 0);
836 ptr += 32*(2*sizeof(long));
837 hex2mem(ptr, (char *)&regs->cp1_fsr, 2*sizeof(long), 0, 0);
838 ptr += 2*(2*sizeof(long));
839 hex2mem(ptr, (char *)&regs->frame_ptr, 2*sizeof(long), 0, 0);
840 ptr += 2*(2*sizeof(long));
841 hex2mem(ptr, (char *)&regs->cp0_index, 16*sizeof(long), 0, 0);
842 strcpy(output_buffer,"OK");
843 }
844 break;
845
846 /*
847 * mAA..AA,LLLL Read LLLL bytes at address AA..AA
848 */
849 case 'm':
850 ptr = &input_buffer[1];
851
852 if (hexToLong(&ptr, &addr)
853 && *ptr++ == ','
854 && hexToInt(&ptr, &length)) {
855 if (mem2hex((char *)addr, output_buffer, length, 1))
856 break;
857 strcpy (output_buffer, "E03");
858 } else
859 strcpy(output_buffer,"E01");
860 break;
861
862 /*
863 * XAA..AA,LLLL: Write LLLL escaped binary bytes at address AA.AA
864 */
865 case 'X':
866 bflag = 1;
867 /* fall through */
868
869 /*
870 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK
871 */
872 case 'M':
873 ptr = &input_buffer[1];
874
875 if (hexToLong(&ptr, &addr)
876 && *ptr++ == ','
877 && hexToInt(&ptr, &length)
878 && *ptr++ == ':') {
879 if (hex2mem(ptr, (char *)addr, length, bflag, 1))
880 strcpy(output_buffer, "OK");
881 else
882 strcpy(output_buffer, "E03");
883 }
884 else
885 strcpy(output_buffer, "E02");
886 break;
887
888 /*
889 * cAA..AA Continue at address AA..AA(optional)
890 */
891 case 'c':
892 /* try to read optional parameter, pc unchanged if no parm */
893
894 ptr = &input_buffer[1];
895 if (hexToLong(&ptr, &addr))
896 regs->cp0_epc = addr;
897
898 goto exit_kgdb_exception;
899 break;
900
901 /*
902 * kill the program; let us try to restart the machine
903 * Reset the whole machine.
904 */
905 case 'k':
906 case 'r':
907 machine_restart("kgdb restarts machine");
908 break;
909
910 /*
911 * Step to next instruction
912 */
913 case 's':
914 /*
915 * There is no single step insn in the MIPS ISA, so we
916 * use breakpoints and continue, instead.
917 */
918 single_step(regs);
919 goto exit_kgdb_exception;
920 /* NOTREACHED */
921 break;
922
923 /*
924 * Set baud rate (bBB)
925 * FIXME: Needs to be written
926 */
927 case 'b':
928 {
929#if 0
930 int baudrate;
931 extern void set_timer_3();
932
933 ptr = &input_buffer[1];
934 if (!hexToInt(&ptr, &baudrate))
935 {
936 strcpy(output_buffer,"B01");
937 break;
938 }
939
940 /* Convert baud rate to uart clock divider */
941
942 switch (baudrate)
943 {
944 case 38400:
945 baudrate = 16;
946 break;
947 case 19200:
948 baudrate = 33;
949 break;
950 case 9600:
951 baudrate = 65;
952 break;
953 default:
954 baudrate = 0;
955 strcpy(output_buffer,"B02");
956 goto x1;
957 }
958
959 if (baudrate) {
960 putpacket("OK"); /* Ack before changing speed */
961 set_timer_3(baudrate); /* Set it */
962 }
963#endif
964 }
965 break;
966
967 } /* switch */
968
969 /*
970 * reply to the request
971 */
972
973 putpacket(output_buffer);
974
975 } /* while */
976
977 return;
978
979finish_kgdb:
980 restore_debug_traps();
981
982exit_kgdb_exception:
983 /* release locks so other CPUs can go */
984 for (i = num_online_cpus()-1; i >= 0; i--)
985 spin_unlock(&kgdb_cpulock[i]);
986 spin_unlock(&kgdb_lock);
987
988 __flush_cache_all();
989 return;
990}
991
992/*
993 * This function will generate a breakpoint exception. It is used at the
994 * beginning of a program to sync up with a debugger and can be used
995 * otherwise as a quick means to stop program execution and "break" into
996 * the debugger.
997 */
998void breakpoint(void)
999{
1000 if (!initialized)
1001 return;
1002
1003 __asm__ __volatile__(
1004 ".globl breakinst\n\t"
1005 ".set\tnoreorder\n\t"
1006 "nop\n"
1007 "breakinst:\tbreak\n\t"
1008 "nop\n\t"
1009 ".set\treorder"
1010 );
1011}
1012
1013/* Nothing but the break; don't pollute any registers */
1014void async_breakpoint(void)
1015{
1016 __asm__ __volatile__(
1017 ".globl async_breakinst\n\t"
1018 ".set\tnoreorder\n\t"
1019 "nop\n"
1020 "async_breakinst:\tbreak\n\t"
1021 "nop\n\t"
1022 ".set\treorder"
1023 );
1024}
1025
1026void adel(void)
1027{
1028 __asm__ __volatile__(
1029 ".globl\tadel\n\t"
1030 "lui\t$8,0x8000\n\t"
1031 "lw\t$9,1($8)\n\t"
1032 );
1033}
1034
1035/*
1036 * malloc is needed by gdb client in "call func()", even a private one
1037 * will make gdb happy
1038 */
1039static void *malloc(size_t size)
1040{
1041 return kmalloc(size, GFP_ATOMIC);
1042}
1043
1044static void free(void *where)
1045{
1046 kfree(where);
1047}
1048
1049#ifdef CONFIG_GDB_CONSOLE
1050
1051void gdb_putsn(const char *str, int l)
1052{
1053 char outbuf[18];
1054
1055 if (!kgdb_started)
1056 return;
1057
1058 outbuf[0]='O';
1059
1060 while(l) {
1061 int i = (l>8)?8:l;
1062 mem2hex((char *)str, &outbuf[1], i, 0);
1063 outbuf[(i*2)+1]=0;
1064 putpacket(outbuf);
1065 str += i;
1066 l -= i;
1067 }
1068}
1069
1070static void gdb_console_write(struct console *con, const char *s, unsigned n)
1071{
1072 gdb_putsn(s, n);
1073}
1074
1075static struct console gdb_console = {
1076 .name = "gdb",
1077 .write = gdb_console_write,
1078 .flags = CON_PRINTBUFFER,
1079 .index = -1
1080};
1081
1082static int __init register_gdb_console(void)
1083{
1084 register_console(&gdb_console);
1085
1086 return 0;
1087}
1088
1089console_initcall(register_gdb_console);
1090
1091#endif
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
new file mode 100644
index 000000000000..a5b0a389b063
--- /dev/null
+++ b/arch/mips/kernel/genex.S
@@ -0,0 +1,302 @@
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) 1994 - 2000, 2001, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 * Copyright (C) 2002 Maciej W. Rozycki
10 */
11#include <linux/config.h>
12#include <linux/init.h>
13
14#include <asm/asm.h>
15#include <asm/cacheops.h>
16#include <asm/regdef.h>
17#include <asm/fpregdef.h>
18#include <asm/mipsregs.h>
19#include <asm/stackframe.h>
20#include <asm/war.h>
21
22#define PANIC_PIC(msg) \
23 .set push; \
24 .set reorder; \
25 PTR_LA a0,8f; \
26 .set noat; \
27 PTR_LA AT, panic; \
28 jr AT; \
299: b 9b; \
30 .set pop; \
31 TEXT(msg)
32
33 __INIT
34
35NESTED(except_vec0_generic, 0, sp)
36 PANIC_PIC("Exception vector 0 called")
37 END(except_vec0_generic)
38
39NESTED(except_vec1_generic, 0, sp)
40 PANIC_PIC("Exception vector 1 called")
41 END(except_vec1_generic)
42
43/*
44 * General exception vector for all other CPUs.
45 *
46 * Be careful when changing this, it has to be at most 128 bytes
47 * to fit into space reserved for the exception handler.
48 */
49NESTED(except_vec3_generic, 0, sp)
50 .set push
51 .set noat
52#if R5432_CP0_INTERRUPT_WAR
53 mfc0 k0, CP0_INDEX
54#endif
55 mfc0 k1, CP0_CAUSE
56 andi k1, k1, 0x7c
57#ifdef CONFIG_MIPS64
58 dsll k1, k1, 1
59#endif
60 PTR_L k0, exception_handlers(k1)
61 jr k0
62 .set pop
63 END(except_vec3_generic)
64
65/*
66 * General exception handler for CPUs with virtual coherency exception.
67 *
68 * Be careful when changing this, it has to be at most 256 (as a special
69 * exception) bytes to fit into space reserved for the exception handler.
70 */
71NESTED(except_vec3_r4000, 0, sp)
72 .set push
73 .set mips3
74 .set noat
75 mfc0 k1, CP0_CAUSE
76 li k0, 31<<2
77 andi k1, k1, 0x7c
78 .set push
79 .set noreorder
80 .set nomacro
81 beq k1, k0, handle_vced
82 li k0, 14<<2
83 beq k1, k0, handle_vcei
84#ifdef CONFIG_MIPS64
85 dsll k1, k1, 1
86#endif
87 .set pop
88 PTR_L k0, exception_handlers(k1)
89 jr k0
90
91 /*
92 * Big shit, we now may have two dirty primary cache lines for the same
93 * physical address. We can savely invalidate the line pointed to by
94 * c0_badvaddr because after return from this exception handler the
95 * load / store will be re-executed.
96 */
97handle_vced:
98 DMFC0 k0, CP0_BADVADDR
99 li k1, -4 # Is this ...
100 and k0, k1 # ... really needed?
101 mtc0 zero, CP0_TAGLO
102 cache Index_Store_Tag_D,(k0)
103 cache Hit_Writeback_Inv_SD,(k0)
104#ifdef CONFIG_PROC_FS
105 PTR_LA k0, vced_count
106 lw k1, (k0)
107 addiu k1, 1
108 sw k1, (k0)
109#endif
110 eret
111
112handle_vcei:
113 MFC0 k0, CP0_BADVADDR
114 cache Hit_Writeback_Inv_SD, (k0) # also cleans pi
115#ifdef CONFIG_PROC_FS
116 PTR_LA k0, vcei_count
117 lw k1, (k0)
118 addiu k1, 1
119 sw k1, (k0)
120#endif
121 eret
122 .set pop
123 END(except_vec3_r4000)
124
125/*
126 * Special interrupt vector for MIPS64 ISA & embedded MIPS processors.
127 * This is a dedicated interrupt exception vector which reduces the
128 * interrupt processing overhead. The jump instruction will be replaced
129 * at the initialization time.
130 *
131 * Be careful when changing this, it has to be at most 128 bytes
132 * to fit into space reserved for the exception handler.
133 */
134NESTED(except_vec4, 0, sp)
1351: j 1b /* Dummy, will be replaced */
136 END(except_vec4)
137
138/*
139 * EJTAG debug exception handler.
140 * The EJTAG debug exception entry point is 0xbfc00480, which
141 * normally is in the boot PROM, so the boot PROM must do a
142 * unconditional jump to this vector.
143 */
144NESTED(except_vec_ejtag_debug, 0, sp)
145 j ejtag_debug_handler
146 END(except_vec_ejtag_debug)
147
148 __FINIT
149
150/*
151 * EJTAG debug exception handler.
152 */
153NESTED(ejtag_debug_handler, PT_SIZE, sp)
154 .set push
155 .set noat
156 MTC0 k0, CP0_DESAVE
157 mfc0 k0, CP0_DEBUG
158
159 sll k0, k0, 30 # Check for SDBBP.
160 bgez k0, ejtag_return
161
162 PTR_LA k0, ejtag_debug_buffer
163 LONG_S k1, 0(k0)
164 SAVE_ALL
165 move a0, sp
166 jal ejtag_exception_handler
167 RESTORE_ALL
168 PTR_LA k0, ejtag_debug_buffer
169 LONG_L k1, 0(k0)
170
171ejtag_return:
172 MFC0 k0, CP0_DESAVE
173 .set mips32
174 deret
175 .set pop
176 END(ejtag_debug_handler)
177
178/*
179 * This buffer is reserved for the use of the EJTAG debug
180 * handler.
181 */
182 .data
183EXPORT(ejtag_debug_buffer)
184 .fill LONGSIZE
185 .previous
186
187 __INIT
188
189/*
190 * NMI debug exception handler for MIPS reference boards.
191 * The NMI debug exception entry point is 0xbfc00000, which
192 * normally is in the boot PROM, so the boot PROM must do a
193 * unconditional jump to this vector.
194 */
195NESTED(except_vec_nmi, 0, sp)
196 j nmi_handler
197 END(except_vec_nmi)
198
199 __FINIT
200
201NESTED(nmi_handler, PT_SIZE, sp)
202 .set push
203 .set noat
204 .set mips3
205 SAVE_ALL
206 move a0, sp
207 jal nmi_exception_handler
208 RESTORE_ALL
209 eret
210 .set pop
211 END(nmi_handler)
212
213 .macro __build_clear_none
214 .endm
215
216 .macro __build_clear_sti
217 STI
218 .endm
219
220 .macro __build_clear_cli
221 CLI
222 .endm
223
224 .macro __build_clear_fpe
225 cfc1 a1, fcr31
226 li a2, ~(0x3f << 12)
227 and a2, a1
228 ctc1 a2, fcr31
229 STI
230 .endm
231
232 .macro __build_clear_ade
233 MFC0 t0, CP0_BADVADDR
234 PTR_S t0, PT_BVADDR(sp)
235 KMODE
236 .endm
237
238 .macro __BUILD_silent exception
239 .endm
240
241 /* Gas tries to parse the PRINT argument as a string containing
242 string escapes and emits bogus warnings if it believes to
243 recognize an unknown escape code. So make the arguments
244 start with an n and gas will believe \n is ok ... */
245 .macro __BUILD_verbose nexception
246 LONG_L a1, PT_EPC(sp)
247#if CONFIG_MIPS32
248 PRINT("Got \nexception at %08lx\012")
249#endif
250#if CONFIG_MIPS64
251 PRINT("Got \nexception at %016lx\012")
252#endif
253 .endm
254
255 .macro __BUILD_count exception
256 LONG_L t0,exception_count_\exception
257 LONG_ADDIU t0, 1
258 LONG_S t0,exception_count_\exception
259 .comm exception_count\exception, 8, 8
260 .endm
261
262 .macro __BUILD_HANDLER exception handler clear verbose ext
263 .align 5
264 NESTED(handle_\exception, PT_SIZE, sp)
265 .set noat
266 SAVE_ALL
267 FEXPORT(handle_\exception\ext)
268 __BUILD_clear_\clear
269 .set at
270 __BUILD_\verbose \exception
271 move a0, sp
272 jal do_\handler
273 j ret_from_exception
274 END(handle_\exception)
275 .endm
276
277 .macro BUILD_HANDLER exception handler clear verbose
278 __BUILD_HANDLER \exception \handler \clear \verbose _int
279 .endm
280
281 BUILD_HANDLER adel ade ade silent /* #4 */
282 BUILD_HANDLER ades ade ade silent /* #5 */
283 BUILD_HANDLER ibe be cli silent /* #6 */
284 BUILD_HANDLER dbe be cli silent /* #7 */
285 BUILD_HANDLER bp bp sti silent /* #9 */
286 BUILD_HANDLER ri ri sti silent /* #10 */
287 BUILD_HANDLER cpu cpu sti silent /* #11 */
288 BUILD_HANDLER ov ov sti silent /* #12 */
289 BUILD_HANDLER tr tr sti silent /* #13 */
290 BUILD_HANDLER fpe fpe fpe silent /* #15 */
291 BUILD_HANDLER mdmx mdmx sti silent /* #22 */
292 BUILD_HANDLER watch watch sti verbose /* #23 */
293 BUILD_HANDLER mcheck mcheck cli verbose /* #24 */
294 BUILD_HANDLER reserved reserved sti verbose /* others */
295
296#ifdef CONFIG_MIPS64
297/* A temporary overflow handler used by check_daddi(). */
298
299 __INIT
300
301 BUILD_HANDLER daddi_ov daddi_ov none silent /* #12 */
302#endif
diff --git a/arch/mips/kernel/genrtc.c b/arch/mips/kernel/genrtc.c
new file mode 100644
index 000000000000..288bf51ad4ec
--- /dev/null
+++ b/arch/mips/kernel/genrtc.c
@@ -0,0 +1,64 @@
1/*
2 * A glue layer that provides RTC read/write to drivers/char/genrtc.c driver
3 * based on MIPS internal RTC routines. It does take care locking
4 * issues so that we are SMP/Preemption safe.
5 *
6 * Copyright (C) 2004 MontaVista Software Inc.
7 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
8 *
9 * Please read the COPYING file for all license details.
10 */
11
12#include <linux/spinlock.h>
13
14#include <asm/rtc.h>
15#include <asm/time.h>
16
17static spinlock_t mips_rtc_lock = SPIN_LOCK_UNLOCKED;
18
19unsigned int get_rtc_time(struct rtc_time *time)
20{
21 unsigned long nowtime;
22
23 spin_lock(&mips_rtc_lock);
24 nowtime = rtc_get_time();
25 to_tm(nowtime, time);
26 time->tm_year -= 1900;
27 spin_unlock(&mips_rtc_lock);
28
29 return RTC_24H;
30}
31
32int set_rtc_time(struct rtc_time *time)
33{
34 unsigned long nowtime;
35 int ret;
36
37 spin_lock(&mips_rtc_lock);
38 nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
39 time->tm_mday, time->tm_hour, time->tm_min,
40 time->tm_sec);
41 ret = rtc_set_time(nowtime);
42 spin_unlock(&mips_rtc_lock);
43
44 return ret;
45}
46
47unsigned int get_rtc_ss(void)
48{
49 struct rtc_time h;
50
51 get_rtc_time(&h);
52 return h.tm_sec;
53}
54
55int get_rtc_pll(struct rtc_pll_info *pll)
56{
57 return -EINVAL;
58}
59
60int set_rtc_pll(struct rtc_pll_info *pll)
61{
62 return -EINVAL;
63}
64
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
new file mode 100644
index 000000000000..a64e87d22014
--- /dev/null
+++ b/arch/mips/kernel/head.S
@@ -0,0 +1,221 @@
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) 1994, 1995 Waldorf Electronics
7 * Written by Ralf Baechle and Andreas Busse
8 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003 Ralf Baechle
9 * Copyright (C) 1996 Paul M. Antoine
10 * Modified for DECStation and hence R3000 support by Paul M. Antoine
11 * Further modifications by David S. Miller and Harald Koerfgen
12 * Copyright (C) 1999 Silicon Graphics, Inc.
13 * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
14 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
15 */
16#include <linux/config.h>
17#include <linux/init.h>
18#include <linux/threads.h>
19
20#include <asm/asm.h>
21#include <asm/regdef.h>
22#include <asm/page.h>
23#include <asm/mipsregs.h>
24#include <asm/stackframe.h>
25#ifdef CONFIG_SGI_IP27
26#include <asm/sn/addrs.h>
27#include <asm/sn/sn0/hubni.h>
28#include <asm/sn/klkernvars.h>
29#endif
30
31 .macro ARC64_TWIDDLE_PC
32#if defined(CONFIG_ARC64) || defined(CONFIG_MAPPED_KERNEL)
33 /* We get launched at a XKPHYS address but the kernel is linked to
34 run at a KSEG0 address, so jump there. */
35 PTR_LA t0, \@f
36 jr t0
37\@:
38#endif
39 .endm
40
41#ifdef CONFIG_SGI_IP27
42 /*
43 * outputs the local nasid into res. IP27 stuff.
44 */
45 .macro GET_NASID_ASM res
46 dli \res, LOCAL_HUB_ADDR(NI_STATUS_REV_ID)
47 ld \res, (\res)
48 and \res, NSRI_NODEID_MASK
49 dsrl \res, NSRI_NODEID_SHFT
50 .endm
51#endif /* CONFIG_SGI_IP27 */
52
53 /*
54 * inputs are the text nasid in t1, data nasid in t2.
55 */
56 .macro MAPPED_KERNEL_SETUP_TLB
57#ifdef CONFIG_MAPPED_KERNEL
58 /*
59 * This needs to read the nasid - assume 0 for now.
60 * Drop in 0xffffffffc0000000 in tlbhi, 0+VG in tlblo_0,
61 * 0+DVG in tlblo_1.
62 */
63 dli t0, 0xffffffffc0000000
64 dmtc0 t0, CP0_ENTRYHI
65 li t0, 0x1c000 # Offset of text into node memory
66 dsll t1, NASID_SHFT # Shift text nasid into place
67 dsll t2, NASID_SHFT # Same for data nasid
68 or t1, t1, t0 # Physical load address of kernel text
69 or t2, t2, t0 # Physical load address of kernel data
70 dsrl t1, 12 # 4K pfn
71 dsrl t2, 12 # 4K pfn
72 dsll t1, 6 # Get pfn into place
73 dsll t2, 6 # Get pfn into place
74 li t0, ((_PAGE_GLOBAL|_PAGE_VALID| _CACHE_CACHABLE_COW) >> 6)
75 or t0, t0, t1
76 mtc0 t0, CP0_ENTRYLO0 # physaddr, VG, cach exlwr
77 li t0, ((_PAGE_GLOBAL|_PAGE_VALID| _PAGE_DIRTY|_CACHE_CACHABLE_COW) >> 6)
78 or t0, t0, t2
79 mtc0 t0, CP0_ENTRYLO1 # physaddr, DVG, cach exlwr
80 li t0, 0x1ffe000 # MAPPED_KERN_TLBMASK, TLBPGMASK_16M
81 mtc0 t0, CP0_PAGEMASK
82 li t0, 0 # KMAP_INX
83 mtc0 t0, CP0_INDEX
84 li t0, 1
85 mtc0 t0, CP0_WIRED
86 tlbwi
87#else
88 mtc0 zero, CP0_WIRED
89#endif
90 .endm
91
92 /*
93 * For the moment disable interrupts, mark the kernel mode and
94 * set ST0_KX so that the CPU does not spit fire when using
95 * 64-bit addresses. A full initialization of the CPU's status
96 * register is done later in per_cpu_trap_init().
97 */
98 .macro setup_c0_status set clr
99 .set push
100 mfc0 t0, CP0_STATUS
101 or t0, ST0_CU0|\set|0x1f|\clr
102 xor t0, 0x1f|\clr
103 mtc0 t0, CP0_STATUS
104 .set noreorder
105 sll zero,3 # ehb
106 .set pop
107 .endm
108
109 .macro setup_c0_status_pri
110#ifdef CONFIG_MIPS64
111 setup_c0_status ST0_KX 0
112#else
113 setup_c0_status 0 0
114#endif
115 .endm
116
117 .macro setup_c0_status_sec
118#ifdef CONFIG_MIPS64
119 setup_c0_status ST0_KX ST0_BEV
120#else
121 setup_c0_status 0 ST0_BEV
122#endif
123 .endm
124
125 /*
126 * Reserved space for exception handlers.
127 * Necessary for machines which link their kernels at KSEG0.
128 */
129 .fill 0x400
130
131EXPORT(stext) # used for profiling
132EXPORT(_stext)
133
134 __INIT
135
136NESTED(kernel_entry, 16, sp) # kernel entry point
137 setup_c0_status_pri
138
139#ifdef CONFIG_SGI_IP27
140 GET_NASID_ASM t1
141 move t2, t1 # text and data are here
142 MAPPED_KERNEL_SETUP_TLB
143#endif /* IP27 */
144
145 ARC64_TWIDDLE_PC
146
147 PTR_LA t0, __bss_start # clear .bss
148 LONG_S zero, (t0)
149 PTR_LA t1, __bss_stop - LONGSIZE
1501:
151 PTR_ADDIU t0, LONGSIZE
152 LONG_S zero, (t0)
153 bne t0, t1, 1b
154
155 LONG_S a0, fw_arg0 # firmware arguments
156 LONG_S a1, fw_arg1
157 LONG_S a2, fw_arg2
158 LONG_S a3, fw_arg3
159
160 PTR_LA $28, init_thread_union
161 PTR_ADDIU sp, $28, _THREAD_SIZE - 32
162 set_saved_sp sp, t0, t1
163 PTR_SUBU sp, 4 * SZREG # init stack pointer
164
165 j start_kernel
166 END(kernel_entry)
167
168#ifdef CONFIG_SMP
169/*
170 * SMP slave cpus entry point. Board specific code for bootstrap calls this
171 * function after setting up the stack and gp registers.
172 */
173NESTED(smp_bootstrap, 16, sp)
174 setup_c0_status_sec
175
176#ifdef CONFIG_SGI_IP27
177 GET_NASID_ASM t1
178 dli t0, KLDIR_OFFSET + (KLI_KERN_VARS * KLDIR_ENT_SIZE) + \
179 KLDIR_OFF_POINTER + CAC_BASE
180 dsll t1, NASID_SHFT
181 or t0, t0, t1
182 ld t0, 0(t0) # t0 points to kern_vars struct
183 lh t1, KV_RO_NASID_OFFSET(t0)
184 lh t2, KV_RW_NASID_OFFSET(t0)
185 MAPPED_KERNEL_SETUP_TLB
186 ARC64_TWIDDLE_PC
187#endif /* CONFIG_SGI_IP27 */
188
189 j start_secondary
190 END(smp_bootstrap)
191#endif /* CONFIG_SMP */
192
193 __FINIT
194
195 .comm kernelsp, NR_CPUS * 8, 8
196 .comm pgd_current, NR_CPUS * 8, 8
197
198 .comm fw_arg0, SZREG, SZREG # firmware arguments
199 .comm fw_arg1, SZREG, SZREG
200 .comm fw_arg2, SZREG, SZREG
201 .comm fw_arg3, SZREG, SZREG
202
203 .macro page name, order=0
204 .globl \name
205\name: .size \name, (_PAGE_SIZE << \order)
206 .org . + (_PAGE_SIZE << \order)
207 .type \name, @object
208 .endm
209
210 .data
211 .align PAGE_SHIFT
212
213 /*
214 * ... but on 64-bit we've got three-level pagetables with a
215 * slightly different layout ...
216 */
217 page swapper_pg_dir, _PGD_ORDER
218#ifdef CONFIG_MIPS64
219 page invalid_pmd_table, _PMD_ORDER
220#endif
221 page invalid_pte_table, _PTE_ORDER
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
new file mode 100644
index 000000000000..7eec7568bfea
--- /dev/null
+++ b/arch/mips/kernel/i8259.c
@@ -0,0 +1,331 @@
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 * Code to handle x86 style IRQs plus some generic interrupt stuff.
7 *
8 * Copyright (C) 1992 Linus Torvalds
9 * Copyright (C) 1994 - 2000 Ralf Baechle
10 */
11#include <linux/delay.h>
12#include <linux/init.h>
13#include <linux/ioport.h>
14#include <linux/interrupt.h>
15#include <linux/kernel.h>
16#include <linux/spinlock.h>
17#include <linux/sysdev.h>
18
19#include <asm/i8259.h>
20#include <asm/io.h>
21
22void enable_8259A_irq(unsigned int irq);
23void disable_8259A_irq(unsigned int irq);
24
25/*
26 * This is the 'legacy' 8259A Programmable Interrupt Controller,
27 * present in the majority of PC/AT boxes.
28 * plus some generic x86 specific things if generic specifics makes
29 * any sense at all.
30 * this file should become arch/i386/kernel/irq.c when the old irq.c
31 * moves to arch independent land
32 */
33
34spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
35
36static void end_8259A_irq (unsigned int irq)
37{
38 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)) &&
39 irq_desc[irq].action)
40 enable_8259A_irq(irq);
41}
42
43#define shutdown_8259A_irq disable_8259A_irq
44
45void mask_and_ack_8259A(unsigned int);
46
47static unsigned int startup_8259A_irq(unsigned int irq)
48{
49 enable_8259A_irq(irq);
50
51 return 0; /* never anything pending */
52}
53
54static struct hw_interrupt_type i8259A_irq_type = {
55 "XT-PIC",
56 startup_8259A_irq,
57 shutdown_8259A_irq,
58 enable_8259A_irq,
59 disable_8259A_irq,
60 mask_and_ack_8259A,
61 end_8259A_irq,
62 NULL
63};
64
65/*
66 * 8259A PIC functions to handle ISA devices:
67 */
68
69/*
70 * This contains the irq mask for both 8259A irq controllers,
71 */
72static unsigned int cached_irq_mask = 0xffff;
73
74#define cached_21 (cached_irq_mask)
75#define cached_A1 (cached_irq_mask >> 8)
76
77void disable_8259A_irq(unsigned int irq)
78{
79 unsigned int mask = 1 << irq;
80 unsigned long flags;
81
82 spin_lock_irqsave(&i8259A_lock, flags);
83 cached_irq_mask |= mask;
84 if (irq & 8)
85 outb(cached_A1,0xA1);
86 else
87 outb(cached_21,0x21);
88 spin_unlock_irqrestore(&i8259A_lock, flags);
89}
90
91void enable_8259A_irq(unsigned int irq)
92{
93 unsigned int mask = ~(1 << irq);
94 unsigned long flags;
95
96 spin_lock_irqsave(&i8259A_lock, flags);
97 cached_irq_mask &= mask;
98 if (irq & 8)
99 outb(cached_A1,0xA1);
100 else
101 outb(cached_21,0x21);
102 spin_unlock_irqrestore(&i8259A_lock, flags);
103}
104
105int i8259A_irq_pending(unsigned int irq)
106{
107 unsigned int mask = 1 << irq;
108 unsigned long flags;
109 int ret;
110
111 spin_lock_irqsave(&i8259A_lock, flags);
112 if (irq < 8)
113 ret = inb(0x20) & mask;
114 else
115 ret = inb(0xA0) & (mask >> 8);
116 spin_unlock_irqrestore(&i8259A_lock, flags);
117
118 return ret;
119}
120
121void make_8259A_irq(unsigned int irq)
122{
123 disable_irq_nosync(irq);
124 irq_desc[irq].handler = &i8259A_irq_type;
125 enable_irq(irq);
126}
127
128/*
129 * This function assumes to be called rarely. Switching between
130 * 8259A registers is slow.
131 * This has to be protected by the irq controller spinlock
132 * before being called.
133 */
134static inline int i8259A_irq_real(unsigned int irq)
135{
136 int value;
137 int irqmask = 1 << irq;
138
139 if (irq < 8) {
140 outb(0x0B,0x20); /* ISR register */
141 value = inb(0x20) & irqmask;
142 outb(0x0A,0x20); /* back to the IRR register */
143 return value;
144 }
145 outb(0x0B,0xA0); /* ISR register */
146 value = inb(0xA0) & (irqmask >> 8);
147 outb(0x0A,0xA0); /* back to the IRR register */
148 return value;
149}
150
151/*
152 * Careful! The 8259A is a fragile beast, it pretty
153 * much _has_ to be done exactly like this (mask it
154 * first, _then_ send the EOI, and the order of EOI
155 * to the two 8259s is important!
156 */
157void mask_and_ack_8259A(unsigned int irq)
158{
159 unsigned int irqmask = 1 << irq;
160 unsigned long flags;
161
162 spin_lock_irqsave(&i8259A_lock, flags);
163 /*
164 * Lightweight spurious IRQ detection. We do not want to overdo
165 * spurious IRQ handling - it's usually a sign of hardware problems, so
166 * we only do the checks we can do without slowing down good hardware
167 * nnecesserily.
168 *
169 * Note that IRQ7 and IRQ15 (the two spurious IRQs usually resulting
170 * rom the 8259A-1|2 PICs) occur even if the IRQ is masked in the 8259A.
171 * Thus we can check spurious 8259A IRQs without doing the quite slow
172 * i8259A_irq_real() call for every IRQ. This does not cover 100% of
173 * spurious interrupts, but should be enough to warn the user that
174 * there is something bad going on ...
175 */
176 if (cached_irq_mask & irqmask)
177 goto spurious_8259A_irq;
178 cached_irq_mask |= irqmask;
179
180handle_real_irq:
181 if (irq & 8) {
182 inb(0xA1); /* DUMMY - (do we need this?) */
183 outb(cached_A1,0xA1);
184 outb(0x60+(irq&7),0xA0);/* 'Specific EOI' to slave */
185 outb(0x62,0x20); /* 'Specific EOI' to master-IRQ2 */
186 } else {
187 inb(0x21); /* DUMMY - (do we need this?) */
188 outb(cached_21,0x21);
189 outb(0x60+irq,0x20); /* 'Specific EOI' to master */
190 }
191 spin_unlock_irqrestore(&i8259A_lock, flags);
192 return;
193
194spurious_8259A_irq:
195 /*
196 * this is the slow path - should happen rarely.
197 */
198 if (i8259A_irq_real(irq))
199 /*
200 * oops, the IRQ _is_ in service according to the
201 * 8259A - not spurious, go handle it.
202 */
203 goto handle_real_irq;
204
205 {
206 static int spurious_irq_mask = 0;
207 /*
208 * At this point we can be sure the IRQ is spurious,
209 * lets ACK and report it. [once per IRQ]
210 */
211 if (!(spurious_irq_mask & irqmask)) {
212 printk(KERN_DEBUG "spurious 8259A interrupt: IRQ%d.\n", irq);
213 spurious_irq_mask |= irqmask;
214 }
215 atomic_inc(&irq_err_count);
216 /*
217 * Theoretically we do not have to handle this IRQ,
218 * but in Linux this does not cause problems and is
219 * simpler for us.
220 */
221 goto handle_real_irq;
222 }
223}
224
225static int i8259A_resume(struct sys_device *dev)
226{
227 init_8259A(0);
228 return 0;
229}
230
231static struct sysdev_class i8259_sysdev_class = {
232 set_kset_name("i8259"),
233 .resume = i8259A_resume,
234};
235
236static struct sys_device device_i8259A = {
237 .id = 0,
238 .cls = &i8259_sysdev_class,
239};
240
241static int __init i8259A_init_sysfs(void)
242{
243 int error = sysdev_class_register(&i8259_sysdev_class);
244 if (!error)
245 error = sysdev_register(&device_i8259A);
246 return error;
247}
248
249device_initcall(i8259A_init_sysfs);
250
251void __init init_8259A(int auto_eoi)
252{
253 unsigned long flags;
254
255 spin_lock_irqsave(&i8259A_lock, flags);
256
257 outb(0xff, 0x21); /* mask all of 8259A-1 */
258 outb(0xff, 0xA1); /* mask all of 8259A-2 */
259
260 /*
261 * outb_p - this has to work on a wide range of PC hardware.
262 */
263 outb_p(0x11, 0x20); /* ICW1: select 8259A-1 init */
264 outb_p(0x00, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x00-0x07 */
265 outb_p(0x04, 0x21); /* 8259A-1 (the master) has a slave on IR2 */
266 if (auto_eoi)
267 outb_p(0x03, 0x21); /* master does Auto EOI */
268 else
269 outb_p(0x01, 0x21); /* master expects normal EOI */
270
271 outb_p(0x11, 0xA0); /* ICW1: select 8259A-2 init */
272 outb_p(0x08, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x08-0x0f */
273 outb_p(0x02, 0xA1); /* 8259A-2 is a slave on master's IR2 */
274 outb_p(0x01, 0xA1); /* (slave's support for AEOI in flat mode
275 is to be investigated) */
276
277 if (auto_eoi)
278 /*
279 * in AEOI mode we just have to mask the interrupt
280 * when acking.
281 */
282 i8259A_irq_type.ack = disable_8259A_irq;
283 else
284 i8259A_irq_type.ack = mask_and_ack_8259A;
285
286 udelay(100); /* wait for 8259A to initialize */
287
288 outb(cached_21, 0x21); /* restore master IRQ mask */
289 outb(cached_A1, 0xA1); /* restore slave IRQ mask */
290
291 spin_unlock_irqrestore(&i8259A_lock, flags);
292}
293
294/*
295 * IRQ2 is cascade interrupt to second interrupt controller
296 */
297static struct irqaction irq2 = {
298 no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL
299};
300
301static struct resource pic1_io_resource = {
302 "pic1", 0x20, 0x3f, IORESOURCE_BUSY
303};
304
305static struct resource pic2_io_resource = {
306 "pic2", 0xa0, 0xbf, IORESOURCE_BUSY
307};
308
309/*
310 * On systems with i8259-style interrupt controllers we assume for
311 * driver compatibility reasons interrupts 0 - 15 to be the i8295
312 * interrupts even if the hardware uses a different interrupt numbering.
313 */
314void __init init_i8259_irqs (void)
315{
316 int i;
317
318 request_resource(&ioport_resource, &pic1_io_resource);
319 request_resource(&ioport_resource, &pic2_io_resource);
320
321 init_8259A(0);
322
323 for (i = 0; i < 16; i++) {
324 irq_desc[i].status = IRQ_DISABLED;
325 irq_desc[i].action = 0;
326 irq_desc[i].depth = 1;
327 irq_desc[i].handler = &i8259A_irq_type;
328 }
329
330 setup_irq(2, &irq2);
331}
diff --git a/arch/mips/kernel/init_task.c b/arch/mips/kernel/init_task.c
new file mode 100644
index 000000000000..aeda7f58391b
--- /dev/null
+++ b/arch/mips/kernel/init_task.c
@@ -0,0 +1,42 @@
1#include <linux/mm.h>
2#include <linux/module.h>
3#include <linux/sched.h>
4#include <linux/init_task.h>
5#include <linux/fs.h>
6#include <linux/mqueue.h>
7
8#include <asm/thread_info.h>
9#include <asm/uaccess.h>
10#include <asm/pgtable.h>
11
12static struct fs_struct init_fs = INIT_FS;
13static struct files_struct init_files = INIT_FILES;
14static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16struct mm_struct init_mm = INIT_MM(init_mm);
17
18EXPORT_SYMBOL(init_mm);
19
20/*
21 * Initial thread structure.
22 *
23 * We need to make sure that this is 8192-byte aligned due to the
24 * way process stacks are handled. This is done by making sure
25 * the linker maps this in the .text segment right after head.S,
26 * and making head.S ensure the proper alignment.
27 *
28 * The things we do for performance..
29 */
30union thread_union init_thread_union
31 __attribute__((__section__(".data.init_task"),
32 __aligned__(THREAD_SIZE))) =
33 { INIT_THREAD_INFO(init_task) };
34
35/*
36 * Initial task structure.
37 *
38 * All other task structs will be allocated on slabs in fork.c
39 */
40struct task_struct init_task = INIT_TASK(init_task);
41
42EXPORT_SYMBOL(init_task);
diff --git a/arch/mips/kernel/ioctl32.c b/arch/mips/kernel/ioctl32.c
new file mode 100644
index 000000000000..519cd5d0aebb
--- /dev/null
+++ b/arch/mips/kernel/ioctl32.c
@@ -0,0 +1,58 @@
1/*
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
3 *
4 * Copyright (C) 2000 Silicon Graphics, Inc.
5 * Written by Ulf Carlsson (ulfc@engr.sgi.com)
6 * Copyright (C) 2000, 2004 Ralf Baechle
7 * Copyright (C) 2002, 2003 Maciej W. Rozycki
8 */
9#define INCLUDES
10#include "compat_ioctl.c"
11
12#include <linux/config.h>
13#include <linux/types.h>
14#include <linux/compat.h>
15#include <linux/ioctl32.h>
16#include <linux/syscalls.h>
17
18#ifdef CONFIG_SIBYTE_TBPROF
19#include <asm/sibyte/trace_prof.h>
20#endif
21
22#define A(__x) ((unsigned long)(__x))
23
24long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
25
26#define CODE
27#include "compat_ioctl.c"
28
29typedef int (* ioctl32_handler_t)(unsigned int, unsigned int, unsigned long, struct file *);
30
31#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl)
32#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl32_handler_t)(handler), NULL },
33#define IOCTL_TABLE_START \
34 struct ioctl_trans ioctl_start[] = {
35#define IOCTL_TABLE_END \
36 };
37
38IOCTL_TABLE_START
39
40#include <linux/compat_ioctl.h>
41#define DECLARES
42#include "compat_ioctl.c"
43
44#ifdef CONFIG_SIBYTE_TBPROF
45COMPATIBLE_IOCTL(SBPROF_ZBSTART)
46COMPATIBLE_IOCTL(SBPROF_ZBSTOP)
47COMPATIBLE_IOCTL(SBPROF_ZBWAITFULL)
48#endif /* CONFIG_SIBYTE_TBPROF */
49
50/*HANDLE_IOCTL(RTC_IRQP_READ, w_long)
51COMPATIBLE_IOCTL(RTC_IRQP_SET)
52HANDLE_IOCTL(RTC_EPOCH_READ, w_long)
53COMPATIBLE_IOCTL(RTC_EPOCH_SET)
54*/
55
56IOCTL_TABLE_END
57
58int ioctl_table_size = ARRAY_SIZE(ioctl_start);
diff --git a/arch/mips/kernel/irix5sys.S b/arch/mips/kernel/irix5sys.S
new file mode 100644
index 000000000000..eeef891093ed
--- /dev/null
+++ b/arch/mips/kernel/irix5sys.S
@@ -0,0 +1,1041 @@
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 * 32-bit IRIX5 ABI system call table derived from original file 'irix5sys.h'
7 * created by David S. Miller.
8 *
9 * Copyright (C) 1996 - 2004 David S. Miller <dm@engr.sgi.com>
10 * Copyright (C) 2004 Steven J. Hill <sjhill@realitydiluted.com>
11 */
12#include <asm/asm.h>
13
14 /*
15 * Key:
16 * V == Valid and should work as expected for most cases.
17 * HV == Half Valid, some things will work, some likely will not
18 * IV == InValid, certainly will not work at all yet
19 * ?V == ?'ably Valid, I have not done enough looking into it
20 * DC == Don't Care, a rats ass we couldn't give
21 */
22
23 .macro irix5syscalltable
24
25 sys sys_syscall 0 /* 1000 sysindir() V*/
26 sys sys_exit 1 /* 1001 exit() V*/
27 sys sys_fork 0 /* 1002 fork() V*/
28 sys sys_read 3 /* 1003 read() V*/
29 sys sys_write 3 /* 1004 write() V*/
30 sys sys_open 3 /* 1005 open() V*/
31 sys sys_close 1 /* 1006 close() V*/
32 sys irix_unimp 0 /* 1007 (XXX IRIX 4 wait) V*/
33 sys sys_creat 2 /* 1008 creat() V*/
34 sys sys_link 2 /* 1009 link() V*/
35 sys sys_unlink 1 /* 1010 unlink() V*/
36 sys irix_exec 0 /* 1011 exec() V*/
37 sys sys_chdir 1 /* 1012 chdir() V*/
38 sys irix_gtime 0 /* 1013 time() V*/
39 sys irix_unimp 0 /* 1014 (XXX IRIX 4 mknod) V*/
40 sys sys_chmod 2 /* 1015 chmod() V*/
41 sys sys_chown 3 /* 1016 chown() V*/
42 sys irix_brk 1 /* 1017 break() V*/
43 sys irix_unimp 0 /* 1018 (XXX IRIX 4 stat) V*/
44 sys sys_lseek 3 /* 1019 lseek() XXX64bit HV*/
45 sys irix_getpid 0 /* 1020 getpid() V*/
46 sys irix_mount 6 /* 1021 mount() IV*/
47 sys sys_umount 1 /* 1022 umount() V*/
48 sys sys_setuid 1 /* 1023 setuid() V*/
49 sys irix_getuid 0 /* 1024 getuid() V*/
50 sys irix_stime 1 /* 1025 stime() V*/
51 sys irix_unimp 4 /* 1026 XXX ptrace() IV*/
52 sys irix_alarm 1 /* 1027 alarm() V*/
53 sys irix_unimp 0 /* 1028 (XXX IRIX 4 fstat) V*/
54 sys irix_pause 0 /* 1029 pause() V*/
55 sys sys_utime 2 /* 1030 utime() V*/
56 sys irix_unimp 0 /* 1031 nuthin' V*/
57 sys irix_unimp 0 /* 1032 nobody home man... V*/
58 sys sys_access 2 /* 1033 access() V*/
59 sys sys_nice 1 /* 1034 nice() V*/
60 sys irix_statfs 2 /* 1035 statfs() V*/
61 sys sys_sync 0 /* 1036 sync() V*/
62 sys sys_kill 2 /* 1037 kill() V*/
63 sys irix_fstatfs 2 /* 1038 fstatfs() V*/
64 sys irix_setpgrp 1 /* 1039 setpgrp() V*/
65 sys irix_syssgi 0 /* 1040 syssgi() HV*/
66 sys sys_dup 1 /* 1041 dup() V*/
67 sys sys_pipe 0 /* 1042 pipe() V*/
68 sys irix_times 1 /* 1043 times() V*/
69 sys irix_unimp 0 /* 1044 XXX profil() IV*/
70 sys irix_unimp 0 /* 1045 XXX lock() IV*/
71 sys sys_setgid 1 /* 1046 setgid() V*/
72 sys irix_getgid 0 /* 1047 getgid() V*/
73 sys irix_unimp 0 /* 1048 (XXX IRIX 4 ssig) V*/
74 sys irix_msgsys 6 /* 1049 sys_msgsys V*/
75 sys sys_sysmips 4 /* 1050 sysmips() HV*/
76 sys irix_unimp 0 /* 1051 XXX sysacct() IV*/
77 sys irix_shmsys 5 /* 1052 sys_shmsys V*/
78 sys irix_semsys 0 /* 1053 sys_semsys V*/
79 sys irix_ioctl 3 /* 1054 ioctl() HV*/
80 sys irix_uadmin 0 /* 1055 XXX sys_uadmin() HC*/
81 sys irix_sysmp 0 /* 1056 sysmp() HV*/
82 sys irix_utssys 4 /* 1057 sys_utssys() HV*/
83 sys irix_unimp 0 /* 1058 nada enchilada V*/
84 sys irix_exece 0 /* 1059 exece() V*/
85 sys sys_umask 1 /* 1060 umask() V*/
86 sys sys_chroot 1 /* 1061 chroot() V*/
87 sys irix_fcntl 3 /* 1062 fcntl() ?V*/
88 sys irix_ulimit 2 /* 1063 ulimit() HV*/
89 sys irix_unimp 0 /* 1064 XXX AFS shit DC*/
90 sys irix_unimp 0 /* 1065 XXX AFS shit DC*/
91 sys irix_unimp 0 /* 1066 XXX AFS shit DC*/
92 sys irix_unimp 0 /* 1067 XXX AFS shit DC*/
93 sys irix_unimp 0 /* 1068 XXX AFS shit DC*/
94 sys irix_unimp 0 /* 1069 XXX AFS shit DC*/
95 sys irix_unimp 0 /* 1070 XXX AFS shit DC*/
96 sys irix_unimp 0 /* 1071 XXX AFS shit DC*/
97 sys irix_unimp 0 /* 1072 XXX AFS shit DC*/
98 sys irix_unimp 0 /* 1073 XXX AFS shit DC*/
99 sys irix_unimp 0 /* 1074 nuttin' V*/
100 sys irix_unimp 0 /* 1075 XXX sys_getrlimit64()IV*/
101 sys irix_unimp 0 /* 1076 XXX sys_setrlimit64()IV*/
102 sys sys_nanosleep 2 /* 1077 nanosleep() V*/
103 sys irix_lseek64 5 /* 1078 lseek64() ?V*/
104 sys sys_rmdir 1 /* 1079 rmdir() V*/
105 sys sys_mkdir 2 /* 1080 mkdir() V*/
106 sys sys_getdents 3 /* 1081 getdents() V*/
107 sys irix_sginap 1 /* 1082 sys_sginap() V*/
108 sys irix_sgikopt 3 /* 1083 sys_sgikopt() DC*/
109 sys sys_sysfs 3 /* 1084 sysfs() ?V*/
110 sys irix_unimp 0 /* 1085 XXX sys_getmsg() DC*/
111 sys irix_unimp 0 /* 1086 XXX sys_putmsg() DC*/
112 sys sys_poll 3 /* 1087 poll() V*/
113 sys irix_sigreturn 0 /* 1088 sigreturn() ?V*/
114 sys sys_accept 3 /* 1089 accept() V*/
115 sys sys_bind 3 /* 1090 bind() V*/
116 sys sys_connect 3 /* 1091 connect() V*/
117 sys irix_gethostid 0 /* 1092 sys_gethostid() ?V*/
118 sys sys_getpeername 3 /* 1093 getpeername() V*/
119 sys sys_getsockname 3 /* 1094 getsockname() V*/
120 sys sys_getsockopt 5 /* 1095 getsockopt() V*/
121 sys sys_listen 2 /* 1096 listen() V*/
122 sys sys_recv 4 /* 1097 recv() V*/
123 sys sys_recvfrom 6 /* 1098 recvfrom() V*/
124 sys sys_recvmsg 3 /* 1099 recvmsg() V*/
125 sys sys_select 5 /* 1100 select() V*/
126 sys sys_send 4 /* 1101 send() V*/
127 sys sys_sendmsg 3 /* 1102 sendmsg() V*/
128 sys sys_sendto 6 /* 1103 sendto() V*/
129 sys irix_sethostid 1 /* 1104 sys_sethostid() ?V*/
130 sys sys_setsockopt 5 /* 1105 setsockopt() V*/
131 sys sys_shutdown 2 /* 1106 shutdown() ?V*/
132 sys irix_socket 3 /* 1107 socket() V*/
133 sys sys_gethostname 2 /* 1108 sys_gethostname() ?V*/
134 sys sys_sethostname 2 /* 1109 sethostname() ?V*/
135 sys irix_getdomainname 2 /* 1110 sys_getdomainname() ?V*/
136 sys sys_setdomainname 2 /* 1111 setdomainname() ?V*/
137 sys sys_truncate 2 /* 1112 truncate() V*/
138 sys sys_ftruncate 2 /* 1113 ftruncate() V*/
139 sys sys_rename 2 /* 1114 rename() V*/
140 sys sys_symlink 2 /* 1115 symlink() V*/
141 sys sys_readlink 3 /* 1116 readlink() V*/
142 sys irix_unimp 0 /* 1117 XXX IRIX 4 lstat() DC*/
143 sys irix_unimp 0 /* 1118 nothin' V*/
144 sys irix_unimp 0 /* 1119 XXX nfs_svc() DC*/
145 sys irix_unimp 0 /* 1120 XXX nfs_getfh() DC*/
146 sys irix_unimp 0 /* 1121 XXX async_daemon() DC*/
147 sys irix_unimp 0 /* 1122 XXX exportfs() DC*/
148 sys sys_setregid 2 /* 1123 setregid() V*/
149 sys sys_setreuid 2 /* 1124 setreuid() V*/
150 sys sys_getitimer 2 /* 1125 getitimer() V*/
151 sys sys_setitimer 3 /* 1126 setitimer() V*/
152 sys irix_unimp 1 /* 1127 XXX adjtime() IV*/
153 sys irix_gettimeofday 1 /* 1128 gettimeofday() V*/
154 sys irix_unimp 0 /* 1129 XXX sproc() IV*/
155 sys irix_prctl 0 /* 1130 prctl() HV*/
156 sys irix_unimp 0 /* 1131 XXX procblk() IV*/
157 sys irix_unimp 0 /* 1132 XXX sprocsp() IV*/
158 sys irix_unimp 0 /* 1133 XXX sgigsc() IV*/
159 sys irix_mmap32 6 /* 1134 mmap() XXXflags? ?V*/
160 sys sys_munmap 2 /* 1135 munmap() V*/
161 sys sys_mprotect 3 /* 1136 mprotect() V*/
162 sys sys_msync 4 /* 1137 msync() V*/
163 sys irix_madvise 3 /* 1138 madvise() DC*/
164 sys irix_pagelock 3 /* 1139 pagelock() IV*/
165 sys irix_getpagesize 0 /* 1140 getpagesize() V*/
166 sys irix_quotactl 0 /* 1141 quotactl() V*/
167 sys irix_unimp 0 /* 1142 nobody home man V*/
168 sys sys_getpgid 1 /* 1143 BSD getpgrp() V*/
169 sys irix_BSDsetpgrp 2 /* 1143 BSD setpgrp() V*/
170 sys sys_vhangup 0 /* 1144 vhangup() V*/
171 sys sys_fsync 1 /* 1145 fsync() V*/
172 sys sys_fchdir 1 /* 1146 fchdir() V*/
173 sys sys_getrlimit 2 /* 1147 getrlimit() ?V*/
174 sys sys_setrlimit 2 /* 1148 setrlimit() ?V*/
175 sys sys_cacheflush 3 /* 1150 cacheflush() HV*/
176 sys sys_cachectl 3 /* 1151 cachectl() HV*/
177 sys sys_fchown 3 /* 1152 fchown() ?V*/
178 sys sys_fchmod 2 /* 1153 fchmod() ?V*/
179 sys irix_unimp 0 /* 1154 XXX IRIX 4 wait3() V*/
180 sys sys_socketpair 4 /* 1155 socketpair() V*/
181 sys irix_systeminfo 3 /* 1156 systeminfo() IV*/
182 sys irix_uname 1 /* 1157 uname() IV*/
183 sys irix_xstat 3 /* 1158 xstat() V*/
184 sys irix_lxstat 3 /* 1159 lxstat() V*/
185 sys irix_fxstat 3 /* 1160 fxstat() V*/
186 sys irix_xmknod 0 /* 1161 xmknod() ?V*/
187 sys irix_sigaction 4 /* 1162 sigaction() ?V*/
188 sys irix_sigpending 1 /* 1163 sigpending() ?V*/
189 sys irix_sigprocmask 3 /* 1164 sigprocmask() ?V*/
190 sys irix_sigsuspend 0 /* 1165 sigsuspend() ?V*/
191 sys irix_sigpoll_sys 3 /* 1166 sigpoll_sys() IV*/
192 sys irix_swapctl 2 /* 1167 swapctl() IV*/
193 sys irix_getcontext 0 /* 1168 getcontext() HV*/
194 sys irix_setcontext 0 /* 1169 setcontext() HV*/
195 sys irix_waitsys 5 /* 1170 waitsys() IV*/
196 sys irix_sigstack 2 /* 1171 sigstack() HV*/
197 sys irix_sigaltstack 2 /* 1172 sigaltstack() HV*/
198 sys irix_sigsendset 2 /* 1173 sigsendset() IV*/
199 sys irix_statvfs 2 /* 1174 statvfs() V*/
200 sys irix_fstatvfs 2 /* 1175 fstatvfs() V*/
201 sys irix_unimp 0 /* 1176 XXX getpmsg() DC*/
202 sys irix_unimp 0 /* 1177 XXX putpmsg() DC*/
203 sys sys_lchown 3 /* 1178 lchown() V*/
204 sys irix_priocntl 0 /* 1179 priocntl() DC*/
205 sys irix_sigqueue 4 /* 1180 sigqueue() IV*/
206 sys sys_readv 3 /* 1181 readv() V*/
207 sys sys_writev 3 /* 1182 writev() V*/
208 sys irix_truncate64 4 /* 1183 truncate64() XX32bit HV*/
209 sys irix_ftruncate64 4 /* 1184 ftruncate64()XX32bit HV*/
210 sys irix_mmap64 0 /* 1185 mmap64() XX32bit HV*/
211 sys irix_dmi 0 /* 1186 dmi() DC*/
212 sys irix_pread 6 /* 1187 pread() IV*/
213 sys irix_pwrite 6 /* 1188 pwrite() IV*/
214 sys sys_fsync 1 /* 1189 fdatasync() XXPOSIX HV*/
215 sys irix_sgifastpath 7 /* 1190 sgifastpath() WHEEE IV*/
216 sys irix_unimp 0 /* 1191 XXX attr_get() DC*/
217 sys irix_unimp 0 /* 1192 XXX attr_getf() DC*/
218 sys irix_unimp 0 /* 1193 XXX attr_set() DC*/
219 sys irix_unimp 0 /* 1194 XXX attr_setf() DC*/
220 sys irix_unimp 0 /* 1195 XXX attr_remove() DC*/
221 sys irix_unimp 0 /* 1196 XXX attr_removef() DC*/
222 sys irix_unimp 0 /* 1197 XXX attr_list() DC*/
223 sys irix_unimp 0 /* 1198 XXX attr_listf() DC*/
224 sys irix_unimp 0 /* 1199 XXX attr_multi() DC*/
225 sys irix_unimp 0 /* 1200 XXX attr_multif() DC*/
226 sys irix_statvfs64 2 /* 1201 statvfs64() V*/
227 sys irix_fstatvfs64 2 /* 1202 fstatvfs64() V*/
228 sys irix_getmountid 2 /* 1203 getmountid()XXXfsids HV*/
229 sys irix_nsproc 5 /* 1204 nsproc() IV*/
230 sys irix_getdents64 3 /* 1205 getdents64() HV*/
231 sys irix_unimp 0 /* 1206 XXX DFS garbage DC*/
232 sys irix_ngetdents 4 /* 1207 ngetdents() XXXeop HV*/
233 sys irix_ngetdents64 4 /* 1208 ngetdents64() XXXeop HV*/
234 sys irix_unimp 0 /* 1209 nothin' V*/
235 sys irix_unimp 0 /* 1210 XXX pidsprocsp() */
236 sys irix_unimp 0 /* 1211 XXX rexec() */
237 sys irix_unimp 0 /* 1212 XXX timer_create() */
238 sys irix_unimp 0 /* 1213 XXX timer_delete() */
239 sys irix_unimp 0 /* 1214 XXX timer_settime() */
240 sys irix_unimp 0 /* 1215 XXX timer_gettime() */
241 sys irix_unimp 0 /* 1216 XXX timer_setoverrun() */
242 sys sys_sched_rr_get_interval 2 /* 1217 sched_rr_get_interval()V*/
243 sys sys_sched_yield 0 /* 1218 sched_yield() V*/
244 sys sys_sched_getscheduler 1 /* 1219 sched_getscheduler() V*/
245 sys sys_sched_setscheduler 3 /* 1220 sched_setscheduler() V*/
246 sys sys_sched_getparam 2 /* 1221 sched_getparam() V*/
247 sys sys_sched_setparam 2 /* 1222 sched_setparam() V*/
248 sys irix_unimp 0 /* 1223 XXX usync_cntl() */
249 sys irix_unimp 0 /* 1224 XXX psema_cntl() */
250 sys irix_unimp 0 /* 1225 XXX restartreturn() */
251
252 /* Just to pad things out nicely. */
253 sys irix_unimp 0
254 sys irix_unimp 0
255 sys irix_unimp 0
256 sys irix_unimp 0
257 sys irix_unimp 0
258 sys irix_unimp 0
259 sys irix_unimp 0
260 sys irix_unimp 0
261 sys irix_unimp 0
262 sys irix_unimp 0
263 sys irix_unimp 0
264 sys irix_unimp 0
265 sys irix_unimp 0
266 sys irix_unimp 0
267 sys irix_unimp 0
268 sys irix_unimp 0
269 sys irix_unimp 0
270 sys irix_unimp 0
271 sys irix_unimp 0
272 sys irix_unimp 0
273 sys irix_unimp 0
274 sys irix_unimp 0
275 sys irix_unimp 0
276 sys irix_unimp 0
277 sys irix_unimp 0
278 sys irix_unimp 0
279 sys irix_unimp 0
280 sys irix_unimp 0
281 sys irix_unimp 0
282 sys irix_unimp 0
283 sys irix_unimp 0
284 sys irix_unimp 0
285 sys irix_unimp 0
286 sys irix_unimp 0
287 sys irix_unimp 0
288 sys irix_unimp 0
289 sys irix_unimp 0
290 sys irix_unimp 0
291 sys irix_unimp 0
292 sys irix_unimp 0
293 sys irix_unimp 0
294 sys irix_unimp 0
295 sys irix_unimp 0
296 sys irix_unimp 0
297 sys irix_unimp 0
298 sys irix_unimp 0
299 sys irix_unimp 0
300 sys irix_unimp 0
301 sys irix_unimp 0
302 sys irix_unimp 0
303 sys irix_unimp 0
304 sys irix_unimp 0
305 sys irix_unimp 0
306 sys irix_unimp 0
307 sys irix_unimp 0
308 sys irix_unimp 0
309 sys irix_unimp 0
310 sys irix_unimp 0
311 sys irix_unimp 0
312 sys irix_unimp 0
313 sys irix_unimp 0
314 sys irix_unimp 0
315 sys irix_unimp 0
316 sys irix_unimp 0
317 sys irix_unimp 0
318 sys irix_unimp 0
319 sys irix_unimp 0
320 sys irix_unimp 0
321 sys irix_unimp 0
322 sys irix_unimp 0
323 sys irix_unimp 0
324 sys irix_unimp 0
325 sys irix_unimp 0
326 sys irix_unimp 0
327 sys irix_unimp 0
328 sys irix_unimp 0
329 sys irix_unimp 0
330 sys irix_unimp 0
331 sys irix_unimp 0
332 sys irix_unimp 0
333 sys irix_unimp 0
334 sys irix_unimp 0
335 sys irix_unimp 0
336 sys irix_unimp 0
337 sys irix_unimp 0
338 sys irix_unimp 0
339 sys irix_unimp 0
340 sys irix_unimp 0
341 sys irix_unimp 0
342 sys irix_unimp 0
343 sys irix_unimp 0
344 sys irix_unimp 0
345 sys irix_unimp 0
346 sys irix_unimp 0
347 sys irix_unimp 0
348 sys irix_unimp 0
349 sys irix_unimp 0
350 sys irix_unimp 0
351 sys irix_unimp 0
352 sys irix_unimp 0
353 sys irix_unimp 0
354 sys irix_unimp 0
355 sys irix_unimp 0
356 sys irix_unimp 0
357 sys irix_unimp 0
358 sys irix_unimp 0
359 sys irix_unimp 0
360 sys irix_unimp 0
361 sys irix_unimp 0
362 sys irix_unimp 0
363 sys irix_unimp 0
364 sys irix_unimp 0
365 sys irix_unimp 0
366 sys irix_unimp 0
367 sys irix_unimp 0
368 sys irix_unimp 0
369 sys irix_unimp 0
370 sys irix_unimp 0
371 sys irix_unimp 0
372 sys irix_unimp 0
373 sys irix_unimp 0
374 sys irix_unimp 0
375 sys irix_unimp 0
376 sys irix_unimp 0
377 sys irix_unimp 0
378 sys irix_unimp 0
379 sys irix_unimp 0
380 sys irix_unimp 0
381 sys irix_unimp 0
382 sys irix_unimp 0
383 sys irix_unimp 0
384 sys irix_unimp 0
385 sys irix_unimp 0
386 sys irix_unimp 0
387 sys irix_unimp 0
388 sys irix_unimp 0
389 sys irix_unimp 0
390 sys irix_unimp 0
391 sys irix_unimp 0
392 sys irix_unimp 0
393 sys irix_unimp 0
394 sys irix_unimp 0
395 sys irix_unimp 0
396 sys irix_unimp 0
397 sys irix_unimp 0
398 sys irix_unimp 0
399 sys irix_unimp 0
400 sys irix_unimp 0
401 sys irix_unimp 0
402 sys irix_unimp 0
403 sys irix_unimp 0
404 sys irix_unimp 0
405 sys irix_unimp 0
406 sys irix_unimp 0
407 sys irix_unimp 0
408 sys irix_unimp 0
409 sys irix_unimp 0
410 sys irix_unimp 0
411 sys irix_unimp 0
412 sys irix_unimp 0
413 sys irix_unimp 0
414 sys irix_unimp 0
415 sys irix_unimp 0
416 sys irix_unimp 0
417 sys irix_unimp 0
418 sys irix_unimp 0
419 sys irix_unimp 0
420 sys irix_unimp 0
421 sys irix_unimp 0
422 sys irix_unimp 0
423 sys irix_unimp 0
424 sys irix_unimp 0
425 sys irix_unimp 0
426 sys irix_unimp 0
427 sys irix_unimp 0
428 sys irix_unimp 0
429 sys irix_unimp 0
430 sys irix_unimp 0
431 sys irix_unimp 0
432 sys irix_unimp 0
433 sys irix_unimp 0
434 sys irix_unimp 0
435 sys irix_unimp 0
436 sys irix_unimp 0
437 sys irix_unimp 0
438 sys irix_unimp 0
439 sys irix_unimp 0
440 sys irix_unimp 0
441 sys irix_unimp 0
442 sys irix_unimp 0
443 sys irix_unimp 0
444 sys irix_unimp 0
445 sys irix_unimp 0
446 sys irix_unimp 0
447 sys irix_unimp 0
448 sys irix_unimp 0
449 sys irix_unimp 0
450 sys irix_unimp 0
451 sys irix_unimp 0
452 sys irix_unimp 0
453 sys irix_unimp 0
454 sys irix_unimp 0
455 sys irix_unimp 0
456 sys irix_unimp 0
457 sys irix_unimp 0
458 sys irix_unimp 0
459 sys irix_unimp 0
460 sys irix_unimp 0
461 sys irix_unimp 0
462 sys irix_unimp 0
463 sys irix_unimp 0
464 sys irix_unimp 0
465 sys irix_unimp 0
466 sys irix_unimp 0
467 sys irix_unimp 0
468 sys irix_unimp 0
469 sys irix_unimp 0
470 sys irix_unimp 0
471 sys irix_unimp 0
472 sys irix_unimp 0
473 sys irix_unimp 0
474 sys irix_unimp 0
475 sys irix_unimp 0
476 sys irix_unimp 0
477 sys irix_unimp 0
478 sys irix_unimp 0
479 sys irix_unimp 0
480 sys irix_unimp 0
481 sys irix_unimp 0
482 sys irix_unimp 0
483 sys irix_unimp 0
484 sys irix_unimp 0
485 sys irix_unimp 0
486 sys irix_unimp 0
487 sys irix_unimp 0
488 sys irix_unimp 0
489 sys irix_unimp 0
490 sys irix_unimp 0
491 sys irix_unimp 0
492 sys irix_unimp 0
493 sys irix_unimp 0
494 sys irix_unimp 0
495 sys irix_unimp 0
496 sys irix_unimp 0
497 sys irix_unimp 0
498 sys irix_unimp 0
499 sys irix_unimp 0
500 sys irix_unimp 0
501 sys irix_unimp 0
502 sys irix_unimp 0
503 sys irix_unimp 0
504 sys irix_unimp 0
505 sys irix_unimp 0
506 sys irix_unimp 0
507 sys irix_unimp 0
508 sys irix_unimp 0
509 sys irix_unimp 0
510 sys irix_unimp 0
511 sys irix_unimp 0
512 sys irix_unimp 0
513 sys irix_unimp 0
514 sys irix_unimp 0
515 sys irix_unimp 0
516 sys irix_unimp 0
517 sys irix_unimp 0
518 sys irix_unimp 0
519 sys irix_unimp 0
520 sys irix_unimp 0
521 sys irix_unimp 0
522 sys irix_unimp 0
523 sys irix_unimp 0
524 sys irix_unimp 0
525 sys irix_unimp 0
526 sys irix_unimp 0
527 sys irix_unimp 0
528 sys irix_unimp 0
529 sys irix_unimp 0
530 sys irix_unimp 0
531 sys irix_unimp 0
532 sys irix_unimp 0
533 sys irix_unimp 0
534 sys irix_unimp 0
535 sys irix_unimp 0
536 sys irix_unimp 0
537 sys irix_unimp 0
538 sys irix_unimp 0
539 sys irix_unimp 0
540 sys irix_unimp 0
541 sys irix_unimp 0
542 sys irix_unimp 0
543 sys irix_unimp 0
544 sys irix_unimp 0
545 sys irix_unimp 0
546 sys irix_unimp 0
547 sys irix_unimp 0
548 sys irix_unimp 0
549 sys irix_unimp 0
550 sys irix_unimp 0
551 sys irix_unimp 0
552 sys irix_unimp 0
553 sys irix_unimp 0
554 sys irix_unimp 0
555 sys irix_unimp 0
556 sys irix_unimp 0
557 sys irix_unimp 0
558 sys irix_unimp 0
559 sys irix_unimp 0
560 sys irix_unimp 0
561 sys irix_unimp 0
562 sys irix_unimp 0
563 sys irix_unimp 0
564 sys irix_unimp 0
565 sys irix_unimp 0
566 sys irix_unimp 0
567 sys irix_unimp 0
568 sys irix_unimp 0
569 sys irix_unimp 0
570 sys irix_unimp 0
571 sys irix_unimp 0
572 sys irix_unimp 0
573 sys irix_unimp 0
574 sys irix_unimp 0
575 sys irix_unimp 0
576 sys irix_unimp 0
577 sys irix_unimp 0
578 sys irix_unimp 0
579 sys irix_unimp 0
580 sys irix_unimp 0
581 sys irix_unimp 0
582 sys irix_unimp 0
583 sys irix_unimp 0
584 sys irix_unimp 0
585 sys irix_unimp 0
586 sys irix_unimp 0
587 sys irix_unimp 0
588 sys irix_unimp 0
589 sys irix_unimp 0
590 sys irix_unimp 0
591 sys irix_unimp 0
592 sys irix_unimp 0
593 sys irix_unimp 0
594 sys irix_unimp 0
595 sys irix_unimp 0
596 sys irix_unimp 0
597 sys irix_unimp 0
598 sys irix_unimp 0
599 sys irix_unimp 0
600 sys irix_unimp 0
601 sys irix_unimp 0
602 sys irix_unimp 0
603 sys irix_unimp 0
604 sys irix_unimp 0
605 sys irix_unimp 0
606 sys irix_unimp 0
607 sys irix_unimp 0
608 sys irix_unimp 0
609 sys irix_unimp 0
610 sys irix_unimp 0
611 sys irix_unimp 0
612 sys irix_unimp 0
613 sys irix_unimp 0
614 sys irix_unimp 0
615 sys irix_unimp 0
616 sys irix_unimp 0
617 sys irix_unimp 0
618 sys irix_unimp 0
619 sys irix_unimp 0
620 sys irix_unimp 0
621 sys irix_unimp 0
622 sys irix_unimp 0
623 sys irix_unimp 0
624 sys irix_unimp 0
625 sys irix_unimp 0
626 sys irix_unimp 0
627 sys irix_unimp 0
628 sys irix_unimp 0
629 sys irix_unimp 0
630 sys irix_unimp 0
631 sys irix_unimp 0
632 sys irix_unimp 0
633 sys irix_unimp 0
634 sys irix_unimp 0
635 sys irix_unimp 0
636 sys irix_unimp 0
637 sys irix_unimp 0
638 sys irix_unimp 0
639 sys irix_unimp 0
640 sys irix_unimp 0
641 sys irix_unimp 0
642 sys irix_unimp 0
643 sys irix_unimp 0
644 sys irix_unimp 0
645 sys irix_unimp 0
646 sys irix_unimp 0
647 sys irix_unimp 0
648 sys irix_unimp 0
649 sys irix_unimp 0
650 sys irix_unimp 0
651 sys irix_unimp 0
652 sys irix_unimp 0
653 sys irix_unimp 0
654 sys irix_unimp 0
655 sys irix_unimp 0
656 sys irix_unimp 0
657 sys irix_unimp 0
658 sys irix_unimp 0
659 sys irix_unimp 0
660 sys irix_unimp 0
661 sys irix_unimp 0
662 sys irix_unimp 0
663 sys irix_unimp 0
664 sys irix_unimp 0
665 sys irix_unimp 0
666 sys irix_unimp 0
667 sys irix_unimp 0
668 sys irix_unimp 0
669 sys irix_unimp 0
670 sys irix_unimp 0
671 sys irix_unimp 0
672 sys irix_unimp 0
673 sys irix_unimp 0
674 sys irix_unimp 0
675 sys irix_unimp 0
676 sys irix_unimp 0
677 sys irix_unimp 0
678 sys irix_unimp 0
679 sys irix_unimp 0
680 sys irix_unimp 0
681 sys irix_unimp 0
682 sys irix_unimp 0
683 sys irix_unimp 0
684 sys irix_unimp 0
685 sys irix_unimp 0
686 sys irix_unimp 0
687 sys irix_unimp 0
688 sys irix_unimp 0
689 sys irix_unimp 0
690 sys irix_unimp 0
691 sys irix_unimp 0
692 sys irix_unimp 0
693 sys irix_unimp 0
694 sys irix_unimp 0
695 sys irix_unimp 0
696 sys irix_unimp 0
697 sys irix_unimp 0
698 sys irix_unimp 0
699 sys irix_unimp 0
700 sys irix_unimp 0
701 sys irix_unimp 0
702 sys irix_unimp 0
703 sys irix_unimp 0
704 sys irix_unimp 0
705 sys irix_unimp 0
706 sys irix_unimp 0
707 sys irix_unimp 0
708 sys irix_unimp 0
709 sys irix_unimp 0
710 sys irix_unimp 0
711 sys irix_unimp 0
712 sys irix_unimp 0
713 sys irix_unimp 0
714 sys irix_unimp 0
715 sys irix_unimp 0
716 sys irix_unimp 0
717 sys irix_unimp 0
718 sys irix_unimp 0
719 sys irix_unimp 0
720 sys irix_unimp 0
721 sys irix_unimp 0
722 sys irix_unimp 0
723 sys irix_unimp 0
724 sys irix_unimp 0
725 sys irix_unimp 0
726 sys irix_unimp 0
727 sys irix_unimp 0
728 sys irix_unimp 0
729 sys irix_unimp 0
730 sys irix_unimp 0
731 sys irix_unimp 0
732 sys irix_unimp 0
733 sys irix_unimp 0
734 sys irix_unimp 0
735 sys irix_unimp 0
736 sys irix_unimp 0
737 sys irix_unimp 0
738 sys irix_unimp 0
739 sys irix_unimp 0
740 sys irix_unimp 0
741 sys irix_unimp 0
742 sys irix_unimp 0
743 sys irix_unimp 0
744 sys irix_unimp 0
745 sys irix_unimp 0
746 sys irix_unimp 0
747 sys irix_unimp 0
748 sys irix_unimp 0
749 sys irix_unimp 0
750 sys irix_unimp 0
751 sys irix_unimp 0
752 sys irix_unimp 0
753 sys irix_unimp 0
754 sys irix_unimp 0
755 sys irix_unimp 0
756 sys irix_unimp 0
757 sys irix_unimp 0
758 sys irix_unimp 0
759 sys irix_unimp 0
760 sys irix_unimp 0
761 sys irix_unimp 0
762 sys irix_unimp 0
763 sys irix_unimp 0
764 sys irix_unimp 0
765 sys irix_unimp 0
766 sys irix_unimp 0
767 sys irix_unimp 0
768 sys irix_unimp 0
769 sys irix_unimp 0
770 sys irix_unimp 0
771 sys irix_unimp 0
772 sys irix_unimp 0
773 sys irix_unimp 0
774 sys irix_unimp 0
775 sys irix_unimp 0
776 sys irix_unimp 0
777 sys irix_unimp 0
778 sys irix_unimp 0
779 sys irix_unimp 0
780 sys irix_unimp 0
781 sys irix_unimp 0
782 sys irix_unimp 0
783 sys irix_unimp 0
784 sys irix_unimp 0
785 sys irix_unimp 0
786 sys irix_unimp 0
787 sys irix_unimp 0
788 sys irix_unimp 0
789 sys irix_unimp 0
790 sys irix_unimp 0
791 sys irix_unimp 0
792 sys irix_unimp 0
793 sys irix_unimp 0
794 sys irix_unimp 0
795 sys irix_unimp 0
796 sys irix_unimp 0
797 sys irix_unimp 0
798 sys irix_unimp 0
799 sys irix_unimp 0
800 sys irix_unimp 0
801 sys irix_unimp 0
802 sys irix_unimp 0
803 sys irix_unimp 0
804 sys irix_unimp 0
805 sys irix_unimp 0
806 sys irix_unimp 0
807 sys irix_unimp 0
808 sys irix_unimp 0
809 sys irix_unimp 0
810 sys irix_unimp 0
811 sys irix_unimp 0
812 sys irix_unimp 0
813 sys irix_unimp 0
814 sys irix_unimp 0
815 sys irix_unimp 0
816 sys irix_unimp 0
817 sys irix_unimp 0
818 sys irix_unimp 0
819 sys irix_unimp 0
820 sys irix_unimp 0
821 sys irix_unimp 0
822 sys irix_unimp 0
823 sys irix_unimp 0
824 sys irix_unimp 0
825 sys irix_unimp 0
826 sys irix_unimp 0
827 sys irix_unimp 0
828 sys irix_unimp 0
829 sys irix_unimp 0
830 sys irix_unimp 0
831 sys irix_unimp 0
832 sys irix_unimp 0
833 sys irix_unimp 0
834 sys irix_unimp 0
835 sys irix_unimp 0
836 sys irix_unimp 0
837 sys irix_unimp 0
838 sys irix_unimp 0
839 sys irix_unimp 0
840 sys irix_unimp 0
841 sys irix_unimp 0
842 sys irix_unimp 0
843 sys irix_unimp 0
844 sys irix_unimp 0
845 sys irix_unimp 0
846 sys irix_unimp 0
847 sys irix_unimp 0
848 sys irix_unimp 0
849 sys irix_unimp 0
850 sys irix_unimp 0
851 sys irix_unimp 0
852 sys irix_unimp 0
853 sys irix_unimp 0
854 sys irix_unimp 0
855 sys irix_unimp 0
856 sys irix_unimp 0
857 sys irix_unimp 0
858 sys irix_unimp 0
859 sys irix_unimp 0
860 sys irix_unimp 0
861 sys irix_unimp 0
862 sys irix_unimp 0
863 sys irix_unimp 0
864 sys irix_unimp 0
865 sys irix_unimp 0
866 sys irix_unimp 0
867 sys irix_unimp 0
868 sys irix_unimp 0
869 sys irix_unimp 0
870 sys irix_unimp 0
871 sys irix_unimp 0
872 sys irix_unimp 0
873 sys irix_unimp 0
874 sys irix_unimp 0
875 sys irix_unimp 0
876 sys irix_unimp 0
877 sys irix_unimp 0
878 sys irix_unimp 0
879 sys irix_unimp 0
880 sys irix_unimp 0
881 sys irix_unimp 0
882 sys irix_unimp 0
883 sys irix_unimp 0
884 sys irix_unimp 0
885 sys irix_unimp 0
886 sys irix_unimp 0
887 sys irix_unimp 0
888 sys irix_unimp 0
889 sys irix_unimp 0
890 sys irix_unimp 0
891 sys irix_unimp 0
892 sys irix_unimp 0
893 sys irix_unimp 0
894 sys irix_unimp 0
895 sys irix_unimp 0
896 sys irix_unimp 0
897 sys irix_unimp 0
898 sys irix_unimp 0
899 sys irix_unimp 0
900 sys irix_unimp 0
901 sys irix_unimp 0
902 sys irix_unimp 0
903 sys irix_unimp 0
904 sys irix_unimp 0
905 sys irix_unimp 0
906 sys irix_unimp 0
907 sys irix_unimp 0
908 sys irix_unimp 0
909 sys irix_unimp 0
910 sys irix_unimp 0
911 sys irix_unimp 0
912 sys irix_unimp 0
913 sys irix_unimp 0
914 sys irix_unimp 0
915 sys irix_unimp 0
916 sys irix_unimp 0
917 sys irix_unimp 0
918 sys irix_unimp 0
919 sys irix_unimp 0
920 sys irix_unimp 0
921 sys irix_unimp 0
922 sys irix_unimp 0
923 sys irix_unimp 0
924 sys irix_unimp 0
925 sys irix_unimp 0
926 sys irix_unimp 0
927 sys irix_unimp 0
928 sys irix_unimp 0
929 sys irix_unimp 0
930 sys irix_unimp 0
931 sys irix_unimp 0
932 sys irix_unimp 0
933 sys irix_unimp 0
934 sys irix_unimp 0
935 sys irix_unimp 0
936 sys irix_unimp 0
937 sys irix_unimp 0
938 sys irix_unimp 0
939 sys irix_unimp 0
940 sys irix_unimp 0
941 sys irix_unimp 0
942 sys irix_unimp 0
943 sys irix_unimp 0
944 sys irix_unimp 0
945 sys irix_unimp 0
946 sys irix_unimp 0
947 sys irix_unimp 0
948 sys irix_unimp 0
949 sys irix_unimp 0
950 sys irix_unimp 0
951 sys irix_unimp 0
952 sys irix_unimp 0
953 sys irix_unimp 0
954 sys irix_unimp 0
955 sys irix_unimp 0
956 sys irix_unimp 0
957 sys irix_unimp 0
958 sys irix_unimp 0
959 sys irix_unimp 0
960 sys irix_unimp 0
961 sys irix_unimp 0
962 sys irix_unimp 0
963 sys irix_unimp 0
964 sys irix_unimp 0
965 sys irix_unimp 0
966 sys irix_unimp 0
967 sys irix_unimp 0
968 sys irix_unimp 0
969 sys irix_unimp 0
970 sys irix_unimp 0
971 sys irix_unimp 0
972 sys irix_unimp 0
973 sys irix_unimp 0
974 sys irix_unimp 0
975 sys irix_unimp 0
976 sys irix_unimp 0
977 sys irix_unimp 0
978 sys irix_unimp 0
979 sys irix_unimp 0
980 sys irix_unimp 0
981 sys irix_unimp 0
982 sys irix_unimp 0
983 sys irix_unimp 0
984 sys irix_unimp 0
985 sys irix_unimp 0
986 sys irix_unimp 0
987 sys irix_unimp 0
988 sys irix_unimp 0
989 sys irix_unimp 0
990 sys irix_unimp 0
991 sys irix_unimp 0
992 sys irix_unimp 0
993 sys irix_unimp 0
994 sys irix_unimp 0
995 sys irix_unimp 0
996 sys irix_unimp 0
997 sys irix_unimp 0
998 sys irix_unimp 0
999 sys irix_unimp 0
1000 sys irix_unimp 0
1001 sys irix_unimp 0
1002 sys irix_unimp 0
1003 sys irix_unimp 0
1004 sys irix_unimp 0
1005 sys irix_unimp 0
1006 sys irix_unimp 0
1007 sys irix_unimp 0
1008 sys irix_unimp 0
1009 sys irix_unimp 0
1010 sys irix_unimp 0
1011 sys irix_unimp 0
1012 sys irix_unimp 0
1013 sys irix_unimp 0
1014 sys irix_unimp 0
1015 sys irix_unimp 0
1016 sys irix_unimp 0
1017 sys irix_unimp 0
1018 sys irix_unimp 0
1019 sys irix_unimp 0
1020 sys irix_unimp 0
1021 sys irix_unimp 0
1022 sys irix_unimp 0
1023 sys irix_unimp 0
1024 sys irix_unimp 0
1025 sys irix_unimp 0
1026 sys irix_unimp 0
1027
1028 .endm
1029
1030 /*
1031 * Pre-compute the number of _instruction_ bytes needed to load
1032 * or store the arguments 6-8. Negative values are ignored.
1033 */
1034 .macro sys function, nargs
1035 PTR \function
1036 LONG (\nargs << 2) - (5 << 2)
1037 .endm
1038
1039 .align 4
1040EXPORT(sys_call_table_irix5)
1041 irix5syscalltable
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
new file mode 100644
index 000000000000..4af20cd91f9f
--- /dev/null
+++ b/arch/mips/kernel/irixelf.c
@@ -0,0 +1,1326 @@
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 * irixelf.c: Code to load IRIX ELF executables conforming to the MIPS ABI.
7 * Based off of work by Eric Youngdale.
8 *
9 * Copyright (C) 1993 - 1994 Eric Youngdale <ericy@cais.com>
10 * Copyright (C) 1996 - 2004 David S. Miller <dm@engr.sgi.com>
11 * Copyright (C) 2004 Steven J. Hill <sjhill@realitydiluted.com>
12 */
13#include <linux/module.h>
14#include <linux/fs.h>
15#include <linux/stat.h>
16#include <linux/sched.h>
17#include <linux/mm.h>
18#include <linux/mman.h>
19#include <linux/a.out.h>
20#include <linux/errno.h>
21#include <linux/init.h>
22#include <linux/signal.h>
23#include <linux/binfmts.h>
24#include <linux/string.h>
25#include <linux/file.h>
26#include <linux/fcntl.h>
27#include <linux/ptrace.h>
28#include <linux/slab.h>
29#include <linux/shm.h>
30#include <linux/personality.h>
31#include <linux/elfcore.h>
32#include <linux/smp_lock.h>
33
34#include <asm/uaccess.h>
35#include <asm/mipsregs.h>
36#include <asm/prctl.h>
37
38#define DLINFO_ITEMS 12
39
40#include <linux/elf.h>
41
42#undef DEBUG_ELF
43
44static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs);
45static int load_irix_library(struct file *);
46static int irix_core_dump(long signr, struct pt_regs * regs,
47 struct file *file);
48
49static struct linux_binfmt irix_format = {
50 NULL, THIS_MODULE, load_irix_binary, load_irix_library,
51 irix_core_dump, PAGE_SIZE
52};
53
54#ifndef elf_addr_t
55#define elf_addr_t unsigned long
56#endif
57
58#ifdef DEBUG_ELF
59/* Debugging routines. */
60static char *get_elf_p_type(Elf32_Word p_type)
61{
62 int i = (int) p_type;
63
64 switch(i) {
65 case PT_NULL: return("PT_NULL"); break;
66 case PT_LOAD: return("PT_LOAD"); break;
67 case PT_DYNAMIC: return("PT_DYNAMIC"); break;
68 case PT_INTERP: return("PT_INTERP"); break;
69 case PT_NOTE: return("PT_NOTE"); break;
70 case PT_SHLIB: return("PT_SHLIB"); break;
71 case PT_PHDR: return("PT_PHDR"); break;
72 case PT_LOPROC: return("PT_LOPROC/REGINFO"); break;
73 case PT_HIPROC: return("PT_HIPROC"); break;
74 default: return("PT_BOGUS"); break;
75 }
76}
77
78static void print_elfhdr(struct elfhdr *ehp)
79{
80 int i;
81
82 printk("ELFHDR: e_ident<");
83 for(i = 0; i < (EI_NIDENT - 1); i++) printk("%x ", ehp->e_ident[i]);
84 printk("%x>\n", ehp->e_ident[i]);
85 printk(" e_type[%04x] e_machine[%04x] e_version[%08lx]\n",
86 (unsigned short) ehp->e_type, (unsigned short) ehp->e_machine,
87 (unsigned long) ehp->e_version);
88 printk(" e_entry[%08lx] e_phoff[%08lx] e_shoff[%08lx] "
89 "e_flags[%08lx]\n",
90 (unsigned long) ehp->e_entry, (unsigned long) ehp->e_phoff,
91 (unsigned long) ehp->e_shoff, (unsigned long) ehp->e_flags);
92 printk(" e_ehsize[%04x] e_phentsize[%04x] e_phnum[%04x]\n",
93 (unsigned short) ehp->e_ehsize, (unsigned short) ehp->e_phentsize,
94 (unsigned short) ehp->e_phnum);
95 printk(" e_shentsize[%04x] e_shnum[%04x] e_shstrndx[%04x]\n",
96 (unsigned short) ehp->e_shentsize, (unsigned short) ehp->e_shnum,
97 (unsigned short) ehp->e_shstrndx);
98}
99
100static void print_phdr(int i, struct elf_phdr *ep)
101{
102 printk("PHDR[%d]: p_type[%s] p_offset[%08lx] p_vaddr[%08lx] "
103 "p_paddr[%08lx]\n", i, get_elf_p_type(ep->p_type),
104 (unsigned long) ep->p_offset, (unsigned long) ep->p_vaddr,
105 (unsigned long) ep->p_paddr);
106 printk(" p_filesz[%08lx] p_memsz[%08lx] p_flags[%08lx] "
107 "p_align[%08lx]\n", (unsigned long) ep->p_filesz,
108 (unsigned long) ep->p_memsz, (unsigned long) ep->p_flags,
109 (unsigned long) ep->p_align);
110}
111
112static void dump_phdrs(struct elf_phdr *ep, int pnum)
113{
114 int i;
115
116 for(i = 0; i < pnum; i++, ep++) {
117 if((ep->p_type == PT_LOAD) ||
118 (ep->p_type == PT_INTERP) ||
119 (ep->p_type == PT_PHDR))
120 print_phdr(i, ep);
121 }
122}
123#endif /* (DEBUG_ELF) */
124
125static void set_brk(unsigned long start, unsigned long end)
126{
127 start = PAGE_ALIGN(start);
128 end = PAGE_ALIGN(end);
129 if (end <= start)
130 return;
131 down_write(&current->mm->mmap_sem);
132 do_brk(start, end - start);
133 up_write(&current->mm->mmap_sem);
134}
135
136
137/* We need to explicitly zero any fractional pages
138 * after the data section (i.e. bss). This would
139 * contain the junk from the file that should not
140 * be in memory.
141 */
142static void padzero(unsigned long elf_bss)
143{
144 unsigned long nbyte;
145
146 nbyte = elf_bss & (PAGE_SIZE-1);
147 if (nbyte) {
148 nbyte = PAGE_SIZE - nbyte;
149 clear_user((void *) elf_bss, nbyte);
150 }
151}
152
153unsigned long * create_irix_tables(char * p, int argc, int envc,
154 struct elfhdr * exec, unsigned int load_addr,
155 unsigned int interp_load_addr,
156 struct pt_regs *regs, struct elf_phdr *ephdr)
157{
158 elf_addr_t *argv;
159 elf_addr_t *envp;
160 elf_addr_t *sp, *csp;
161
162#ifdef DEBUG_ELF
163 printk("create_irix_tables: p[%p] argc[%d] envc[%d] "
164 "load_addr[%08x] interp_load_addr[%08x]\n",
165 p, argc, envc, load_addr, interp_load_addr);
166#endif
167 sp = (elf_addr_t *) (~15UL & (unsigned long) p);
168 csp = sp;
169 csp -= exec ? DLINFO_ITEMS*2 : 2;
170 csp -= envc+1;
171 csp -= argc+1;
172 csp -= 1; /* argc itself */
173 if ((unsigned long)csp & 15UL) {
174 sp -= (16UL - ((unsigned long)csp & 15UL)) / sizeof(*sp);
175 }
176
177 /*
178 * Put the ELF interpreter info on the stack
179 */
180#define NEW_AUX_ENT(nr, id, val) \
181 __put_user ((id), sp+(nr*2)); \
182 __put_user ((val), sp+(nr*2+1)); \
183
184 sp -= 2;
185 NEW_AUX_ENT(0, AT_NULL, 0);
186
187 if(exec) {
188 sp -= 11*2;
189
190 NEW_AUX_ENT (0, AT_PHDR, load_addr + exec->e_phoff);
191 NEW_AUX_ENT (1, AT_PHENT, sizeof (struct elf_phdr));
192 NEW_AUX_ENT (2, AT_PHNUM, exec->e_phnum);
193 NEW_AUX_ENT (3, AT_PAGESZ, ELF_EXEC_PAGESIZE);
194 NEW_AUX_ENT (4, AT_BASE, interp_load_addr);
195 NEW_AUX_ENT (5, AT_FLAGS, 0);
196 NEW_AUX_ENT (6, AT_ENTRY, (elf_addr_t) exec->e_entry);
197 NEW_AUX_ENT (7, AT_UID, (elf_addr_t) current->uid);
198 NEW_AUX_ENT (8, AT_EUID, (elf_addr_t) current->euid);
199 NEW_AUX_ENT (9, AT_GID, (elf_addr_t) current->gid);
200 NEW_AUX_ENT (10, AT_EGID, (elf_addr_t) current->egid);
201 }
202#undef NEW_AUX_ENT
203
204 sp -= envc+1;
205 envp = sp;
206 sp -= argc+1;
207 argv = sp;
208
209 __put_user((elf_addr_t)argc,--sp);
210 current->mm->arg_start = (unsigned long) p;
211 while (argc-->0) {
212 __put_user((unsigned long)p,argv++);
213 p += strlen_user(p);
214 }
215 __put_user((unsigned long) NULL, argv);
216 current->mm->arg_end = current->mm->env_start = (unsigned long) p;
217 while (envc-->0) {
218 __put_user((unsigned long)p,envp++);
219 p += strlen_user(p);
220 }
221 __put_user((unsigned long) NULL, envp);
222 current->mm->env_end = (unsigned long) p;
223 return sp;
224}
225
226
227/* This is much more generalized than the library routine read function,
228 * so we keep this separate. Technically the library read function
229 * is only provided so that we can read a.out libraries that have
230 * an ELF header.
231 */
232static unsigned int load_irix_interp(struct elfhdr * interp_elf_ex,
233 struct file * interpreter,
234 unsigned int *interp_load_addr)
235{
236 struct elf_phdr *elf_phdata = NULL;
237 struct elf_phdr *eppnt;
238 unsigned int len;
239 unsigned int load_addr;
240 int elf_bss;
241 int retval;
242 unsigned int last_bss;
243 int error;
244 int i;
245 unsigned int k;
246
247 elf_bss = 0;
248 last_bss = 0;
249 error = load_addr = 0;
250
251#ifdef DEBUG_ELF
252 print_elfhdr(interp_elf_ex);
253#endif
254
255 /* First of all, some simple consistency checks */
256 if ((interp_elf_ex->e_type != ET_EXEC &&
257 interp_elf_ex->e_type != ET_DYN) ||
258 !irix_elf_check_arch(interp_elf_ex) ||
259 !interpreter->f_op->mmap) {
260 printk("IRIX interp has bad e_type %d\n", interp_elf_ex->e_type);
261 return 0xffffffff;
262 }
263
264 /* Now read in all of the header information */
265 if(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > PAGE_SIZE) {
266 printk("IRIX interp header bigger than a page (%d)\n",
267 (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum));
268 return 0xffffffff;
269 }
270
271 elf_phdata = kmalloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum,
272 GFP_KERNEL);
273
274 if(!elf_phdata) {
275 printk("Cannot kmalloc phdata for IRIX interp.\n");
276 return 0xffffffff;
277 }
278
279 /* If the size of this structure has changed, then punt, since
280 * we will be doing the wrong thing.
281 */
282 if(interp_elf_ex->e_phentsize != 32) {
283 printk("IRIX interp e_phentsize == %d != 32 ",
284 interp_elf_ex->e_phentsize);
285 kfree(elf_phdata);
286 return 0xffffffff;
287 }
288
289 retval = kernel_read(interpreter, interp_elf_ex->e_phoff,
290 (char *) elf_phdata,
291 sizeof(struct elf_phdr) * interp_elf_ex->e_phnum);
292
293#ifdef DEBUG_ELF
294 dump_phdrs(elf_phdata, interp_elf_ex->e_phnum);
295#endif
296
297 eppnt = elf_phdata;
298 for(i=0; i<interp_elf_ex->e_phnum; i++, eppnt++) {
299 if(eppnt->p_type == PT_LOAD) {
300 int elf_type = MAP_PRIVATE | MAP_DENYWRITE;
301 int elf_prot = 0;
302 unsigned long vaddr = 0;
303 if (eppnt->p_flags & PF_R) elf_prot = PROT_READ;
304 if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE;
305 if (eppnt->p_flags & PF_X) elf_prot |= PROT_EXEC;
306 elf_type |= MAP_FIXED;
307 vaddr = eppnt->p_vaddr;
308
309#ifdef DEBUG_ELF
310 printk("INTERP do_mmap(%p, %08lx, %08lx, %08lx, %08lx, %08lx) ",
311 interpreter, vaddr,
312 (unsigned long) (eppnt->p_filesz + (eppnt->p_vaddr & 0xfff)),
313 (unsigned long) elf_prot, (unsigned long) elf_type,
314 (unsigned long) (eppnt->p_offset & 0xfffff000));
315#endif
316 down_write(&current->mm->mmap_sem);
317 error = do_mmap(interpreter, vaddr,
318 eppnt->p_filesz + (eppnt->p_vaddr & 0xfff),
319 elf_prot, elf_type,
320 eppnt->p_offset & 0xfffff000);
321 up_write(&current->mm->mmap_sem);
322
323 if(error < 0 && error > -1024) {
324 printk("Aieee IRIX interp mmap error=%d\n", error);
325 break; /* Real error */
326 }
327#ifdef DEBUG_ELF
328 printk("error=%08lx ", (unsigned long) error);
329#endif
330 if(!load_addr && interp_elf_ex->e_type == ET_DYN) {
331 load_addr = error;
332#ifdef DEBUG_ELF
333 printk("load_addr = error ");
334#endif
335 }
336
337 /* Find the end of the file mapping for this phdr, and keep
338 * track of the largest address we see for this.
339 */
340 k = eppnt->p_vaddr + eppnt->p_filesz;
341 if(k > elf_bss) elf_bss = k;
342
343 /* Do the same thing for the memory mapping - between
344 * elf_bss and last_bss is the bss section.
345 */
346 k = eppnt->p_memsz + eppnt->p_vaddr;
347 if(k > last_bss) last_bss = k;
348#ifdef DEBUG_ELF
349 printk("\n");
350#endif
351 }
352 }
353
354 /* Now use mmap to map the library into memory. */
355 if(error < 0 && error > -1024) {
356#ifdef DEBUG_ELF
357 printk("got error %d\n", error);
358#endif
359 kfree(elf_phdata);
360 return 0xffffffff;
361 }
362
363 /* Now fill out the bss section. First pad the last page up
364 * to the page boundary, and then perform a mmap to make sure
365 * that there are zero-mapped pages up to and including the
366 * last bss page.
367 */
368#ifdef DEBUG_ELF
369 printk("padzero(%08lx) ", (unsigned long) (elf_bss));
370#endif
371 padzero(elf_bss);
372 len = (elf_bss + 0xfff) & 0xfffff000; /* What we have mapped so far */
373
374#ifdef DEBUG_ELF
375 printk("last_bss[%08lx] len[%08lx]\n", (unsigned long) last_bss,
376 (unsigned long) len);
377#endif
378
379 /* Map the last of the bss segment */
380 if (last_bss > len) {
381 down_write(&current->mm->mmap_sem);
382 do_brk(len, (last_bss - len));
383 up_write(&current->mm->mmap_sem);
384 }
385 kfree(elf_phdata);
386
387 *interp_load_addr = load_addr;
388 return ((unsigned int) interp_elf_ex->e_entry);
389}
390
391/* Check sanity of IRIX elf executable header. */
392static int verify_binary(struct elfhdr *ehp, struct linux_binprm *bprm)
393{
394 if (memcmp(ehp->e_ident, ELFMAG, SELFMAG) != 0)
395 return -ENOEXEC;
396
397 /* First of all, some simple consistency checks */
398 if((ehp->e_type != ET_EXEC && ehp->e_type != ET_DYN) ||
399 !irix_elf_check_arch(ehp) || !bprm->file->f_op->mmap) {
400 return -ENOEXEC;
401 }
402
403 /* Only support MIPS ARCH2 or greater IRIX binaries for now. */
404 if(!(ehp->e_flags & EF_MIPS_ARCH) && !(ehp->e_flags & 0x04)) {
405 return -ENOEXEC;
406 }
407
408 /* XXX Don't support N32 or 64bit binaries yet because they can
409 * XXX and do execute 64 bit instructions and expect all registers
410 * XXX to be 64 bit as well. We need to make the kernel save
411 * XXX all registers as 64bits on cpu's capable of this at
412 * XXX exception time plus frob the XTLB exception vector.
413 */
414 if((ehp->e_flags & 0x20)) {
415 return -ENOEXEC;
416 }
417
418 return 0; /* It's ok. */
419}
420
421#define IRIX_INTERP_PREFIX "/usr/gnemul/irix"
422
423/* Look for an IRIX ELF interpreter. */
424static inline int look_for_irix_interpreter(char **name,
425 struct file **interpreter,
426 struct elfhdr *interp_elf_ex,
427 struct elf_phdr *epp,
428 struct linux_binprm *bprm, int pnum)
429{
430 int i;
431 int retval = -EINVAL;
432 struct file *file = NULL;
433
434 *name = NULL;
435 for(i = 0; i < pnum; i++, epp++) {
436 if (epp->p_type != PT_INTERP)
437 continue;
438
439 /* It is illegal to have two interpreters for one executable. */
440 if (*name != NULL)
441 goto out;
442
443 *name = kmalloc((epp->p_filesz + strlen(IRIX_INTERP_PREFIX)),
444 GFP_KERNEL);
445 if (!*name)
446 return -ENOMEM;
447
448 strcpy(*name, IRIX_INTERP_PREFIX);
449 retval = kernel_read(bprm->file, epp->p_offset, (*name + 16),
450 epp->p_filesz);
451 if (retval < 0)
452 goto out;
453
454 file = open_exec(*name);
455 if (IS_ERR(file)) {
456 retval = PTR_ERR(file);
457 goto out;
458 }
459 retval = kernel_read(file, 0, bprm->buf, 128);
460 if (retval < 0)
461 goto dput_and_out;
462
463 *interp_elf_ex = *(struct elfhdr *) bprm->buf;
464 }
465 *interpreter = file;
466 return 0;
467
468dput_and_out:
469 fput(file);
470out:
471 kfree(*name);
472 return retval;
473}
474
475static inline int verify_irix_interpreter(struct elfhdr *ihp)
476{
477 if (memcmp(ihp->e_ident, ELFMAG, SELFMAG) != 0)
478 return -ELIBBAD;
479 return 0;
480}
481
482#define EXEC_MAP_FLAGS (MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE)
483
484static inline void map_executable(struct file *fp, struct elf_phdr *epp, int pnum,
485 unsigned int *estack, unsigned int *laddr,
486 unsigned int *scode, unsigned int *ebss,
487 unsigned int *ecode, unsigned int *edata,
488 unsigned int *ebrk)
489{
490 unsigned int tmp;
491 int i, prot;
492
493 for(i = 0; i < pnum; i++, epp++) {
494 if(epp->p_type != PT_LOAD)
495 continue;
496
497 /* Map it. */
498 prot = (epp->p_flags & PF_R) ? PROT_READ : 0;
499 prot |= (epp->p_flags & PF_W) ? PROT_WRITE : 0;
500 prot |= (epp->p_flags & PF_X) ? PROT_EXEC : 0;
501 down_write(&current->mm->mmap_sem);
502 (void) do_mmap(fp, (epp->p_vaddr & 0xfffff000),
503 (epp->p_filesz + (epp->p_vaddr & 0xfff)),
504 prot, EXEC_MAP_FLAGS,
505 (epp->p_offset & 0xfffff000));
506 up_write(&current->mm->mmap_sem);
507
508 /* Fixup location tracking vars. */
509 if((epp->p_vaddr & 0xfffff000) < *estack)
510 *estack = (epp->p_vaddr & 0xfffff000);
511 if(!*laddr)
512 *laddr = epp->p_vaddr - epp->p_offset;
513 if(epp->p_vaddr < *scode)
514 *scode = epp->p_vaddr;
515
516 tmp = epp->p_vaddr + epp->p_filesz;
517 if(tmp > *ebss)
518 *ebss = tmp;
519 if((epp->p_flags & PF_X) && *ecode < tmp)
520 *ecode = tmp;
521 if(*edata < tmp)
522 *edata = tmp;
523
524 tmp = epp->p_vaddr + epp->p_memsz;
525 if(tmp > *ebrk)
526 *ebrk = tmp;
527 }
528
529}
530
531static inline int map_interpreter(struct elf_phdr *epp, struct elfhdr *ihp,
532 struct file *interp, unsigned int *iladdr,
533 int pnum, mm_segment_t old_fs,
534 unsigned int *eentry)
535{
536 int i;
537
538 *eentry = 0xffffffff;
539 for(i = 0; i < pnum; i++, epp++) {
540 if(epp->p_type != PT_INTERP)
541 continue;
542
543 /* We should have fielded this error elsewhere... */
544 if(*eentry != 0xffffffff)
545 return -1;
546
547 set_fs(old_fs);
548 *eentry = load_irix_interp(ihp, interp, iladdr);
549 old_fs = get_fs();
550 set_fs(get_ds());
551
552 fput(interp);
553
554 if (*eentry == 0xffffffff)
555 return -1;
556 }
557 return 0;
558}
559
560/*
561 * IRIX maps a page at 0x200000 that holds information about the
562 * process and the system, here we map the page and fill the
563 * structure
564 */
565void irix_map_prda_page (void)
566{
567 unsigned long v;
568 struct prda *pp;
569
570 down_write(&current->mm->mmap_sem);
571 v = do_brk (PRDA_ADDRESS, PAGE_SIZE);
572 up_write(&current->mm->mmap_sem);
573
574 if (v < 0)
575 return;
576
577 pp = (struct prda *) v;
578 pp->prda_sys.t_pid = current->pid;
579 pp->prda_sys.t_prid = read_c0_prid();
580 pp->prda_sys.t_rpid = current->pid;
581
582 /* We leave the rest set to zero */
583}
584
585
586
587/* These are the functions used to load ELF style executables and shared
588 * libraries. There is no binary dependent code anywhere else.
589 */
590static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
591{
592 struct elfhdr elf_ex, interp_elf_ex;
593 struct file *interpreter;
594 struct elf_phdr *elf_phdata, *elf_ihdr, *elf_ephdr;
595 unsigned int load_addr, elf_bss, elf_brk;
596 unsigned int elf_entry, interp_load_addr = 0;
597 unsigned int start_code, end_code, end_data, elf_stack;
598 int retval, has_interp, has_ephdr, size, i;
599 char *elf_interpreter;
600 mm_segment_t old_fs;
601
602 load_addr = 0;
603 has_interp = has_ephdr = 0;
604 elf_ihdr = elf_ephdr = 0;
605 elf_ex = *((struct elfhdr *) bprm->buf);
606 retval = -ENOEXEC;
607
608 if (verify_binary(&elf_ex, bprm))
609 goto out;
610
611#ifdef DEBUG_ELF
612 print_elfhdr(&elf_ex);
613#endif
614
615 /* Now read in all of the header information */
616 size = elf_ex.e_phentsize * elf_ex.e_phnum;
617 if (size > 65536)
618 goto out;
619 elf_phdata = kmalloc(size, GFP_KERNEL);
620 if (elf_phdata == NULL) {
621 retval = -ENOMEM;
622 goto out;
623 }
624
625 retval = kernel_read(bprm->file, elf_ex.e_phoff, (char *)elf_phdata, size);
626
627 if (retval < 0)
628 goto out_free_ph;
629
630#ifdef DEBUG_ELF
631 dump_phdrs(elf_phdata, elf_ex.e_phnum);
632#endif
633
634 /* Set some things for later. */
635 for(i = 0; i < elf_ex.e_phnum; i++) {
636 switch(elf_phdata[i].p_type) {
637 case PT_INTERP:
638 has_interp = 1;
639 elf_ihdr = &elf_phdata[i];
640 break;
641 case PT_PHDR:
642 has_ephdr = 1;
643 elf_ephdr = &elf_phdata[i];
644 break;
645 };
646 }
647#ifdef DEBUG_ELF
648 printk("\n");
649#endif
650
651 elf_bss = 0;
652 elf_brk = 0;
653
654 elf_stack = 0xffffffff;
655 elf_interpreter = NULL;
656 start_code = 0xffffffff;
657 end_code = 0;
658 end_data = 0;
659
660 retval = look_for_irix_interpreter(&elf_interpreter,
661 &interpreter,
662 &interp_elf_ex, elf_phdata, bprm,
663 elf_ex.e_phnum);
664 if (retval)
665 goto out_free_file;
666
667 if (elf_interpreter) {
668 retval = verify_irix_interpreter(&interp_elf_ex);
669 if(retval)
670 goto out_free_interp;
671 }
672
673 /* OK, we are done with that, now set up the arg stuff,
674 * and then start this sucker up.
675 */
676 retval = -E2BIG;
677 if (!bprm->sh_bang && !bprm->p)
678 goto out_free_interp;
679
680 /* Flush all traces of the currently running executable */
681 retval = flush_old_exec(bprm);
682 if (retval)
683 goto out_free_dentry;
684
685 /* OK, This is the point of no return */
686 current->mm->end_data = 0;
687 current->mm->end_code = 0;
688 current->mm->mmap = NULL;
689 current->flags &= ~PF_FORKNOEXEC;
690 elf_entry = (unsigned int) elf_ex.e_entry;
691
692 /* Do this so that we can load the interpreter, if need be. We will
693 * change some of these later.
694 */
695 set_mm_counter(current->mm, rss, 0);
696 setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT);
697 current->mm->start_stack = bprm->p;
698
699 /* At this point, we assume that the image should be loaded at
700 * fixed address, not at a variable address.
701 */
702 old_fs = get_fs();
703 set_fs(get_ds());
704
705 map_executable(bprm->file, elf_phdata, elf_ex.e_phnum, &elf_stack,
706 &load_addr, &start_code, &elf_bss, &end_code,
707 &end_data, &elf_brk);
708
709 if(elf_interpreter) {
710 retval = map_interpreter(elf_phdata, &interp_elf_ex,
711 interpreter, &interp_load_addr,
712 elf_ex.e_phnum, old_fs, &elf_entry);
713 kfree(elf_interpreter);
714 if(retval) {
715 set_fs(old_fs);
716 printk("Unable to load IRIX ELF interpreter\n");
717 send_sig(SIGSEGV, current, 0);
718 retval = 0;
719 goto out_free_file;
720 }
721 }
722
723 set_fs(old_fs);
724
725 kfree(elf_phdata);
726 set_personality(PER_IRIX32);
727 set_binfmt(&irix_format);
728 compute_creds(bprm);
729 current->flags &= ~PF_FORKNOEXEC;
730 bprm->p = (unsigned long)
731 create_irix_tables((char *)bprm->p, bprm->argc, bprm->envc,
732 (elf_interpreter ? &elf_ex : NULL),
733 load_addr, interp_load_addr, regs, elf_ephdr);
734 current->mm->start_brk = current->mm->brk = elf_brk;
735 current->mm->end_code = end_code;
736 current->mm->start_code = start_code;
737 current->mm->end_data = end_data;
738 current->mm->start_stack = bprm->p;
739
740 /* Calling set_brk effectively mmaps the pages that we need for the
741 * bss and break sections.
742 */
743 set_brk(elf_bss, elf_brk);
744
745 /*
746 * IRIX maps a page at 0x200000 which holds some system
747 * information. Programs depend on this.
748 */
749 irix_map_prda_page ();
750
751 padzero(elf_bss);
752
753#ifdef DEBUG_ELF
754 printk("(start_brk) %lx\n" , (long) current->mm->start_brk);
755 printk("(end_code) %lx\n" , (long) current->mm->end_code);
756 printk("(start_code) %lx\n" , (long) current->mm->start_code);
757 printk("(end_data) %lx\n" , (long) current->mm->end_data);
758 printk("(start_stack) %lx\n" , (long) current->mm->start_stack);
759 printk("(brk) %lx\n" , (long) current->mm->brk);
760#endif
761
762#if 0 /* XXX No fucking way dude... */
763 /* Why this, you ask??? Well SVr4 maps page 0 as read-only,
764 * and some applications "depend" upon this behavior.
765 * Since we do not have the power to recompile these, we
766 * emulate the SVr4 behavior. Sigh.
767 */
768 down_write(&current->mm->mmap_sem);
769 (void) do_mmap(NULL, 0, 4096, PROT_READ | PROT_EXEC,
770 MAP_FIXED | MAP_PRIVATE, 0);
771 up_write(&current->mm->mmap_sem);
772#endif
773
774 start_thread(regs, elf_entry, bprm->p);
775 if (current->ptrace & PT_PTRACED)
776 send_sig(SIGTRAP, current, 0);
777 return 0;
778out:
779 return retval;
780
781out_free_dentry:
782 allow_write_access(interpreter);
783 fput(interpreter);
784out_free_interp:
785 if (elf_interpreter)
786 kfree(elf_interpreter);
787out_free_file:
788out_free_ph:
789 kfree (elf_phdata);
790 goto out;
791}
792
793/* This is really simpleminded and specialized - we are loading an
794 * a.out library that is given an ELF header.
795 */
796static int load_irix_library(struct file *file)
797{
798 struct elfhdr elf_ex;
799 struct elf_phdr *elf_phdata = NULL;
800 unsigned int len = 0;
801 int elf_bss = 0;
802 int retval;
803 unsigned int bss;
804 int error;
805 int i,j, k;
806
807 error = kernel_read(file, 0, (char *) &elf_ex, sizeof(elf_ex));
808 if (error != sizeof(elf_ex))
809 return -ENOEXEC;
810
811 if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
812 return -ENOEXEC;
813
814 /* First of all, some simple consistency checks. */
815 if(elf_ex.e_type != ET_EXEC || elf_ex.e_phnum > 2 ||
816 !irix_elf_check_arch(&elf_ex) || !file->f_op->mmap)
817 return -ENOEXEC;
818
819 /* Now read in all of the header information. */
820 if(sizeof(struct elf_phdr) * elf_ex.e_phnum > PAGE_SIZE)
821 return -ENOEXEC;
822
823 elf_phdata = kmalloc(sizeof(struct elf_phdr) * elf_ex.e_phnum, GFP_KERNEL);
824 if (elf_phdata == NULL)
825 return -ENOMEM;
826
827 retval = kernel_read(file, elf_ex.e_phoff, (char *) elf_phdata,
828 sizeof(struct elf_phdr) * elf_ex.e_phnum);
829
830 j = 0;
831 for(i=0; i<elf_ex.e_phnum; i++)
832 if((elf_phdata + i)->p_type == PT_LOAD) j++;
833
834 if(j != 1) {
835 kfree(elf_phdata);
836 return -ENOEXEC;
837 }
838
839 while(elf_phdata->p_type != PT_LOAD) elf_phdata++;
840
841 /* Now use mmap to map the library into memory. */
842 down_write(&current->mm->mmap_sem);
843 error = do_mmap(file,
844 elf_phdata->p_vaddr & 0xfffff000,
845 elf_phdata->p_filesz + (elf_phdata->p_vaddr & 0xfff),
846 PROT_READ | PROT_WRITE | PROT_EXEC,
847 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE,
848 elf_phdata->p_offset & 0xfffff000);
849 up_write(&current->mm->mmap_sem);
850
851 k = elf_phdata->p_vaddr + elf_phdata->p_filesz;
852 if (k > elf_bss) elf_bss = k;
853
854 if (error != (elf_phdata->p_vaddr & 0xfffff000)) {
855 kfree(elf_phdata);
856 return error;
857 }
858
859 padzero(elf_bss);
860
861 len = (elf_phdata->p_filesz + elf_phdata->p_vaddr+ 0xfff) & 0xfffff000;
862 bss = elf_phdata->p_memsz + elf_phdata->p_vaddr;
863 if (bss > len) {
864 down_write(&current->mm->mmap_sem);
865 do_brk(len, bss-len);
866 up_write(&current->mm->mmap_sem);
867 }
868 kfree(elf_phdata);
869 return 0;
870}
871
872/* Called through irix_syssgi() to map an elf image given an FD,
873 * a phdr ptr USER_PHDRP in userspace, and a count CNT telling how many
874 * phdrs there are in the USER_PHDRP array. We return the vaddr the
875 * first phdr was successfully mapped to.
876 */
877unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt)
878{
879 struct elf_phdr *hp;
880 struct file *filp;
881 int i, retval;
882
883#ifdef DEBUG_ELF
884 printk("irix_mapelf: fd[%d] user_phdrp[%p] cnt[%d]\n",
885 fd, user_phdrp, cnt);
886#endif
887
888 /* First get the verification out of the way. */
889 hp = user_phdrp;
890 if (!access_ok(VERIFY_READ, hp, (sizeof(struct elf_phdr) * cnt))) {
891#ifdef DEBUG_ELF
892 printk("irix_mapelf: access_ok fails!\n");
893#endif
894 return -EFAULT;
895 }
896
897#ifdef DEBUG_ELF
898 dump_phdrs(user_phdrp, cnt);
899#endif
900
901 for(i = 0; i < cnt; i++, hp++)
902 if(hp->p_type != PT_LOAD) {
903 printk("irix_mapelf: One section is not PT_LOAD!\n");
904 return -ENOEXEC;
905 }
906
907 filp = fget(fd);
908 if (!filp)
909 return -EACCES;
910 if(!filp->f_op) {
911 printk("irix_mapelf: Bogon filp!\n");
912 fput(filp);
913 return -EACCES;
914 }
915
916 hp = user_phdrp;
917 for(i = 0; i < cnt; i++, hp++) {
918 int prot;
919
920 prot = (hp->p_flags & PF_R) ? PROT_READ : 0;
921 prot |= (hp->p_flags & PF_W) ? PROT_WRITE : 0;
922 prot |= (hp->p_flags & PF_X) ? PROT_EXEC : 0;
923 down_write(&current->mm->mmap_sem);
924 retval = do_mmap(filp, (hp->p_vaddr & 0xfffff000),
925 (hp->p_filesz + (hp->p_vaddr & 0xfff)),
926 prot, (MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE),
927 (hp->p_offset & 0xfffff000));
928 up_write(&current->mm->mmap_sem);
929
930 if(retval != (hp->p_vaddr & 0xfffff000)) {
931 printk("irix_mapelf: do_mmap fails with %d!\n", retval);
932 fput(filp);
933 return retval;
934 }
935 }
936
937#ifdef DEBUG_ELF
938 printk("irix_mapelf: Success, returning %08lx\n",
939 (unsigned long) user_phdrp->p_vaddr);
940#endif
941 fput(filp);
942 return user_phdrp->p_vaddr;
943}
944
945/*
946 * ELF core dumper
947 *
948 * Modelled on fs/exec.c:aout_core_dump()
949 * Jeremy Fitzhardinge <jeremy@sw.oz.au>
950 */
951
952/* These are the only things you should do on a core-file: use only these
953 * functions to write out all the necessary info.
954 */
955static int dump_write(struct file *file, const void *addr, int nr)
956{
957 return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
958}
959
960static int dump_seek(struct file *file, off_t off)
961{
962 if (file->f_op->llseek) {
963 if (file->f_op->llseek(file, off, 0) != off)
964 return 0;
965 } else
966 file->f_pos = off;
967 return 1;
968}
969
970/* Decide whether a segment is worth dumping; default is yes to be
971 * sure (missing info is worse than too much; etc).
972 * Personally I'd include everything, and use the coredump limit...
973 *
974 * I think we should skip something. But I am not sure how. H.J.
975 */
976static inline int maydump(struct vm_area_struct *vma)
977{
978 if (!(vma->vm_flags & (VM_READ|VM_WRITE|VM_EXEC)))
979 return 0;
980#if 1
981 if (vma->vm_flags & (VM_WRITE|VM_GROWSUP|VM_GROWSDOWN))
982 return 1;
983 if (vma->vm_flags & (VM_READ|VM_EXEC|VM_EXECUTABLE|VM_SHARED))
984 return 0;
985#endif
986 return 1;
987}
988
989#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
990
991/* An ELF note in memory. */
992struct memelfnote
993{
994 const char *name;
995 int type;
996 unsigned int datasz;
997 void *data;
998};
999
1000static int notesize(struct memelfnote *en)
1001{
1002 int sz;
1003
1004 sz = sizeof(struct elf_note);
1005 sz += roundup(strlen(en->name), 4);
1006 sz += roundup(en->datasz, 4);
1007
1008 return sz;
1009}
1010
1011/* #define DEBUG */
1012
1013#define DUMP_WRITE(addr, nr) \
1014 if (!dump_write(file, (addr), (nr))) \
1015 goto end_coredump;
1016#define DUMP_SEEK(off) \
1017 if (!dump_seek(file, (off))) \
1018 goto end_coredump;
1019
1020static int writenote(struct memelfnote *men, struct file *file)
1021{
1022 struct elf_note en;
1023
1024 en.n_namesz = strlen(men->name);
1025 en.n_descsz = men->datasz;
1026 en.n_type = men->type;
1027
1028 DUMP_WRITE(&en, sizeof(en));
1029 DUMP_WRITE(men->name, en.n_namesz);
1030 /* XXX - cast from long long to long to avoid need for libgcc.a */
1031 DUMP_SEEK(roundup((unsigned long)file->f_pos, 4)); /* XXX */
1032 DUMP_WRITE(men->data, men->datasz);
1033 DUMP_SEEK(roundup((unsigned long)file->f_pos, 4)); /* XXX */
1034
1035 return 1;
1036
1037end_coredump:
1038 return 0;
1039}
1040#undef DUMP_WRITE
1041#undef DUMP_SEEK
1042
1043#define DUMP_WRITE(addr, nr) \
1044 if (!dump_write(file, (addr), (nr))) \
1045 goto end_coredump;
1046#define DUMP_SEEK(off) \
1047 if (!dump_seek(file, (off))) \
1048 goto end_coredump;
1049
1050/* Actual dumper.
1051 *
1052 * This is a two-pass process; first we find the offsets of the bits,
1053 * and then they are actually written out. If we run out of core limit
1054 * we just truncate.
1055 */
1056static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
1057{
1058 int has_dumped = 0;
1059 mm_segment_t fs;
1060 int segs;
1061 int i;
1062 size_t size;
1063 struct vm_area_struct *vma;
1064 struct elfhdr elf;
1065 off_t offset = 0, dataoff;
1066 int limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
1067 int numnote = 4;
1068 struct memelfnote notes[4];
1069 struct elf_prstatus prstatus; /* NT_PRSTATUS */
1070 elf_fpregset_t fpu; /* NT_PRFPREG */
1071 struct elf_prpsinfo psinfo; /* NT_PRPSINFO */
1072
1073 /* Count what's needed to dump, up to the limit of coredump size. */
1074 segs = 0;
1075 size = 0;
1076 for(vma = current->mm->mmap; vma != NULL; vma = vma->vm_next) {
1077 if (maydump(vma))
1078 {
1079 int sz = vma->vm_end-vma->vm_start;
1080
1081 if (size+sz >= limit)
1082 break;
1083 else
1084 size += sz;
1085 }
1086
1087 segs++;
1088 }
1089#ifdef DEBUG
1090 printk("irix_core_dump: %d segs taking %d bytes\n", segs, size);
1091#endif
1092
1093 /* Set up header. */
1094 memcpy(elf.e_ident, ELFMAG, SELFMAG);
1095 elf.e_ident[EI_CLASS] = ELFCLASS32;
1096 elf.e_ident[EI_DATA] = ELFDATA2LSB;
1097 elf.e_ident[EI_VERSION] = EV_CURRENT;
1098 elf.e_ident[EI_OSABI] = ELF_OSABI;
1099 memset(elf.e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD);
1100
1101 elf.e_type = ET_CORE;
1102 elf.e_machine = ELF_ARCH;
1103 elf.e_version = EV_CURRENT;
1104 elf.e_entry = 0;
1105 elf.e_phoff = sizeof(elf);
1106 elf.e_shoff = 0;
1107 elf.e_flags = 0;
1108 elf.e_ehsize = sizeof(elf);
1109 elf.e_phentsize = sizeof(struct elf_phdr);
1110 elf.e_phnum = segs+1; /* Include notes. */
1111 elf.e_shentsize = 0;
1112 elf.e_shnum = 0;
1113 elf.e_shstrndx = 0;
1114
1115 fs = get_fs();
1116 set_fs(KERNEL_DS);
1117
1118 has_dumped = 1;
1119 current->flags |= PF_DUMPCORE;
1120
1121 DUMP_WRITE(&elf, sizeof(elf));
1122 offset += sizeof(elf); /* Elf header. */
1123 offset += (segs+1) * sizeof(struct elf_phdr); /* Program headers. */
1124
1125 /* Set up the notes in similar form to SVR4 core dumps made
1126 * with info from their /proc.
1127 */
1128 memset(&psinfo, 0, sizeof(psinfo));
1129 memset(&prstatus, 0, sizeof(prstatus));
1130
1131 notes[0].name = "CORE";
1132 notes[0].type = NT_PRSTATUS;
1133 notes[0].datasz = sizeof(prstatus);
1134 notes[0].data = &prstatus;
1135 prstatus.pr_info.si_signo = prstatus.pr_cursig = signr;
1136 prstatus.pr_sigpend = current->pending.signal.sig[0];
1137 prstatus.pr_sighold = current->blocked.sig[0];
1138 psinfo.pr_pid = prstatus.pr_pid = current->pid;
1139 psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid;
1140 psinfo.pr_pgrp = prstatus.pr_pgrp = process_group(current);
1141 psinfo.pr_sid = prstatus.pr_sid = current->signal->session;
1142 if (current->pid == current->tgid) {
1143 /*
1144 * This is the record for the group leader. Add in the
1145 * cumulative times of previous dead threads. This total
1146 * won't include the time of each live thread whose state
1147 * is included in the core dump. The final total reported
1148 * to our parent process when it calls wait4 will include
1149 * those sums as well as the little bit more time it takes
1150 * this and each other thread to finish dying after the
1151 * core dump synchronization phase.
1152 */
1153 jiffies_to_timeval(current->utime + current->signal->utime,
1154 &prstatus.pr_utime);
1155 jiffies_to_timeval(current->stime + current->signal->stime,
1156 &prstatus.pr_stime);
1157 } else {
1158 jiffies_to_timeval(current->utime, &prstatus.pr_utime);
1159 jiffies_to_timeval(current->stime, &prstatus.pr_stime);
1160 }
1161 jiffies_to_timeval(current->signal->cutime, &prstatus.pr_cutime);
1162 jiffies_to_timeval(current->signal->cstime, &prstatus.pr_cstime);
1163
1164 if (sizeof(elf_gregset_t) != sizeof(struct pt_regs)) {
1165 printk("sizeof(elf_gregset_t) (%d) != sizeof(struct pt_regs) "
1166 "(%d)\n", sizeof(elf_gregset_t), sizeof(struct pt_regs));
1167 } else {
1168 *(struct pt_regs *)&prstatus.pr_reg = *regs;
1169 }
1170
1171 notes[1].name = "CORE";
1172 notes[1].type = NT_PRPSINFO;
1173 notes[1].datasz = sizeof(psinfo);
1174 notes[1].data = &psinfo;
1175 i = current->state ? ffz(~current->state) + 1 : 0;
1176 psinfo.pr_state = i;
1177 psinfo.pr_sname = (i < 0 || i > 5) ? '.' : "RSDZTD"[i];
1178 psinfo.pr_zomb = psinfo.pr_sname == 'Z';
1179 psinfo.pr_nice = task_nice(current);
1180 psinfo.pr_flag = current->flags;
1181 psinfo.pr_uid = current->uid;
1182 psinfo.pr_gid = current->gid;
1183 {
1184 int i, len;
1185
1186 set_fs(fs);
1187
1188 len = current->mm->arg_end - current->mm->arg_start;
1189 len = len >= ELF_PRARGSZ ? ELF_PRARGSZ : len;
1190 copy_from_user(&psinfo.pr_psargs,
1191 (const char *)current->mm->arg_start, len);
1192 for(i = 0; i < len; i++)
1193 if (psinfo.pr_psargs[i] == 0)
1194 psinfo.pr_psargs[i] = ' ';
1195 psinfo.pr_psargs[len] = 0;
1196
1197 set_fs(KERNEL_DS);
1198 }
1199 strlcpy(psinfo.pr_fname, current->comm, sizeof(psinfo.pr_fname));
1200
1201 notes[2].name = "CORE";
1202 notes[2].type = NT_TASKSTRUCT;
1203 notes[2].datasz = sizeof(*current);
1204 notes[2].data = current;
1205
1206 /* Try to dump the FPU. */
1207 prstatus.pr_fpvalid = dump_fpu (regs, &fpu);
1208 if (!prstatus.pr_fpvalid) {
1209 numnote--;
1210 } else {
1211 notes[3].name = "CORE";
1212 notes[3].type = NT_PRFPREG;
1213 notes[3].datasz = sizeof(fpu);
1214 notes[3].data = &fpu;
1215 }
1216
1217 /* Write notes phdr entry. */
1218 {
1219 struct elf_phdr phdr;
1220 int sz = 0;
1221
1222 for(i = 0; i < numnote; i++)
1223 sz += notesize(&notes[i]);
1224
1225 phdr.p_type = PT_NOTE;
1226 phdr.p_offset = offset;
1227 phdr.p_vaddr = 0;
1228 phdr.p_paddr = 0;
1229 phdr.p_filesz = sz;
1230 phdr.p_memsz = 0;
1231 phdr.p_flags = 0;
1232 phdr.p_align = 0;
1233
1234 offset += phdr.p_filesz;
1235 DUMP_WRITE(&phdr, sizeof(phdr));
1236 }
1237
1238 /* Page-align dumped data. */
1239 dataoff = offset = roundup(offset, PAGE_SIZE);
1240
1241 /* Write program headers for segments dump. */
1242 for(vma = current->mm->mmap, i = 0;
1243 i < segs && vma != NULL; vma = vma->vm_next) {
1244 struct elf_phdr phdr;
1245 size_t sz;
1246
1247 i++;
1248
1249 sz = vma->vm_end - vma->vm_start;
1250
1251 phdr.p_type = PT_LOAD;
1252 phdr.p_offset = offset;
1253 phdr.p_vaddr = vma->vm_start;
1254 phdr.p_paddr = 0;
1255 phdr.p_filesz = maydump(vma) ? sz : 0;
1256 phdr.p_memsz = sz;
1257 offset += phdr.p_filesz;
1258 phdr.p_flags = vma->vm_flags & VM_READ ? PF_R : 0;
1259 if (vma->vm_flags & VM_WRITE) phdr.p_flags |= PF_W;
1260 if (vma->vm_flags & VM_EXEC) phdr.p_flags |= PF_X;
1261 phdr.p_align = PAGE_SIZE;
1262
1263 DUMP_WRITE(&phdr, sizeof(phdr));
1264 }
1265
1266 for(i = 0; i < numnote; i++)
1267 if (!writenote(&notes[i], file))
1268 goto end_coredump;
1269
1270 set_fs(fs);
1271
1272 DUMP_SEEK(dataoff);
1273
1274 for(i = 0, vma = current->mm->mmap;
1275 i < segs && vma != NULL;
1276 vma = vma->vm_next) {
1277 unsigned long addr = vma->vm_start;
1278 unsigned long len = vma->vm_end - vma->vm_start;
1279
1280 if (!maydump(vma))
1281 continue;
1282 i++;
1283#ifdef DEBUG
1284 printk("elf_core_dump: writing %08lx %lx\n", addr, len);
1285#endif
1286 DUMP_WRITE((void *)addr, len);
1287 }
1288
1289 if ((off_t) file->f_pos != offset) {
1290 /* Sanity check. */
1291 printk("elf_core_dump: file->f_pos (%ld) != offset (%ld)\n",
1292 (off_t) file->f_pos, offset);
1293 }
1294
1295end_coredump:
1296 set_fs(fs);
1297 return has_dumped;
1298}
1299
1300static int __init init_irix_binfmt(void)
1301{
1302 int init_inventory(void);
1303 extern asmlinkage unsigned long sys_call_table;
1304 extern asmlinkage unsigned long sys_call_table_irix5;
1305
1306 init_inventory();
1307
1308 /*
1309 * Copy the IRIX5 syscall table (8000 bytes) into the main syscall
1310 * table. The IRIX5 calls are located by an offset of 8000 bytes
1311 * from the beginning of the main table.
1312 */
1313 memcpy((void *) ((unsigned long) &sys_call_table + 8000),
1314 &sys_call_table_irix5, 8000);
1315
1316 return register_binfmt(&irix_format);
1317}
1318
1319static void __exit exit_irix_binfmt(void)
1320{
1321 /* Remove the IRIX ELF loaders. */
1322 unregister_binfmt(&irix_format);
1323}
1324
1325module_init(init_irix_binfmt)
1326module_exit(exit_irix_binfmt)
diff --git a/arch/mips/kernel/irixinv.c b/arch/mips/kernel/irixinv.c
new file mode 100644
index 000000000000..60aa98cd1791
--- /dev/null
+++ b/arch/mips/kernel/irixinv.c
@@ -0,0 +1,77 @@
1/*
2 * Support the inventory interface for IRIX binaries
3 * This is invoked before the mm layer is working, so we do not
4 * use the linked lists for the inventory yet.
5 *
6 * Miguel de Icaza, 1997.
7 */
8#include <linux/mm.h>
9#include <asm/inventory.h>
10#include <asm/uaccess.h>
11
12#define MAX_INVENTORY 50
13int inventory_items = 0;
14
15static inventory_t inventory [MAX_INVENTORY];
16
17void add_to_inventory (int class, int type, int controller, int unit, int state)
18{
19 inventory_t *ni = &inventory [inventory_items];
20
21 if (inventory_items == MAX_INVENTORY)
22 return;
23
24 ni->inv_class = class;
25 ni->inv_type = type;
26 ni->inv_controller = controller;
27 ni->inv_unit = unit;
28 ni->inv_state = state;
29 ni->inv_next = ni;
30 inventory_items++;
31}
32
33int dump_inventory_to_user (void *userbuf, int size)
34{
35 inventory_t *inv = &inventory [0];
36 inventory_t *user = userbuf;
37 int v;
38
39 if (!access_ok(VERIFY_WRITE, userbuf, size))
40 return -EFAULT;
41
42 for (v = 0; v < inventory_items; v++){
43 inv = &inventory [v];
44 copy_to_user (user, inv, sizeof (inventory_t));
45 user++;
46 }
47 return inventory_items * sizeof (inventory_t);
48}
49
50int __init init_inventory(void)
51{
52 /*
53 * gross hack while we put the right bits all over the kernel
54 * most likely this will not let just anyone run the X server
55 * until we put the right values all over the place
56 */
57 add_to_inventory (10, 3, 0, 0, 16400);
58 add_to_inventory (1, 1, 150, -1, 12);
59 add_to_inventory (1, 3, 0, 0, 8976);
60 add_to_inventory (1, 2, 0, 0, 8976);
61 add_to_inventory (4, 8, 0, 0, 2);
62 add_to_inventory (5, 5, 0, 0, 1);
63 add_to_inventory (3, 3, 0, 0, 32768);
64 add_to_inventory (3, 4, 0, 0, 32768);
65 add_to_inventory (3, 8, 0, 0, 524288);
66 add_to_inventory (3, 9, 0, 0, 64);
67 add_to_inventory (3, 1, 0, 0, 67108864);
68 add_to_inventory (12, 3, 0, 0, 16);
69 add_to_inventory (8, 7, 17, 0, 16777472);
70 add_to_inventory (8, 0, 0, 0, 1);
71 add_to_inventory (2, 1, 0, 13, 2);
72 add_to_inventory (2, 2, 0, 2, 0);
73 add_to_inventory (2, 2, 0, 1, 0);
74 add_to_inventory (7, 14, 0, 0, 6);
75
76 return 0;
77}
diff --git a/arch/mips/kernel/irixioctl.c b/arch/mips/kernel/irixioctl.c
new file mode 100644
index 000000000000..4cd3d38a22c2
--- /dev/null
+++ b/arch/mips/kernel/irixioctl.c
@@ -0,0 +1,261 @@
1/*
2 * irixioctl.c: A fucking mess...
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 */
6
7#include <linux/kernel.h>
8#include <linux/sched.h>
9#include <linux/fs.h>
10#include <linux/mm.h>
11#include <linux/smp.h>
12#include <linux/smp_lock.h>
13#include <linux/sockios.h>
14#include <linux/syscalls.h>
15#include <linux/tty.h>
16#include <linux/file.h>
17
18#include <asm/uaccess.h>
19#include <asm/ioctl.h>
20#include <asm/ioctls.h>
21
22#undef DEBUG_IOCTLS
23#undef DEBUG_MISSING_IOCTL
24
25struct irix_termios {
26 tcflag_t c_iflag, c_oflag, c_cflag, c_lflag;
27 cc_t c_cc[NCCS];
28};
29
30extern void start_tty(struct tty_struct *tty);
31static struct tty_struct *get_tty(int fd)
32{
33 struct file *filp;
34 struct tty_struct *ttyp = NULL;
35
36 spin_lock(&current->files->file_lock);
37 filp = fcheck(fd);
38 if(filp && filp->private_data) {
39 ttyp = (struct tty_struct *) filp->private_data;
40
41 if(ttyp->magic != TTY_MAGIC)
42 ttyp =NULL;
43 }
44 spin_unlock(&current->files->file_lock);
45 return ttyp;
46}
47
48static struct tty_struct *get_real_tty(struct tty_struct *tp)
49{
50 if (tp->driver->type == TTY_DRIVER_TYPE_PTY &&
51 tp->driver->subtype == PTY_TYPE_MASTER)
52 return tp->link;
53 else
54 return tp;
55}
56
57asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
58{
59 struct tty_struct *tp, *rtp;
60 mm_segment_t old_fs;
61 int error = 0;
62
63#ifdef DEBUG_IOCTLS
64 printk("[%s:%d] irix_ioctl(%d, ", current->comm, current->pid, fd);
65#endif
66 switch(cmd) {
67 case 0x00005401:
68#ifdef DEBUG_IOCTLS
69 printk("TCGETA, %08lx) ", arg);
70#endif
71 error = sys_ioctl(fd, TCGETA, arg);
72 break;
73
74 case 0x0000540d: {
75 struct termios kt;
76 struct irix_termios *it = (struct irix_termios *) arg;
77
78#ifdef DEBUG_IOCTLS
79 printk("TCGETS, %08lx) ", arg);
80#endif
81 if(!access_ok(VERIFY_WRITE, it, sizeof(*it))) {
82 error = -EFAULT;
83 break;
84 }
85 old_fs = get_fs(); set_fs(get_ds());
86 error = sys_ioctl(fd, TCGETS, (unsigned long) &kt);
87 set_fs(old_fs);
88 if (error)
89 break;
90 __put_user(kt.c_iflag, &it->c_iflag);
91 __put_user(kt.c_oflag, &it->c_oflag);
92 __put_user(kt.c_cflag, &it->c_cflag);
93 __put_user(kt.c_lflag, &it->c_lflag);
94 for(error = 0; error < NCCS; error++)
95 __put_user(kt.c_cc[error], &it->c_cc[error]);
96 error = 0;
97 break;
98 }
99
100 case 0x0000540e: {
101 struct termios kt;
102 struct irix_termios *it = (struct irix_termios *) arg;
103
104#ifdef DEBUG_IOCTLS
105 printk("TCSETS, %08lx) ", arg);
106#endif
107 if (!access_ok(VERIFY_READ, it, sizeof(*it))) {
108 error = -EFAULT;
109 break;
110 }
111 old_fs = get_fs(); set_fs(get_ds());
112 error = sys_ioctl(fd, TCGETS, (unsigned long) &kt);
113 set_fs(old_fs);
114 if(error)
115 break;
116 __get_user(kt.c_iflag, &it->c_iflag);
117 __get_user(kt.c_oflag, &it->c_oflag);
118 __get_user(kt.c_cflag, &it->c_cflag);
119 __get_user(kt.c_lflag, &it->c_lflag);
120 for(error = 0; error < NCCS; error++)
121 __get_user(kt.c_cc[error], &it->c_cc[error]);
122 old_fs = get_fs(); set_fs(get_ds());
123 error = sys_ioctl(fd, TCSETS, (unsigned long) &kt);
124 set_fs(old_fs);
125 break;
126 }
127
128 case 0x0000540f:
129#ifdef DEBUG_IOCTLS
130 printk("TCSETSW, %08lx) ", arg);
131#endif
132 error = sys_ioctl(fd, TCSETSW, arg);
133 break;
134
135 case 0x00005471:
136#ifdef DEBUG_IOCTLS
137 printk("TIOCNOTTY, %08lx) ", arg);
138#endif
139 error = sys_ioctl(fd, TIOCNOTTY, arg);
140 break;
141
142 case 0x00007416:
143#ifdef DEBUG_IOCTLS
144 printk("TIOCGSID, %08lx) ", arg);
145#endif
146 tp = get_tty(fd);
147 if(!tp) {
148 error = -EINVAL;
149 break;
150 }
151 rtp = get_real_tty(tp);
152#ifdef DEBUG_IOCTLS
153 printk("rtp->session=%d ", rtp->session);
154#endif
155 error = put_user(rtp->session, (unsigned long *) arg);
156 break;
157
158 case 0x746e:
159 /* TIOCSTART, same effect as hitting ^Q */
160#ifdef DEBUG_IOCTLS
161 printk("TIOCSTART, %08lx) ", arg);
162#endif
163 tp = get_tty(fd);
164 if(!tp) {
165 error = -EINVAL;
166 break;
167 }
168 rtp = get_real_tty(tp);
169 start_tty(rtp);
170 break;
171
172 case 0x20006968:
173#ifdef DEBUG_IOCTLS
174 printk("SIOCGETLABEL, %08lx) ", arg);
175#endif
176 error = -ENOPKG;
177 break;
178
179 case 0x40047477:
180#ifdef DEBUG_IOCTLS
181 printk("TIOCGPGRP, %08lx) ", arg);
182#endif
183 error = sys_ioctl(fd, TIOCGPGRP, arg);
184#ifdef DEBUG_IOCTLS
185 printk("arg=%d ", *(int *)arg);
186#endif
187 break;
188
189 case 0x40087468:
190#ifdef DEBUG_IOCTLS
191 printk("TIOCGWINSZ, %08lx) ", arg);
192#endif
193 error = sys_ioctl(fd, TIOCGWINSZ, arg);
194 break;
195
196 case 0x8004667e:
197#ifdef DEBUG_IOCTLS
198 printk("FIONBIO, %08lx) arg=%d ", arg, *(int *)arg);
199#endif
200 error = sys_ioctl(fd, FIONBIO, arg);
201 break;
202
203 case 0x80047476:
204#ifdef DEBUG_IOCTLS
205 printk("TIOCSPGRP, %08lx) arg=%d ", arg, *(int *)arg);
206#endif
207 error = sys_ioctl(fd, TIOCSPGRP, arg);
208 break;
209
210 case 0x8020690c:
211#ifdef DEBUG_IOCTLS
212 printk("SIOCSIFADDR, %08lx) arg=%d ", arg, *(int *)arg);
213#endif
214 error = sys_ioctl(fd, SIOCSIFADDR, arg);
215 break;
216
217 case 0x80206910:
218#ifdef DEBUG_IOCTLS
219 printk("SIOCSIFFLAGS, %08lx) arg=%d ", arg, *(int *)arg);
220#endif
221 error = sys_ioctl(fd, SIOCSIFFLAGS, arg);
222 break;
223
224 case 0xc0206911:
225#ifdef DEBUG_IOCTLS
226 printk("SIOCGIFFLAGS, %08lx) arg=%d ", arg, *(int *)arg);
227#endif
228 error = sys_ioctl(fd, SIOCGIFFLAGS, arg);
229 break;
230
231 case 0xc020691b:
232#ifdef DEBUG_IOCTLS
233 printk("SIOCGIFMETRIC, %08lx) arg=%d ", arg, *(int *)arg);
234#endif
235 error = sys_ioctl(fd, SIOCGIFMETRIC, arg);
236 break;
237
238 default: {
239#ifdef DEBUG_MISSING_IOCTL
240 char *msg = "Unimplemented IOCTL cmd tell linux@engr.sgi.com\n";
241
242#ifdef DEBUG_IOCTLS
243 printk("UNIMP_IOCTL, %08lx)\n", arg);
244#endif
245 old_fs = get_fs(); set_fs(get_ds());
246 sys_write(2, msg, strlen(msg));
247 set_fs(old_fs);
248 printk("[%s:%d] Does unimplemented IRIX ioctl cmd %08lx\n",
249 current->comm, current->pid, cmd);
250 do_exit(255);
251#else
252 error = sys_ioctl (fd, cmd, arg);
253#endif
254 }
255
256 };
257#ifdef DEBUG_IOCTLS
258 printk("error=%d\n", error);
259#endif
260 return error;
261}
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
new file mode 100644
index 000000000000..3f956f809fa4
--- /dev/null
+++ b/arch/mips/kernel/irixsig.c
@@ -0,0 +1,853 @@
1/*
2 * irixsig.c: WHEEE, IRIX signals! YOW, am I compatible or what?!?!
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1997 - 2000 Ralf Baechle (ralf@gnu.org)
6 * Copyright (C) 2000 Silicon Graphics, Inc.
7 */
8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/mm.h>
11#include <linux/errno.h>
12#include <linux/smp.h>
13#include <linux/smp_lock.h>
14#include <linux/time.h>
15#include <linux/ptrace.h>
16
17#include <asm/ptrace.h>
18#include <asm/uaccess.h>
19
20#undef DEBUG_SIG
21
22#define _S(nr) (1<<((nr)-1))
23
24#define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP)))
25
26typedef struct {
27 unsigned long sig[4];
28} irix_sigset_t;
29
30struct sigctx_irix5 {
31 u32 rmask, cp0_status;
32 u64 pc;
33 u64 regs[32];
34 u64 fpregs[32];
35 u32 usedfp, fpcsr, fpeir, sstk_flags;
36 u64 hi, lo;
37 u64 cp0_cause, cp0_badvaddr, _unused0;
38 irix_sigset_t sigset;
39 u64 weird_fpu_thing;
40 u64 _unused1[31];
41};
42
43#ifdef DEBUG_SIG
44/* Debugging */
45static inline void dump_irix5_sigctx(struct sigctx_irix5 *c)
46{
47 int i;
48
49 printk("misc: rmask[%08lx] status[%08lx] pc[%08lx]\n",
50 (unsigned long) c->rmask,
51 (unsigned long) c->cp0_status,
52 (unsigned long) c->pc);
53 printk("regs: ");
54 for(i = 0; i < 16; i++)
55 printk("[%d]<%08lx> ", i, (unsigned long) c->regs[i]);
56 printk("\nregs: ");
57 for(i = 16; i < 32; i++)
58 printk("[%d]<%08lx> ", i, (unsigned long) c->regs[i]);
59 printk("\nfpregs: ");
60 for(i = 0; i < 16; i++)
61 printk("[%d]<%08lx> ", i, (unsigned long) c->fpregs[i]);
62 printk("\nfpregs: ");
63 for(i = 16; i < 32; i++)
64 printk("[%d]<%08lx> ", i, (unsigned long) c->fpregs[i]);
65 printk("misc: usedfp[%d] fpcsr[%08lx] fpeir[%08lx] stk_flgs[%08lx]\n",
66 (int) c->usedfp, (unsigned long) c->fpcsr,
67 (unsigned long) c->fpeir, (unsigned long) c->sstk_flags);
68 printk("misc: hi[%08lx] lo[%08lx] cause[%08lx] badvaddr[%08lx]\n",
69 (unsigned long) c->hi, (unsigned long) c->lo,
70 (unsigned long) c->cp0_cause, (unsigned long) c->cp0_badvaddr);
71 printk("misc: sigset<0>[%08lx] sigset<1>[%08lx] sigset<2>[%08lx] "
72 "sigset<3>[%08lx]\n", (unsigned long) c->sigset.sig[0],
73 (unsigned long) c->sigset.sig[1],
74 (unsigned long) c->sigset.sig[2],
75 (unsigned long) c->sigset.sig[3]);
76}
77#endif
78
79static void setup_irix_frame(struct k_sigaction *ka, struct pt_regs *regs,
80 int signr, sigset_t *oldmask)
81{
82 unsigned long sp;
83 struct sigctx_irix5 *ctx;
84 int i;
85
86 sp = regs->regs[29];
87 sp -= sizeof(struct sigctx_irix5);
88 sp &= ~(0xf);
89 ctx = (struct sigctx_irix5 *) sp;
90 if (!access_ok(VERIFY_WRITE, ctx, sizeof(*ctx)))
91 goto segv_and_exit;
92
93 __put_user(0, &ctx->weird_fpu_thing);
94 __put_user(~(0x00000001), &ctx->rmask);
95 __put_user(0, &ctx->regs[0]);
96 for(i = 1; i < 32; i++)
97 __put_user((u64) regs->regs[i], &ctx->regs[i]);
98
99 __put_user((u64) regs->hi, &ctx->hi);
100 __put_user((u64) regs->lo, &ctx->lo);
101 __put_user((u64) regs->cp0_epc, &ctx->pc);
102 __put_user(!!used_math(), &ctx->usedfp);
103 __put_user((u64) regs->cp0_cause, &ctx->cp0_cause);
104 __put_user((u64) regs->cp0_badvaddr, &ctx->cp0_badvaddr);
105
106 __put_user(0, &ctx->sstk_flags); /* XXX sigstack unimp... todo... */
107
108 __copy_to_user(&ctx->sigset, oldmask, sizeof(irix_sigset_t));
109
110#ifdef DEBUG_SIG
111 dump_irix5_sigctx(ctx);
112#endif
113
114 regs->regs[4] = (unsigned long) signr;
115 regs->regs[5] = 0; /* XXX sigcode XXX */
116 regs->regs[6] = regs->regs[29] = sp;
117 regs->regs[7] = (unsigned long) ka->sa.sa_handler;
118 regs->regs[25] = regs->cp0_epc = (unsigned long) ka->sa_restorer;
119
120 return;
121
122segv_and_exit:
123 force_sigsegv(signr, current);
124}
125
126static void inline
127setup_irix_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
128 int signr, sigset_t *oldmask, siginfo_t *info)
129{
130 printk("Aiee: setup_tr_frame wants to be written");
131 do_exit(SIGSEGV);
132}
133
134static inline void handle_signal(unsigned long sig, siginfo_t *info,
135 struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs)
136{
137 switch(regs->regs[0]) {
138 case ERESTARTNOHAND:
139 regs->regs[2] = EINTR;
140 break;
141 case ERESTARTSYS:
142 if(!(ka->sa.sa_flags & SA_RESTART)) {
143 regs->regs[2] = EINTR;
144 break;
145 }
146 /* fallthrough */
147 case ERESTARTNOINTR: /* Userland will reload $v0. */
148 regs->cp0_epc -= 8;
149 }
150
151 regs->regs[0] = 0; /* Don't deal with this again. */
152
153 if (ka->sa.sa_flags & SA_SIGINFO)
154 setup_irix_rt_frame(ka, regs, sig, oldset, info);
155 else
156 setup_irix_frame(ka, regs, sig, oldset);
157
158 if (!(ka->sa.sa_flags & SA_NODEFER)) {
159 spin_lock_irq(&current->sighand->siglock);
160 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
161 sigaddset(&current->blocked,sig);
162 recalc_sigpending();
163 spin_unlock_irq(&current->sighand->siglock);
164 }
165}
166
167asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs)
168{
169 struct k_sigaction ka;
170 siginfo_t info;
171 int signr;
172
173 /*
174 * We want the common case to go fast, which is why we may in certain
175 * cases get here from kernel mode. Just return without doing anything
176 * if so.
177 */
178 if (!user_mode(regs))
179 return 1;
180
181 if (try_to_freeze(0))
182 goto no_signal;
183
184 if (!oldset)
185 oldset = &current->blocked;
186
187 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
188 if (signr > 0) {
189 handle_signal(signr, &info, &ka, oldset, regs);
190 return 1;
191 }
192
193no_signal:
194 /*
195 * Who's code doesn't conform to the restartable syscall convention
196 * dies here!!! The li instruction, a single machine instruction,
197 * must directly be followed by the syscall instruction.
198 */
199 if (regs->regs[0]) {
200 if (regs->regs[2] == ERESTARTNOHAND ||
201 regs->regs[2] == ERESTARTSYS ||
202 regs->regs[2] == ERESTARTNOINTR) {
203 regs->cp0_epc -= 8;
204 }
205 }
206 return 0;
207}
208
209asmlinkage void
210irix_sigreturn(struct pt_regs *regs)
211{
212 struct sigctx_irix5 *context, *magic;
213 unsigned long umask, mask;
214 u64 *fregs;
215 int sig, i, base = 0;
216 sigset_t blocked;
217
218 /* Always make any pending restarted system calls return -EINTR */
219 current_thread_info()->restart_block.fn = do_no_restart_syscall;
220
221 if (regs->regs[2] == 1000)
222 base = 1;
223
224 context = (struct sigctx_irix5 *) regs->regs[base + 4];
225 magic = (struct sigctx_irix5 *) regs->regs[base + 5];
226 sig = (int) regs->regs[base + 6];
227#ifdef DEBUG_SIG
228 printk("[%s:%d] IRIX sigreturn(scp[%p],ucp[%p],sig[%d])\n",
229 current->comm, current->pid, context, magic, sig);
230#endif
231 if (!context)
232 context = magic;
233 if (!access_ok(VERIFY_READ, context, sizeof(struct sigctx_irix5)))
234 goto badframe;
235
236#ifdef DEBUG_SIG
237 dump_irix5_sigctx(context);
238#endif
239
240 __get_user(regs->cp0_epc, &context->pc);
241 umask = context->rmask; mask = 2;
242 for (i = 1; i < 32; i++, mask <<= 1) {
243 if(umask & mask)
244 __get_user(regs->regs[i], &context->regs[i]);
245 }
246 __get_user(regs->hi, &context->hi);
247 __get_user(regs->lo, &context->lo);
248
249 if ((umask & 1) && context->usedfp) {
250 fregs = (u64 *) &current->thread.fpu;
251 for(i = 0; i < 32; i++)
252 fregs[i] = (u64) context->fpregs[i];
253 __get_user(current->thread.fpu.hard.fcr31, &context->fpcsr);
254 }
255
256 /* XXX do sigstack crapola here... XXX */
257
258 if (__copy_from_user(&blocked, &context->sigset, sizeof(blocked)))
259 goto badframe;
260
261 sigdelsetmask(&blocked, ~_BLOCKABLE);
262 spin_lock_irq(&current->sighand->siglock);
263 current->blocked = blocked;
264 recalc_sigpending();
265 spin_unlock_irq(&current->sighand->siglock);
266
267 /*
268 * Don't let your children do this ...
269 */
270 if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
271 do_syscall_trace(regs, 1);
272 __asm__ __volatile__(
273 "move\t$29,%0\n\t"
274 "j\tsyscall_exit"
275 :/* no outputs */
276 :"r" (&regs));
277 /* Unreached */
278
279badframe:
280 force_sig(SIGSEGV, current);
281}
282
283struct sigact_irix5 {
284 int flags;
285 void (*handler)(int);
286 u32 sigset[4];
287 int _unused0[2];
288};
289
290#ifdef DEBUG_SIG
291static inline void dump_sigact_irix5(struct sigact_irix5 *p)
292{
293 printk("<f[%d] hndlr[%08lx] msk[%08lx]>", p->flags,
294 (unsigned long) p->handler,
295 (unsigned long) p->sigset[0]);
296}
297#endif
298
299asmlinkage int
300irix_sigaction(int sig, const struct sigaction *act,
301 struct sigaction *oact, void *trampoline)
302{
303 struct k_sigaction new_ka, old_ka;
304 int ret;
305
306#ifdef DEBUG_SIG
307 printk(" (%d,%s,%s,%08lx) ", sig, (!new ? "0" : "NEW"),
308 (!old ? "0" : "OLD"), trampoline);
309 if(new) {
310 dump_sigact_irix5(new); printk(" ");
311 }
312#endif
313 if (act) {
314 sigset_t mask;
315 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
316 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
317 __get_user(new_ka.sa.sa_flags, &act->sa_flags))
318 return -EFAULT;
319
320 __copy_from_user(&mask, &act->sa_mask, sizeof(sigset_t));
321
322 /*
323 * Hmmm... methinks IRIX libc always passes a valid trampoline
324 * value for all invocations of sigaction. Will have to
325 * investigate. POSIX POSIX, die die die...
326 */
327 new_ka.sa_restorer = trampoline;
328 }
329
330/* XXX Implement SIG_SETMASK32 for IRIX compatibility */
331 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
332
333 if (!ret && oact) {
334 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
335 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
336 __put_user(old_ka.sa.sa_flags, &oact->sa_flags))
337 return -EFAULT;
338 __copy_to_user(&old_ka.sa.sa_mask, &oact->sa_mask,
339 sizeof(sigset_t));
340 }
341
342 return ret;
343}
344
345asmlinkage int irix_sigpending(irix_sigset_t *set)
346{
347 return do_sigpending(set, sizeof(*set));
348}
349
350asmlinkage int irix_sigprocmask(int how, irix_sigset_t *new, irix_sigset_t *old)
351{
352 sigset_t oldbits, newbits;
353
354 if (new) {
355 if (!access_ok(VERIFY_READ, new, sizeof(*new)))
356 return -EFAULT;
357 __copy_from_user(&newbits, new, sizeof(unsigned long)*4);
358 sigdelsetmask(&newbits, ~_BLOCKABLE);
359
360 spin_lock_irq(&current->sighand->siglock);
361 oldbits = current->blocked;
362
363 switch(how) {
364 case 1:
365 sigorsets(&newbits, &oldbits, &newbits);
366 break;
367
368 case 2:
369 sigandsets(&newbits, &oldbits, &newbits);
370 break;
371
372 case 3:
373 break;
374
375 case 256:
376 siginitset(&newbits, newbits.sig[0]);
377 break;
378
379 default:
380 return -EINVAL;
381 }
382 recalc_sigpending();
383 spin_unlock_irq(&current->sighand->siglock);
384 }
385 if(old) {
386 if (!access_ok(VERIFY_WRITE, old, sizeof(*old)))
387 return -EFAULT;
388 __copy_to_user(old, &current->blocked, sizeof(unsigned long)*4);
389 }
390
391 return 0;
392}
393
394asmlinkage int irix_sigsuspend(struct pt_regs *regs)
395{
396 sigset_t *uset, saveset, newset;
397
398 uset = (sigset_t *) regs->regs[4];
399 if (copy_from_user(&newset, uset, sizeof(sigset_t)))
400 return -EFAULT;
401 sigdelsetmask(&newset, ~_BLOCKABLE);
402
403 spin_lock_irq(&current->sighand->siglock);
404 saveset = current->blocked;
405 current->blocked = newset;
406 recalc_sigpending();
407 spin_unlock_irq(&current->sighand->siglock);
408
409 regs->regs[2] = -EINTR;
410 while (1) {
411 current->state = TASK_INTERRUPTIBLE;
412 schedule();
413 if (do_irix_signal(&saveset, regs))
414 return -EINTR;
415 }
416}
417
418/* hate hate hate... */
419struct irix5_siginfo {
420 int sig, code, error;
421 union {
422 char unused[128 - (3 * 4)]; /* Safety net. */
423 struct {
424 int pid;
425 union {
426 int uid;
427 struct {
428 int utime, status, stime;
429 } child;
430 } procdata;
431 } procinfo;
432
433 unsigned long fault_addr;
434
435 struct {
436 int fd;
437 long band;
438 } fileinfo;
439
440 unsigned long sigval;
441 } stuff;
442};
443
444static inline unsigned long timespectojiffies(struct timespec *value)
445{
446 unsigned long sec = (unsigned) value->tv_sec;
447 long nsec = value->tv_nsec;
448
449 if (sec > (LONG_MAX / HZ))
450 return LONG_MAX;
451 nsec += 1000000000L / HZ - 1;
452 nsec /= 1000000000L / HZ;
453 return HZ * sec + nsec;
454}
455
456asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
457 struct timespec *tp)
458{
459 long expire = MAX_SCHEDULE_TIMEOUT;
460 sigset_t kset;
461 int i, sig, error, timeo = 0;
462
463#ifdef DEBUG_SIG
464 printk("[%s:%d] irix_sigpoll_sys(%p,%p,%p)\n",
465 current->comm, current->pid, set, info, tp);
466#endif
467
468 /* Must always specify the signal set. */
469 if (!set)
470 return -EINVAL;
471
472 if (!access_ok(VERIFY_READ, set, sizeof(kset))) {
473 error = -EFAULT;
474 goto out;
475 }
476
477 __copy_from_user(&kset, set, sizeof(set));
478 if (error)
479 goto out;
480
481 if (info && clear_user(info, sizeof(*info))) {
482 error = -EFAULT;
483 goto out;
484 }
485
486 if (tp) {
487 if (!access_ok(VERIFY_READ, tp, sizeof(*tp)))
488 return -EFAULT;
489 if (!tp->tv_sec && !tp->tv_nsec) {
490 error = -EINVAL;
491 goto out;
492 }
493 expire = timespectojiffies(tp)+(tp->tv_sec||tp->tv_nsec);
494 }
495
496 while(1) {
497 long tmp = 0;
498
499 current->state = TASK_INTERRUPTIBLE;
500 expire = schedule_timeout(expire);
501
502 for (i=0; i<=4; i++)
503 tmp |= (current->pending.signal.sig[i] & kset.sig[i]);
504
505 if (tmp)
506 break;
507 if (!expire) {
508 timeo = 1;
509 break;
510 }
511 if (signal_pending(current))
512 return -EINTR;
513 }
514 if (timeo)
515 return -EAGAIN;
516
517 for(sig = 1; i <= 65 /* IRIX_NSIG */; sig++) {
518 if (sigismember (&kset, sig))
519 continue;
520 if (sigismember (&current->pending.signal, sig)) {
521 /* XXX need more than this... */
522 if (info)
523 info->sig = sig;
524 error = 0;
525 goto out;
526 }
527 }
528
529 /* Should not get here, but do something sane if we do. */
530 error = -EINTR;
531
532out:
533 return error;
534}
535
536/* This is here because of irix5_siginfo definition. */
537#define IRIX_P_PID 0
538#define IRIX_P_PGID 2
539#define IRIX_P_ALL 7
540
541extern int getrusage(struct task_struct *, int, struct rusage __user *);
542
543#define W_EXITED 1
544#define W_TRAPPED 2
545#define W_STOPPED 4
546#define W_CONT 8
547#define W_NOHANG 64
548
549#define W_MASK (W_EXITED | W_TRAPPED | W_STOPPED | W_CONT | W_NOHANG)
550
551asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
552 int options, struct rusage *ru)
553{
554 int flag, retval;
555 DECLARE_WAITQUEUE(wait, current);
556 struct task_struct *tsk;
557 struct task_struct *p;
558 struct list_head *_p;
559
560 if (!info) {
561 retval = -EINVAL;
562 goto out;
563 }
564 if (!access_ok(VERIFY_WRITE, info, sizeof(*info))) {
565 retval = -EFAULT;
566 goto out;
567 }
568 if (ru) {
569 if (!access_ok(VERIFY_WRITE, ru, sizeof(*ru))) {
570 retval = -EFAULT;
571 goto out;
572 }
573 }
574 if (options & ~(W_MASK)) {
575 retval = -EINVAL;
576 goto out;
577 }
578 if (type != IRIX_P_PID && type != IRIX_P_PGID && type != IRIX_P_ALL) {
579 retval = -EINVAL;
580 goto out;
581 }
582 add_wait_queue(&current->signal->wait_chldexit, &wait);
583repeat:
584 flag = 0;
585 current->state = TASK_INTERRUPTIBLE;
586 read_lock(&tasklist_lock);
587 tsk = current;
588 list_for_each(_p,&tsk->children) {
589 p = list_entry(_p,struct task_struct,sibling);
590 if ((type == IRIX_P_PID) && p->pid != pid)
591 continue;
592 if ((type == IRIX_P_PGID) && process_group(p) != pid)
593 continue;
594 if ((p->exit_signal != SIGCHLD))
595 continue;
596 flag = 1;
597 switch (p->state) {
598 case TASK_STOPPED:
599 if (!p->exit_code)
600 continue;
601 if (!(options & (W_TRAPPED|W_STOPPED)) &&
602 !(p->ptrace & PT_PTRACED))
603 continue;
604 read_unlock(&tasklist_lock);
605
606 /* move to end of parent's list to avoid starvation */
607 write_lock_irq(&tasklist_lock);
608 remove_parent(p);
609 add_parent(p, p->parent);
610 write_unlock_irq(&tasklist_lock);
611 retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
612 if (!retval && ru) {
613 retval |= __put_user(SIGCHLD, &info->sig);
614 retval |= __put_user(0, &info->code);
615 retval |= __put_user(p->pid, &info->stuff.procinfo.pid);
616 retval |= __put_user((p->exit_code >> 8) & 0xff,
617 &info->stuff.procinfo.procdata.child.status);
618 retval |= __put_user(p->utime, &info->stuff.procinfo.procdata.child.utime);
619 retval |= __put_user(p->stime, &info->stuff.procinfo.procdata.child.stime);
620 }
621 if (!retval) {
622 p->exit_code = 0;
623 }
624 goto end_waitsys;
625
626 case EXIT_ZOMBIE:
627 current->signal->cutime += p->utime + p->signal->cutime;
628 current->signal->cstime += p->stime + p->signal->cstime;
629 if (ru != NULL)
630 getrusage(p, RUSAGE_BOTH, ru);
631 __put_user(SIGCHLD, &info->sig);
632 __put_user(1, &info->code); /* CLD_EXITED */
633 __put_user(p->pid, &info->stuff.procinfo.pid);
634 __put_user((p->exit_code >> 8) & 0xff,
635 &info->stuff.procinfo.procdata.child.status);
636 __put_user(p->utime,
637 &info->stuff.procinfo.procdata.child.utime);
638 __put_user(p->stime,
639 &info->stuff.procinfo.procdata.child.stime);
640 retval = 0;
641 if (p->real_parent != p->parent) {
642 write_lock_irq(&tasklist_lock);
643 remove_parent(p);
644 p->parent = p->real_parent;
645 add_parent(p, p->parent);
646 do_notify_parent(p, SIGCHLD);
647 write_unlock_irq(&tasklist_lock);
648 } else
649 release_task(p);
650 goto end_waitsys;
651 default:
652 continue;
653 }
654 tsk = next_thread(tsk);
655 }
656 read_unlock(&tasklist_lock);
657 if (flag) {
658 retval = 0;
659 if (options & W_NOHANG)
660 goto end_waitsys;
661 retval = -ERESTARTSYS;
662 if (signal_pending(current))
663 goto end_waitsys;
664 current->state = TASK_INTERRUPTIBLE;
665 schedule();
666 goto repeat;
667 }
668 retval = -ECHILD;
669end_waitsys:
670 current->state = TASK_RUNNING;
671 remove_wait_queue(&current->signal->wait_chldexit, &wait);
672
673out:
674 return retval;
675}
676
677struct irix5_context {
678 u32 flags;
679 u32 link;
680 u32 sigmask[4];
681 struct { u32 sp, size, flags; } stack;
682 int regs[36];
683 u32 fpregs[32];
684 u32 fpcsr;
685 u32 _unused0;
686 u32 _unused1[47];
687 u32 weird_graphics_thing;
688};
689
690asmlinkage int irix_getcontext(struct pt_regs *regs)
691{
692 int i, base = 0;
693 struct irix5_context *ctx;
694 unsigned long flags;
695
696 if (regs->regs[2] == 1000)
697 base = 1;
698 ctx = (struct irix5_context *) regs->regs[base + 4];
699
700#ifdef DEBUG_SIG
701 printk("[%s:%d] irix_getcontext(%p)\n",
702 current->comm, current->pid, ctx);
703#endif
704
705 if (!access_ok(VERIFY_WRITE, ctx, sizeof(*ctx)))
706 return -EFAULT;
707
708 __put_user(current->thread.irix_oldctx, &ctx->link);
709
710 __copy_to_user(&ctx->sigmask, &current->blocked, sizeof(irix_sigset_t));
711
712 /* XXX Do sigstack stuff someday... */
713 __put_user(0, &ctx->stack.sp);
714 __put_user(0, &ctx->stack.size);
715 __put_user(0, &ctx->stack.flags);
716
717 __put_user(0, &ctx->weird_graphics_thing);
718 __put_user(0, &ctx->regs[0]);
719 for (i = 1; i < 32; i++)
720 __put_user(regs->regs[i], &ctx->regs[i]);
721 __put_user(regs->lo, &ctx->regs[32]);
722 __put_user(regs->hi, &ctx->regs[33]);
723 __put_user(regs->cp0_cause, &ctx->regs[34]);
724 __put_user(regs->cp0_epc, &ctx->regs[35]);
725
726 flags = 0x0f;
727 if (!used_math()) {
728 flags &= ~(0x08);
729 } else {
730 /* XXX wheee... */
731 printk("Wheee, no code for saving IRIX FPU context yet.\n");
732 }
733 __put_user(flags, &ctx->flags);
734
735 return 0;
736}
737
738asmlinkage unsigned long irix_setcontext(struct pt_regs *regs)
739{
740 int error, base = 0;
741 struct irix5_context *ctx;
742
743 if(regs->regs[2] == 1000)
744 base = 1;
745 ctx = (struct irix5_context *) regs->regs[base + 4];
746
747#ifdef DEBUG_SIG
748 printk("[%s:%d] irix_setcontext(%p)\n",
749 current->comm, current->pid, ctx);
750#endif
751
752 if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx))) {
753 error = -EFAULT;
754 goto out;
755 }
756
757 if (ctx->flags & 0x02) {
758 /* XXX sigstack garbage, todo... */
759 printk("Wheee, cannot do sigstack stuff in setcontext\n");
760 }
761
762 if (ctx->flags & 0x04) {
763 int i;
764
765 /* XXX extra control block stuff... todo... */
766 for(i = 1; i < 32; i++)
767 regs->regs[i] = ctx->regs[i];
768 regs->lo = ctx->regs[32];
769 regs->hi = ctx->regs[33];
770 regs->cp0_epc = ctx->regs[35];
771 }
772
773 if (ctx->flags & 0x08) {
774 /* XXX fpu context, blah... */
775 printk("Wheee, cannot restore FPU context yet...\n");
776 }
777 current->thread.irix_oldctx = ctx->link;
778 error = regs->regs[2];
779
780out:
781 return error;
782}
783
784struct irix_sigstack { unsigned long sp; int status; };
785
786asmlinkage int irix_sigstack(struct irix_sigstack *new, struct irix_sigstack *old)
787{
788 int error = -EFAULT;
789
790#ifdef DEBUG_SIG
791 printk("[%s:%d] irix_sigstack(%p,%p)\n",
792 current->comm, current->pid, new, old);
793#endif
794 if(new) {
795 if (!access_ok(VERIFY_READ, new, sizeof(*new)))
796 goto out;
797 }
798
799 if(old) {
800 if (!access_ok(VERIFY_WRITE, old, sizeof(*old)))
801 goto out;
802 }
803 error = 0;
804
805out:
806 return error;
807}
808
809struct irix_sigaltstack { unsigned long sp; int size; int status; };
810
811asmlinkage int irix_sigaltstack(struct irix_sigaltstack *new,
812 struct irix_sigaltstack *old)
813{
814 int error = -EFAULT;
815
816#ifdef DEBUG_SIG
817 printk("[%s:%d] irix_sigaltstack(%p,%p)\n",
818 current->comm, current->pid, new, old);
819#endif
820 if (new) {
821 if (!access_ok(VERIFY_READ, new, sizeof(*new)))
822 goto out;
823 }
824
825 if (old) {
826 if (!access_ok(VERIFY_WRITE, old, sizeof(*old)))
827 goto out;
828 }
829 error = 0;
830
831out:
832 error = 0;
833
834 return error;
835}
836
837struct irix_procset {
838 int cmd, ltype, lid, rtype, rid;
839};
840
841asmlinkage int irix_sigsendset(struct irix_procset *pset, int sig)
842{
843 if (!access_ok(VERIFY_READ, pset, sizeof(*pset)))
844 return -EFAULT;
845
846#ifdef DEBUG_SIG
847 printk("[%s:%d] irix_sigsendset([%d,%d,%d,%d,%d],%d)\n",
848 current->comm, current->pid,
849 pset->cmd, pset->ltype, pset->lid, pset->rtype, pset->rid,
850 sig);
851#endif
852 return -EINVAL;
853}
diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
new file mode 100644
index 000000000000..43c00ac0b88d
--- /dev/null
+++ b/arch/mips/kernel/irq-msc01.c
@@ -0,0 +1,189 @@
1/*
2 * Copyright (c) 2004 MIPS Inc
3 * Author: chris@mips.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#include <linux/module.h>
11#include <linux/interrupt.h>
12#include <linux/kernel.h>
13#include <asm/ptrace.h>
14#include <linux/sched.h>
15#include <linux/kernel_stat.h>
16#include <asm/io.h>
17#include <asm/irq.h>
18#include <asm/msc01_ic.h>
19
20static unsigned long _icctrl_msc;
21#define MSC01_IC_REG_BASE _icctrl_msc
22
23#define MSCIC_WRITE(reg, data) do { *(volatile u32 *)(reg) = data; } while (0)
24#define MSCIC_READ(reg, data) do { data = *(volatile u32 *)(reg); } while (0)
25
26static unsigned int irq_base;
27
28/* mask off an interrupt */
29static inline void mask_msc_irq(unsigned int irq)
30{
31 if (irq < (irq_base + 32))
32 MSCIC_WRITE(MSC01_IC_DISL, 1<<(irq - irq_base));
33 else
34 MSCIC_WRITE(MSC01_IC_DISH, 1<<(irq - irq_base - 32));
35}
36
37/* unmask an interrupt */
38static inline void unmask_msc_irq(unsigned int irq)
39{
40 if (irq < (irq_base + 32))
41 MSCIC_WRITE(MSC01_IC_ENAL, 1<<(irq - irq_base));
42 else
43 MSCIC_WRITE(MSC01_IC_ENAH, 1<<(irq - irq_base - 32));
44}
45
46/*
47 * Enables the IRQ on SOC-it
48 */
49static void enable_msc_irq(unsigned int irq)
50{
51 unmask_msc_irq(irq);
52}
53
54/*
55 * Initialize the IRQ on SOC-it
56 */
57static unsigned int startup_msc_irq(unsigned int irq)
58{
59 unmask_msc_irq(irq);
60 return 0;
61}
62
63/*
64 * Disables the IRQ on SOC-it
65 */
66static void disable_msc_irq(unsigned int irq)
67{
68 mask_msc_irq(irq);
69}
70
71/*
72 * Masks and ACKs an IRQ
73 */
74static void level_mask_and_ack_msc_irq(unsigned int irq)
75{
76 mask_msc_irq(irq);
77 if (!cpu_has_ei)
78 MSCIC_WRITE(MSC01_IC_EOI, 0);
79}
80
81/*
82 * Masks and ACKs an IRQ
83 */
84static void edge_mask_and_ack_msc_irq(unsigned int irq)
85{
86 mask_msc_irq(irq);
87 if (!cpu_has_ei)
88 MSCIC_WRITE(MSC01_IC_EOI, 0);
89 else {
90 u32 r;
91 MSCIC_READ(MSC01_IC_SUP+irq*8, r);
92 MSCIC_WRITE(MSC01_IC_SUP+irq*8, r | ~MSC01_IC_SUP_EDGE_BIT);
93 MSCIC_WRITE(MSC01_IC_SUP+irq*8, r);
94 }
95}
96
97/*
98 * End IRQ processing
99 */
100static void end_msc_irq(unsigned int irq)
101{
102 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
103 unmask_msc_irq(irq);
104}
105
106/*
107 * Interrupt handler for interrupts coming from SOC-it.
108 */
109void ll_msc_irq(struct pt_regs *regs)
110{
111 unsigned int irq;
112
113 /* read the interrupt vector register */
114 MSCIC_READ(MSC01_IC_VEC, irq);
115 if (irq < 64)
116 do_IRQ(irq + irq_base, regs);
117 else {
118 /* Ignore spurious interrupt */
119 }
120}
121
122void
123msc_bind_eic_interrupt (unsigned int irq, unsigned int set)
124{
125 MSCIC_WRITE(MSC01_IC_RAMW,
126 (irq<<MSC01_IC_RAMW_ADDR_SHF) | (set<<MSC01_IC_RAMW_DATA_SHF));
127}
128
129#define shutdown_msc_irq disable_msc_irq
130
131struct hw_interrupt_type msc_levelirq_type = {
132 "SOC-it-Level",
133 startup_msc_irq,
134 shutdown_msc_irq,
135 enable_msc_irq,
136 disable_msc_irq,
137 level_mask_and_ack_msc_irq,
138 end_msc_irq,
139 NULL
140};
141
142struct hw_interrupt_type msc_edgeirq_type = {
143 "SOC-it-Edge",
144 startup_msc_irq,
145 shutdown_msc_irq,
146 enable_msc_irq,
147 disable_msc_irq,
148 edge_mask_and_ack_msc_irq,
149 end_msc_irq,
150 NULL
151};
152
153
154void __init init_msc_irqs(unsigned int base, msc_irqmap_t *imp, int nirq)
155{
156 extern void (*board_bind_eic_interrupt)(unsigned int irq, unsigned int regset);
157
158 _icctrl_msc = (unsigned long) ioremap (MIPS_MSC01_IC_REG_BASE, 0x40000);
159
160 /* Reset interrupt controller - initialises all registers to 0 */
161 MSCIC_WRITE(MSC01_IC_RST, MSC01_IC_RST_RST_BIT);
162
163 board_bind_eic_interrupt = &msc_bind_eic_interrupt;
164
165 for (; nirq >= 0; nirq--, imp++) {
166 int n = imp->im_irq;
167
168 switch (imp->im_type) {
169 case MSC01_IRQ_EDGE:
170 irq_desc[base+n].handler = &msc_edgeirq_type;
171 if (cpu_has_ei)
172 MSCIC_WRITE(MSC01_IC_SUP+n*8, MSC01_IC_SUP_EDGE_BIT);
173 else
174 MSCIC_WRITE(MSC01_IC_SUP+n*8, MSC01_IC_SUP_EDGE_BIT | imp->im_lvl);
175 break;
176 case MSC01_IRQ_LEVEL:
177 irq_desc[base+n].handler = &msc_levelirq_type;
178 if (cpu_has_ei)
179 MSCIC_WRITE(MSC01_IC_SUP+n*8, 0);
180 else
181 MSCIC_WRITE(MSC01_IC_SUP+n*8, imp->im_lvl);
182 }
183 }
184
185 irq_base = base;
186
187 MSCIC_WRITE(MSC01_IC_GENA, MSC01_IC_GENA_GENA_BIT); /* Enable interrupt generation */
188
189}
diff --git a/arch/mips/kernel/irq-mv6434x.c b/arch/mips/kernel/irq-mv6434x.c
new file mode 100644
index 000000000000..088bbbc869e6
--- /dev/null
+++ b/arch/mips/kernel/irq-mv6434x.c
@@ -0,0 +1,161 @@
1/*
2 * Copyright 2002 Momentum Computer
3 * Author: mdharm@momenco.com
4 * Copyright (C) 2004 Ralf Baechle <ralf@linux-mips.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11#include <linux/module.h>
12#include <linux/interrupt.h>
13#include <linux/kernel.h>
14#include <asm/ptrace.h>
15#include <linux/sched.h>
16#include <linux/kernel_stat.h>
17#include <asm/io.h>
18#include <asm/irq.h>
19#include <linux/mv643xx.h>
20
21static unsigned int irq_base;
22
23static inline int ls1bit32(unsigned int x)
24{
25 int b = 31, s;
26
27 s = 16; if (x << 16 == 0) s = 0; b -= s; x <<= s;
28 s = 8; if (x << 8 == 0) s = 0; b -= s; x <<= s;
29 s = 4; if (x << 4 == 0) s = 0; b -= s; x <<= s;
30 s = 2; if (x << 2 == 0) s = 0; b -= s; x <<= s;
31 s = 1; if (x << 1 == 0) s = 0; b -= s;
32
33 return b;
34}
35
36/* mask off an interrupt -- 1 is enable, 0 is disable */
37static inline void mask_mv64340_irq(unsigned int irq)
38{
39 uint32_t value;
40
41 if (irq < (irq_base + 32)) {
42 value = MV_READ(MV64340_INTERRUPT0_MASK_0_LOW);
43 value &= ~(1 << (irq - irq_base));
44 MV_WRITE(MV64340_INTERRUPT0_MASK_0_LOW, value);
45 } else {
46 value = MV_READ(MV64340_INTERRUPT0_MASK_0_HIGH);
47 value &= ~(1 << (irq - irq_base - 32));
48 MV_WRITE(MV64340_INTERRUPT0_MASK_0_HIGH, value);
49 }
50}
51
52/* unmask an interrupt -- 1 is enable, 0 is disable */
53static inline void unmask_mv64340_irq(unsigned int irq)
54{
55 uint32_t value;
56
57 if (irq < (irq_base + 32)) {
58 value = MV_READ(MV64340_INTERRUPT0_MASK_0_LOW);
59 value |= 1 << (irq - irq_base);
60 MV_WRITE(MV64340_INTERRUPT0_MASK_0_LOW, value);
61 } else {
62 value = MV_READ(MV64340_INTERRUPT0_MASK_0_HIGH);
63 value |= 1 << (irq - irq_base - 32);
64 MV_WRITE(MV64340_INTERRUPT0_MASK_0_HIGH, value);
65 }
66}
67
68/*
69 * Enables the IRQ on Marvell Chip
70 */
71static void enable_mv64340_irq(unsigned int irq)
72{
73 unmask_mv64340_irq(irq);
74}
75
76/*
77 * Initialize the IRQ on Marvell Chip
78 */
79static unsigned int startup_mv64340_irq(unsigned int irq)
80{
81 unmask_mv64340_irq(irq);
82 return 0;
83}
84
85/*
86 * Disables the IRQ on Marvell Chip
87 */
88static void disable_mv64340_irq(unsigned int irq)
89{
90 mask_mv64340_irq(irq);
91}
92
93/*
94 * Masks and ACKs an IRQ
95 */
96static void mask_and_ack_mv64340_irq(unsigned int irq)
97{
98 mask_mv64340_irq(irq);
99}
100
101/*
102 * End IRQ processing
103 */
104static void end_mv64340_irq(unsigned int irq)
105{
106 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
107 unmask_mv64340_irq(irq);
108}
109
110/*
111 * Interrupt handler for interrupts coming from the Marvell chip.
112 * It could be built in ethernet ports etc...
113 */
114void ll_mv64340_irq(struct pt_regs *regs)
115{
116 unsigned int irq_src_low, irq_src_high;
117 unsigned int irq_mask_low, irq_mask_high;
118
119 /* read the interrupt status registers */
120 irq_mask_low = MV_READ(MV64340_INTERRUPT0_MASK_0_LOW);
121 irq_mask_high = MV_READ(MV64340_INTERRUPT0_MASK_0_HIGH);
122 irq_src_low = MV_READ(MV64340_MAIN_INTERRUPT_CAUSE_LOW);
123 irq_src_high = MV_READ(MV64340_MAIN_INTERRUPT_CAUSE_HIGH);
124
125 /* mask for just the interrupts we want */
126 irq_src_low &= irq_mask_low;
127 irq_src_high &= irq_mask_high;
128
129 if (irq_src_low)
130 do_IRQ(ls1bit32(irq_src_low) + irq_base, regs);
131 else
132 do_IRQ(ls1bit32(irq_src_high) + irq_base + 32, regs);
133}
134
135#define shutdown_mv64340_irq disable_mv64340_irq
136
137struct hw_interrupt_type mv64340_irq_type = {
138 "MV-64340",
139 startup_mv64340_irq,
140 shutdown_mv64340_irq,
141 enable_mv64340_irq,
142 disable_mv64340_irq,
143 mask_and_ack_mv64340_irq,
144 end_mv64340_irq,
145 NULL
146};
147
148void __init mv64340_irq_init(unsigned int base)
149{
150 int i;
151
152 /* Reset irq handlers pointers to NULL */
153 for (i = base; i < base + 64; i++) {
154 irq_desc[i].status = IRQ_DISABLED;
155 irq_desc[i].action = 0;
156 irq_desc[i].depth = 2;
157 irq_desc[i].handler = &mv64340_irq_type;
158 }
159
160 irq_base = base;
161}
diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
new file mode 100644
index 000000000000..f5d779fd0355
--- /dev/null
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2003 Ralf Baechle
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * Handler for RM7000 extended interrupts. These are a non-standard
10 * feature so we handle them separately from standard interrupts.
11 */
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/kernel.h>
15
16#include <asm/irq_cpu.h>
17#include <asm/mipsregs.h>
18#include <asm/system.h>
19
20static int irq_base;
21
22static inline void unmask_rm7k_irq(unsigned int irq)
23{
24 set_c0_intcontrol(0x100 << (irq - irq_base));
25}
26
27static inline void mask_rm7k_irq(unsigned int irq)
28{
29 clear_c0_intcontrol(0x100 << (irq - irq_base));
30}
31
32static inline void rm7k_cpu_irq_enable(unsigned int irq)
33{
34 unsigned long flags;
35
36 local_irq_save(flags);
37 unmask_rm7k_irq(irq);
38 local_irq_restore(flags);
39}
40
41static void rm7k_cpu_irq_disable(unsigned int irq)
42{
43 unsigned long flags;
44
45 local_irq_save(flags);
46 mask_rm7k_irq(irq);
47 local_irq_restore(flags);
48}
49
50static unsigned int rm7k_cpu_irq_startup(unsigned int irq)
51{
52 rm7k_cpu_irq_enable(irq);
53
54 return 0;
55}
56
57#define rm7k_cpu_irq_shutdown rm7k_cpu_irq_disable
58
59/*
60 * While we ack the interrupt interrupts are disabled and thus we don't need
61 * to deal with concurrency issues. Same for rm7k_cpu_irq_end.
62 */
63static void rm7k_cpu_irq_ack(unsigned int irq)
64{
65 mask_rm7k_irq(irq);
66}
67
68static void rm7k_cpu_irq_end(unsigned int irq)
69{
70 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
71 unmask_rm7k_irq(irq);
72}
73
74static hw_irq_controller rm7k_irq_controller = {
75 "RM7000",
76 rm7k_cpu_irq_startup,
77 rm7k_cpu_irq_shutdown,
78 rm7k_cpu_irq_enable,
79 rm7k_cpu_irq_disable,
80 rm7k_cpu_irq_ack,
81 rm7k_cpu_irq_end,
82};
83
84void __init rm7k_cpu_irq_init(int base)
85{
86 int i;
87
88 clear_c0_intcontrol(0x00000f00); /* Mask all */
89
90 for (i = base; i < base + 4; i++) {
91 irq_desc[i].status = IRQ_DISABLED;
92 irq_desc[i].action = NULL;
93 irq_desc[i].depth = 1;
94 irq_desc[i].handler = &rm7k_irq_controller;
95 }
96
97 irq_base = base;
98}
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
new file mode 100644
index 000000000000..bdd130296256
--- /dev/null
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -0,0 +1,149 @@
1/*
2 * Copyright (C) 2003 Ralf Baechle
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * Handler for RM9000 extended interrupts. These are a non-standard
10 * feature so we handle them separately from standard interrupts.
11 */
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/kernel.h>
15#include <linux/module.h>
16
17#include <asm/irq_cpu.h>
18#include <asm/mipsregs.h>
19#include <asm/system.h>
20
21static int irq_base;
22
23static inline void unmask_rm9k_irq(unsigned int irq)
24{
25 set_c0_intcontrol(0x1000 << (irq - irq_base));
26}
27
28static inline void mask_rm9k_irq(unsigned int irq)
29{
30 clear_c0_intcontrol(0x1000 << (irq - irq_base));
31}
32
33static inline void rm9k_cpu_irq_enable(unsigned int irq)
34{
35 unsigned long flags;
36
37 local_irq_save(flags);
38 unmask_rm9k_irq(irq);
39 local_irq_restore(flags);
40}
41
42static void rm9k_cpu_irq_disable(unsigned int irq)
43{
44 unsigned long flags;
45
46 local_irq_save(flags);
47 mask_rm9k_irq(irq);
48 local_irq_restore(flags);
49}
50
51static unsigned int rm9k_cpu_irq_startup(unsigned int irq)
52{
53 rm9k_cpu_irq_enable(irq);
54
55 return 0;
56}
57
58#define rm9k_cpu_irq_shutdown rm9k_cpu_irq_disable
59
60/*
61 * Performance counter interrupts are global on all processors.
62 */
63static void local_rm9k_perfcounter_irq_startup(void *args)
64{
65 unsigned int irq = (unsigned int) args;
66
67 rm9k_cpu_irq_enable(irq);
68}
69
70static unsigned int rm9k_perfcounter_irq_startup(unsigned int irq)
71{
72 on_each_cpu(local_rm9k_perfcounter_irq_startup, (void *) irq, 0, 1);
73
74 return 0;
75}
76
77static void local_rm9k_perfcounter_irq_shutdown(void *args)
78{
79 unsigned int irq = (unsigned int) args;
80 unsigned long flags;
81
82 local_irq_save(flags);
83 mask_rm9k_irq(irq);
84 local_irq_restore(flags);
85}
86
87static void rm9k_perfcounter_irq_shutdown(unsigned int irq)
88{
89 on_each_cpu(local_rm9k_perfcounter_irq_shutdown, (void *) irq, 0, 1);
90}
91
92
93/*
94 * While we ack the interrupt interrupts are disabled and thus we don't need
95 * to deal with concurrency issues. Same for rm9k_cpu_irq_end.
96 */
97static void rm9k_cpu_irq_ack(unsigned int irq)
98{
99 mask_rm9k_irq(irq);
100}
101
102static void rm9k_cpu_irq_end(unsigned int irq)
103{
104 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
105 unmask_rm9k_irq(irq);
106}
107
108static hw_irq_controller rm9k_irq_controller = {
109 "RM9000",
110 rm9k_cpu_irq_startup,
111 rm9k_cpu_irq_shutdown,
112 rm9k_cpu_irq_enable,
113 rm9k_cpu_irq_disable,
114 rm9k_cpu_irq_ack,
115 rm9k_cpu_irq_end,
116};
117
118static hw_irq_controller rm9k_perfcounter_irq = {
119 "RM9000",
120 rm9k_perfcounter_irq_startup,
121 rm9k_perfcounter_irq_shutdown,
122 rm9k_cpu_irq_enable,
123 rm9k_cpu_irq_disable,
124 rm9k_cpu_irq_ack,
125 rm9k_cpu_irq_end,
126};
127
128unsigned int rm9000_perfcount_irq;
129
130EXPORT_SYMBOL(rm9000_perfcount_irq);
131
132void __init rm9k_cpu_irq_init(int base)
133{
134 int i;
135
136 clear_c0_intcontrol(0x0000f000); /* Mask all */
137
138 for (i = base; i < base + 4; i++) {
139 irq_desc[i].status = IRQ_DISABLED;
140 irq_desc[i].action = NULL;
141 irq_desc[i].depth = 1;
142 irq_desc[i].handler = &rm9k_irq_controller;
143 }
144
145 rm9000_perfcount_irq = base + 1;
146 irq_desc[rm9000_perfcount_irq].handler = &rm9k_perfcounter_irq;
147
148 irq_base = base;
149}
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
new file mode 100644
index 000000000000..441157a1f994
--- /dev/null
+++ b/arch/mips/kernel/irq.c
@@ -0,0 +1,140 @@
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 * Code to handle x86 style IRQs plus some generic interrupt stuff.
7 *
8 * Copyright (C) 1992 Linus Torvalds
9 * Copyright (C) 1994 - 2000 Ralf Baechle
10 */
11#include <linux/config.h>
12#include <linux/kernel.h>
13#include <linux/delay.h>
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/kernel_stat.h>
17#include <linux/module.h>
18#include <linux/proc_fs.h>
19#include <linux/slab.h>
20#include <linux/mm.h>
21#include <linux/random.h>
22#include <linux/sched.h>
23#include <linux/seq_file.h>
24#include <linux/kallsyms.h>
25
26#include <asm/atomic.h>
27#include <asm/system.h>
28#include <asm/uaccess.h>
29
30/*
31 * 'what should we do if we get a hw irq event on an illegal vector'.
32 * each architecture has to answer this themselves.
33 */
34void ack_bad_irq(unsigned int irq)
35{
36 printk("unexpected IRQ # %d\n", irq);
37}
38
39atomic_t irq_err_count;
40
41#undef do_IRQ
42
43/*
44 * do_IRQ handles all normal device IRQ's (the special
45 * SMP cross-CPU interrupts have their own specific
46 * handlers).
47 */
48asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs)
49{
50 irq_enter();
51
52 __do_IRQ(irq, regs);
53
54 irq_exit();
55
56 return 1;
57}
58
59/*
60 * Generic, controller-independent functions:
61 */
62
63int show_interrupts(struct seq_file *p, void *v)
64{
65 int i = *(loff_t *) v, j;
66 struct irqaction * action;
67 unsigned long flags;
68
69 if (i == 0) {
70 seq_printf(p, " ");
71 for (j=0; j<NR_CPUS; j++)
72 if (cpu_online(j))
73 seq_printf(p, "CPU%d ",j);
74 seq_putc(p, '\n');
75 }
76
77 if (i < NR_IRQS) {
78 spin_lock_irqsave(&irq_desc[i].lock, flags);
79 action = irq_desc[i].action;
80 if (!action)
81 goto skip;
82 seq_printf(p, "%3d: ",i);
83#ifndef CONFIG_SMP
84 seq_printf(p, "%10u ", kstat_irqs(i));
85#else
86 for (j = 0; j < NR_CPUS; j++)
87 if (cpu_online(j))
88 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
89#endif
90 seq_printf(p, " %14s", irq_desc[i].handler->typename);
91 seq_printf(p, " %s", action->name);
92
93 for (action=action->next; action; action = action->next)
94 seq_printf(p, ", %s", action->name);
95
96 seq_putc(p, '\n');
97skip:
98 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
99 } else if (i == NR_IRQS) {
100 seq_putc(p, '\n');
101 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
102 }
103 return 0;
104}
105
106#ifdef CONFIG_KGDB
107extern void breakpoint(void);
108extern void set_debug_traps(void);
109
110static int kgdb_flag = 1;
111static int __init nokgdb(char *str)
112{
113 kgdb_flag = 0;
114 return 1;
115}
116__setup("nokgdb", nokgdb);
117#endif
118
119void __init init_IRQ(void)
120{
121 int i;
122
123 for (i = 0; i < NR_IRQS; i++) {
124 irq_desc[i].status = IRQ_DISABLED;
125 irq_desc[i].action = NULL;
126 irq_desc[i].depth = 1;
127 irq_desc[i].handler = &no_irq_type;
128 spin_lock_init(&irq_desc[i].lock);
129 }
130
131 arch_init_irq();
132
133#ifdef CONFIG_KGDB
134 if (kgdb_flag) {
135 printk("Wait for gdb client connection ...\n");
136 set_debug_traps();
137 breakpoint();
138 }
139#endif
140}
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
new file mode 100644
index 000000000000..2b936cf1ef70
--- /dev/null
+++ b/arch/mips/kernel/irq_cpu.c
@@ -0,0 +1,118 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * Copyright (C) 2001 Ralf Baechle
6 *
7 * This file define the irq handler for MIPS CPU interrupts.
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 * Almost all MIPS CPUs define 8 interrupt sources. They are typically
17 * level triggered (i.e., cannot be cleared from CPU; must be cleared from
18 * device). The first two are software interrupts which we don't really
19 * use or support. The last one is usually the CPU timer interrupt if
20 * counter register is present or, for CPUs with an external FPU, by
21 * convention it's the FPU exception interrupt.
22 *
23 * Don't even think about using this on SMP. You have been warned.
24 *
25 * This file exports one global function:
26 * void mips_cpu_irq_init(int irq_base);
27 */
28#include <linux/init.h>
29#include <linux/interrupt.h>
30#include <linux/kernel.h>
31
32#include <asm/irq_cpu.h>
33#include <asm/mipsregs.h>
34#include <asm/system.h>
35
36static int mips_cpu_irq_base;
37
38static inline void unmask_mips_irq(unsigned int irq)
39{
40 clear_c0_cause(0x100 << (irq - mips_cpu_irq_base));
41 set_c0_status(0x100 << (irq - mips_cpu_irq_base));
42}
43
44static inline void mask_mips_irq(unsigned int irq)
45{
46 clear_c0_status(0x100 << (irq - mips_cpu_irq_base));
47}
48
49static inline void mips_cpu_irq_enable(unsigned int irq)
50{
51 unsigned long flags;
52
53 local_irq_save(flags);
54 unmask_mips_irq(irq);
55 local_irq_restore(flags);
56}
57
58static void mips_cpu_irq_disable(unsigned int irq)
59{
60 unsigned long flags;
61
62 local_irq_save(flags);
63 mask_mips_irq(irq);
64 local_irq_restore(flags);
65}
66
67static unsigned int mips_cpu_irq_startup(unsigned int irq)
68{
69 mips_cpu_irq_enable(irq);
70
71 return 0;
72}
73
74#define mips_cpu_irq_shutdown mips_cpu_irq_disable
75
76/*
77 * While we ack the interrupt interrupts are disabled and thus we don't need
78 * to deal with concurrency issues. Same for mips_cpu_irq_end.
79 */
80static void mips_cpu_irq_ack(unsigned int irq)
81{
82 /* Only necessary for soft interrupts */
83 clear_c0_cause(0x100 << (irq - mips_cpu_irq_base));
84
85 mask_mips_irq(irq);
86}
87
88static void mips_cpu_irq_end(unsigned int irq)
89{
90 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
91 unmask_mips_irq(irq);
92}
93
94static hw_irq_controller mips_cpu_irq_controller = {
95 "MIPS",
96 mips_cpu_irq_startup,
97 mips_cpu_irq_shutdown,
98 mips_cpu_irq_enable,
99 mips_cpu_irq_disable,
100 mips_cpu_irq_ack,
101 mips_cpu_irq_end,
102 NULL /* no affinity stuff for UP */
103};
104
105
106void __init mips_cpu_irq_init(int irq_base)
107{
108 int i;
109
110 for (i = irq_base; i < irq_base + 8; i++) {
111 irq_desc[i].status = IRQ_DISABLED;
112 irq_desc[i].action = NULL;
113 irq_desc[i].depth = 1;
114 irq_desc[i].handler = &mips_cpu_irq_controller;
115 }
116
117 mips_cpu_irq_base = irq_base;
118}
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
new file mode 100644
index 000000000000..993abc868e54
--- /dev/null
+++ b/arch/mips/kernel/linux32.c
@@ -0,0 +1,1469 @@
1/*
2 * Conversion between 32-bit and 64-bit native system calls.
3 *
4 * Copyright (C) 2000 Silicon Graphics, Inc.
5 * Written by Ulf Carlsson (ulfc@engr.sgi.com)
6 * sys32_execve from ia64/ia32 code, Feb 2000, Kanoj Sarcar (kanoj@sgi.com)
7 */
8#include <linux/config.h>
9#include <linux/compiler.h>
10#include <linux/mm.h>
11#include <linux/errno.h>
12#include <linux/file.h>
13#include <linux/smp_lock.h>
14#include <linux/highuid.h>
15#include <linux/dirent.h>
16#include <linux/resource.h>
17#include <linux/highmem.h>
18#include <linux/time.h>
19#include <linux/times.h>
20#include <linux/poll.h>
21#include <linux/slab.h>
22#include <linux/skbuff.h>
23#include <linux/filter.h>
24#include <linux/shm.h>
25#include <linux/sem.h>
26#include <linux/msg.h>
27#include <linux/icmpv6.h>
28#include <linux/syscalls.h>
29#include <linux/sysctl.h>
30#include <linux/utime.h>
31#include <linux/utsname.h>
32#include <linux/personality.h>
33#include <linux/timex.h>
34#include <linux/dnotify.h>
35#include <linux/module.h>
36#include <linux/binfmts.h>
37#include <linux/security.h>
38#include <linux/compat.h>
39#include <linux/vfs.h>
40
41#include <net/sock.h>
42#include <net/scm.h>
43
44#include <asm/ipc.h>
45#include <asm/sim.h>
46#include <asm/uaccess.h>
47#include <asm/mmu_context.h>
48#include <asm/mman.h>
49
50/* Use this to get at 32-bit user passed pointers. */
51/* A() macro should be used for places where you e.g.
52 have some internal variable u32 and just want to get
53 rid of a compiler warning. AA() has to be used in
54 places where you want to convert a function argument
55 to 32bit pointer or when you e.g. access pt_regs
56 structure and want to consider 32bit registers only.
57 */
58#define A(__x) ((unsigned long)(__x))
59#define AA(__x) ((unsigned long)((int)__x))
60
61#ifdef __MIPSEB__
62#define merge_64(r1,r2) ((((r1) & 0xffffffffUL) << 32) + ((r2) & 0xffffffffUL))
63#endif
64#ifdef __MIPSEL__
65#define merge_64(r1,r2) ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL))
66#endif
67
68/*
69 * Revalidate the inode. This is required for proper NFS attribute caching.
70 */
71
72int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
73{
74 struct compat_stat tmp;
75
76 if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev))
77 return -EOVERFLOW;
78
79 memset(&tmp, 0, sizeof(tmp));
80 tmp.st_dev = new_encode_dev(stat->dev);
81 tmp.st_ino = stat->ino;
82 tmp.st_mode = stat->mode;
83 tmp.st_nlink = stat->nlink;
84 SET_UID(tmp.st_uid, stat->uid);
85 SET_GID(tmp.st_gid, stat->gid);
86 tmp.st_rdev = new_encode_dev(stat->rdev);
87 tmp.st_size = stat->size;
88 tmp.st_atime = stat->atime.tv_sec;
89 tmp.st_mtime = stat->mtime.tv_sec;
90 tmp.st_ctime = stat->ctime.tv_sec;
91#ifdef STAT_HAVE_NSEC
92 tmp.st_atime_nsec = stat->atime.tv_nsec;
93 tmp.st_mtime_nsec = stat->mtime.tv_nsec;
94 tmp.st_ctime_nsec = stat->ctime.tv_nsec;
95#endif
96 tmp.st_blocks = stat->blocks;
97 tmp.st_blksize = stat->blksize;
98 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
99}
100
101asmlinkage unsigned long
102sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
103 unsigned long flags, unsigned long fd, unsigned long pgoff)
104{
105 struct file * file = NULL;
106 unsigned long error;
107
108 error = -EINVAL;
109 if (!(flags & MAP_ANONYMOUS)) {
110 error = -EBADF;
111 file = fget(fd);
112 if (!file)
113 goto out;
114 }
115 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
116
117 down_write(&current->mm->mmap_sem);
118 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
119 up_write(&current->mm->mmap_sem);
120 if (file)
121 fput(file);
122
123out:
124 return error;
125}
126
127
128asmlinkage int sys_truncate64(const char *path, unsigned int high,
129 unsigned int low)
130{
131 if ((int)high < 0)
132 return -EINVAL;
133 return sys_truncate(path, ((long) high << 32) | low);
134}
135
136asmlinkage int sys_ftruncate64(unsigned int fd, unsigned int high,
137 unsigned int low)
138{
139 if ((int)high < 0)
140 return -EINVAL;
141 return sys_ftruncate(fd, ((long) high << 32) | low);
142}
143
144/*
145 * sys_execve() executes a new program.
146 */
147asmlinkage int sys32_execve(nabi_no_regargs struct pt_regs regs)
148{
149 int error;
150 char * filename;
151
152 filename = getname(compat_ptr(regs.regs[4]));
153 error = PTR_ERR(filename);
154 if (IS_ERR(filename))
155 goto out;
156 error = compat_do_execve(filename, compat_ptr(regs.regs[5]),
157 compat_ptr(regs.regs[6]), &regs);
158 putname(filename);
159
160out:
161 return error;
162}
163
164struct dirent32 {
165 unsigned int d_ino;
166 unsigned int d_off;
167 unsigned short d_reclen;
168 char d_name[NAME_MAX + 1];
169};
170
171static void
172xlate_dirent(void *dirent64, void *dirent32, long n)
173{
174 long off;
175 struct dirent *dirp;
176 struct dirent32 *dirp32;
177
178 off = 0;
179 while (off < n) {
180 dirp = (struct dirent *)(dirent64 + off);
181 dirp32 = (struct dirent32 *)(dirent32 + off);
182 off += dirp->d_reclen;
183 dirp32->d_ino = dirp->d_ino;
184 dirp32->d_off = (unsigned int)dirp->d_off;
185 dirp32->d_reclen = dirp->d_reclen;
186 strncpy(dirp32->d_name, dirp->d_name, dirp->d_reclen - ((3 * 4) + 2));
187 }
188 return;
189}
190
191asmlinkage long
192sys32_getdents(unsigned int fd, void * dirent32, unsigned int count)
193{
194 long n;
195 void *dirent64;
196
197 dirent64 = (void *)((unsigned long)(dirent32 + (sizeof(long) - 1)) & ~(sizeof(long) - 1));
198 if ((n = sys_getdents(fd, dirent64, count - (dirent64 - dirent32))) < 0)
199 return(n);
200 xlate_dirent(dirent64, dirent32, n);
201 return(n);
202}
203
204asmlinkage int old_readdir(unsigned int fd, void * dirent, unsigned int count);
205
206asmlinkage int
207sys32_readdir(unsigned int fd, void * dirent32, unsigned int count)
208{
209 int n;
210 struct dirent dirent64;
211
212 if ((n = old_readdir(fd, &dirent64, count)) < 0)
213 return(n);
214 xlate_dirent(&dirent64, dirent32, dirent64.d_reclen);
215 return(n);
216}
217
218struct rusage32 {
219 struct compat_timeval ru_utime;
220 struct compat_timeval ru_stime;
221 int ru_maxrss;
222 int ru_ixrss;
223 int ru_idrss;
224 int ru_isrss;
225 int ru_minflt;
226 int ru_majflt;
227 int ru_nswap;
228 int ru_inblock;
229 int ru_oublock;
230 int ru_msgsnd;
231 int ru_msgrcv;
232 int ru_nsignals;
233 int ru_nvcsw;
234 int ru_nivcsw;
235};
236
237static int
238put_rusage (struct rusage32 *ru, struct rusage *r)
239{
240 int err;
241
242 if (!access_ok(VERIFY_WRITE, ru, sizeof *ru))
243 return -EFAULT;
244
245 err = __put_user (r->ru_utime.tv_sec, &ru->ru_utime.tv_sec);
246 err |= __put_user (r->ru_utime.tv_usec, &ru->ru_utime.tv_usec);
247 err |= __put_user (r->ru_stime.tv_sec, &ru->ru_stime.tv_sec);
248 err |= __put_user (r->ru_stime.tv_usec, &ru->ru_stime.tv_usec);
249 err |= __put_user (r->ru_maxrss, &ru->ru_maxrss);
250 err |= __put_user (r->ru_ixrss, &ru->ru_ixrss);
251 err |= __put_user (r->ru_idrss, &ru->ru_idrss);
252 err |= __put_user (r->ru_isrss, &ru->ru_isrss);
253 err |= __put_user (r->ru_minflt, &ru->ru_minflt);
254 err |= __put_user (r->ru_majflt, &ru->ru_majflt);
255 err |= __put_user (r->ru_nswap, &ru->ru_nswap);
256 err |= __put_user (r->ru_inblock, &ru->ru_inblock);
257 err |= __put_user (r->ru_oublock, &ru->ru_oublock);
258 err |= __put_user (r->ru_msgsnd, &ru->ru_msgsnd);
259 err |= __put_user (r->ru_msgrcv, &ru->ru_msgrcv);
260 err |= __put_user (r->ru_nsignals, &ru->ru_nsignals);
261 err |= __put_user (r->ru_nvcsw, &ru->ru_nvcsw);
262 err |= __put_user (r->ru_nivcsw, &ru->ru_nivcsw);
263
264 return err;
265}
266
267asmlinkage int
268sys32_wait4(compat_pid_t pid, unsigned int * stat_addr, int options,
269 struct rusage32 * ru)
270{
271 if (!ru)
272 return sys_wait4(pid, stat_addr, options, NULL);
273 else {
274 struct rusage r;
275 int ret;
276 unsigned int status;
277 mm_segment_t old_fs = get_fs();
278
279 set_fs(KERNEL_DS);
280 ret = sys_wait4(pid, stat_addr ? &status : NULL, options, &r);
281 set_fs(old_fs);
282 if (put_rusage (ru, &r)) return -EFAULT;
283 if (stat_addr && put_user (status, stat_addr))
284 return -EFAULT;
285 return ret;
286 }
287}
288
289asmlinkage int
290sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options)
291{
292 return sys32_wait4(pid, stat_addr, options, NULL);
293}
294
295struct sysinfo32 {
296 s32 uptime;
297 u32 loads[3];
298 u32 totalram;
299 u32 freeram;
300 u32 sharedram;
301 u32 bufferram;
302 u32 totalswap;
303 u32 freeswap;
304 u16 procs;
305 u32 totalhigh;
306 u32 freehigh;
307 u32 mem_unit;
308 char _f[8];
309};
310
311asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
312{
313 struct sysinfo s;
314 int ret, err;
315 mm_segment_t old_fs = get_fs ();
316
317 set_fs (KERNEL_DS);
318 ret = sys_sysinfo(&s);
319 set_fs (old_fs);
320 err = put_user (s.uptime, &info->uptime);
321 err |= __put_user (s.loads[0], &info->loads[0]);
322 err |= __put_user (s.loads[1], &info->loads[1]);
323 err |= __put_user (s.loads[2], &info->loads[2]);
324 err |= __put_user (s.totalram, &info->totalram);
325 err |= __put_user (s.freeram, &info->freeram);
326 err |= __put_user (s.sharedram, &info->sharedram);
327 err |= __put_user (s.bufferram, &info->bufferram);
328 err |= __put_user (s.totalswap, &info->totalswap);
329 err |= __put_user (s.freeswap, &info->freeswap);
330 err |= __put_user (s.procs, &info->procs);
331 err |= __put_user (s.totalhigh, &info->totalhigh);
332 err |= __put_user (s.freehigh, &info->freehigh);
333 err |= __put_user (s.mem_unit, &info->mem_unit);
334 if (err)
335 return -EFAULT;
336 return ret;
337}
338
339#define RLIM_INFINITY32 0x7fffffff
340#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x)
341
342struct rlimit32 {
343 int rlim_cur;
344 int rlim_max;
345};
346
347#ifdef __MIPSEB__
348asmlinkage long sys32_truncate64(const char * path, unsigned long __dummy,
349 int length_hi, int length_lo)
350#endif
351#ifdef __MIPSEL__
352asmlinkage long sys32_truncate64(const char * path, unsigned long __dummy,
353 int length_lo, int length_hi)
354#endif
355{
356 loff_t length;
357
358 length = ((unsigned long) length_hi << 32) | (unsigned int) length_lo;
359
360 return sys_truncate(path, length);
361}
362
363#ifdef __MIPSEB__
364asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long __dummy,
365 int length_hi, int length_lo)
366#endif
367#ifdef __MIPSEL__
368asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long __dummy,
369 int length_lo, int length_hi)
370#endif
371{
372 loff_t length;
373
374 length = ((unsigned long) length_hi << 32) | (unsigned int) length_lo;
375
376 return sys_ftruncate(fd, length);
377}
378
379static inline long
380get_tv32(struct timeval *o, struct compat_timeval *i)
381{
382 return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
383 (__get_user(o->tv_sec, &i->tv_sec) |
384 __get_user(o->tv_usec, &i->tv_usec)));
385}
386
387static inline long
388put_tv32(struct compat_timeval *o, struct timeval *i)
389{
390 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
391 (__put_user(i->tv_sec, &o->tv_sec) |
392 __put_user(i->tv_usec, &o->tv_usec)));
393}
394
395extern struct timezone sys_tz;
396
397asmlinkage int
398sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
399{
400 if (tv) {
401 struct timeval ktv;
402 do_gettimeofday(&ktv);
403 if (put_tv32(tv, &ktv))
404 return -EFAULT;
405 }
406 if (tz) {
407 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
408 return -EFAULT;
409 }
410 return 0;
411}
412
413static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
414{
415 long usec;
416
417 if (!access_ok(VERIFY_READ, i, sizeof(*i)))
418 return -EFAULT;
419 if (__get_user(o->tv_sec, &i->tv_sec))
420 return -EFAULT;
421 if (__get_user(usec, &i->tv_usec))
422 return -EFAULT;
423 o->tv_nsec = usec * 1000;
424 return 0;
425}
426
427asmlinkage int
428sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
429{
430 struct timespec kts;
431 struct timezone ktz;
432
433 if (tv) {
434 if (get_ts32(&kts, tv))
435 return -EFAULT;
436 }
437 if (tz) {
438 if (copy_from_user(&ktz, tz, sizeof(ktz)))
439 return -EFAULT;
440 }
441
442 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
443}
444
445asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
446 unsigned int offset_low, loff_t * result,
447 unsigned int origin)
448{
449 return sys_llseek(fd, offset_high, offset_low, result, origin);
450}
451
452/* From the Single Unix Spec: pread & pwrite act like lseek to pos + op +
453 lseek back to original location. They fail just like lseek does on
454 non-seekable files. */
455
456asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf,
457 size_t count, u32 unused, u64 a4, u64 a5)
458{
459 ssize_t ret;
460 struct file * file;
461 ssize_t (*read)(struct file *, char *, size_t, loff_t *);
462 loff_t pos;
463
464 ret = -EBADF;
465 file = fget(fd);
466 if (!file)
467 goto bad_file;
468 if (!(file->f_mode & FMODE_READ))
469 goto out;
470 pos = merge_64(a4, a5);
471 ret = rw_verify_area(READ, file, &pos, count);
472 if (ret)
473 goto out;
474 ret = -EINVAL;
475 if (!file->f_op || !(read = file->f_op->read))
476 goto out;
477 if (pos < 0)
478 goto out;
479 ret = -ESPIPE;
480 if (!(file->f_mode & FMODE_PREAD))
481 goto out;
482 ret = read(file, buf, count, &pos);
483 if (ret > 0)
484 dnotify_parent(file->f_dentry, DN_ACCESS);
485out:
486 fput(file);
487bad_file:
488 return ret;
489}
490
491asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf,
492 size_t count, u32 unused, u64 a4, u64 a5)
493{
494 ssize_t ret;
495 struct file * file;
496 ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
497 loff_t pos;
498
499 ret = -EBADF;
500 file = fget(fd);
501 if (!file)
502 goto bad_file;
503 if (!(file->f_mode & FMODE_WRITE))
504 goto out;
505 pos = merge_64(a4, a5);
506 ret = rw_verify_area(WRITE, file, &pos, count);
507 if (ret)
508 goto out;
509 ret = -EINVAL;
510 if (!file->f_op || !(write = file->f_op->write))
511 goto out;
512 if (pos < 0)
513 goto out;
514
515 ret = -ESPIPE;
516 if (!(file->f_mode & FMODE_PWRITE))
517 goto out;
518
519 ret = write(file, buf, count, &pos);
520 if (ret > 0)
521 dnotify_parent(file->f_dentry, DN_MODIFY);
522out:
523 fput(file);
524bad_file:
525 return ret;
526}
527
528asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
529 struct compat_timespec *interval)
530{
531 struct timespec t;
532 int ret;
533 mm_segment_t old_fs = get_fs ();
534
535 set_fs (KERNEL_DS);
536 ret = sys_sched_rr_get_interval(pid, &t);
537 set_fs (old_fs);
538 if (put_user (t.tv_sec, &interval->tv_sec) ||
539 __put_user (t.tv_nsec, &interval->tv_nsec))
540 return -EFAULT;
541 return ret;
542}
543
544struct msgbuf32 { s32 mtype; char mtext[1]; };
545
546struct ipc_perm32
547{
548 key_t key;
549 compat_uid_t uid;
550 compat_gid_t gid;
551 compat_uid_t cuid;
552 compat_gid_t cgid;
553 compat_mode_t mode;
554 unsigned short seq;
555};
556
557struct ipc64_perm32 {
558 key_t key;
559 compat_uid_t uid;
560 compat_gid_t gid;
561 compat_uid_t cuid;
562 compat_gid_t cgid;
563 compat_mode_t mode;
564 unsigned short seq;
565 unsigned short __pad1;
566 unsigned int __unused1;
567 unsigned int __unused2;
568};
569
570struct semid_ds32 {
571 struct ipc_perm32 sem_perm; /* permissions .. see ipc.h */
572 compat_time_t sem_otime; /* last semop time */
573 compat_time_t sem_ctime; /* last change time */
574 u32 sem_base; /* ptr to first semaphore in array */
575 u32 sem_pending; /* pending operations to be processed */
576 u32 sem_pending_last; /* last pending operation */
577 u32 undo; /* undo requests on this array */
578 unsigned short sem_nsems; /* no. of semaphores in array */
579};
580
581struct semid64_ds32 {
582 struct ipc64_perm32 sem_perm;
583 compat_time_t sem_otime;
584 compat_time_t sem_ctime;
585 unsigned int sem_nsems;
586 unsigned int __unused1;
587 unsigned int __unused2;
588};
589
590struct msqid_ds32
591{
592 struct ipc_perm32 msg_perm;
593 u32 msg_first;
594 u32 msg_last;
595 compat_time_t msg_stime;
596 compat_time_t msg_rtime;
597 compat_time_t msg_ctime;
598 u32 wwait;
599 u32 rwait;
600 unsigned short msg_cbytes;
601 unsigned short msg_qnum;
602 unsigned short msg_qbytes;
603 compat_ipc_pid_t msg_lspid;
604 compat_ipc_pid_t msg_lrpid;
605};
606
607struct msqid64_ds32 {
608 struct ipc64_perm32 msg_perm;
609 compat_time_t msg_stime;
610 unsigned int __unused1;
611 compat_time_t msg_rtime;
612 unsigned int __unused2;
613 compat_time_t msg_ctime;
614 unsigned int __unused3;
615 unsigned int msg_cbytes;
616 unsigned int msg_qnum;
617 unsigned int msg_qbytes;
618 compat_pid_t msg_lspid;
619 compat_pid_t msg_lrpid;
620 unsigned int __unused4;
621 unsigned int __unused5;
622};
623
624struct shmid_ds32 {
625 struct ipc_perm32 shm_perm;
626 int shm_segsz;
627 compat_time_t shm_atime;
628 compat_time_t shm_dtime;
629 compat_time_t shm_ctime;
630 compat_ipc_pid_t shm_cpid;
631 compat_ipc_pid_t shm_lpid;
632 unsigned short shm_nattch;
633};
634
635struct shmid64_ds32 {
636 struct ipc64_perm32 shm_perm;
637 compat_size_t shm_segsz;
638 compat_time_t shm_atime;
639 compat_time_t shm_dtime;
640 compat_time_t shm_ctime;
641 compat_pid_t shm_cpid;
642 compat_pid_t shm_lpid;
643 unsigned int shm_nattch;
644 unsigned int __unused1;
645 unsigned int __unused2;
646};
647
648struct ipc_kludge32 {
649 u32 msgp;
650 s32 msgtyp;
651};
652
653static int
654do_sys32_semctl(int first, int second, int third, void *uptr)
655{
656 union semun fourth;
657 u32 pad;
658 int err, err2;
659 struct semid64_ds s;
660 mm_segment_t old_fs;
661
662 if (!uptr)
663 return -EINVAL;
664 err = -EFAULT;
665 if (get_user (pad, (u32 *)uptr))
666 return err;
667 if ((third & ~IPC_64) == SETVAL)
668 fourth.val = (int)pad;
669 else
670 fourth.__pad = (void *)A(pad);
671 switch (third & ~IPC_64) {
672 case IPC_INFO:
673 case IPC_RMID:
674 case IPC_SET:
675 case SEM_INFO:
676 case GETVAL:
677 case GETPID:
678 case GETNCNT:
679 case GETZCNT:
680 case GETALL:
681 case SETVAL:
682 case SETALL:
683 err = sys_semctl (first, second, third, fourth);
684 break;
685
686 case IPC_STAT:
687 case SEM_STAT:
688 fourth.__pad = &s;
689 old_fs = get_fs();
690 set_fs(KERNEL_DS);
691 err = sys_semctl(first, second, third | IPC_64, fourth);
692 set_fs(old_fs);
693
694 if (third & IPC_64) {
695 struct semid64_ds32 *usp64 = (struct semid64_ds32 *) A(pad);
696
697 if (!access_ok(VERIFY_WRITE, usp64, sizeof(*usp64))) {
698 err = -EFAULT;
699 break;
700 }
701 err2 = __put_user(s.sem_perm.key, &usp64->sem_perm.key);
702 err2 |= __put_user(s.sem_perm.uid, &usp64->sem_perm.uid);
703 err2 |= __put_user(s.sem_perm.gid, &usp64->sem_perm.gid);
704 err2 |= __put_user(s.sem_perm.cuid, &usp64->sem_perm.cuid);
705 err2 |= __put_user(s.sem_perm.cgid, &usp64->sem_perm.cgid);
706 err2 |= __put_user(s.sem_perm.mode, &usp64->sem_perm.mode);
707 err2 |= __put_user(s.sem_perm.seq, &usp64->sem_perm.seq);
708 err2 |= __put_user(s.sem_otime, &usp64->sem_otime);
709 err2 |= __put_user(s.sem_ctime, &usp64->sem_ctime);
710 err2 |= __put_user(s.sem_nsems, &usp64->sem_nsems);
711 } else {
712 struct semid_ds32 *usp32 = (struct semid_ds32 *) A(pad);
713
714 if (!access_ok(VERIFY_WRITE, usp32, sizeof(*usp32))) {
715 err = -EFAULT;
716 break;
717 }
718 err2 = __put_user(s.sem_perm.key, &usp32->sem_perm.key);
719 err2 |= __put_user(s.sem_perm.uid, &usp32->sem_perm.uid);
720 err2 |= __put_user(s.sem_perm.gid, &usp32->sem_perm.gid);
721 err2 |= __put_user(s.sem_perm.cuid, &usp32->sem_perm.cuid);
722 err2 |= __put_user(s.sem_perm.cgid, &usp32->sem_perm.cgid);
723 err2 |= __put_user(s.sem_perm.mode, &usp32->sem_perm.mode);
724 err2 |= __put_user(s.sem_perm.seq, &usp32->sem_perm.seq);
725 err2 |= __put_user(s.sem_otime, &usp32->sem_otime);
726 err2 |= __put_user(s.sem_ctime, &usp32->sem_ctime);
727 err2 |= __put_user(s.sem_nsems, &usp32->sem_nsems);
728 }
729 if (err2)
730 err = -EFAULT;
731 break;
732
733 default:
734 err = - EINVAL;
735 break;
736 }
737
738 return err;
739}
740
741static int
742do_sys32_msgsnd (int first, int second, int third, void *uptr)
743{
744 struct msgbuf32 *up = (struct msgbuf32 *)uptr;
745 struct msgbuf *p;
746 mm_segment_t old_fs;
747 int err;
748
749 if (second < 0)
750 return -EINVAL;
751 p = kmalloc (second + sizeof (struct msgbuf)
752 + 4, GFP_USER);
753 if (!p)
754 return -ENOMEM;
755 err = get_user (p->mtype, &up->mtype);
756 if (err)
757 goto out;
758 err |= __copy_from_user (p->mtext, &up->mtext, second);
759 if (err)
760 goto out;
761 old_fs = get_fs ();
762 set_fs (KERNEL_DS);
763 err = sys_msgsnd (first, p, second, third);
764 set_fs (old_fs);
765out:
766 kfree (p);
767
768 return err;
769}
770
771static int
772do_sys32_msgrcv (int first, int second, int msgtyp, int third,
773 int version, void *uptr)
774{
775 struct msgbuf32 *up;
776 struct msgbuf *p;
777 mm_segment_t old_fs;
778 int err;
779
780 if (!version) {
781 struct ipc_kludge32 *uipck = (struct ipc_kludge32 *)uptr;
782 struct ipc_kludge32 ipck;
783
784 err = -EINVAL;
785 if (!uptr)
786 goto out;
787 err = -EFAULT;
788 if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge32)))
789 goto out;
790 uptr = (void *)AA(ipck.msgp);
791 msgtyp = ipck.msgtyp;
792 }
793
794 if (second < 0)
795 return -EINVAL;
796 err = -ENOMEM;
797 p = kmalloc (second + sizeof (struct msgbuf) + 4, GFP_USER);
798 if (!p)
799 goto out;
800 old_fs = get_fs ();
801 set_fs (KERNEL_DS);
802 err = sys_msgrcv (first, p, second + 4, msgtyp, third);
803 set_fs (old_fs);
804 if (err < 0)
805 goto free_then_out;
806 up = (struct msgbuf32 *)uptr;
807 if (put_user (p->mtype, &up->mtype) ||
808 __copy_to_user (&up->mtext, p->mtext, err))
809 err = -EFAULT;
810free_then_out:
811 kfree (p);
812out:
813 return err;
814}
815
816static int
817do_sys32_msgctl (int first, int second, void *uptr)
818{
819 int err = -EINVAL, err2;
820 struct msqid64_ds m;
821 struct msqid_ds32 *up32 = (struct msqid_ds32 *)uptr;
822 struct msqid64_ds32 *up64 = (struct msqid64_ds32 *)uptr;
823 mm_segment_t old_fs;
824
825 switch (second & ~IPC_64) {
826 case IPC_INFO:
827 case IPC_RMID:
828 case MSG_INFO:
829 err = sys_msgctl (first, second, (struct msqid_ds *)uptr);
830 break;
831
832 case IPC_SET:
833 if (second & IPC_64) {
834 if (!access_ok(VERIFY_READ, up64, sizeof(*up64))) {
835 err = -EFAULT;
836 break;
837 }
838 err = __get_user(m.msg_perm.uid, &up64->msg_perm.uid);
839 err |= __get_user(m.msg_perm.gid, &up64->msg_perm.gid);
840 err |= __get_user(m.msg_perm.mode, &up64->msg_perm.mode);
841 err |= __get_user(m.msg_qbytes, &up64->msg_qbytes);
842 } else {
843 if (!access_ok(VERIFY_READ, up32, sizeof(*up32))) {
844 err = -EFAULT;
845 break;
846 }
847 err = __get_user(m.msg_perm.uid, &up32->msg_perm.uid);
848 err |= __get_user(m.msg_perm.gid, &up32->msg_perm.gid);
849 err |= __get_user(m.msg_perm.mode, &up32->msg_perm.mode);
850 err |= __get_user(m.msg_qbytes, &up32->msg_qbytes);
851 }
852 if (err)
853 break;
854 old_fs = get_fs();
855 set_fs(KERNEL_DS);
856 err = sys_msgctl(first, second | IPC_64, (struct msqid_ds *)&m);
857 set_fs(old_fs);
858 break;
859
860 case IPC_STAT:
861 case MSG_STAT:
862 old_fs = get_fs();
863 set_fs(KERNEL_DS);
864 err = sys_msgctl(first, second | IPC_64, (struct msqid_ds *)&m);
865 set_fs(old_fs);
866 if (second & IPC_64) {
867 if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) {
868 err = -EFAULT;
869 break;
870 }
871 err2 = __put_user(m.msg_perm.key, &up64->msg_perm.key);
872 err2 |= __put_user(m.msg_perm.uid, &up64->msg_perm.uid);
873 err2 |= __put_user(m.msg_perm.gid, &up64->msg_perm.gid);
874 err2 |= __put_user(m.msg_perm.cuid, &up64->msg_perm.cuid);
875 err2 |= __put_user(m.msg_perm.cgid, &up64->msg_perm.cgid);
876 err2 |= __put_user(m.msg_perm.mode, &up64->msg_perm.mode);
877 err2 |= __put_user(m.msg_perm.seq, &up64->msg_perm.seq);
878 err2 |= __put_user(m.msg_stime, &up64->msg_stime);
879 err2 |= __put_user(m.msg_rtime, &up64->msg_rtime);
880 err2 |= __put_user(m.msg_ctime, &up64->msg_ctime);
881 err2 |= __put_user(m.msg_cbytes, &up64->msg_cbytes);
882 err2 |= __put_user(m.msg_qnum, &up64->msg_qnum);
883 err2 |= __put_user(m.msg_qbytes, &up64->msg_qbytes);
884 err2 |= __put_user(m.msg_lspid, &up64->msg_lspid);
885 err2 |= __put_user(m.msg_lrpid, &up64->msg_lrpid);
886 if (err2)
887 err = -EFAULT;
888 } else {
889 if (!access_ok(VERIFY_WRITE, up32, sizeof(*up32))) {
890 err = -EFAULT;
891 break;
892 }
893 err2 = __put_user(m.msg_perm.key, &up32->msg_perm.key);
894 err2 |= __put_user(m.msg_perm.uid, &up32->msg_perm.uid);
895 err2 |= __put_user(m.msg_perm.gid, &up32->msg_perm.gid);
896 err2 |= __put_user(m.msg_perm.cuid, &up32->msg_perm.cuid);
897 err2 |= __put_user(m.msg_perm.cgid, &up32->msg_perm.cgid);
898 err2 |= __put_user(m.msg_perm.mode, &up32->msg_perm.mode);
899 err2 |= __put_user(m.msg_perm.seq, &up32->msg_perm.seq);
900 err2 |= __put_user(m.msg_stime, &up32->msg_stime);
901 err2 |= __put_user(m.msg_rtime, &up32->msg_rtime);
902 err2 |= __put_user(m.msg_ctime, &up32->msg_ctime);
903 err2 |= __put_user(m.msg_cbytes, &up32->msg_cbytes);
904 err2 |= __put_user(m.msg_qnum, &up32->msg_qnum);
905 err2 |= __put_user(m.msg_qbytes, &up32->msg_qbytes);
906 err2 |= __put_user(m.msg_lspid, &up32->msg_lspid);
907 err2 |= __put_user(m.msg_lrpid, &up32->msg_lrpid);
908 if (err2)
909 err = -EFAULT;
910 }
911 break;
912 }
913
914 return err;
915}
916
917static int
918do_sys32_shmat (int first, int second, int third, int version, void *uptr)
919{
920 unsigned long raddr;
921 u32 *uaddr = (u32 *)A((u32)third);
922 int err = -EINVAL;
923
924 if (version == 1)
925 return err;
926 err = do_shmat (first, uptr, second, &raddr);
927 if (err)
928 return err;
929 err = put_user (raddr, uaddr);
930 return err;
931}
932
933struct shm_info32 {
934 int used_ids;
935 u32 shm_tot, shm_rss, shm_swp;
936 u32 swap_attempts, swap_successes;
937};
938
939static int
940do_sys32_shmctl (int first, int second, void *uptr)
941{
942 struct shmid64_ds32 *up64 = (struct shmid64_ds32 *)uptr;
943 struct shmid_ds32 *up32 = (struct shmid_ds32 *)uptr;
944 struct shm_info32 *uip = (struct shm_info32 *)uptr;
945 int err = -EFAULT, err2;
946 struct shmid64_ds s64;
947 mm_segment_t old_fs;
948 struct shm_info si;
949 struct shmid_ds s;
950
951 switch (second & ~IPC_64) {
952 case IPC_INFO:
953 second = IPC_INFO; /* So that we don't have to translate it */
954 case IPC_RMID:
955 case SHM_LOCK:
956 case SHM_UNLOCK:
957 err = sys_shmctl(first, second, (struct shmid_ds *)uptr);
958 break;
959 case IPC_SET:
960 if (second & IPC_64) {
961 err = get_user(s.shm_perm.uid, &up64->shm_perm.uid);
962 err |= get_user(s.shm_perm.gid, &up64->shm_perm.gid);
963 err |= get_user(s.shm_perm.mode, &up64->shm_perm.mode);
964 } else {
965 err = get_user(s.shm_perm.uid, &up32->shm_perm.uid);
966 err |= get_user(s.shm_perm.gid, &up32->shm_perm.gid);
967 err |= get_user(s.shm_perm.mode, &up32->shm_perm.mode);
968 }
969 if (err)
970 break;
971 old_fs = get_fs();
972 set_fs(KERNEL_DS);
973 err = sys_shmctl(first, second & ~IPC_64, &s);
974 set_fs(old_fs);
975 break;
976
977 case IPC_STAT:
978 case SHM_STAT:
979 old_fs = get_fs();
980 set_fs(KERNEL_DS);
981 err = sys_shmctl(first, second | IPC_64, (void *) &s64);
982 set_fs(old_fs);
983 if (err < 0)
984 break;
985 if (second & IPC_64) {
986 if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) {
987 err = -EFAULT;
988 break;
989 }
990 err2 = __put_user(s64.shm_perm.key, &up64->shm_perm.key);
991 err2 |= __put_user(s64.shm_perm.uid, &up64->shm_perm.uid);
992 err2 |= __put_user(s64.shm_perm.gid, &up64->shm_perm.gid);
993 err2 |= __put_user(s64.shm_perm.cuid, &up64->shm_perm.cuid);
994 err2 |= __put_user(s64.shm_perm.cgid, &up64->shm_perm.cgid);
995 err2 |= __put_user(s64.shm_perm.mode, &up64->shm_perm.mode);
996 err2 |= __put_user(s64.shm_perm.seq, &up64->shm_perm.seq);
997 err2 |= __put_user(s64.shm_atime, &up64->shm_atime);
998 err2 |= __put_user(s64.shm_dtime, &up64->shm_dtime);
999 err2 |= __put_user(s64.shm_ctime, &up64->shm_ctime);
1000 err2 |= __put_user(s64.shm_segsz, &up64->shm_segsz);
1001 err2 |= __put_user(s64.shm_nattch, &up64->shm_nattch);
1002 err2 |= __put_user(s64.shm_cpid, &up64->shm_cpid);
1003 err2 |= __put_user(s64.shm_lpid, &up64->shm_lpid);
1004 } else {
1005 if (!access_ok(VERIFY_WRITE, up32, sizeof(*up32))) {
1006 err = -EFAULT;
1007 break;
1008 }
1009 err2 = __put_user(s64.shm_perm.key, &up32->shm_perm.key);
1010 err2 |= __put_user(s64.shm_perm.uid, &up32->shm_perm.uid);
1011 err2 |= __put_user(s64.shm_perm.gid, &up32->shm_perm.gid);
1012 err2 |= __put_user(s64.shm_perm.cuid, &up32->shm_perm.cuid);
1013 err2 |= __put_user(s64.shm_perm.cgid, &up32->shm_perm.cgid);
1014 err2 |= __put_user(s64.shm_perm.mode, &up32->shm_perm.mode);
1015 err2 |= __put_user(s64.shm_perm.seq, &up32->shm_perm.seq);
1016 err2 |= __put_user(s64.shm_atime, &up32->shm_atime);
1017 err2 |= __put_user(s64.shm_dtime, &up32->shm_dtime);
1018 err2 |= __put_user(s64.shm_ctime, &up32->shm_ctime);
1019 err2 |= __put_user(s64.shm_segsz, &up32->shm_segsz);
1020 err2 |= __put_user(s64.shm_nattch, &up32->shm_nattch);
1021 err2 |= __put_user(s64.shm_cpid, &up32->shm_cpid);
1022 err2 |= __put_user(s64.shm_lpid, &up32->shm_lpid);
1023 }
1024 if (err2)
1025 err = -EFAULT;
1026 break;
1027
1028 case SHM_INFO:
1029 old_fs = get_fs();
1030 set_fs(KERNEL_DS);
1031 err = sys_shmctl(first, second, (void *)&si);
1032 set_fs(old_fs);
1033 if (err < 0)
1034 break;
1035 err2 = put_user(si.used_ids, &uip->used_ids);
1036 err2 |= __put_user(si.shm_tot, &uip->shm_tot);
1037 err2 |= __put_user(si.shm_rss, &uip->shm_rss);
1038 err2 |= __put_user(si.shm_swp, &uip->shm_swp);
1039 err2 |= __put_user(si.swap_attempts, &uip->swap_attempts);
1040 err2 |= __put_user (si.swap_successes, &uip->swap_successes);
1041 if (err2)
1042 err = -EFAULT;
1043 break;
1044
1045 default:
1046 err = -EINVAL;
1047 break;
1048 }
1049
1050 return err;
1051}
1052
1053static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems,
1054 const struct compat_timespec *timeout32)
1055{
1056 struct compat_timespec t32;
1057 struct timespec *t64 = compat_alloc_user_space(sizeof(*t64));
1058
1059 if (copy_from_user(&t32, timeout32, sizeof(t32)))
1060 return -EFAULT;
1061
1062 if (put_user(t32.tv_sec, &t64->tv_sec) ||
1063 put_user(t32.tv_nsec, &t64->tv_nsec))
1064 return -EFAULT;
1065
1066 return sys_semtimedop(semid, tsems, nsems, t64);
1067}
1068
1069asmlinkage long
1070sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
1071{
1072 int version, err;
1073
1074 version = call >> 16; /* hack for backward compatibility */
1075 call &= 0xffff;
1076
1077 switch (call) {
1078 case SEMOP:
1079 /* struct sembuf is the same on 32 and 64bit :)) */
1080 err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second,
1081 NULL);
1082 break;
1083 case SEMTIMEDOP:
1084 err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second,
1085 (const struct compat_timespec __user *)AA(fifth));
1086 break;
1087 case SEMGET:
1088 err = sys_semget (first, second, third);
1089 break;
1090 case SEMCTL:
1091 err = do_sys32_semctl (first, second, third,
1092 (void *)AA(ptr));
1093 break;
1094
1095 case MSGSND:
1096 err = do_sys32_msgsnd (first, second, third,
1097 (void *)AA(ptr));
1098 break;
1099 case MSGRCV:
1100 err = do_sys32_msgrcv (first, second, fifth, third,
1101 version, (void *)AA(ptr));
1102 break;
1103 case MSGGET:
1104 err = sys_msgget ((key_t) first, second);
1105 break;
1106 case MSGCTL:
1107 err = do_sys32_msgctl (first, second, (void *)AA(ptr));
1108 break;
1109
1110 case SHMAT:
1111 err = do_sys32_shmat (first, second, third,
1112 version, (void *)AA(ptr));
1113 break;
1114 case SHMDT:
1115 err = sys_shmdt ((char *)A(ptr));
1116 break;
1117 case SHMGET:
1118 err = sys_shmget (first, (unsigned)second, third);
1119 break;
1120 case SHMCTL:
1121 err = do_sys32_shmctl (first, second, (void *)AA(ptr));
1122 break;
1123 default:
1124 err = -EINVAL;
1125 break;
1126 }
1127
1128 return err;
1129}
1130
1131asmlinkage long sys32_shmat(int shmid, char __user *shmaddr,
1132 int shmflg, int32_t *addr)
1133{
1134 unsigned long raddr;
1135 int err;
1136
1137 err = do_shmat(shmid, shmaddr, shmflg, &raddr);
1138 if (err)
1139 return err;
1140
1141 return put_user(raddr, addr);
1142}
1143
1144struct sysctl_args32
1145{
1146 compat_caddr_t name;
1147 int nlen;
1148 compat_caddr_t oldval;
1149 compat_caddr_t oldlenp;
1150 compat_caddr_t newval;
1151 compat_size_t newlen;
1152 unsigned int __unused[4];
1153};
1154
1155#ifdef CONFIG_SYSCTL
1156
1157asmlinkage long sys32_sysctl(struct sysctl_args32 *args)
1158{
1159 struct sysctl_args32 tmp;
1160 int error;
1161 size_t oldlen, *oldlenp = NULL;
1162 unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
1163
1164 if (copy_from_user(&tmp, args, sizeof(tmp)))
1165 return -EFAULT;
1166
1167 if (tmp.oldval && tmp.oldlenp) {
1168 /* Duh, this is ugly and might not work if sysctl_args
1169 is in read-only memory, but do_sysctl does indirectly
1170 a lot of uaccess in both directions and we'd have to
1171 basically copy the whole sysctl.c here, and
1172 glibc's __sysctl uses rw memory for the structure
1173 anyway. */
1174 if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) ||
1175 put_user(oldlen, (size_t *)addr))
1176 return -EFAULT;
1177 oldlenp = (size_t *)addr;
1178 }
1179
1180 lock_kernel();
1181 error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval),
1182 oldlenp, (void *)A(tmp.newval), tmp.newlen);
1183 unlock_kernel();
1184 if (oldlenp) {
1185 if (!error) {
1186 if (get_user(oldlen, (size_t *)addr) ||
1187 put_user(oldlen, (u32 *)A(tmp.oldlenp)))
1188 error = -EFAULT;
1189 }
1190 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
1191 }
1192 return error;
1193}
1194
1195#endif /* CONFIG_SYSCTL */
1196
1197asmlinkage long sys32_newuname(struct new_utsname * name)
1198{
1199 int ret = 0;
1200
1201 down_read(&uts_sem);
1202 if (copy_to_user(name,&system_utsname,sizeof *name))
1203 ret = -EFAULT;
1204 up_read(&uts_sem);
1205
1206 if (current->personality == PER_LINUX32 && !ret)
1207 if (copy_to_user(name->machine, "mips\0\0\0", 8))
1208 ret = -EFAULT;
1209
1210 return ret;
1211}
1212
1213asmlinkage int sys32_personality(unsigned long personality)
1214{
1215 int ret;
1216 if (current->personality == PER_LINUX32 && personality == PER_LINUX)
1217 personality = PER_LINUX32;
1218 ret = sys_personality(personality);
1219 if (ret == PER_LINUX32)
1220 ret = PER_LINUX;
1221 return ret;
1222}
1223
1224/* ustat compatibility */
1225struct ustat32 {
1226 compat_daddr_t f_tfree;
1227 compat_ino_t f_tinode;
1228 char f_fname[6];
1229 char f_fpack[6];
1230};
1231
1232extern asmlinkage long sys_ustat(dev_t dev, struct ustat * ubuf);
1233
1234asmlinkage int sys32_ustat(dev_t dev, struct ustat32 * ubuf32)
1235{
1236 int err;
1237 struct ustat tmp;
1238 struct ustat32 tmp32;
1239 mm_segment_t old_fs = get_fs();
1240
1241 set_fs(KERNEL_DS);
1242 err = sys_ustat(dev, &tmp);
1243 set_fs (old_fs);
1244
1245 if (err)
1246 goto out;
1247
1248 memset(&tmp32,0,sizeof(struct ustat32));
1249 tmp32.f_tfree = tmp.f_tfree;
1250 tmp32.f_tinode = tmp.f_tinode;
1251
1252 err = copy_to_user(ubuf32,&tmp32,sizeof(struct ustat32)) ? -EFAULT : 0;
1253
1254out:
1255 return err;
1256}
1257
1258/* Handle adjtimex compatibility. */
1259
1260struct timex32 {
1261 u32 modes;
1262 s32 offset, freq, maxerror, esterror;
1263 s32 status, constant, precision, tolerance;
1264 struct compat_timeval time;
1265 s32 tick;
1266 s32 ppsfreq, jitter, shift, stabil;
1267 s32 jitcnt, calcnt, errcnt, stbcnt;
1268 s32 :32; s32 :32; s32 :32; s32 :32;
1269 s32 :32; s32 :32; s32 :32; s32 :32;
1270 s32 :32; s32 :32; s32 :32; s32 :32;
1271};
1272
1273extern int do_adjtimex(struct timex *);
1274
1275asmlinkage int sys32_adjtimex(struct timex32 *utp)
1276{
1277 struct timex txc;
1278 int ret;
1279
1280 memset(&txc, 0, sizeof(struct timex));
1281
1282 if (get_user(txc.modes, &utp->modes) ||
1283 __get_user(txc.offset, &utp->offset) ||
1284 __get_user(txc.freq, &utp->freq) ||
1285 __get_user(txc.maxerror, &utp->maxerror) ||
1286 __get_user(txc.esterror, &utp->esterror) ||
1287 __get_user(txc.status, &utp->status) ||
1288 __get_user(txc.constant, &utp->constant) ||
1289 __get_user(txc.precision, &utp->precision) ||
1290 __get_user(txc.tolerance, &utp->tolerance) ||
1291 __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
1292 __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
1293 __get_user(txc.tick, &utp->tick) ||
1294 __get_user(txc.ppsfreq, &utp->ppsfreq) ||
1295 __get_user(txc.jitter, &utp->jitter) ||
1296 __get_user(txc.shift, &utp->shift) ||
1297 __get_user(txc.stabil, &utp->stabil) ||
1298 __get_user(txc.jitcnt, &utp->jitcnt) ||
1299 __get_user(txc.calcnt, &utp->calcnt) ||
1300 __get_user(txc.errcnt, &utp->errcnt) ||
1301 __get_user(txc.stbcnt, &utp->stbcnt))
1302 return -EFAULT;
1303
1304 ret = do_adjtimex(&txc);
1305
1306 if (put_user(txc.modes, &utp->modes) ||
1307 __put_user(txc.offset, &utp->offset) ||
1308 __put_user(txc.freq, &utp->freq) ||
1309 __put_user(txc.maxerror, &utp->maxerror) ||
1310 __put_user(txc.esterror, &utp->esterror) ||
1311 __put_user(txc.status, &utp->status) ||
1312 __put_user(txc.constant, &utp->constant) ||
1313 __put_user(txc.precision, &utp->precision) ||
1314 __put_user(txc.tolerance, &utp->tolerance) ||
1315 __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
1316 __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
1317 __put_user(txc.tick, &utp->tick) ||
1318 __put_user(txc.ppsfreq, &utp->ppsfreq) ||
1319 __put_user(txc.jitter, &utp->jitter) ||
1320 __put_user(txc.shift, &utp->shift) ||
1321 __put_user(txc.stabil, &utp->stabil) ||
1322 __put_user(txc.jitcnt, &utp->jitcnt) ||
1323 __put_user(txc.calcnt, &utp->calcnt) ||
1324 __put_user(txc.errcnt, &utp->errcnt) ||
1325 __put_user(txc.stbcnt, &utp->stbcnt))
1326 ret = -EFAULT;
1327
1328 return ret;
1329}
1330
1331asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset,
1332 s32 count)
1333{
1334 mm_segment_t old_fs = get_fs();
1335 int ret;
1336 off_t of;
1337
1338 if (offset && get_user(of, offset))
1339 return -EFAULT;
1340
1341 set_fs(KERNEL_DS);
1342 ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
1343 set_fs(old_fs);
1344
1345 if (offset && put_user(of, offset))
1346 return -EFAULT;
1347
1348 return ret;
1349}
1350
1351asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3,
1352 size_t count)
1353{
1354 return sys_readahead(fd, merge_64(a2, a3), count);
1355}
1356
1357/* Argument list sizes for sys_socketcall */
1358#define AL(x) ((x) * sizeof(unsigned int))
1359static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
1360 AL(3),AL(3),AL(4),AL(4),AL(4),AL(6),
1361 AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)};
1362#undef AL
1363
1364/*
1365 * System call vectors.
1366 *
1367 * Argument checking cleaned up. Saved 20% in size.
1368 * This function doesn't need to set the kernel lock because
1369 * it is set by the callees.
1370 */
1371
1372asmlinkage long sys32_socketcall(int call, unsigned int *args32)
1373{
1374 unsigned int a[6];
1375 unsigned int a0,a1;
1376 int err;
1377
1378 extern asmlinkage long sys_socket(int family, int type, int protocol);
1379 extern asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen);
1380 extern asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen);
1381 extern asmlinkage long sys_listen(int fd, int backlog);
1382 extern asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int __user *upeer_addrlen);
1383 extern asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
1384 extern asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);
1385 extern asmlinkage long sys_socketpair(int family, int type, int protocol, int __user *usockvec);
1386 extern asmlinkage long sys_send(int fd, void __user * buff, size_t len, unsigned flags);
1387 extern asmlinkage long sys_sendto(int fd, void __user * buff, size_t len, unsigned flags,
1388 struct sockaddr __user *addr, int addr_len);
1389 extern asmlinkage long sys_recv(int fd, void __user * ubuf, size_t size, unsigned flags);
1390 extern asmlinkage long sys_recvfrom(int fd, void __user * ubuf, size_t size, unsigned flags,
1391 struct sockaddr __user *addr, int __user *addr_len);
1392 extern asmlinkage long sys_shutdown(int fd, int how);
1393 extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen);
1394 extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int *optlen);
1395 extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags);
1396 extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags);
1397
1398
1399 if(call<1||call>SYS_RECVMSG)
1400 return -EINVAL;
1401
1402 /* copy_from_user should be SMP safe. */
1403 if (copy_from_user(a, args32, socketcall_nargs[call]))
1404 return -EFAULT;
1405
1406 a0=a[0];
1407 a1=a[1];
1408
1409 switch(call)
1410 {
1411 case SYS_SOCKET:
1412 err = sys_socket(a0,a1,a[2]);
1413 break;
1414 case SYS_BIND:
1415 err = sys_bind(a0,(struct sockaddr __user *)A(a1), a[2]);
1416 break;
1417 case SYS_CONNECT:
1418 err = sys_connect(a0, (struct sockaddr __user *)A(a1), a[2]);
1419 break;
1420 case SYS_LISTEN:
1421 err = sys_listen(a0,a1);
1422 break;
1423 case SYS_ACCEPT:
1424 err = sys_accept(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
1425 break;
1426 case SYS_GETSOCKNAME:
1427 err = sys_getsockname(a0,(struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
1428 break;
1429 case SYS_GETPEERNAME:
1430 err = sys_getpeername(a0, (struct sockaddr __user *)A(a1), (int __user *)A(a[2]));
1431 break;
1432 case SYS_SOCKETPAIR:
1433 err = sys_socketpair(a0,a1, a[2], (int __user *)A(a[3]));
1434 break;
1435 case SYS_SEND:
1436 err = sys_send(a0, (void __user *)A(a1), a[2], a[3]);
1437 break;
1438 case SYS_SENDTO:
1439 err = sys_sendto(a0,(void __user *)A(a1), a[2], a[3],
1440 (struct sockaddr __user *)A(a[4]), a[5]);
1441 break;
1442 case SYS_RECV:
1443 err = sys_recv(a0, (void __user *)A(a1), a[2], a[3]);
1444 break;
1445 case SYS_RECVFROM:
1446 err = sys_recvfrom(a0, (void __user *)A(a1), a[2], a[3],
1447 (struct sockaddr __user *)A(a[4]), (int __user *)A(a[5]));
1448 break;
1449 case SYS_SHUTDOWN:
1450 err = sys_shutdown(a0,a1);
1451 break;
1452 case SYS_SETSOCKOPT:
1453 err = sys_setsockopt(a0, a1, a[2], (char __user *)A(a[3]), a[4]);
1454 break;
1455 case SYS_GETSOCKOPT:
1456 err = sys_getsockopt(a0, a1, a[2], (char __user *)A(a[3]), (int __user *)A(a[4]));
1457 break;
1458 case SYS_SENDMSG:
1459 err = sys_sendmsg(a0, (struct msghdr __user *) A(a1), a[2]);
1460 break;
1461 case SYS_RECVMSG:
1462 err = sys_recvmsg(a0, (struct msghdr __user *) A(a1), a[2]);
1463 break;
1464 default:
1465 err = -EINVAL;
1466 break;
1467 }
1468 return err;
1469}
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
new file mode 100644
index 000000000000..eed29fc9dc82
--- /dev/null
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -0,0 +1,67 @@
1/*
2 * Export MIPS-specific functions needed for loadable modules.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 97, 98, 99, 2000, 01, 03, 04, 05 by Ralf Baechle
9 * Copyright (C) 1999, 2000, 01 Silicon Graphics, Inc.
10 */
11#include <linux/config.h>
12#include <linux/interrupt.h>
13#include <linux/module.h>
14#include <asm/checksum.h>
15#include <asm/pgtable.h>
16#include <asm/uaccess.h>
17
18extern void *__bzero(void *__s, size_t __count);
19extern long __strncpy_from_user_nocheck_asm(char *__to,
20 const char *__from, long __len);
21extern long __strncpy_from_user_asm(char *__to, const char *__from,
22 long __len);
23extern long __strlen_user_nocheck_asm(const char *s);
24extern long __strlen_user_asm(const char *s);
25extern long __strnlen_user_nocheck_asm(const char *s);
26extern long __strnlen_user_asm(const char *s);
27
28/*
29 * String functions
30 */
31EXPORT_SYMBOL(memchr);
32EXPORT_SYMBOL(memcmp);
33EXPORT_SYMBOL(memset);
34EXPORT_SYMBOL(memcpy);
35EXPORT_SYMBOL(memmove);
36EXPORT_SYMBOL(strcat);
37EXPORT_SYMBOL(strchr);
38#ifdef CONFIG_MIPS64
39EXPORT_SYMBOL(strncmp);
40#endif
41EXPORT_SYMBOL(strlen);
42EXPORT_SYMBOL(strpbrk);
43EXPORT_SYMBOL(strncat);
44EXPORT_SYMBOL(strnlen);
45EXPORT_SYMBOL(strrchr);
46EXPORT_SYMBOL(strstr);
47
48EXPORT_SYMBOL(kernel_thread);
49
50/*
51 * Userspace access stuff.
52 */
53EXPORT_SYMBOL(__copy_user);
54EXPORT_SYMBOL(__bzero);
55EXPORT_SYMBOL(__strncpy_from_user_nocheck_asm);
56EXPORT_SYMBOL(__strncpy_from_user_asm);
57EXPORT_SYMBOL(__strlen_user_nocheck_asm);
58EXPORT_SYMBOL(__strlen_user_asm);
59EXPORT_SYMBOL(__strnlen_user_nocheck_asm);
60EXPORT_SYMBOL(__strnlen_user_asm);
61
62EXPORT_SYMBOL(csum_partial);
63
64EXPORT_SYMBOL(invalid_pte_table);
65#ifdef CONFIG_GENERIC_IRQ_PROBE
66EXPORT_SYMBOL(probe_irq_mask);
67#endif
diff --git a/arch/mips/kernel/module-elf32.c b/arch/mips/kernel/module-elf32.c
new file mode 100644
index 000000000000..ffd216d6d6dc
--- /dev/null
+++ b/arch/mips/kernel/module-elf32.c
@@ -0,0 +1,250 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 *
16 * Copyright (C) 2001 Rusty Russell.
17 * Copyright (C) 2003, 2004 Ralf Baechle (ralf@linux-mips.org)
18 */
19
20#undef DEBUG
21
22#include <linux/moduleloader.h>
23#include <linux/elf.h>
24#include <linux/vmalloc.h>
25#include <linux/slab.h>
26#include <linux/fs.h>
27#include <linux/string.h>
28#include <linux/kernel.h>
29
30struct mips_hi16 {
31 struct mips_hi16 *next;
32 Elf32_Addr *addr;
33 Elf32_Addr value;
34};
35
36static struct mips_hi16 *mips_hi16_list;
37
38void *module_alloc(unsigned long size)
39{
40 if (size == 0)
41 return NULL;
42 return vmalloc(size);
43}
44
45
46/* Free memory returned from module_alloc */
47void module_free(struct module *mod, void *module_region)
48{
49 vfree(module_region);
50 /* FIXME: If module_region == mod->init_region, trim exception
51 table entries. */
52}
53
54int module_frob_arch_sections(Elf_Ehdr *hdr,
55 Elf_Shdr *sechdrs,
56 char *secstrings,
57 struct module *mod)
58{
59 return 0;
60}
61
62static int apply_r_mips_none(struct module *me, uint32_t *location,
63 Elf32_Addr v)
64{
65 return 0;
66}
67
68static int apply_r_mips_32(struct module *me, uint32_t *location,
69 Elf32_Addr v)
70{
71 *location += v;
72
73 return 0;
74}
75
76static int apply_r_mips_26(struct module *me, uint32_t *location,
77 Elf32_Addr v)
78{
79 if (v % 4) {
80 printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
81 return -ENOEXEC;
82 }
83
84 if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
85 printk(KERN_ERR
86 "module %s: relocation overflow\n",
87 me->name);
88 return -ENOEXEC;
89 }
90
91 *location = (*location & ~0x03ffffff) |
92 ((*location + (v >> 2)) & 0x03ffffff);
93
94 return 0;
95}
96
97static int apply_r_mips_hi16(struct module *me, uint32_t *location,
98 Elf32_Addr v)
99{
100 struct mips_hi16 *n;
101
102 /*
103 * We cannot relocate this one now because we don't know the value of
104 * the carry we need to add. Save the information, and let LO16 do the
105 * actual relocation.
106 */
107 n = kmalloc(sizeof *n, GFP_KERNEL);
108 if (!n)
109 return -ENOMEM;
110
111 n->addr = location;
112 n->value = v;
113 n->next = mips_hi16_list;
114 mips_hi16_list = n;
115
116 return 0;
117}
118
119static int apply_r_mips_lo16(struct module *me, uint32_t *location,
120 Elf32_Addr v)
121{
122 unsigned long insnlo = *location;
123 Elf32_Addr val, vallo;
124
125 /* Sign extend the addend we extract from the lo insn. */
126 vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000;
127
128 if (mips_hi16_list != NULL) {
129 struct mips_hi16 *l;
130
131 l = mips_hi16_list;
132 while (l != NULL) {
133 struct mips_hi16 *next;
134 unsigned long insn;
135
136 /*
137 * The value for the HI16 had best be the same.
138 */
139 if (v != l->value)
140 goto out_danger;
141
142 /*
143 * Do the HI16 relocation. Note that we actually don't
144 * need to know anything about the LO16 itself, except
145 * where to find the low 16 bits of the addend needed
146 * by the LO16.
147 */
148 insn = *l->addr;
149 val = ((insn & 0xffff) << 16) + vallo;
150 val += v;
151
152 /*
153 * Account for the sign extension that will happen in
154 * the low bits.
155 */
156 val = ((val >> 16) + ((val & 0x8000) != 0)) & 0xffff;
157
158 insn = (insn & ~0xffff) | val;
159 *l->addr = insn;
160
161 next = l->next;
162 kfree(l);
163 l = next;
164 }
165
166 mips_hi16_list = NULL;
167 }
168
169 /*
170 * Ok, we're done with the HI16 relocs. Now deal with the LO16.
171 */
172 val = v + vallo;
173 insnlo = (insnlo & ~0xffff) | (val & 0xffff);
174 *location = insnlo;
175
176 return 0;
177
178out_danger:
179 printk(KERN_ERR "module %s: dangerous " "relocation\n", me->name);
180
181 return -ENOEXEC;
182}
183
184static int (*reloc_handlers[]) (struct module *me, uint32_t *location,
185 Elf32_Addr v) = {
186 [R_MIPS_NONE] = apply_r_mips_none,
187 [R_MIPS_32] = apply_r_mips_32,
188 [R_MIPS_26] = apply_r_mips_26,
189 [R_MIPS_HI16] = apply_r_mips_hi16,
190 [R_MIPS_LO16] = apply_r_mips_lo16
191};
192
193int apply_relocate(Elf32_Shdr *sechdrs,
194 const char *strtab,
195 unsigned int symindex,
196 unsigned int relsec,
197 struct module *me)
198{
199 Elf32_Rel *rel = (void *) sechdrs[relsec].sh_addr;
200 Elf32_Sym *sym;
201 uint32_t *location;
202 unsigned int i;
203 Elf32_Addr v;
204 int res;
205
206 pr_debug("Applying relocate section %u to %u\n", relsec,
207 sechdrs[relsec].sh_info);
208
209 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
210 Elf32_Word r_info = rel[i].r_info;
211
212 /* This is where to make the change */
213 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
214 + rel[i].r_offset;
215 /* This is the symbol it is referring to */
216 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
217 + ELF32_R_SYM(r_info);
218 if (!sym->st_value) {
219 printk(KERN_WARNING "%s: Unknown symbol %s\n",
220 me->name, strtab + sym->st_name);
221 return -ENOENT;
222 }
223
224 v = sym->st_value;
225
226 res = reloc_handlers[ELF32_R_TYPE(r_info)](me, location, v);
227 if (res)
228 return res;
229 }
230
231 return 0;
232}
233
234int apply_relocate_add(Elf32_Shdr *sechdrs,
235 const char *strtab,
236 unsigned int symindex,
237 unsigned int relsec,
238 struct module *me)
239{
240 /*
241 * Current binutils always generate .rela relocations. Keep smiling
242 * if it's empty, abort otherwise.
243 */
244 if (!sechdrs[relsec].sh_size)
245 return 0;
246
247 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
248 me->name);
249 return -ENOEXEC;
250}
diff --git a/arch/mips/kernel/module-elf64.c b/arch/mips/kernel/module-elf64.c
new file mode 100644
index 000000000000..e804792ee1ee
--- /dev/null
+++ b/arch/mips/kernel/module-elf64.c
@@ -0,0 +1,274 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 *
16 * Copyright (C) 2001 Rusty Russell.
17 * Copyright (C) 2003, 2004 Ralf Baechle (ralf@linux-mips.org)
18 */
19
20#undef DEBUG
21
22#include <linux/moduleloader.h>
23#include <linux/elf.h>
24#include <linux/vmalloc.h>
25#include <linux/slab.h>
26#include <linux/fs.h>
27#include <linux/string.h>
28#include <linux/kernel.h>
29
30struct mips_hi16 {
31 struct mips_hi16 *next;
32 Elf32_Addr *addr;
33 Elf64_Addr value;
34};
35
36static struct mips_hi16 *mips_hi16_list;
37
38void *module_alloc(unsigned long size)
39{
40 if (size == 0)
41 return NULL;
42 return vmalloc(size);
43}
44
45
46/* Free memory returned from module_alloc */
47void module_free(struct module *mod, void *module_region)
48{
49 vfree(module_region);
50 /* FIXME: If module_region == mod->init_region, trim exception
51 table entries. */
52}
53
54int module_frob_arch_sections(Elf_Ehdr *hdr,
55 Elf_Shdr *sechdrs,
56 char *secstrings,
57 struct module *mod)
58{
59 return 0;
60}
61
62int apply_relocate(Elf64_Shdr *sechdrs,
63 const char *strtab,
64 unsigned int symindex,
65 unsigned int relsec,
66 struct module *me)
67{
68 /*
69 * We don't want to deal with REL relocations - RELA is so much saner.
70 */
71 if (!sechdrs[relsec].sh_size)
72 return 0;
73
74 printk(KERN_ERR "module %s: REL relocation unsupported\n",
75 me->name);
76 return -ENOEXEC;
77}
78
79static int apply_r_mips_none(struct module *me, uint32_t *location,
80 Elf64_Addr v)
81{
82 return 0;
83}
84
85static int apply_r_mips_32(struct module *me, uint32_t *location,
86 Elf64_Addr v)
87{
88 *location = v;
89
90 return 0;
91}
92
93static int apply_r_mips_26(struct module *me, uint32_t *location,
94 Elf64_Addr v)
95{
96 if (v % 4) {
97 printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
98 return -ENOEXEC;
99 }
100
101 if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
102 printk(KERN_ERR
103 "module %s: relocation overflow\n",
104 me->name);
105 return -ENOEXEC;
106 }
107
108 *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff);
109
110 return 0;
111}
112
113static int apply_r_mips_hi16(struct module *me, uint32_t *location,
114 Elf64_Addr v)
115{
116 struct mips_hi16 *n;
117
118 /*
119 * We cannot relocate this one now because we don't know the value of
120 * the carry we need to add. Save the information, and let LO16 do the
121 * actual relocation.
122 */
123 n = kmalloc(sizeof *n, GFP_KERNEL);
124 if (!n)
125 return -ENOMEM;
126
127 n->addr = location;
128 n->value = v;
129 n->next = mips_hi16_list;
130 mips_hi16_list = n;
131
132 return 0;
133}
134
135static int apply_r_mips_lo16(struct module *me, uint32_t *location,
136 Elf64_Addr v)
137{
138 unsigned long insnlo = *location;
139 Elf32_Addr val, vallo;
140
141 /* Sign extend the addend we extract from the lo insn. */
142 vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000;
143
144 if (mips_hi16_list != NULL) {
145 struct mips_hi16 *l;
146
147 l = mips_hi16_list;
148 while (l != NULL) {
149 struct mips_hi16 *next;
150 unsigned long insn;
151
152 /*
153 * The value for the HI16 had best be the same.
154 */
155 if (v != l->value)
156 goto out_danger;
157
158 /*
159 * Do the HI16 relocation. Note that we actually don't
160 * need to know anything about the LO16 itself, except
161 * where to find the low 16 bits of the addend needed
162 * by the LO16.
163 */
164 insn = *l->addr;
165 val = ((insn & 0xffff) << 16) + vallo;
166 val += v;
167
168 /*
169 * Account for the sign extension that will happen in
170 * the low bits.
171 */
172 val = ((val >> 16) + ((val & 0x8000) != 0)) & 0xffff;
173
174 insn = (insn & ~0xffff) | val;
175 *l->addr = insn;
176
177 next = l->next;
178 kfree(l);
179 l = next;
180 }
181
182 mips_hi16_list = NULL;
183 }
184
185 /*
186 * Ok, we're done with the HI16 relocs. Now deal with the LO16.
187 */
188 insnlo = (insnlo & ~0xffff) | (v & 0xffff);
189 *location = insnlo;
190
191 return 0;
192
193out_danger:
194 printk(KERN_ERR "module %s: dangerous " "relocation\n", me->name);
195
196 return -ENOEXEC;
197}
198
199static int apply_r_mips_64(struct module *me, uint32_t *location,
200 Elf64_Addr v)
201{
202 *(uint64_t *) location = v;
203
204 return 0;
205}
206
207
208static int apply_r_mips_higher(struct module *me, uint32_t *location,
209 Elf64_Addr v)
210{
211 *location = (*location & 0xffff0000) |
212 ((((long long) v + 0x80008000LL) >> 32) & 0xffff);
213
214 return 0;
215}
216
217static int apply_r_mips_highest(struct module *me, uint32_t *location,
218 Elf64_Addr v)
219{
220 *location = (*location & 0xffff0000) |
221 ((((long long) v + 0x800080008000LL) >> 48) & 0xffff);
222
223 return 0;
224}
225
226static int (*reloc_handlers[]) (struct module *me, uint32_t *location,
227 Elf64_Addr v) = {
228 [R_MIPS_NONE] = apply_r_mips_none,
229 [R_MIPS_32] = apply_r_mips_32,
230 [R_MIPS_26] = apply_r_mips_26,
231 [R_MIPS_HI16] = apply_r_mips_hi16,
232 [R_MIPS_LO16] = apply_r_mips_lo16,
233 [R_MIPS_64] = apply_r_mips_64,
234 [R_MIPS_HIGHER] = apply_r_mips_higher,
235 [R_MIPS_HIGHEST] = apply_r_mips_highest
236};
237
238int apply_relocate_add(Elf64_Shdr *sechdrs,
239 const char *strtab,
240 unsigned int symindex,
241 unsigned int relsec,
242 struct module *me)
243{
244 Elf64_Mips_Rela *rel = (void *) sechdrs[relsec].sh_addr;
245 Elf64_Sym *sym;
246 uint32_t *location;
247 unsigned int i;
248 Elf64_Addr v;
249 int res;
250
251 pr_debug("Applying relocate section %u to %u\n", relsec,
252 sechdrs[relsec].sh_info);
253
254 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
255 /* This is where to make the change */
256 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
257 + rel[i].r_offset;
258 /* This is the symbol it is referring to */
259 sym = (Elf64_Sym *)sechdrs[symindex].sh_addr + rel[i].r_sym;
260 if (!sym->st_value) {
261 printk(KERN_WARNING "%s: Unknown symbol %s\n",
262 me->name, strtab + sym->st_name);
263 return -ENOENT;
264 }
265
266 v = sym->st_value;
267
268 res = reloc_handlers[rel[i].r_type](me, location, v);
269 if (res)
270 return res;
271 }
272
273 return 0;
274}
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
new file mode 100644
index 000000000000..458af3c7a639
--- /dev/null
+++ b/arch/mips/kernel/module.c
@@ -0,0 +1,53 @@
1#include <linux/module.h>
2#include <linux/spinlock.h>
3
4static LIST_HEAD(dbe_list);
5static DEFINE_SPINLOCK(dbe_lock);
6
7/* Given an address, look for it in the module exception tables. */
8const struct exception_table_entry *search_module_dbetables(unsigned long addr)
9{
10 unsigned long flags;
11 const struct exception_table_entry *e = NULL;
12 struct mod_arch_specific *dbe;
13
14 spin_lock_irqsave(&dbe_lock, flags);
15 list_for_each_entry(dbe, &dbe_list, dbe_list) {
16 e = search_extable(dbe->dbe_start, dbe->dbe_end - 1, addr);
17 if (e)
18 break;
19 }
20 spin_unlock_irqrestore(&dbe_lock, flags);
21
22 /* Now, if we found one, we are running inside it now, hence
23 we cannot unload the module, hence no refcnt needed. */
24 return e;
25}
26
27/* Put in dbe list if neccessary. */
28int module_finalize(const Elf_Ehdr *hdr,
29 const Elf_Shdr *sechdrs,
30 struct module *me)
31{
32 const Elf_Shdr *s;
33 char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
34
35 INIT_LIST_HEAD(&me->arch.dbe_list);
36 for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
37 if (strcmp("__dbe_table", secstrings + s->sh_name) != 0)
38 continue;
39 me->arch.dbe_start = (void *)s->sh_addr;
40 me->arch.dbe_end = (void *)s->sh_addr + s->sh_size;
41 spin_lock_irq(&dbe_lock);
42 list_add(&me->arch.dbe_list, &dbe_list);
43 spin_unlock_irq(&dbe_lock);
44 }
45 return 0;
46}
47
48void module_arch_cleanup(struct module *mod)
49{
50 spin_lock_irq(&dbe_lock);
51 list_del(&mod->arch.dbe_list);
52 spin_unlock_irq(&dbe_lock);
53}
diff --git a/arch/mips/kernel/offset.c b/arch/mips/kernel/offset.c
new file mode 100644
index 000000000000..2c11abb5a406
--- /dev/null
+++ b/arch/mips/kernel/offset.c
@@ -0,0 +1,314 @@
1/*
2 * offset.c: Calculate pt_regs and task_struct offsets.
3 *
4 * Copyright (C) 1996 David S. Miller
5 * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Ralf Baechle
6 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
7 *
8 * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
9 * Copyright (C) 2000 MIPS Technologies, Inc.
10 */
11#include <linux/config.h>
12#include <linux/compat.h>
13#include <linux/types.h>
14#include <linux/sched.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17
18#include <asm/ptrace.h>
19#include <asm/processor.h>
20
21#define text(t) __asm__("\n@@@" t)
22#define _offset(type, member) (&(((type *)NULL)->member))
23#define offset(string, ptr, member) \
24 __asm__("\n@@@" string "%0" : : "i" (_offset(ptr, member)))
25#define constant(string, member) \
26 __asm__("\n@@@" string "%x0" : : "ri" (member))
27#define size(string, size) \
28 __asm__("\n@@@" string "%0" : : "i" (sizeof(size)))
29#define linefeed text("")
30
31void output_ptreg_defines(void)
32{
33 text("/* MIPS pt_regs offsets. */");
34 offset("#define PT_R0 ", struct pt_regs, regs[0]);
35 offset("#define PT_R1 ", struct pt_regs, regs[1]);
36 offset("#define PT_R2 ", struct pt_regs, regs[2]);
37 offset("#define PT_R3 ", struct pt_regs, regs[3]);
38 offset("#define PT_R4 ", struct pt_regs, regs[4]);
39 offset("#define PT_R5 ", struct pt_regs, regs[5]);
40 offset("#define PT_R6 ", struct pt_regs, regs[6]);
41 offset("#define PT_R7 ", struct pt_regs, regs[7]);
42 offset("#define PT_R8 ", struct pt_regs, regs[8]);
43 offset("#define PT_R9 ", struct pt_regs, regs[9]);
44 offset("#define PT_R10 ", struct pt_regs, regs[10]);
45 offset("#define PT_R11 ", struct pt_regs, regs[11]);
46 offset("#define PT_R12 ", struct pt_regs, regs[12]);
47 offset("#define PT_R13 ", struct pt_regs, regs[13]);
48 offset("#define PT_R14 ", struct pt_regs, regs[14]);
49 offset("#define PT_R15 ", struct pt_regs, regs[15]);
50 offset("#define PT_R16 ", struct pt_regs, regs[16]);
51 offset("#define PT_R17 ", struct pt_regs, regs[17]);
52 offset("#define PT_R18 ", struct pt_regs, regs[18]);
53 offset("#define PT_R19 ", struct pt_regs, regs[19]);
54 offset("#define PT_R20 ", struct pt_regs, regs[20]);
55 offset("#define PT_R21 ", struct pt_regs, regs[21]);
56 offset("#define PT_R22 ", struct pt_regs, regs[22]);
57 offset("#define PT_R23 ", struct pt_regs, regs[23]);
58 offset("#define PT_R24 ", struct pt_regs, regs[24]);
59 offset("#define PT_R25 ", struct pt_regs, regs[25]);
60 offset("#define PT_R26 ", struct pt_regs, regs[26]);
61 offset("#define PT_R27 ", struct pt_regs, regs[27]);
62 offset("#define PT_R28 ", struct pt_regs, regs[28]);
63 offset("#define PT_R29 ", struct pt_regs, regs[29]);
64 offset("#define PT_R30 ", struct pt_regs, regs[30]);
65 offset("#define PT_R31 ", struct pt_regs, regs[31]);
66 offset("#define PT_LO ", struct pt_regs, lo);
67 offset("#define PT_HI ", struct pt_regs, hi);
68 offset("#define PT_EPC ", struct pt_regs, cp0_epc);
69 offset("#define PT_BVADDR ", struct pt_regs, cp0_badvaddr);
70 offset("#define PT_STATUS ", struct pt_regs, cp0_status);
71 offset("#define PT_CAUSE ", struct pt_regs, cp0_cause);
72 size("#define PT_SIZE ", struct pt_regs);
73 linefeed;
74}
75
76void output_task_defines(void)
77{
78 text("/* MIPS task_struct offsets. */");
79 offset("#define TASK_STATE ", struct task_struct, state);
80 offset("#define TASK_THREAD_INFO ", struct task_struct, thread_info);
81 offset("#define TASK_FLAGS ", struct task_struct, flags);
82 offset("#define TASK_MM ", struct task_struct, mm);
83 offset("#define TASK_PID ", struct task_struct, pid);
84 size( "#define TASK_STRUCT_SIZE ", struct task_struct);
85 linefeed;
86}
87
88void output_thread_info_defines(void)
89{
90 text("/* MIPS thread_info offsets. */");
91 offset("#define TI_TASK ", struct thread_info, task);
92 offset("#define TI_EXEC_DOMAIN ", struct thread_info, exec_domain);
93 offset("#define TI_FLAGS ", struct thread_info, flags);
94 offset("#define TI_CPU ", struct thread_info, cpu);
95 offset("#define TI_PRE_COUNT ", struct thread_info, preempt_count);
96 offset("#define TI_ADDR_LIMIT ", struct thread_info, addr_limit);
97 offset("#define TI_RESTART_BLOCK ", struct thread_info, restart_block);
98 constant("#define _THREAD_SIZE_ORDER ", THREAD_SIZE_ORDER);
99 constant("#define _THREAD_SIZE ", THREAD_SIZE);
100 constant("#define _THREAD_MASK ", THREAD_MASK);
101 linefeed;
102}
103
104void output_thread_defines(void)
105{
106 text("/* MIPS specific thread_struct offsets. */");
107 offset("#define THREAD_REG16 ", struct task_struct, thread.reg16);
108 offset("#define THREAD_REG17 ", struct task_struct, thread.reg17);
109 offset("#define THREAD_REG18 ", struct task_struct, thread.reg18);
110 offset("#define THREAD_REG19 ", struct task_struct, thread.reg19);
111 offset("#define THREAD_REG20 ", struct task_struct, thread.reg20);
112 offset("#define THREAD_REG21 ", struct task_struct, thread.reg21);
113 offset("#define THREAD_REG22 ", struct task_struct, thread.reg22);
114 offset("#define THREAD_REG23 ", struct task_struct, thread.reg23);
115 offset("#define THREAD_REG29 ", struct task_struct, thread.reg29);
116 offset("#define THREAD_REG30 ", struct task_struct, thread.reg30);
117 offset("#define THREAD_REG31 ", struct task_struct, thread.reg31);
118 offset("#define THREAD_STATUS ", struct task_struct,
119 thread.cp0_status);
120 offset("#define THREAD_FPU ", struct task_struct, thread.fpu);
121
122 offset("#define THREAD_BVADDR ", struct task_struct, \
123 thread.cp0_badvaddr);
124 offset("#define THREAD_BUADDR ", struct task_struct, \
125 thread.cp0_baduaddr);
126 offset("#define THREAD_ECODE ", struct task_struct, \
127 thread.error_code);
128 offset("#define THREAD_TRAPNO ", struct task_struct, thread.trap_no);
129 offset("#define THREAD_MFLAGS ", struct task_struct, thread.mflags);
130 offset("#define THREAD_TRAMP ", struct task_struct, \
131 thread.irix_trampoline);
132 offset("#define THREAD_OLDCTX ", struct task_struct, \
133 thread.irix_oldctx);
134 linefeed;
135}
136
137void output_thread_fpu_defines(void)
138{
139 offset("#define THREAD_FPR0 ",
140 struct task_struct, thread.fpu.hard.fpr[0]);
141 offset("#define THREAD_FPR1 ",
142 struct task_struct, thread.fpu.hard.fpr[1]);
143 offset("#define THREAD_FPR2 ",
144 struct task_struct, thread.fpu.hard.fpr[2]);
145 offset("#define THREAD_FPR3 ",
146 struct task_struct, thread.fpu.hard.fpr[3]);
147 offset("#define THREAD_FPR4 ",
148 struct task_struct, thread.fpu.hard.fpr[4]);
149 offset("#define THREAD_FPR5 ",
150 struct task_struct, thread.fpu.hard.fpr[5]);
151 offset("#define THREAD_FPR6 ",
152 struct task_struct, thread.fpu.hard.fpr[6]);
153 offset("#define THREAD_FPR7 ",
154 struct task_struct, thread.fpu.hard.fpr[7]);
155 offset("#define THREAD_FPR8 ",
156 struct task_struct, thread.fpu.hard.fpr[8]);
157 offset("#define THREAD_FPR9 ",
158 struct task_struct, thread.fpu.hard.fpr[9]);
159 offset("#define THREAD_FPR10 ",
160 struct task_struct, thread.fpu.hard.fpr[10]);
161 offset("#define THREAD_FPR11 ",
162 struct task_struct, thread.fpu.hard.fpr[11]);
163 offset("#define THREAD_FPR12 ",
164 struct task_struct, thread.fpu.hard.fpr[12]);
165 offset("#define THREAD_FPR13 ",
166 struct task_struct, thread.fpu.hard.fpr[13]);
167 offset("#define THREAD_FPR14 ",
168 struct task_struct, thread.fpu.hard.fpr[14]);
169 offset("#define THREAD_FPR15 ",
170 struct task_struct, thread.fpu.hard.fpr[15]);
171 offset("#define THREAD_FPR16 ",
172 struct task_struct, thread.fpu.hard.fpr[16]);
173 offset("#define THREAD_FPR17 ",
174 struct task_struct, thread.fpu.hard.fpr[17]);
175 offset("#define THREAD_FPR18 ",
176 struct task_struct, thread.fpu.hard.fpr[18]);
177 offset("#define THREAD_FPR19 ",
178 struct task_struct, thread.fpu.hard.fpr[19]);
179 offset("#define THREAD_FPR20 ",
180 struct task_struct, thread.fpu.hard.fpr[20]);
181 offset("#define THREAD_FPR21 ",
182 struct task_struct, thread.fpu.hard.fpr[21]);
183 offset("#define THREAD_FPR22 ",
184 struct task_struct, thread.fpu.hard.fpr[22]);
185 offset("#define THREAD_FPR23 ",
186 struct task_struct, thread.fpu.hard.fpr[23]);
187 offset("#define THREAD_FPR24 ",
188 struct task_struct, thread.fpu.hard.fpr[24]);
189 offset("#define THREAD_FPR25 ",
190 struct task_struct, thread.fpu.hard.fpr[25]);
191 offset("#define THREAD_FPR26 ",
192 struct task_struct, thread.fpu.hard.fpr[26]);
193 offset("#define THREAD_FPR27 ",
194 struct task_struct, thread.fpu.hard.fpr[27]);
195 offset("#define THREAD_FPR28 ",
196 struct task_struct, thread.fpu.hard.fpr[28]);
197 offset("#define THREAD_FPR29 ",
198 struct task_struct, thread.fpu.hard.fpr[29]);
199 offset("#define THREAD_FPR30 ",
200 struct task_struct, thread.fpu.hard.fpr[30]);
201 offset("#define THREAD_FPR31 ",
202 struct task_struct, thread.fpu.hard.fpr[31]);
203
204 offset("#define THREAD_FCR31 ",
205 struct task_struct, thread.fpu.hard.fcr31);
206 linefeed;
207}
208
209void output_mm_defines(void)
210{
211 text("/* Size of struct page */");
212 size("#define STRUCT_PAGE_SIZE ", struct page);
213 linefeed;
214 text("/* Linux mm_struct offsets. */");
215 offset("#define MM_USERS ", struct mm_struct, mm_users);
216 offset("#define MM_PGD ", struct mm_struct, pgd);
217 offset("#define MM_CONTEXT ", struct mm_struct, context);
218 linefeed;
219 constant("#define _PAGE_SIZE ", PAGE_SIZE);
220 constant("#define _PAGE_SHIFT ", PAGE_SHIFT);
221 linefeed;
222 constant("#define _PGD_T_SIZE ", sizeof(pgd_t));
223 constant("#define _PMD_T_SIZE ", sizeof(pmd_t));
224 constant("#define _PTE_T_SIZE ", sizeof(pte_t));
225 linefeed;
226 constant("#define _PGD_T_LOG2 ", PGD_T_LOG2);
227 constant("#define _PMD_T_LOG2 ", PMD_T_LOG2);
228 constant("#define _PTE_T_LOG2 ", PTE_T_LOG2);
229 linefeed;
230 constant("#define _PMD_SHIFT ", PMD_SHIFT);
231 constant("#define _PGDIR_SHIFT ", PGDIR_SHIFT);
232 linefeed;
233 constant("#define _PGD_ORDER ", PGD_ORDER);
234 constant("#define _PMD_ORDER ", PMD_ORDER);
235 constant("#define _PTE_ORDER ", PTE_ORDER);
236 linefeed;
237 constant("#define _PTRS_PER_PGD ", PTRS_PER_PGD);
238 constant("#define _PTRS_PER_PMD ", PTRS_PER_PMD);
239 constant("#define _PTRS_PER_PTE ", PTRS_PER_PTE);
240 linefeed;
241}
242
243void output_sc_defines(void)
244{
245 text("/* Linux sigcontext offsets. */");
246 offset("#define SC_REGS ", struct sigcontext, sc_regs);
247 offset("#define SC_FPREGS ", struct sigcontext, sc_fpregs);
248 offset("#define SC_MDHI ", struct sigcontext, sc_mdhi);
249 offset("#define SC_MDLO ", struct sigcontext, sc_mdlo);
250 offset("#define SC_PC ", struct sigcontext, sc_pc);
251 offset("#define SC_STATUS ", struct sigcontext, sc_status);
252 offset("#define SC_FPC_CSR ", struct sigcontext, sc_fpc_csr);
253 offset("#define SC_FPC_EIR ", struct sigcontext, sc_fpc_eir);
254 offset("#define SC_CAUSE ", struct sigcontext, sc_cause);
255 offset("#define SC_BADVADDR ", struct sigcontext, sc_badvaddr);
256 linefeed;
257}
258
259#ifdef CONFIG_MIPS32_COMPAT
260void output_sc32_defines(void)
261{
262 text("/* Linux 32-bit sigcontext offsets. */");
263 offset("#define SC32_FPREGS ", struct sigcontext32, sc_fpregs);
264 offset("#define SC32_FPC_CSR ", struct sigcontext32, sc_fpc_csr);
265 offset("#define SC32_FPC_EIR ", struct sigcontext32, sc_fpc_eir);
266 linefeed;
267}
268#endif
269
270void output_signal_defined(void)
271{
272 text("/* Linux signal numbers. */");
273 constant("#define _SIGHUP ", SIGHUP);
274 constant("#define _SIGINT ", SIGINT);
275 constant("#define _SIGQUIT ", SIGQUIT);
276 constant("#define _SIGILL ", SIGILL);
277 constant("#define _SIGTRAP ", SIGTRAP);
278 constant("#define _SIGIOT ", SIGIOT);
279 constant("#define _SIGABRT ", SIGABRT);
280 constant("#define _SIGEMT ", SIGEMT);
281 constant("#define _SIGFPE ", SIGFPE);
282 constant("#define _SIGKILL ", SIGKILL);
283 constant("#define _SIGBUS ", SIGBUS);
284 constant("#define _SIGSEGV ", SIGSEGV);
285 constant("#define _SIGSYS ", SIGSYS);
286 constant("#define _SIGPIPE ", SIGPIPE);
287 constant("#define _SIGALRM ", SIGALRM);
288 constant("#define _SIGTERM ", SIGTERM);
289 constant("#define _SIGUSR1 ", SIGUSR1);
290 constant("#define _SIGUSR2 ", SIGUSR2);
291 constant("#define _SIGCHLD ", SIGCHLD);
292 constant("#define _SIGPWR ", SIGPWR);
293 constant("#define _SIGWINCH ", SIGWINCH);
294 constant("#define _SIGURG ", SIGURG);
295 constant("#define _SIGIO ", SIGIO);
296 constant("#define _SIGSTOP ", SIGSTOP);
297 constant("#define _SIGTSTP ", SIGTSTP);
298 constant("#define _SIGCONT ", SIGCONT);
299 constant("#define _SIGTTIN ", SIGTTIN);
300 constant("#define _SIGTTOU ", SIGTTOU);
301 constant("#define _SIGVTALRM ", SIGVTALRM);
302 constant("#define _SIGPROF ", SIGPROF);
303 constant("#define _SIGXCPU ", SIGXCPU);
304 constant("#define _SIGXFSZ ", SIGXFSZ);
305 linefeed;
306}
307
308void output_irq_cpustat_t_defines(void)
309{
310 text("/* Linux irq_cpustat_t offsets. */");
311 offset("#define IC_SOFTIRQ_PENDING ", irq_cpustat_t, __softirq_pending);
312 size("#define IC_IRQ_CPUSTAT_T ", irq_cpustat_t);
313 linefeed;
314}
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
new file mode 100644
index 000000000000..0f159f30e894
--- /dev/null
+++ b/arch/mips/kernel/proc.c
@@ -0,0 +1,149 @@
1/*
2 * linux/arch/mips/kernel/proc.c
3 *
4 * Copyright (C) 1995, 1996, 2001 Ralf Baechle
5 * Copyright (C) 2001 MIPS Technologies, Inc.
6 */
7#include <linux/config.h>
8#include <linux/delay.h>
9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <linux/seq_file.h>
12#include <asm/bootinfo.h>
13#include <asm/cpu.h>
14#include <asm/cpu-features.h>
15#include <asm/mipsregs.h>
16#include <asm/processor.h>
17#include <asm/watch.h>
18
19unsigned int vced_count, vcei_count;
20
21static const char *cpu_name[] = {
22 [CPU_UNKNOWN] "unknown",
23 [CPU_R2000] "R2000",
24 [CPU_R3000] "R3000",
25 [CPU_R3000A] "R3000A",
26 [CPU_R3041] "R3041",
27 [CPU_R3051] "R3051",
28 [CPU_R3052] "R3052",
29 [CPU_R3081] "R3081",
30 [CPU_R3081E] "R3081E",
31 [CPU_R4000PC] "R4000PC",
32 [CPU_R4000SC] "R4000SC",
33 [CPU_R4000MC] "R4000MC",
34 [CPU_R4200] "R4200",
35 [CPU_R4400PC] "R4400PC",
36 [CPU_R4400SC] "R4400SC",
37 [CPU_R4400MC] "R4400MC",
38 [CPU_R4600] "R4600",
39 [CPU_R6000] "R6000",
40 [CPU_R6000A] "R6000A",
41 [CPU_R8000] "R8000",
42 [CPU_R10000] "R10000",
43 [CPU_R12000] "R12000",
44 [CPU_R4300] "R4300",
45 [CPU_R4650] "R4650",
46 [CPU_R4700] "R4700",
47 [CPU_R5000] "R5000",
48 [CPU_R5000A] "R5000A",
49 [CPU_R4640] "R4640",
50 [CPU_NEVADA] "Nevada",
51 [CPU_RM7000] "RM7000",
52 [CPU_RM9000] "RM9000",
53 [CPU_R5432] "R5432",
54 [CPU_4KC] "MIPS 4Kc",
55 [CPU_5KC] "MIPS 5Kc",
56 [CPU_R4310] "R4310",
57 [CPU_SB1] "SiByte SB1",
58 [CPU_TX3912] "TX3912",
59 [CPU_TX3922] "TX3922",
60 [CPU_TX3927] "TX3927",
61 [CPU_AU1000] "Au1000",
62 [CPU_AU1500] "Au1500",
63 [CPU_4KEC] "MIPS 4KEc",
64 [CPU_4KSC] "MIPS 4KSc",
65 [CPU_VR41XX] "NEC Vr41xx",
66 [CPU_R5500] "R5500",
67 [CPU_TX49XX] "TX49xx",
68 [CPU_20KC] "MIPS 20Kc",
69 [CPU_24K] "MIPS 24K",
70 [CPU_25KF] "MIPS 25Kf",
71 [CPU_VR4111] "NEC VR4111",
72 [CPU_VR4121] "NEC VR4121",
73 [CPU_VR4122] "NEC VR4122",
74 [CPU_VR4131] "NEC VR4131",
75 [CPU_VR4133] "NEC VR4133",
76 [CPU_VR4181] "NEC VR4181",
77 [CPU_VR4181A] "NEC VR4181A",
78 [CPU_SR71000] "Sandcraft SR71000"
79};
80
81
82static int show_cpuinfo(struct seq_file *m, void *v)
83{
84 unsigned int version = current_cpu_data.processor_id;
85 unsigned int fp_vers = current_cpu_data.fpu_id;
86 unsigned long n = (unsigned long) v - 1;
87 char fmt [64];
88
89#ifdef CONFIG_SMP
90 if (!cpu_isset(n, cpu_online_map))
91 return 0;
92#endif
93
94 /*
95 * For the first processor also print the system type
96 */
97 if (n == 0)
98 seq_printf(m, "system type\t\t: %s\n", get_system_type());
99
100 seq_printf(m, "processor\t\t: %ld\n", n);
101 sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n",
102 cpu_has_fpu ? " FPU V%d.%d" : "");
103 seq_printf(m, fmt, cpu_name[current_cpu_data.cputype <= CPU_LAST ?
104 current_cpu_data.cputype : CPU_UNKNOWN],
105 (version >> 4) & 0x0f, version & 0x0f,
106 (fp_vers >> 4) & 0x0f, fp_vers & 0x0f);
107 seq_printf(m, "BogoMIPS\t\t: %lu.%02lu\n",
108 loops_per_jiffy / (500000/HZ),
109 (loops_per_jiffy / (5000/HZ)) % 100);
110 seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
111 seq_printf(m, "microsecond timers\t: %s\n",
112 cpu_has_counter ? "yes" : "no");
113 seq_printf(m, "tlb_entries\t\t: %d\n", current_cpu_data.tlbsize);
114 seq_printf(m, "extra interrupt vector\t: %s\n",
115 cpu_has_divec ? "yes" : "no");
116 seq_printf(m, "hardware watchpoint\t: %s\n",
117 cpu_has_watch ? "yes" : "no");
118
119 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
120 cpu_has_vce ? "%u" : "not available");
121 seq_printf(m, fmt, 'D', vced_count);
122 seq_printf(m, fmt, 'I', vcei_count);
123
124 return 0;
125}
126
127static void *c_start(struct seq_file *m, loff_t *pos)
128{
129 unsigned long i = *pos;
130
131 return i < NR_CPUS ? (void *) (i + 1) : NULL;
132}
133
134static void *c_next(struct seq_file *m, void *v, loff_t *pos)
135{
136 ++*pos;
137 return c_start(m, pos);
138}
139
140static void c_stop(struct seq_file *m, void *v)
141{
142}
143
144struct seq_operations cpuinfo_op = {
145 .start = c_start,
146 .next = c_next,
147 .stop = c_stop,
148 .show = show_cpuinfo,
149};
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
new file mode 100644
index 000000000000..6e70c42c2058
--- /dev/null
+++ b/arch/mips/kernel/process.c
@@ -0,0 +1,364 @@
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) 1994 - 1999, 2000 by Ralf Baechle and others.
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2004 Thiemo Seufer
9 */
10#include <linux/config.h>
11#include <linux/errno.h>
12#include <linux/module.h>
13#include <linux/sched.h>
14#include <linux/kernel.h>
15#include <linux/mm.h>
16#include <linux/stddef.h>
17#include <linux/unistd.h>
18#include <linux/ptrace.h>
19#include <linux/slab.h>
20#include <linux/mman.h>
21#include <linux/personality.h>
22#include <linux/sys.h>
23#include <linux/user.h>
24#include <linux/a.out.h>
25#include <linux/init.h>
26#include <linux/completion.h>
27
28#include <asm/bootinfo.h>
29#include <asm/cpu.h>
30#include <asm/fpu.h>
31#include <asm/pgtable.h>
32#include <asm/system.h>
33#include <asm/mipsregs.h>
34#include <asm/processor.h>
35#include <asm/uaccess.h>
36#include <asm/io.h>
37#include <asm/elf.h>
38#include <asm/isadep.h>
39#include <asm/inst.h>
40
41/*
42 * We use this if we don't have any better idle routine..
43 * (This to kill: kernel/platform.c.
44 */
45void default_idle (void)
46{
47}
48
49/*
50 * The idle thread. There's no useful work to be done, so just try to conserve
51 * power and have a low exit latency (ie sit in a loop waiting for somebody to
52 * say that they'd like to reschedule)
53 */
54ATTRIB_NORET void cpu_idle(void)
55{
56 /* endless idle loop with no priority at all */
57 while (1) {
58 while (!need_resched())
59 if (cpu_wait)
60 (*cpu_wait)();
61 schedule();
62 }
63}
64
65asmlinkage void ret_from_fork(void);
66
67void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
68{
69 unsigned long status;
70
71 /* New thread loses kernel privileges. */
72 status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|KU_MASK);
73#ifdef CONFIG_MIPS64
74 status &= ~ST0_FR;
75 status |= (current->thread.mflags & MF_32BIT_REGS) ? 0 : ST0_FR;
76#endif
77 status |= KU_USER;
78 regs->cp0_status = status;
79 clear_used_math();
80 lose_fpu();
81 regs->cp0_epc = pc;
82 regs->regs[29] = sp;
83 current_thread_info()->addr_limit = USER_DS;
84}
85
86void exit_thread(void)
87{
88}
89
90void flush_thread(void)
91{
92}
93
94int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
95 unsigned long unused, struct task_struct *p, struct pt_regs *regs)
96{
97 struct thread_info *ti = p->thread_info;
98 struct pt_regs *childregs;
99 long childksp;
100
101 childksp = (unsigned long)ti + THREAD_SIZE - 32;
102
103 preempt_disable();
104
105 if (is_fpu_owner()) {
106 save_fp(p);
107 }
108
109 preempt_enable();
110
111 /* set up new TSS. */
112 childregs = (struct pt_regs *) childksp - 1;
113 *childregs = *regs;
114 childregs->regs[7] = 0; /* Clear error flag */
115
116#if defined(CONFIG_BINFMT_IRIX)
117 if (current->personality != PER_LINUX) {
118 /* Under IRIX things are a little different. */
119 childregs->regs[3] = 1;
120 regs->regs[3] = 0;
121 }
122#endif
123 childregs->regs[2] = 0; /* Child gets zero as return value */
124 regs->regs[2] = p->pid;
125
126 if (childregs->cp0_status & ST0_CU0) {
127 childregs->regs[28] = (unsigned long) ti;
128 childregs->regs[29] = childksp;
129 ti->addr_limit = KERNEL_DS;
130 } else {
131 childregs->regs[29] = usp;
132 ti->addr_limit = USER_DS;
133 }
134 p->thread.reg29 = (unsigned long) childregs;
135 p->thread.reg31 = (unsigned long) ret_from_fork;
136
137 /*
138 * New tasks lose permission to use the fpu. This accelerates context
139 * switching for most programs since they don't use the fpu.
140 */
141 p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1);
142 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1);
143 clear_tsk_thread_flag(p, TIF_USEDFPU);
144
145 return 0;
146}
147
148/* Fill in the fpu structure for a core dump.. */
149int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
150{
151 memcpy(r, &current->thread.fpu, sizeof(current->thread.fpu));
152
153 return 1;
154}
155
156void dump_regs(elf_greg_t *gp, struct pt_regs *regs)
157{
158 int i;
159
160 for (i = 0; i < EF_R0; i++)
161 gp[i] = 0;
162 gp[EF_R0] = 0;
163 for (i = 1; i <= 31; i++)
164 gp[EF_R0 + i] = regs->regs[i];
165 gp[EF_R26] = 0;
166 gp[EF_R27] = 0;
167 gp[EF_LO] = regs->lo;
168 gp[EF_HI] = regs->hi;
169 gp[EF_CP0_EPC] = regs->cp0_epc;
170 gp[EF_CP0_BADVADDR] = regs->cp0_badvaddr;
171 gp[EF_CP0_STATUS] = regs->cp0_status;
172 gp[EF_CP0_CAUSE] = regs->cp0_cause;
173#ifdef EF_UNUSED0
174 gp[EF_UNUSED0] = 0;
175#endif
176}
177
178int dump_task_fpu (struct task_struct *t, elf_fpregset_t *fpr)
179{
180 memcpy(fpr, &t->thread.fpu, sizeof(current->thread.fpu));
181
182 return 1;
183}
184
185/*
186 * Create a kernel thread
187 */
188ATTRIB_NORET void kernel_thread_helper(void *arg, int (*fn)(void *))
189{
190 do_exit(fn(arg));
191}
192
193long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
194{
195 struct pt_regs regs;
196
197 memset(&regs, 0, sizeof(regs));
198
199 regs.regs[4] = (unsigned long) arg;
200 regs.regs[5] = (unsigned long) fn;
201 regs.cp0_epc = (unsigned long) kernel_thread_helper;
202 regs.cp0_status = read_c0_status();
203#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
204 regs.cp0_status &= ~(ST0_KUP | ST0_IEC);
205 regs.cp0_status |= ST0_IEP;
206#else
207 regs.cp0_status |= ST0_EXL;
208#endif
209
210 /* Ok, create the new process.. */
211 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
212}
213
214struct mips_frame_info {
215 int frame_offset;
216 int pc_offset;
217};
218static struct mips_frame_info schedule_frame;
219static struct mips_frame_info schedule_timeout_frame;
220static struct mips_frame_info sleep_on_frame;
221static struct mips_frame_info sleep_on_timeout_frame;
222static struct mips_frame_info wait_for_completion_frame;
223static int mips_frame_info_initialized;
224static int __init get_frame_info(struct mips_frame_info *info, void *func)
225{
226 int i;
227 union mips_instruction *ip = (union mips_instruction *)func;
228 info->pc_offset = -1;
229 info->frame_offset = -1;
230 for (i = 0; i < 128; i++, ip++) {
231 /* if jal, jalr, jr, stop. */
232 if (ip->j_format.opcode == jal_op ||
233 (ip->r_format.opcode == spec_op &&
234 (ip->r_format.func == jalr_op ||
235 ip->r_format.func == jr_op)))
236 break;
237
238 if (
239#ifdef CONFIG_MIPS32
240 ip->i_format.opcode == sw_op &&
241#endif
242#ifdef CONFIG_MIPS64
243 ip->i_format.opcode == sd_op &&
244#endif
245 ip->i_format.rs == 29)
246 {
247 /* sw / sd $ra, offset($sp) */
248 if (ip->i_format.rt == 31) {
249 if (info->pc_offset != -1)
250 break;
251 info->pc_offset =
252 ip->i_format.simmediate / sizeof(long);
253 }
254 /* sw / sd $s8, offset($sp) */
255 if (ip->i_format.rt == 30) {
256 if (info->frame_offset != -1)
257 break;
258 info->frame_offset =
259 ip->i_format.simmediate / sizeof(long);
260 }
261 }
262 }
263 if (info->pc_offset == -1 || info->frame_offset == -1) {
264 printk("Can't analyze prologue code at %p\n", func);
265 info->pc_offset = -1;
266 info->frame_offset = -1;
267 return -1;
268 }
269
270 return 0;
271}
272
273static int __init frame_info_init(void)
274{
275 mips_frame_info_initialized =
276 !get_frame_info(&schedule_frame, schedule) &&
277 !get_frame_info(&schedule_timeout_frame, schedule_timeout) &&
278 !get_frame_info(&sleep_on_frame, sleep_on) &&
279 !get_frame_info(&sleep_on_timeout_frame, sleep_on_timeout) &&
280 !get_frame_info(&wait_for_completion_frame, wait_for_completion);
281
282 return 0;
283}
284
285arch_initcall(frame_info_init);
286
287/*
288 * Return saved PC of a blocked thread.
289 */
290unsigned long thread_saved_pc(struct task_struct *tsk)
291{
292 struct thread_struct *t = &tsk->thread;
293
294 /* New born processes are a special case */
295 if (t->reg31 == (unsigned long) ret_from_fork)
296 return t->reg31;
297
298 if (schedule_frame.pc_offset < 0)
299 return 0;
300 return ((unsigned long *)t->reg29)[schedule_frame.pc_offset];
301}
302
303/* get_wchan - a maintenance nightmare^W^Wpain in the ass ... */
304unsigned long get_wchan(struct task_struct *p)
305{
306 unsigned long frame, pc;
307
308 if (!p || p == current || p->state == TASK_RUNNING)
309 return 0;
310
311 if (!mips_frame_info_initialized)
312 return 0;
313 pc = thread_saved_pc(p);
314 if (!in_sched_functions(pc))
315 goto out;
316
317 if (pc >= (unsigned long) sleep_on_timeout)
318 goto schedule_timeout_caller;
319 if (pc >= (unsigned long) sleep_on)
320 goto schedule_caller;
321 if (pc >= (unsigned long) interruptible_sleep_on_timeout)
322 goto schedule_timeout_caller;
323 if (pc >= (unsigned long)interruptible_sleep_on)
324 goto schedule_caller;
325 if (pc >= (unsigned long)wait_for_completion)
326 goto schedule_caller;
327 goto schedule_timeout_caller;
328
329schedule_caller:
330 frame = ((unsigned long *)p->thread.reg30)[schedule_frame.frame_offset];
331 if (pc >= (unsigned long) sleep_on)
332 pc = ((unsigned long *)frame)[sleep_on_frame.pc_offset];
333 else
334 pc = ((unsigned long *)frame)[wait_for_completion_frame.pc_offset];
335 goto out;
336
337schedule_timeout_caller:
338 /*
339 * The schedule_timeout frame
340 */
341 frame = ((unsigned long *)p->thread.reg30)[schedule_frame.frame_offset];
342
343 /*
344 * frame now points to sleep_on_timeout's frame
345 */
346 pc = ((unsigned long *)frame)[schedule_timeout_frame.pc_offset];
347
348 if (in_sched_functions(pc)) {
349 /* schedule_timeout called by [interruptible_]sleep_on_timeout */
350 frame = ((unsigned long *)frame)[schedule_timeout_frame.frame_offset];
351 pc = ((unsigned long *)frame)[sleep_on_timeout_frame.pc_offset];
352 }
353
354out:
355
356#ifdef CONFIG_MIPS64
357 if (current->thread.mflags & MF_32BIT_REGS) /* Kludge for 32-bit ps */
358 pc &= 0xffffffffUL;
359#endif
360
361 return pc;
362}
363
364EXPORT_SYMBOL(get_wchan);
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
new file mode 100644
index 000000000000..a166954a70b3
--- /dev/null
+++ b/arch/mips/kernel/ptrace.c
@@ -0,0 +1,338 @@
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) 1992 Ross Biro
7 * Copyright (C) Linus Torvalds
8 * Copyright (C) 1994, 95, 96, 97, 98, 2000 Ralf Baechle
9 * Copyright (C) 1996 David S. Miller
10 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
11 * Copyright (C) 1999 MIPS Technologies, Inc.
12 * Copyright (C) 2000 Ulf Carlsson
13 *
14 * At this time Linux/MIPS64 only supports syscall tracing, even for 32-bit
15 * binaries.
16 */
17#include <linux/config.h>
18#include <linux/compiler.h>
19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/mm.h>
22#include <linux/errno.h>
23#include <linux/ptrace.h>
24#include <linux/audit.h>
25#include <linux/smp.h>
26#include <linux/smp_lock.h>
27#include <linux/user.h>
28#include <linux/security.h>
29#include <linux/audit.h>
30
31#include <asm/cpu.h>
32#include <asm/fpu.h>
33#include <asm/mipsregs.h>
34#include <asm/pgtable.h>
35#include <asm/page.h>
36#include <asm/system.h>
37#include <asm/uaccess.h>
38#include <asm/bootinfo.h>
39
40/*
41 * Called by kernel/ptrace.c when detaching..
42 *
43 * Make sure single step bits etc are not set.
44 */
45void ptrace_disable(struct task_struct *child)
46{
47 /* Nothing to do.. */
48}
49
50asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
51{
52 struct task_struct *child;
53 int ret;
54
55#if 0
56 printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
57 (int) request, (int) pid, (unsigned long) addr,
58 (unsigned long) data);
59#endif
60 lock_kernel();
61 ret = -EPERM;
62 if (request == PTRACE_TRACEME) {
63 /* are we already being traced? */
64 if (current->ptrace & PT_PTRACED)
65 goto out;
66 if ((ret = security_ptrace(current->parent, current)))
67 goto out;
68 /* set the ptrace bit in the process flags. */
69 current->ptrace |= PT_PTRACED;
70 ret = 0;
71 goto out;
72 }
73 ret = -ESRCH;
74 read_lock(&tasklist_lock);
75 child = find_task_by_pid(pid);
76 if (child)
77 get_task_struct(child);
78 read_unlock(&tasklist_lock);
79 if (!child)
80 goto out;
81
82 ret = -EPERM;
83 if (pid == 1) /* you may not mess with init */
84 goto out_tsk;
85
86 if (request == PTRACE_ATTACH) {
87 ret = ptrace_attach(child);
88 goto out_tsk;
89 }
90
91 ret = ptrace_check_attach(child, request == PTRACE_KILL);
92 if (ret < 0)
93 goto out_tsk;
94
95 switch (request) {
96 /* when I and D space are separate, these will need to be fixed. */
97 case PTRACE_PEEKTEXT: /* read word at location addr. */
98 case PTRACE_PEEKDATA: {
99 unsigned long tmp;
100 int copied;
101
102 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
103 ret = -EIO;
104 if (copied != sizeof(tmp))
105 break;
106 ret = put_user(tmp,(unsigned long *) data);
107 break;
108 }
109
110 /* Read the word at location addr in the USER area. */
111 case PTRACE_PEEKUSR: {
112 struct pt_regs *regs;
113 unsigned long tmp = 0;
114
115 regs = (struct pt_regs *) ((unsigned long) child->thread_info +
116 THREAD_SIZE - 32 - sizeof(struct pt_regs));
117 ret = 0; /* Default return value. */
118
119 switch (addr) {
120 case 0 ... 31:
121 tmp = regs->regs[addr];
122 break;
123 case FPR_BASE ... FPR_BASE + 31:
124 if (tsk_used_math(child)) {
125 fpureg_t *fregs = get_fpu_regs(child);
126
127#ifdef CONFIG_MIPS32
128 /*
129 * The odd registers are actually the high
130 * order bits of the values stored in the even
131 * registers - unless we're using r2k_switch.S.
132 */
133 if (addr & 1)
134 tmp = (unsigned long) (fregs[((addr & ~1) - 32)] >> 32);
135 else
136 tmp = (unsigned long) (fregs[(addr - 32)] & 0xffffffff);
137#endif
138#ifdef CONFIG_MIPS64
139 tmp = fregs[addr - FPR_BASE];
140#endif
141 } else {
142 tmp = -1; /* FP not yet used */
143 }
144 break;
145 case PC:
146 tmp = regs->cp0_epc;
147 break;
148 case CAUSE:
149 tmp = regs->cp0_cause;
150 break;
151 case BADVADDR:
152 tmp = regs->cp0_badvaddr;
153 break;
154 case MMHI:
155 tmp = regs->hi;
156 break;
157 case MMLO:
158 tmp = regs->lo;
159 break;
160 case FPC_CSR:
161 if (cpu_has_fpu)
162 tmp = child->thread.fpu.hard.fcr31;
163 else
164 tmp = child->thread.fpu.soft.fcr31;
165 break;
166 case FPC_EIR: { /* implementation / version register */
167 unsigned int flags;
168
169 if (!cpu_has_fpu)
170 break;
171
172 flags = read_c0_status();
173 __enable_fpu();
174 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
175 write_c0_status(flags);
176 break;
177 }
178 default:
179 tmp = 0;
180 ret = -EIO;
181 goto out_tsk;
182 }
183 ret = put_user(tmp, (unsigned long *) data);
184 break;
185 }
186
187 /* when I and D space are separate, this will have to be fixed. */
188 case PTRACE_POKETEXT: /* write the word at location addr. */
189 case PTRACE_POKEDATA:
190 ret = 0;
191 if (access_process_vm(child, addr, &data, sizeof(data), 1)
192 == sizeof(data))
193 break;
194 ret = -EIO;
195 break;
196
197 case PTRACE_POKEUSR: {
198 struct pt_regs *regs;
199 ret = 0;
200 regs = (struct pt_regs *) ((unsigned long) child->thread_info +
201 THREAD_SIZE - 32 - sizeof(struct pt_regs));
202
203 switch (addr) {
204 case 0 ... 31:
205 regs->regs[addr] = data;
206 break;
207 case FPR_BASE ... FPR_BASE + 31: {
208 fpureg_t *fregs = get_fpu_regs(child);
209
210 if (!tsk_used_math(child)) {
211 /* FP not yet used */
212 memset(&child->thread.fpu.hard, ~0,
213 sizeof(child->thread.fpu.hard));
214 child->thread.fpu.hard.fcr31 = 0;
215 }
216#ifdef CONFIG_MIPS32
217 /*
218 * The odd registers are actually the high order bits
219 * of the values stored in the even registers - unless
220 * we're using r2k_switch.S.
221 */
222 if (addr & 1) {
223 fregs[(addr & ~1) - FPR_BASE] &= 0xffffffff;
224 fregs[(addr & ~1) - FPR_BASE] |= ((unsigned long long) data) << 32;
225 } else {
226 fregs[addr - FPR_BASE] &= ~0xffffffffLL;
227 fregs[addr - FPR_BASE] |= data;
228 }
229#endif
230#ifdef CONFIG_MIPS64
231 fregs[addr - FPR_BASE] = data;
232#endif
233 break;
234 }
235 case PC:
236 regs->cp0_epc = data;
237 break;
238 case MMHI:
239 regs->hi = data;
240 break;
241 case MMLO:
242 regs->lo = data;
243 break;
244 case FPC_CSR:
245 if (cpu_has_fpu)
246 child->thread.fpu.hard.fcr31 = data;
247 else
248 child->thread.fpu.soft.fcr31 = data;
249 break;
250 default:
251 /* The rest are not allowed. */
252 ret = -EIO;
253 break;
254 }
255 break;
256 }
257
258 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
259 case PTRACE_CONT: { /* restart after signal. */
260 ret = -EIO;
261 if ((unsigned long) data > _NSIG)
262 break;
263 if (request == PTRACE_SYSCALL) {
264 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
265 }
266 else {
267 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
268 }
269 child->exit_code = data;
270 wake_up_process(child);
271 ret = 0;
272 break;
273 }
274
275 /*
276 * make the child exit. Best I can do is send it a sigkill.
277 * perhaps it should be put in the status that it wants to
278 * exit.
279 */
280 case PTRACE_KILL:
281 ret = 0;
282 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
283 break;
284 child->exit_code = SIGKILL;
285 wake_up_process(child);
286 break;
287
288 case PTRACE_DETACH: /* detach a process that was attached. */
289 ret = ptrace_detach(child, data);
290 break;
291
292 default:
293 ret = ptrace_request(child, request, addr, data);
294 break;
295 }
296
297out_tsk:
298 put_task_struct(child);
299out:
300 unlock_kernel();
301 return ret;
302}
303
304/*
305 * Notification of system call entry/exit
306 * - triggered by current->work.syscall_trace
307 */
308asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
309{
310 if (unlikely(current->audit_context)) {
311 if (!entryexit)
312 audit_syscall_entry(current, regs->regs[2],
313 regs->regs[4], regs->regs[5],
314 regs->regs[6], regs->regs[7]);
315 else
316 audit_syscall_exit(current, regs->regs[2]);
317 }
318
319 if (!test_thread_flag(TIF_SYSCALL_TRACE))
320 return;
321 if (!(current->ptrace & PT_PTRACED))
322 return;
323
324 /* The 0x80 provides a way for the tracing parent to distinguish
325 between a syscall stop and SIGTRAP delivery */
326 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ?
327 0x80 : 0));
328
329 /*
330 * this isn't the same as continuing with a signal, but it will do
331 * for normal use. strace only continues with a signal if the
332 * stopping signal is not SIGTRAP. -brl
333 */
334 if (current->exit_code) {
335 send_sig(current->exit_code, current, 1);
336 current->exit_code = 0;
337 }
338}
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
new file mode 100644
index 000000000000..611dee919d50
--- /dev/null
+++ b/arch/mips/kernel/ptrace32.c
@@ -0,0 +1,285 @@
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) 1992 Ross Biro
7 * Copyright (C) Linus Torvalds
8 * Copyright (C) 1994, 95, 96, 97, 98, 2000 Ralf Baechle
9 * Copyright (C) 1996 David S. Miller
10 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
11 * Copyright (C) 1999 MIPS Technologies, Inc.
12 * Copyright (C) 2000 Ulf Carlsson
13 *
14 * At this time Linux/MIPS64 only supports syscall tracing, even for 32-bit
15 * binaries.
16 */
17#include <linux/compiler.h>
18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/mm.h>
21#include <linux/errno.h>
22#include <linux/ptrace.h>
23#include <linux/smp.h>
24#include <linux/smp_lock.h>
25#include <linux/user.h>
26#include <linux/security.h>
27
28#include <asm/cpu.h>
29#include <asm/fpu.h>
30#include <asm/mipsregs.h>
31#include <asm/pgtable.h>
32#include <asm/page.h>
33#include <asm/system.h>
34#include <asm/uaccess.h>
35#include <asm/bootinfo.h>
36
37/*
38 * Tracing a 32-bit process with a 64-bit strace and vice versa will not
39 * work. I don't know how to fix this.
40 */
41asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
42{
43 struct task_struct *child;
44 int ret;
45
46#if 0
47 printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
48 (int) request, (int) pid, (unsigned long) addr,
49 (unsigned long) data);
50#endif
51 lock_kernel();
52 ret = -EPERM;
53 if (request == PTRACE_TRACEME) {
54 /* are we already being traced? */
55 if (current->ptrace & PT_PTRACED)
56 goto out;
57 if ((ret = security_ptrace(current->parent, current)))
58 goto out;
59 /* set the ptrace bit in the process flags. */
60 current->ptrace |= PT_PTRACED;
61 ret = 0;
62 goto out;
63 }
64 ret = -ESRCH;
65 read_lock(&tasklist_lock);
66 child = find_task_by_pid(pid);
67 if (child)
68 get_task_struct(child);
69 read_unlock(&tasklist_lock);
70 if (!child)
71 goto out;
72
73 ret = -EPERM;
74 if (pid == 1) /* you may not mess with init */
75 goto out_tsk;
76
77 if (request == PTRACE_ATTACH) {
78 ret = ptrace_attach(child);
79 goto out_tsk;
80 }
81
82 ret = ptrace_check_attach(child, request == PTRACE_KILL);
83 if (ret < 0)
84 goto out_tsk;
85
86 switch (request) {
87 /* when I and D space are separate, these will need to be fixed. */
88 case PTRACE_PEEKTEXT: /* read word at location addr. */
89 case PTRACE_PEEKDATA: {
90 unsigned int tmp;
91 int copied;
92
93 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
94 ret = -EIO;
95 if (copied != sizeof(tmp))
96 break;
97 ret = put_user(tmp, (unsigned int *) (unsigned long) data);
98 break;
99 }
100
101 /* Read the word at location addr in the USER area. */
102 case PTRACE_PEEKUSR: {
103 struct pt_regs *regs;
104 unsigned int tmp;
105
106 regs = (struct pt_regs *) ((unsigned long) child->thread_info +
107 THREAD_SIZE - 32 - sizeof(struct pt_regs));
108 ret = 0; /* Default return value. */
109
110 switch (addr) {
111 case 0 ... 31:
112 tmp = regs->regs[addr];
113 break;
114 case FPR_BASE ... FPR_BASE + 31:
115 if (tsk_used_math(child)) {
116 fpureg_t *fregs = get_fpu_regs(child);
117
118 /*
119 * The odd registers are actually the high
120 * order bits of the values stored in the even
121 * registers - unless we're using r2k_switch.S.
122 */
123 if (addr & 1)
124 tmp = (unsigned long) (fregs[((addr & ~1) - 32)] >> 32);
125 else
126 tmp = (unsigned long) (fregs[(addr - 32)] & 0xffffffff);
127 } else {
128 tmp = -1; /* FP not yet used */
129 }
130 break;
131 case PC:
132 tmp = regs->cp0_epc;
133 break;
134 case CAUSE:
135 tmp = regs->cp0_cause;
136 break;
137 case BADVADDR:
138 tmp = regs->cp0_badvaddr;
139 break;
140 case MMHI:
141 tmp = regs->hi;
142 break;
143 case MMLO:
144 tmp = regs->lo;
145 break;
146 case FPC_CSR:
147 if (cpu_has_fpu)
148 tmp = child->thread.fpu.hard.fcr31;
149 else
150 tmp = child->thread.fpu.soft.fcr31;
151 break;
152 case FPC_EIR: { /* implementation / version register */
153 unsigned int flags;
154
155 if (!cpu_has_fpu)
156 break;
157
158 flags = read_c0_status();
159 __enable_fpu();
160 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
161 write_c0_status(flags);
162 break;
163 }
164 default:
165 tmp = 0;
166 ret = -EIO;
167 goto out_tsk;
168 }
169 ret = put_user(tmp, (unsigned *) (unsigned long) data);
170 break;
171 }
172
173 /* when I and D space are separate, this will have to be fixed. */
174 case PTRACE_POKETEXT: /* write the word at location addr. */
175 case PTRACE_POKEDATA:
176 ret = 0;
177 if (access_process_vm(child, addr, &data, sizeof(data), 1)
178 == sizeof(data))
179 break;
180 ret = -EIO;
181 break;
182
183 case PTRACE_POKEUSR: {
184 struct pt_regs *regs;
185 ret = 0;
186 regs = (struct pt_regs *) ((unsigned long) child->thread_info +
187 THREAD_SIZE - 32 - sizeof(struct pt_regs));
188
189 switch (addr) {
190 case 0 ... 31:
191 regs->regs[addr] = data;
192 break;
193 case FPR_BASE ... FPR_BASE + 31: {
194 fpureg_t *fregs = get_fpu_regs(child);
195
196 if (!tsk_used_math(child)) {
197 /* FP not yet used */
198 memset(&child->thread.fpu.hard, ~0,
199 sizeof(child->thread.fpu.hard));
200 child->thread.fpu.hard.fcr31 = 0;
201 }
202 /*
203 * The odd registers are actually the high order bits
204 * of the values stored in the even registers - unless
205 * we're using r2k_switch.S.
206 */
207 if (addr & 1) {
208 fregs[(addr & ~1) - FPR_BASE] &= 0xffffffff;
209 fregs[(addr & ~1) - FPR_BASE] |= ((unsigned long long) data) << 32;
210 } else {
211 fregs[addr - FPR_BASE] &= ~0xffffffffLL;
212 /* Must cast, lest sign extension fill upper
213 bits! */
214 fregs[addr - FPR_BASE] |= (unsigned int)data;
215 }
216 break;
217 }
218 case PC:
219 regs->cp0_epc = data;
220 break;
221 case MMHI:
222 regs->hi = data;
223 break;
224 case MMLO:
225 regs->lo = data;
226 break;
227 case FPC_CSR:
228 if (cpu_has_fpu)
229 child->thread.fpu.hard.fcr31 = data;
230 else
231 child->thread.fpu.soft.fcr31 = data;
232 break;
233 default:
234 /* The rest are not allowed. */
235 ret = -EIO;
236 break;
237 }
238 break;
239 }
240
241 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
242 case PTRACE_CONT: { /* restart after signal. */
243 ret = -EIO;
244 if ((unsigned int) data > _NSIG)
245 break;
246 if (request == PTRACE_SYSCALL) {
247 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
248 }
249 else {
250 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
251 }
252 child->exit_code = data;
253 wake_up_process(child);
254 ret = 0;
255 break;
256 }
257
258 /*
259 * make the child exit. Best I can do is send it a sigkill.
260 * perhaps it should be put in the status that it wants to
261 * exit.
262 */
263 case PTRACE_KILL:
264 ret = 0;
265 if (child->exit_state == EXIT_ZOMBIE) /* already dead */
266 break;
267 child->exit_code = SIGKILL;
268 wake_up_process(child);
269 break;
270
271 case PTRACE_DETACH: /* detach a process that was attached. */
272 ret = ptrace_detach(child, data);
273 break;
274
275 default:
276 ret = ptrace_request(child, request, addr, data);
277 break;
278 }
279
280out_tsk:
281 put_task_struct(child);
282out:
283 unlock_kernel();
284 return ret;
285}
diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S
new file mode 100644
index 000000000000..f83c31f720c4
--- /dev/null
+++ b/arch/mips/kernel/r2300_fpu.S
@@ -0,0 +1,126 @@
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) 1996, 1998 by Ralf Baechle
7 *
8 * Multi-arch abstraction and asm macros for easier reading:
9 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
10 *
11 * Further modifications to make this work:
12 * Copyright (c) 1998 Harald Koerfgen
13 */
14#include <asm/asm.h>
15#include <asm/errno.h>
16#include <asm/fpregdef.h>
17#include <asm/mipsregs.h>
18#include <asm/offset.h>
19#include <asm/regdef.h>
20
21#define EX(a,b) \
229: a,##b; \
23 .section __ex_table,"a"; \
24 PTR 9b,bad_stack; \
25 .previous
26
27 .set noreorder
28 .set mips1
29 /* Save floating point context */
30LEAF(_save_fp_context)
31 li v0, 0 # assume success
32 cfc1 t1,fcr31
33 EX(swc1 $f0,(SC_FPREGS+0)(a0))
34 EX(swc1 $f1,(SC_FPREGS+8)(a0))
35 EX(swc1 $f2,(SC_FPREGS+16)(a0))
36 EX(swc1 $f3,(SC_FPREGS+24)(a0))
37 EX(swc1 $f4,(SC_FPREGS+32)(a0))
38 EX(swc1 $f5,(SC_FPREGS+40)(a0))
39 EX(swc1 $f6,(SC_FPREGS+48)(a0))
40 EX(swc1 $f7,(SC_FPREGS+56)(a0))
41 EX(swc1 $f8,(SC_FPREGS+64)(a0))
42 EX(swc1 $f9,(SC_FPREGS+72)(a0))
43 EX(swc1 $f10,(SC_FPREGS+80)(a0))
44 EX(swc1 $f11,(SC_FPREGS+88)(a0))
45 EX(swc1 $f12,(SC_FPREGS+96)(a0))
46 EX(swc1 $f13,(SC_FPREGS+104)(a0))
47 EX(swc1 $f14,(SC_FPREGS+112)(a0))
48 EX(swc1 $f15,(SC_FPREGS+120)(a0))
49 EX(swc1 $f16,(SC_FPREGS+128)(a0))
50 EX(swc1 $f17,(SC_FPREGS+136)(a0))
51 EX(swc1 $f18,(SC_FPREGS+144)(a0))
52 EX(swc1 $f19,(SC_FPREGS+152)(a0))
53 EX(swc1 $f20,(SC_FPREGS+160)(a0))
54 EX(swc1 $f21,(SC_FPREGS+168)(a0))
55 EX(swc1 $f22,(SC_FPREGS+176)(a0))
56 EX(swc1 $f23,(SC_FPREGS+184)(a0))
57 EX(swc1 $f24,(SC_FPREGS+192)(a0))
58 EX(swc1 $f25,(SC_FPREGS+200)(a0))
59 EX(swc1 $f26,(SC_FPREGS+208)(a0))
60 EX(swc1 $f27,(SC_FPREGS+216)(a0))
61 EX(swc1 $f28,(SC_FPREGS+224)(a0))
62 EX(swc1 $f29,(SC_FPREGS+232)(a0))
63 EX(swc1 $f30,(SC_FPREGS+240)(a0))
64 EX(swc1 $f31,(SC_FPREGS+248)(a0))
65 EX(sw t1,(SC_FPC_CSR)(a0))
66 cfc1 t0,$0 # implementation/version
67 jr ra
68 .set nomacro
69 EX(sw t0,(SC_FPC_EIR)(a0))
70 .set macro
71 END(_save_fp_context)
72
73/*
74 * Restore FPU state:
75 * - fp gp registers
76 * - cp1 status/control register
77 *
78 * We base the decision which registers to restore from the signal stack
79 * frame on the current content of c0_status, not on the content of the
80 * stack frame which might have been changed by the user.
81 */
82LEAF(_restore_fp_context)
83 li v0, 0 # assume success
84 EX(lw t0,(SC_FPC_CSR)(a0))
85 EX(lwc1 $f0,(SC_FPREGS+0)(a0))
86 EX(lwc1 $f1,(SC_FPREGS+8)(a0))
87 EX(lwc1 $f2,(SC_FPREGS+16)(a0))
88 EX(lwc1 $f3,(SC_FPREGS+24)(a0))
89 EX(lwc1 $f4,(SC_FPREGS+32)(a0))
90 EX(lwc1 $f5,(SC_FPREGS+40)(a0))
91 EX(lwc1 $f6,(SC_FPREGS+48)(a0))
92 EX(lwc1 $f7,(SC_FPREGS+56)(a0))
93 EX(lwc1 $f8,(SC_FPREGS+64)(a0))
94 EX(lwc1 $f9,(SC_FPREGS+72)(a0))
95 EX(lwc1 $f10,(SC_FPREGS+80)(a0))
96 EX(lwc1 $f11,(SC_FPREGS+88)(a0))
97 EX(lwc1 $f12,(SC_FPREGS+96)(a0))
98 EX(lwc1 $f13,(SC_FPREGS+104)(a0))
99 EX(lwc1 $f14,(SC_FPREGS+112)(a0))
100 EX(lwc1 $f15,(SC_FPREGS+120)(a0))
101 EX(lwc1 $f16,(SC_FPREGS+128)(a0))
102 EX(lwc1 $f17,(SC_FPREGS+136)(a0))
103 EX(lwc1 $f18,(SC_FPREGS+144)(a0))
104 EX(lwc1 $f19,(SC_FPREGS+152)(a0))
105 EX(lwc1 $f20,(SC_FPREGS+160)(a0))
106 EX(lwc1 $f21,(SC_FPREGS+168)(a0))
107 EX(lwc1 $f22,(SC_FPREGS+176)(a0))
108 EX(lwc1 $f23,(SC_FPREGS+184)(a0))
109 EX(lwc1 $f24,(SC_FPREGS+192)(a0))
110 EX(lwc1 $f25,(SC_FPREGS+200)(a0))
111 EX(lwc1 $f26,(SC_FPREGS+208)(a0))
112 EX(lwc1 $f27,(SC_FPREGS+216)(a0))
113 EX(lwc1 $f28,(SC_FPREGS+224)(a0))
114 EX(lwc1 $f29,(SC_FPREGS+232)(a0))
115 EX(lwc1 $f30,(SC_FPREGS+240)(a0))
116 EX(lwc1 $f31,(SC_FPREGS+248)(a0))
117 jr ra
118 ctc1 t0,fcr31
119 END(_restore_fp_context)
120 .set reorder
121
122 .type fault@function
123 .ent fault
124fault: li v0, -EFAULT
125 jr ra
126 .end fault
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
new file mode 100644
index 000000000000..243e7b629af6
--- /dev/null
+++ b/arch/mips/kernel/r2300_switch.S
@@ -0,0 +1,174 @@
1/*
2 * r2300_switch.S: R2300 specific task switching code.
3 *
4 * Copyright (C) 1994, 1995, 1996, 1999 by Ralf Baechle
5 * Copyright (C) 1994, 1995, 1996 by Andreas Busse
6 *
7 * Multi-cpu abstraction and macros for easier reading:
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 *
10 * Further modifications to make this work:
11 * Copyright (c) 1998-2000 Harald Koerfgen
12 */
13#include <linux/config.h>
14#include <asm/asm.h>
15#include <asm/cachectl.h>
16#include <asm/fpregdef.h>
17#include <asm/mipsregs.h>
18#include <asm/offset.h>
19#include <asm/page.h>
20#include <asm/regdef.h>
21#include <asm/stackframe.h>
22#include <asm/thread_info.h>
23
24#include <asm/asmmacro.h>
25
26 .set mips1
27 .align 5
28
29/*
30 * Offset to the current process status flags, the first 32 bytes of the
31 * stack are not used.
32 */
33#define ST_OFF (_THREAD_SIZE - 32 - PT_SIZE + PT_STATUS)
34
35/*
36 * FPU context is saved iff the process has used it's FPU in the current
37 * time slice as indicated by TIF_USEDFPU. In any case, the CU1 bit for user
38 * space STATUS register should be 0, so that a process *always* starts its
39 * userland with FPU disabled after each context switch.
40 *
41 * FPU will be enabled as soon as the process accesses FPU again, through
42 * do_cpu() trap.
43 */
44
45/*
46 * task_struct *resume(task_struct *prev, task_struct *next,
47 * struct thread_info *next_ti) )
48 */
49LEAF(resume)
50#ifndef CONFIG_CPU_HAS_LLSC
51 sw zero, ll_bit
52#endif
53 mfc0 t1, CP0_STATUS
54 sw t1, THREAD_STATUS(a0)
55 cpu_save_nonscratch a0
56 sw ra, THREAD_REG31(a0)
57
58 /*
59 * check if we need to save FPU registers
60 */
61 lw t3, TASK_THREAD_INFO(a0)
62 lw t0, TI_FLAGS(t3)
63 li t1, _TIF_USEDFPU
64 and t2, t0, t1
65 beqz t2, 1f
66 nor t1, zero, t1
67
68 and t0, t0, t1
69 sw t0, TI_FLAGS(t3)
70
71 /*
72 * clear saved user stack CU1 bit
73 */
74 lw t0, ST_OFF(t3)
75 li t1, ~ST0_CU1
76 and t0, t0, t1
77 sw t0, ST_OFF(t3)
78
79 fpu_save_single a0, t0 # clobbers t0
80
811:
82 /*
83 * The order of restoring the registers takes care of the race
84 * updating $28, $29 and kernelsp without disabling ints.
85 */
86 move $28, a2
87 cpu_restore_nonscratch a1
88
89 addiu t1, $28, _THREAD_SIZE - 32
90 sw t1, kernelsp
91
92 mfc0 t1, CP0_STATUS /* Do we really need this? */
93 li a3, 0xff01
94 and t1, a3
95 lw a2, THREAD_STATUS(a1)
96 nor a3, $0, a3
97 and a2, a3
98 or a2, t1
99 mtc0 a2, CP0_STATUS
100 move v0, a0
101 jr ra
102 END(resume)
103
104/*
105 * Save a thread's fp context.
106 */
107LEAF(_save_fp)
108 fpu_save_single a0, t1 # clobbers t1
109 jr ra
110 END(_save_fp)
111
112/*
113 * Restore a thread's fp context.
114 */
115LEAF(_restore_fp)
116 fpu_restore_single a0, t1 # clobbers t1
117 jr ra
118 END(_restore_fp)
119
120/*
121 * Load the FPU with signalling NANS. This bit pattern we're using has
122 * the property that no matter whether considered as single or as double
123 * precision represents signaling NANS.
124 *
125 * We initialize fcr31 to rounding to nearest, no exceptions.
126 */
127
128#define FPU_DEFAULT 0x00000000
129
130LEAF(_init_fpu)
131 mfc0 t0, CP0_STATUS
132 li t1, ST0_CU1
133 or t0, t1
134 mtc0 t0, CP0_STATUS
135
136 li t1, FPU_DEFAULT
137 ctc1 t1, fcr31
138
139 li t0, -1
140
141 mtc1 t0, $f0
142 mtc1 t0, $f1
143 mtc1 t0, $f2
144 mtc1 t0, $f3
145 mtc1 t0, $f4
146 mtc1 t0, $f5
147 mtc1 t0, $f6
148 mtc1 t0, $f7
149 mtc1 t0, $f8
150 mtc1 t0, $f9
151 mtc1 t0, $f10
152 mtc1 t0, $f11
153 mtc1 t0, $f12
154 mtc1 t0, $f13
155 mtc1 t0, $f14
156 mtc1 t0, $f15
157 mtc1 t0, $f16
158 mtc1 t0, $f17
159 mtc1 t0, $f18
160 mtc1 t0, $f19
161 mtc1 t0, $f20
162 mtc1 t0, $f21
163 mtc1 t0, $f22
164 mtc1 t0, $f23
165 mtc1 t0, $f24
166 mtc1 t0, $f25
167 mtc1 t0, $f26
168 mtc1 t0, $f27
169 mtc1 t0, $f28
170 mtc1 t0, $f29
171 mtc1 t0, $f30
172 mtc1 t0, $f31
173 jr ra
174 END(_init_fpu)
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
new file mode 100644
index 000000000000..ebb643d8d14c
--- /dev/null
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -0,0 +1,191 @@
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) 1996, 98, 99, 2000, 01 Ralf Baechle
7 *
8 * Multi-arch abstraction and asm macros for easier reading:
9 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
10 *
11 * Carsten Langgaard, carstenl@mips.com
12 * Copyright (C) 2000 MIPS Technologies, Inc.
13 * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
14 */
15#include <linux/config.h>
16#include <asm/asm.h>
17#include <asm/errno.h>
18#include <asm/fpregdef.h>
19#include <asm/mipsregs.h>
20#include <asm/offset.h>
21#include <asm/regdef.h>
22
23 .macro EX insn, reg, src
24 .set push
25 .set nomacro
26.ex\@: \insn \reg, \src
27 .set pop
28 .section __ex_table,"a"
29 PTR .ex\@, fault
30 .previous
31 .endm
32
33 .set noreorder
34 .set mips3
35 /* Save floating point context */
36LEAF(_save_fp_context)
37 cfc1 t1, fcr31
38
39#ifdef CONFIG_MIPS64
40 /* Store the 16 odd double precision registers */
41 EX sdc1 $f1, SC_FPREGS+8(a0)
42 EX sdc1 $f3, SC_FPREGS+24(a0)
43 EX sdc1 $f5, SC_FPREGS+40(a0)
44 EX sdc1 $f7, SC_FPREGS+56(a0)
45 EX sdc1 $f9, SC_FPREGS+72(a0)
46 EX sdc1 $f11, SC_FPREGS+88(a0)
47 EX sdc1 $f13, SC_FPREGS+104(a0)
48 EX sdc1 $f15, SC_FPREGS+120(a0)
49 EX sdc1 $f17, SC_FPREGS+136(a0)
50 EX sdc1 $f19, SC_FPREGS+152(a0)
51 EX sdc1 $f21, SC_FPREGS+168(a0)
52 EX sdc1 $f23, SC_FPREGS+184(a0)
53 EX sdc1 $f25, SC_FPREGS+200(a0)
54 EX sdc1 $f27, SC_FPREGS+216(a0)
55 EX sdc1 $f29, SC_FPREGS+232(a0)
56 EX sdc1 $f31, SC_FPREGS+248(a0)
57#endif
58
59 /* Store the 16 even double precision registers */
60 EX sdc1 $f0, SC_FPREGS+0(a0)
61 EX sdc1 $f2, SC_FPREGS+16(a0)
62 EX sdc1 $f4, SC_FPREGS+32(a0)
63 EX sdc1 $f6, SC_FPREGS+48(a0)
64 EX sdc1 $f8, SC_FPREGS+64(a0)
65 EX sdc1 $f10, SC_FPREGS+80(a0)
66 EX sdc1 $f12, SC_FPREGS+96(a0)
67 EX sdc1 $f14, SC_FPREGS+112(a0)
68 EX sdc1 $f16, SC_FPREGS+128(a0)
69 EX sdc1 $f18, SC_FPREGS+144(a0)
70 EX sdc1 $f20, SC_FPREGS+160(a0)
71 EX sdc1 $f22, SC_FPREGS+176(a0)
72 EX sdc1 $f24, SC_FPREGS+192(a0)
73 EX sdc1 $f26, SC_FPREGS+208(a0)
74 EX sdc1 $f28, SC_FPREGS+224(a0)
75 EX sdc1 $f30, SC_FPREGS+240(a0)
76 EX sw t1, SC_FPC_CSR(a0)
77 cfc1 t0, $0 # implementation/version
78 EX sw t0, SC_FPC_EIR(a0)
79
80 jr ra
81 li v0, 0 # success
82 END(_save_fp_context)
83
84#ifdef CONFIG_MIPS32_COMPAT
85 /* Save 32-bit process floating point context */
86LEAF(_save_fp_context32)
87 cfc1 t1, fcr31
88
89 EX sdc1 $f0, SC32_FPREGS+0(a0)
90 EX sdc1 $f2, SC32_FPREGS+16(a0)
91 EX sdc1 $f4, SC32_FPREGS+32(a0)
92 EX sdc1 $f6, SC32_FPREGS+48(a0)
93 EX sdc1 $f8, SC32_FPREGS+64(a0)
94 EX sdc1 $f10, SC32_FPREGS+80(a0)
95 EX sdc1 $f12, SC32_FPREGS+96(a0)
96 EX sdc1 $f14, SC32_FPREGS+112(a0)
97 EX sdc1 $f16, SC32_FPREGS+128(a0)
98 EX sdc1 $f18, SC32_FPREGS+144(a0)
99 EX sdc1 $f20, SC32_FPREGS+160(a0)
100 EX sdc1 $f22, SC32_FPREGS+176(a0)
101 EX sdc1 $f24, SC32_FPREGS+192(a0)
102 EX sdc1 $f26, SC32_FPREGS+208(a0)
103 EX sdc1 $f28, SC32_FPREGS+224(a0)
104 EX sdc1 $f30, SC32_FPREGS+240(a0)
105 EX sw t1, SC32_FPC_CSR(a0)
106 cfc1 t0, $0 # implementation/version
107 EX sw t0, SC32_FPC_EIR(a0)
108
109 jr ra
110 li v0, 0 # success
111 END(_save_fp_context32)
112#endif
113
114/*
115 * Restore FPU state:
116 * - fp gp registers
117 * - cp1 status/control register
118 */
119LEAF(_restore_fp_context)
120 EX lw t0, SC_FPC_CSR(a0)
121#ifdef CONFIG_MIPS64
122 EX ldc1 $f1, SC_FPREGS+8(a0)
123 EX ldc1 $f3, SC_FPREGS+24(a0)
124 EX ldc1 $f5, SC_FPREGS+40(a0)
125 EX ldc1 $f7, SC_FPREGS+56(a0)
126 EX ldc1 $f9, SC_FPREGS+72(a0)
127 EX ldc1 $f11, SC_FPREGS+88(a0)
128 EX ldc1 $f13, SC_FPREGS+104(a0)
129 EX ldc1 $f15, SC_FPREGS+120(a0)
130 EX ldc1 $f17, SC_FPREGS+136(a0)
131 EX ldc1 $f19, SC_FPREGS+152(a0)
132 EX ldc1 $f21, SC_FPREGS+168(a0)
133 EX ldc1 $f23, SC_FPREGS+184(a0)
134 EX ldc1 $f25, SC_FPREGS+200(a0)
135 EX ldc1 $f27, SC_FPREGS+216(a0)
136 EX ldc1 $f29, SC_FPREGS+232(a0)
137 EX ldc1 $f31, SC_FPREGS+248(a0)
138#endif
139 EX ldc1 $f0, SC_FPREGS+0(a0)
140 EX ldc1 $f2, SC_FPREGS+16(a0)
141 EX ldc1 $f4, SC_FPREGS+32(a0)
142 EX ldc1 $f6, SC_FPREGS+48(a0)
143 EX ldc1 $f8, SC_FPREGS+64(a0)
144 EX ldc1 $f10, SC_FPREGS+80(a0)
145 EX ldc1 $f12, SC_FPREGS+96(a0)
146 EX ldc1 $f14, SC_FPREGS+112(a0)
147 EX ldc1 $f16, SC_FPREGS+128(a0)
148 EX ldc1 $f18, SC_FPREGS+144(a0)
149 EX ldc1 $f20, SC_FPREGS+160(a0)
150 EX ldc1 $f22, SC_FPREGS+176(a0)
151 EX ldc1 $f24, SC_FPREGS+192(a0)
152 EX ldc1 $f26, SC_FPREGS+208(a0)
153 EX ldc1 $f28, SC_FPREGS+224(a0)
154 EX ldc1 $f30, SC_FPREGS+240(a0)
155 ctc1 t0, fcr31
156 jr ra
157 li v0, 0 # success
158 END(_restore_fp_context)
159
160#ifdef CONFIG_MIPS32_COMPAT
161LEAF(_restore_fp_context32)
162 /* Restore an o32 sigcontext. */
163 EX lw t0, SC32_FPC_CSR(a0)
164 EX ldc1 $f0, SC32_FPREGS+0(a0)
165 EX ldc1 $f2, SC32_FPREGS+16(a0)
166 EX ldc1 $f4, SC32_FPREGS+32(a0)
167 EX ldc1 $f6, SC32_FPREGS+48(a0)
168 EX ldc1 $f8, SC32_FPREGS+64(a0)
169 EX ldc1 $f10, SC32_FPREGS+80(a0)
170 EX ldc1 $f12, SC32_FPREGS+96(a0)
171 EX ldc1 $f14, SC32_FPREGS+112(a0)
172 EX ldc1 $f16, SC32_FPREGS+128(a0)
173 EX ldc1 $f18, SC32_FPREGS+144(a0)
174 EX ldc1 $f20, SC32_FPREGS+160(a0)
175 EX ldc1 $f22, SC32_FPREGS+176(a0)
176 EX ldc1 $f24, SC32_FPREGS+192(a0)
177 EX ldc1 $f26, SC32_FPREGS+208(a0)
178 EX ldc1 $f28, SC32_FPREGS+224(a0)
179 EX ldc1 $f30, SC32_FPREGS+240(a0)
180 ctc1 t0, fcr31
181 jr ra
182 li v0, 0 # success
183 END(_restore_fp_context32)
184 .set reorder
185#endif
186
187 .type fault@function
188 .ent fault
189fault: li v0, -EFAULT # failure
190 jr ra
191 .end fault
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
new file mode 100644
index 000000000000..1fc3b2eb12bd
--- /dev/null
+++ b/arch/mips/kernel/r4k_switch.S
@@ -0,0 +1,221 @@
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) 1994, 1995, 1996, 1998, 1999, 2002, 2003 Ralf Baechle
7 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
8 * Copyright (C) 1994, 1995, 1996, by Andreas Busse
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 * Copyright (C) 2000 MIPS Technologies, Inc.
11 * written by Carsten Langgaard, carstenl@mips.com
12 */
13#include <linux/config.h>
14#include <asm/asm.h>
15#include <asm/cachectl.h>
16#include <asm/fpregdef.h>
17#include <asm/mipsregs.h>
18#include <asm/offset.h>
19#include <asm/page.h>
20#include <asm/pgtable-bits.h>
21#include <asm/regdef.h>
22#include <asm/stackframe.h>
23#include <asm/thread_info.h>
24
25#include <asm/asmmacro.h>
26
27/*
28 * Offset to the current process status flags, the first 32 bytes of the
29 * stack are not used.
30 */
31#define ST_OFF (_THREAD_SIZE - 32 - PT_SIZE + PT_STATUS)
32
33/*
34 * FPU context is saved iff the process has used it's FPU in the current
35 * time slice as indicated by _TIF_USEDFPU. In any case, the CU1 bit for user
36 * space STATUS register should be 0, so that a process *always* starts its
37 * userland with FPU disabled after each context switch.
38 *
39 * FPU will be enabled as soon as the process accesses FPU again, through
40 * do_cpu() trap.
41 */
42
43/*
44 * task_struct *resume(task_struct *prev, task_struct *next,
45 * struct thread_info *next_ti)
46 */
47 .align 5
48 LEAF(resume)
49#ifndef CONFIG_CPU_HAS_LLSC
50 sw zero, ll_bit
51#endif
52 mfc0 t1, CP0_STATUS
53 LONG_S t1, THREAD_STATUS(a0)
54 cpu_save_nonscratch a0
55 LONG_S ra, THREAD_REG31(a0)
56
57 /*
58 * check if we need to save FPU registers
59 */
60 PTR_L t3, TASK_THREAD_INFO(a0)
61 LONG_L t0, TI_FLAGS(t3)
62 li t1, _TIF_USEDFPU
63 and t2, t0, t1
64 beqz t2, 1f
65 nor t1, zero, t1
66
67 and t0, t0, t1
68 LONG_S t0, TI_FLAGS(t3)
69
70 /*
71 * clear saved user stack CU1 bit
72 */
73 LONG_L t0, ST_OFF(t3)
74 li t1, ~ST0_CU1
75 and t0, t0, t1
76 LONG_S t0, ST_OFF(t3)
77
78 fpu_save_double a0 t1 t0 t2 # c0_status passed in t1
79 # clobbers t0 and t2
801:
81
82 /*
83 * The order of restoring the registers takes care of the race
84 * updating $28, $29 and kernelsp without disabling ints.
85 */
86 move $28, a2
87 cpu_restore_nonscratch a1
88
89 PTR_ADDIU t0, $28, _THREAD_SIZE - 32
90 set_saved_sp t0, t1, t2
91
92 mfc0 t1, CP0_STATUS /* Do we really need this? */
93 li a3, 0xff01
94 and t1, a3
95 LONG_L a2, THREAD_STATUS(a1)
96 nor a3, $0, a3
97 and a2, a3
98 or a2, t1
99 mtc0 a2, CP0_STATUS
100 move v0, a0
101 jr ra
102 END(resume)
103
104/*
105 * Save a thread's fp context.
106 */
107LEAF(_save_fp)
108#ifdef CONFIG_MIPS64
109 mfc0 t1, CP0_STATUS
110#endif
111 fpu_save_double a0 t1 t0 t2 # clobbers t1
112 jr ra
113 END(_save_fp)
114
115/*
116 * Restore a thread's fp context.
117 */
118LEAF(_restore_fp)
119 fpu_restore_double a0, t1 # clobbers t1
120 jr ra
121 END(_restore_fp)
122
123/*
124 * Load the FPU with signalling NANS. This bit pattern we're using has
125 * the property that no matter whether considered as single or as double
126 * precision represents signaling NANS.
127 *
128 * We initialize fcr31 to rounding to nearest, no exceptions.
129 */
130
131#define FPU_DEFAULT 0x00000000
132
133LEAF(_init_fpu)
134 mfc0 t0, CP0_STATUS
135 li t1, ST0_CU1
136 or t0, t1
137 mtc0 t0, CP0_STATUS
138 fpu_enable_hazard
139
140 li t1, FPU_DEFAULT
141 ctc1 t1, fcr31
142
143 li t1, -1 # SNaN
144
145#ifdef CONFIG_MIPS64
146 sll t0, t0, 5
147 bgez t0, 1f # 16 / 32 register mode?
148
149 dmtc1 t1, $f1
150 dmtc1 t1, $f3
151 dmtc1 t1, $f5
152 dmtc1 t1, $f7
153 dmtc1 t1, $f9
154 dmtc1 t1, $f11
155 dmtc1 t1, $f13
156 dmtc1 t1, $f15
157 dmtc1 t1, $f17
158 dmtc1 t1, $f19
159 dmtc1 t1, $f21
160 dmtc1 t1, $f23
161 dmtc1 t1, $f25
162 dmtc1 t1, $f27
163 dmtc1 t1, $f29
164 dmtc1 t1, $f31
1651:
166#endif
167
168#ifdef CONFIG_CPU_MIPS32
169 mtc1 t1, $f0
170 mtc1 t1, $f1
171 mtc1 t1, $f2
172 mtc1 t1, $f3
173 mtc1 t1, $f4
174 mtc1 t1, $f5
175 mtc1 t1, $f6
176 mtc1 t1, $f7
177 mtc1 t1, $f8
178 mtc1 t1, $f9
179 mtc1 t1, $f10
180 mtc1 t1, $f11
181 mtc1 t1, $f12
182 mtc1 t1, $f13
183 mtc1 t1, $f14
184 mtc1 t1, $f15
185 mtc1 t1, $f16
186 mtc1 t1, $f17
187 mtc1 t1, $f18
188 mtc1 t1, $f19
189 mtc1 t1, $f20
190 mtc1 t1, $f21
191 mtc1 t1, $f22
192 mtc1 t1, $f23
193 mtc1 t1, $f24
194 mtc1 t1, $f25
195 mtc1 t1, $f26
196 mtc1 t1, $f27
197 mtc1 t1, $f28
198 mtc1 t1, $f29
199 mtc1 t1, $f30
200 mtc1 t1, $f31
201#else
202 .set mips3
203 dmtc1 t1, $f0
204 dmtc1 t1, $f2
205 dmtc1 t1, $f4
206 dmtc1 t1, $f6
207 dmtc1 t1, $f8
208 dmtc1 t1, $f10
209 dmtc1 t1, $f12
210 dmtc1 t1, $f14
211 dmtc1 t1, $f16
212 dmtc1 t1, $f18
213 dmtc1 t1, $f20
214 dmtc1 t1, $f22
215 dmtc1 t1, $f24
216 dmtc1 t1, $f26
217 dmtc1 t1, $f28
218 dmtc1 t1, $f30
219#endif
220 jr ra
221 END(_init_fpu)
diff --git a/arch/mips/kernel/r6000_fpu.S b/arch/mips/kernel/r6000_fpu.S
new file mode 100644
index 000000000000..d8d3b13fe57f
--- /dev/null
+++ b/arch/mips/kernel/r6000_fpu.S
@@ -0,0 +1,87 @@
1/*
2 * r6000_fpu.S: Save/restore floating point context for signal handlers.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996 by Ralf Baechle
9 *
10 * Multi-arch abstraction and asm macros for easier reading:
11 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
12 */
13#include <asm/asm.h>
14#include <asm/fpregdef.h>
15#include <asm/mipsregs.h>
16#include <asm/offset.h>
17#include <asm/regdef.h>
18
19 .set noreorder
20 .set mips2
21 /* Save floating point context */
22 LEAF(_save_fp_context)
23 mfc0 t0,CP0_STATUS
24 sll t0,t0,2
25 bgez t0,1f
26 nop
27
28 cfc1 t1,fcr31
29 /* Store the 16 double precision registers */
30 sdc1 $f0,(SC_FPREGS+0)(a0)
31 sdc1 $f2,(SC_FPREGS+16)(a0)
32 sdc1 $f4,(SC_FPREGS+32)(a0)
33 sdc1 $f6,(SC_FPREGS+48)(a0)
34 sdc1 $f8,(SC_FPREGS+64)(a0)
35 sdc1 $f10,(SC_FPREGS+80)(a0)
36 sdc1 $f12,(SC_FPREGS+96)(a0)
37 sdc1 $f14,(SC_FPREGS+112)(a0)
38 sdc1 $f16,(SC_FPREGS+128)(a0)
39 sdc1 $f18,(SC_FPREGS+144)(a0)
40 sdc1 $f20,(SC_FPREGS+160)(a0)
41 sdc1 $f22,(SC_FPREGS+176)(a0)
42 sdc1 $f24,(SC_FPREGS+192)(a0)
43 sdc1 $f26,(SC_FPREGS+208)(a0)
44 sdc1 $f28,(SC_FPREGS+224)(a0)
45 sdc1 $f30,(SC_FPREGS+240)(a0)
46 jr ra
47 sw t0,SC_FPC_CSR(a0)
481: jr ra
49 nop
50 END(_save_fp_context)
51
52/* Restore FPU state:
53 * - fp gp registers
54 * - cp1 status/control register
55 *
56 * We base the decision which registers to restore from the signal stack
57 * frame on the current content of c0_status, not on the content of the
58 * stack frame which might have been changed by the user.
59 */
60 LEAF(_restore_fp_context)
61 mfc0 t0,CP0_STATUS
62 sll t0,t0,2
63
64 bgez t0,1f
65 lw t0,SC_FPC_CSR(a0)
66 /* Restore the 16 double precision registers */
67 ldc1 $f0,(SC_FPREGS+0)(a0)
68 ldc1 $f2,(SC_FPREGS+16)(a0)
69 ldc1 $f4,(SC_FPREGS+32)(a0)
70 ldc1 $f6,(SC_FPREGS+48)(a0)
71 ldc1 $f8,(SC_FPREGS+64)(a0)
72 ldc1 $f10,(SC_FPREGS+80)(a0)
73 ldc1 $f12,(SC_FPREGS+96)(a0)
74 ldc1 $f14,(SC_FPREGS+112)(a0)
75 ldc1 $f16,(SC_FPREGS+128)(a0)
76 ldc1 $f18,(SC_FPREGS+144)(a0)
77 ldc1 $f20,(SC_FPREGS+160)(a0)
78 ldc1 $f22,(SC_FPREGS+176)(a0)
79 ldc1 $f24,(SC_FPREGS+192)(a0)
80 ldc1 $f26,(SC_FPREGS+208)(a0)
81 ldc1 $f28,(SC_FPREGS+224)(a0)
82 ldc1 $f30,(SC_FPREGS+240)(a0)
83 jr ra
84 ctc1 t0,fcr31
851: jr ra
86 nop
87 END(_restore_fp_context)
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
new file mode 100644
index 000000000000..7e0a9821931a
--- /dev/null
+++ b/arch/mips/kernel/reset.c
@@ -0,0 +1,43 @@
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) 2001 by Ralf Baechle
7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 */
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/types.h>
12#include <linux/reboot.h>
13#include <asm/reboot.h>
14
15/*
16 * Urgs ... Too many MIPS machines to handle this in a generic way.
17 * So handle all using function pointers to machine specific
18 * functions.
19 */
20void (*_machine_restart)(char *command);
21void (*_machine_halt)(void);
22void (*_machine_power_off)(void);
23
24void machine_restart(char *command)
25{
26 _machine_restart(command);
27}
28
29EXPORT_SYMBOL(machine_restart);
30
31void machine_halt(void)
32{
33 _machine_halt();
34}
35
36EXPORT_SYMBOL(machine_halt);
37
38void machine_power_off(void)
39{
40 _machine_power_off();
41}
42
43EXPORT_SYMBOL(machine_power_off);
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
new file mode 100644
index 000000000000..344f2e29eb61
--- /dev/null
+++ b/arch/mips/kernel/scall32-o32.S
@@ -0,0 +1,641 @@
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) 1995, 96, 97, 98, 99, 2000, 01, 02 by Ralf Baechle
7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 * Copyright (C) 2004 Thiemo Seufer
9 */
10#include <linux/config.h>
11#include <linux/errno.h>
12#include <asm/asm.h>
13#include <asm/asmmacro.h>
14#include <asm/mipsregs.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17#include <asm/isadep.h>
18#include <asm/sysmips.h>
19#include <asm/thread_info.h>
20#include <asm/unistd.h>
21#include <asm/war.h>
22#include <asm/offset.h>
23
24/* Highest syscall used of any syscall flavour */
25#define MAX_SYSCALL_NO __NR_O32_Linux + __NR_O32_Linux_syscalls
26
27 .align 5
28NESTED(handle_sys, PT_SIZE, sp)
29 .set noat
30 SAVE_SOME
31 STI
32 .set at
33
34 lw t1, PT_EPC(sp) # skip syscall on return
35
36#if defined(CONFIG_BINFMT_IRIX)
37 sltiu t0, v0, MAX_SYSCALL_NO + 1 # check syscall number
38#else
39 subu v0, v0, __NR_O32_Linux # check syscall number
40 sltiu t0, v0, __NR_O32_Linux_syscalls + 1
41#endif
42 addiu t1, 4 # skip to next instruction
43 sw t1, PT_EPC(sp)
44 beqz t0, illegal_syscall
45
46 sll t0, v0, 3
47 la t1, sys_call_table
48 addu t1, t0
49 lw t2, (t1) # syscall routine
50 lw t3, 4(t1) # >= 0 if we need stack arguments
51 beqz t2, illegal_syscall
52
53 sw a3, PT_R26(sp) # save a3 for syscall restarting
54 bgez t3, stackargs
55
56stack_done:
57 lw t0, TI_FLAGS($28) # syscall tracing enabled?
58 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
59 and t0, t1
60 bnez t0, syscall_trace_entry # -> yes
61
62 jalr t2 # Do The Real Thing (TM)
63
64 li t0, -EMAXERRNO - 1 # error?
65 sltu t0, t0, v0
66 sw t0, PT_R7(sp) # set error flag
67 beqz t0, 1f
68
69 negu v0 # error
70 sw v0, PT_R0(sp) # set flag for syscall
71 # restarting
721: sw v0, PT_R2(sp) # result
73
74o32_syscall_exit:
75 local_irq_disable # make sure need_resched and
76 # signals dont change between
77 # sampling and return
78 lw a2, TI_FLAGS($28) # current->work
79 li t0, _TIF_ALLWORK_MASK
80 and t0, a2
81 bnez t0, o32_syscall_exit_work
82
83 j restore_partial
84
85o32_syscall_exit_work:
86 j syscall_exit_work_partial
87
88/* ------------------------------------------------------------------------ */
89
90syscall_trace_entry:
91 SAVE_STATIC
92 move s0, t2
93 move a0, sp
94 li a1, 0
95 jal do_syscall_trace
96
97 lw a0, PT_R4(sp) # Restore argument registers
98 lw a1, PT_R5(sp)
99 lw a2, PT_R6(sp)
100 lw a3, PT_R7(sp)
101 jalr s0
102
103 li t0, -EMAXERRNO - 1 # error?
104 sltu t0, t0, v0
105 sw t0, PT_R7(sp) # set error flag
106 beqz t0, 1f
107
108 negu v0 # error
109 sw v0, PT_R0(sp) # set flag for syscall
110 # restarting
1111: sw v0, PT_R2(sp) # result
112
113 j syscall_exit
114
115/* ------------------------------------------------------------------------ */
116
117 /*
118 * More than four arguments. Try to deal with it by copying the
119 * stack arguments from the user stack to the kernel stack.
120 * This Sucks (TM).
121 */
122stackargs:
123 lw t0, PT_R29(sp) # get old user stack pointer
124
125 /*
126 * We intentionally keep the kernel stack a little below the top of
127 * userspace so we don't have to do a slower byte accurate check here.
128 */
129 lw t5, TI_ADDR_LIMIT($28)
130 addu t4, t0, 32
131 and t5, t4
132 bltz t5, bad_stack # -> sp is bad
133
134 /* Ok, copy the args from the luser stack to the kernel stack.
135 * t3 is the precomputed number of instruction bytes needed to
136 * load or store arguments 6-8.
137 */
138
139 la t1, 5f # load up to 3 arguments
140 subu t1, t3
1411: lw t5, 16(t0) # argument #5 from usp
142 .set push
143 .set noreorder
144 .set nomacro
145 jr t1
146 addiu t1, 6f - 5f
147
1482: lw t8, 28(t0) # argument #8 from usp
1493: lw t7, 24(t0) # argument #7 from usp
1504: lw t6, 20(t0) # argument #6 from usp
1515: jr t1
152 sw t5, 16(sp) # argument #5 to ksp
153
154 sw t8, 28(sp) # argument #8 to ksp
155 sw t7, 24(sp) # argument #7 to ksp
156 sw t6, 20(sp) # argument #6 to ksp
1576: j stack_done # go back
158 nop
159 .set pop
160
161 .section __ex_table,"a"
162 PTR 1b,bad_stack
163 PTR 2b,bad_stack
164 PTR 3b,bad_stack
165 PTR 4b,bad_stack
166 .previous
167
168 /*
169 * The stackpointer for a call with more than 4 arguments is bad.
170 * We probably should handle this case a bit more drastic.
171 */
172bad_stack:
173 negu v0 # error
174 sw v0, PT_R0(sp)
175 sw v0, PT_R2(sp)
176 li t0, 1 # set error flag
177 sw t0, PT_R7(sp)
178 j o32_syscall_exit
179
180 /*
181 * The system call does not exist in this kernel
182 */
183illegal_syscall:
184 li v0, -ENOSYS # error
185 sw v0, PT_R2(sp)
186 li t0, 1 # set error flag
187 sw t0, PT_R7(sp)
188 j o32_syscall_exit
189 END(handle_sys)
190
191 LEAF(mips_atomic_set)
192 andi v0, a1, 3 # must be word aligned
193 bnez v0, bad_alignment
194
195 lw v1, TI_ADDR_LIMIT($28) # in legal address range?
196 addiu a0, a1, 4
197 or a0, a0, a1
198 and a0, a0, v1
199 bltz a0, bad_address
200
201#ifdef CONFIG_CPU_HAS_LLSC
202 /* Ok, this is the ll/sc case. World is sane :-) */
2031: ll v0, (a1)
204 move a0, a2
2052: sc a0, (a1)
206#if R10000_LLSC_WAR
207 beqzl a0, 1b
208#else
209 beqz a0, 1b
210#endif
211
212 .section __ex_table,"a"
213 PTR 1b, bad_stack
214 PTR 2b, bad_stack
215 .previous
216#else
217 sw a1, 16(sp)
218 sw a2, 20(sp)
219
220 move a0, sp
221 move a2, a1
222 li a1, 1
223 jal do_page_fault
224
225 lw a1, 16(sp)
226 lw a2, 20(sp)
227
228 /*
229 * At this point the page should be readable and writable unless
230 * there was no more memory available.
231 */
2321: lw v0, (a1)
2332: sw a2, (a1)
234
235 .section __ex_table,"a"
236 PTR 1b, no_mem
237 PTR 2b, no_mem
238 .previous
239#endif
240
241 sw zero, PT_R7(sp) # success
242 sw v0, PT_R2(sp) # result
243
244 /* Success, so skip usual error handling garbage. */
245 lw a2, TI_FLAGS($28) # syscall tracing enabled?
246 li t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
247 and t0, a2, t0
248 bnez t0, 1f
249
250 j o32_syscall_exit
251
2521: SAVE_STATIC
253 move a0, sp
254 li a1, 1
255 jal do_syscall_trace
256 j syscall_exit
257
258no_mem: li v0, -ENOMEM
259 jr ra
260
261bad_address:
262 li v0, -EFAULT
263 jr ra
264
265bad_alignment:
266 li v0, -EINVAL
267 jr ra
268 END(mips_atomic_set)
269
270 LEAF(sys_sysmips)
271 beq a0, MIPS_ATOMIC_SET, mips_atomic_set
272 j _sys_sysmips
273 END(sys_sysmips)
274
275 LEAF(sys_syscall)
276#if defined(CONFIG_BINFMT_IRIX)
277 sltiu v0, a0, MAX_SYSCALL_NO + 1 # check syscall number
278#else
279 subu t0, a0, __NR_O32_Linux # check syscall number
280 sltiu v0, t0, __NR_O32_Linux_syscalls + 1
281#endif
282 sll t1, t0, 3
283 beqz v0, einval
284
285 lw t2, sys_call_table(t1) # syscall routine
286
287#if defined(CONFIG_BINFMT_IRIX)
288 li v1, 4000 # nr of sys_syscall
289#else
290 li v1, 4000 - __NR_O32_Linux # index of sys_syscall
291#endif
292 beq t0, v1, einval # do not recurse
293
294 /* Some syscalls like execve get their arguments from struct pt_regs
295 and claim zero arguments in the syscall table. Thus we have to
296 assume the worst case and shuffle around all potential arguments.
297 If you want performance, don't use indirect syscalls. */
298
299 move a0, a1 # shift argument registers
300 move a1, a2
301 move a2, a3
302 lw a3, 16(sp)
303 lw t4, 20(sp)
304 lw t5, 24(sp)
305 lw t6, 28(sp)
306 sw t4, 16(sp)
307 sw t5, 20(sp)
308 sw t6, 24(sp)
309 sw a0, PT_R4(sp) # .. and push back a0 - a3, some
310 sw a1, PT_R5(sp) # syscalls expect them there
311 sw a2, PT_R6(sp)
312 sw a3, PT_R7(sp)
313 sw a3, PT_R26(sp) # update a3 for syscall restarting
314 jr t2
315 /* Unreached */
316
317einval: li v0, -EINVAL
318 jr ra
319 END(sys_syscall)
320
321 .macro fifty ptr, nargs, from=1, to=50
322 sys \ptr \nargs
323 .if \to-\from
324 fifty \ptr,\nargs,"(\from+1)",\to
325 .endif
326 .endm
327
328 .macro mille ptr, nargs, from=1, to=20
329 fifty \ptr,\nargs
330 .if \to-\from
331 mille \ptr,\nargs,"(\from+1)",\to
332 .endif
333 .endm
334
335 .macro syscalltable
336#if defined(CONFIG_BINFMT_IRIX)
337 mille sys_ni_syscall 0 /* 0 - 999 SVR4 flavour */
338 mille sys_ni_syscall 0 /* 1000 - 1999 32-bit IRIX */
339 mille sys_ni_syscall 0 /* 2000 - 2999 BSD43 flavour */
340 mille sys_ni_syscall 0 /* 3000 - 3999 POSIX flavour */
341#endif
342
343 sys sys_syscall 8 /* 4000 */
344 sys sys_exit 1
345 sys sys_fork 0
346 sys sys_read 3
347 sys sys_write 3
348 sys sys_open 3 /* 4005 */
349 sys sys_close 1
350 sys sys_waitpid 3
351 sys sys_creat 2
352 sys sys_link 2
353 sys sys_unlink 1 /* 4010 */
354 sys sys_execve 0
355 sys sys_chdir 1
356 sys sys_time 1
357 sys sys_mknod 3
358 sys sys_chmod 2 /* 4015 */
359 sys sys_lchown 3
360 sys sys_ni_syscall 0
361 sys sys_ni_syscall 0 /* was sys_stat */
362 sys sys_lseek 3
363 sys sys_getpid 0 /* 4020 */
364 sys sys_mount 5
365 sys sys_oldumount 1
366 sys sys_setuid 1
367 sys sys_getuid 0
368 sys sys_stime 1 /* 4025 */
369 sys sys_ptrace 4
370 sys sys_alarm 1
371 sys sys_ni_syscall 0 /* was sys_fstat */
372 sys sys_pause 0
373 sys sys_utime 2 /* 4030 */
374 sys sys_ni_syscall 0
375 sys sys_ni_syscall 0
376 sys sys_access 2
377 sys sys_nice 1
378 sys sys_ni_syscall 0 /* 4035 */
379 sys sys_sync 0
380 sys sys_kill 2
381 sys sys_rename 2
382 sys sys_mkdir 2
383 sys sys_rmdir 1 /* 4040 */
384 sys sys_dup 1
385 sys sys_pipe 0
386 sys sys_times 1
387 sys sys_ni_syscall 0
388 sys sys_brk 1 /* 4045 */
389 sys sys_setgid 1
390 sys sys_getgid 0
391 sys sys_ni_syscall 0 /* was signal(2) */
392 sys sys_geteuid 0
393 sys sys_getegid 0 /* 4050 */
394 sys sys_acct 1
395 sys sys_umount 2
396 sys sys_ni_syscall 0
397 sys sys_ioctl 3
398 sys sys_fcntl 3 /* 4055 */
399 sys sys_ni_syscall 2
400 sys sys_setpgid 2
401 sys sys_ni_syscall 0
402 sys sys_olduname 1
403 sys sys_umask 1 /* 4060 */
404 sys sys_chroot 1
405 sys sys_ustat 2
406 sys sys_dup2 2
407 sys sys_getppid 0
408 sys sys_getpgrp 0 /* 4065 */
409 sys sys_setsid 0
410 sys sys_sigaction 3
411 sys sys_sgetmask 0
412 sys sys_ssetmask 1
413 sys sys_setreuid 2 /* 4070 */
414 sys sys_setregid 2
415 sys sys_sigsuspend 0
416 sys sys_sigpending 1
417 sys sys_sethostname 2
418 sys sys_setrlimit 2 /* 4075 */
419 sys sys_getrlimit 2
420 sys sys_getrusage 2
421 sys sys_gettimeofday 2
422 sys sys_settimeofday 2
423 sys sys_getgroups 2 /* 4080 */
424 sys sys_setgroups 2
425 sys sys_ni_syscall 0 /* old_select */
426 sys sys_symlink 2
427 sys sys_ni_syscall 0 /* was sys_lstat */
428 sys sys_readlink 3 /* 4085 */
429 sys sys_uselib 1
430 sys sys_swapon 2
431 sys sys_reboot 3
432 sys old_readdir 3
433 sys old_mmap 6 /* 4090 */
434 sys sys_munmap 2
435 sys sys_truncate 2
436 sys sys_ftruncate 2
437 sys sys_fchmod 2
438 sys sys_fchown 3 /* 4095 */
439 sys sys_getpriority 2
440 sys sys_setpriority 3
441 sys sys_ni_syscall 0
442 sys sys_statfs 2
443 sys sys_fstatfs 2 /* 4100 */
444 sys sys_ni_syscall 0 /* was ioperm(2) */
445 sys sys_socketcall 2
446 sys sys_syslog 3
447 sys sys_setitimer 3
448 sys sys_getitimer 2 /* 4105 */
449 sys sys_newstat 2
450 sys sys_newlstat 2
451 sys sys_newfstat 2
452 sys sys_uname 1
453 sys sys_ni_syscall 0 /* 4110 was iopl(2) */
454 sys sys_vhangup 0
455 sys sys_ni_syscall 0 /* was sys_idle() */
456 sys sys_ni_syscall 0 /* was sys_vm86 */
457 sys sys_wait4 4
458 sys sys_swapoff 1 /* 4115 */
459 sys sys_sysinfo 1
460 sys sys_ipc 6
461 sys sys_fsync 1
462 sys sys_sigreturn 0
463 sys sys_clone 0 /* 4120 */
464 sys sys_setdomainname 2
465 sys sys_newuname 1
466 sys sys_ni_syscall 0 /* sys_modify_ldt */
467 sys sys_adjtimex 1
468 sys sys_mprotect 3 /* 4125 */
469 sys sys_sigprocmask 3
470 sys sys_ni_syscall 0 /* was create_module */
471 sys sys_init_module 5
472 sys sys_delete_module 1
473 sys sys_ni_syscall 0 /* 4130 was get_kernel_syms */
474 sys sys_quotactl 4
475 sys sys_getpgid 1
476 sys sys_fchdir 1
477 sys sys_bdflush 2
478 sys sys_sysfs 3 /* 4135 */
479 sys sys_personality 1
480 sys sys_ni_syscall 0 /* for afs_syscall */
481 sys sys_setfsuid 1
482 sys sys_setfsgid 1
483 sys sys_llseek 5 /* 4140 */
484 sys sys_getdents 3
485 sys sys_select 5
486 sys sys_flock 2
487 sys sys_msync 3
488 sys sys_readv 3 /* 4145 */
489 sys sys_writev 3
490 sys sys_cacheflush 3
491 sys sys_cachectl 3
492 sys sys_sysmips 4
493 sys sys_ni_syscall 0 /* 4150 */
494 sys sys_getsid 1
495 sys sys_fdatasync 1
496 sys sys_sysctl 1
497 sys sys_mlock 2
498 sys sys_munlock 2 /* 4155 */
499 sys sys_mlockall 1
500 sys sys_munlockall 0
501 sys sys_sched_setparam 2
502 sys sys_sched_getparam 2
503 sys sys_sched_setscheduler 3 /* 4160 */
504 sys sys_sched_getscheduler 1
505 sys sys_sched_yield 0
506 sys sys_sched_get_priority_max 1
507 sys sys_sched_get_priority_min 1
508 sys sys_sched_rr_get_interval 2 /* 4165 */
509 sys sys_nanosleep, 2
510 sys sys_mremap, 4
511 sys sys_accept 3
512 sys sys_bind 3
513 sys sys_connect 3 /* 4170 */
514 sys sys_getpeername 3
515 sys sys_getsockname 3
516 sys sys_getsockopt 5
517 sys sys_listen 2
518 sys sys_recv 4 /* 4175 */
519 sys sys_recvfrom 6
520 sys sys_recvmsg 3
521 sys sys_send 4
522 sys sys_sendmsg 3
523 sys sys_sendto 6 /* 4180 */
524 sys sys_setsockopt 5
525 sys sys_shutdown 2
526 sys sys_socket 3
527 sys sys_socketpair 4
528 sys sys_setresuid 3 /* 4185 */
529 sys sys_getresuid 3
530 sys sys_ni_syscall 0 /* was sys_query_module */
531 sys sys_poll 3
532 sys sys_nfsservctl 3
533 sys sys_setresgid 3 /* 4190 */
534 sys sys_getresgid 3
535 sys sys_prctl 5
536 sys sys_rt_sigreturn 0
537 sys sys_rt_sigaction 4
538 sys sys_rt_sigprocmask 4 /* 4195 */
539 sys sys_rt_sigpending 2
540 sys sys_rt_sigtimedwait 4
541 sys sys_rt_sigqueueinfo 3
542 sys sys_rt_sigsuspend 0
543 sys sys_pread64 6 /* 4200 */
544 sys sys_pwrite64 6
545 sys sys_chown 3
546 sys sys_getcwd 2
547 sys sys_capget 2
548 sys sys_capset 2 /* 4205 */
549 sys sys_sigaltstack 0
550 sys sys_sendfile 4
551 sys sys_ni_syscall 0
552 sys sys_ni_syscall 0
553 sys sys_mmap2 6 /* 4210 */
554 sys sys_truncate64 4
555 sys sys_ftruncate64 4
556 sys sys_stat64 2
557 sys sys_lstat64 2
558 sys sys_fstat64 2 /* 4215 */
559 sys sys_pivot_root 2
560 sys sys_mincore 3
561 sys sys_madvise 3
562 sys sys_getdents64 3
563 sys sys_fcntl64 3 /* 4220 */
564 sys sys_ni_syscall 0
565 sys sys_gettid 0
566 sys sys_readahead 5
567 sys sys_setxattr 5
568 sys sys_lsetxattr 5 /* 4225 */
569 sys sys_fsetxattr 5
570 sys sys_getxattr 4
571 sys sys_lgetxattr 4
572 sys sys_fgetxattr 4
573 sys sys_listxattr 3 /* 4230 */
574 sys sys_llistxattr 3
575 sys sys_flistxattr 3
576 sys sys_removexattr 2
577 sys sys_lremovexattr 2
578 sys sys_fremovexattr 2 /* 4235 */
579 sys sys_tkill 2
580 sys sys_sendfile64 5
581 sys sys_futex 2
582 sys sys_sched_setaffinity 3
583 sys sys_sched_getaffinity 3 /* 4240 */
584 sys sys_io_setup 2
585 sys sys_io_destroy 1
586 sys sys_io_getevents 5
587 sys sys_io_submit 3
588 sys sys_io_cancel 3 /* 4245 */
589 sys sys_exit_group 1
590 sys sys_lookup_dcookie 3
591 sys sys_epoll_create 1
592 sys sys_epoll_ctl 4
593 sys sys_epoll_wait 3 /* 4250 */
594 sys sys_remap_file_pages 5
595 sys sys_set_tid_address 1
596 sys sys_restart_syscall 0
597 sys sys_fadvise64_64 7
598 sys sys_statfs64 3 /* 4255 */
599 sys sys_fstatfs64 2
600 sys sys_timer_create 3
601 sys sys_timer_settime 4
602 sys sys_timer_gettime 2
603 sys sys_timer_getoverrun 1 /* 4260 */
604 sys sys_timer_delete 1
605 sys sys_clock_settime 2
606 sys sys_clock_gettime 2
607 sys sys_clock_getres 2
608 sys sys_clock_nanosleep 4 /* 4265 */
609 sys sys_tgkill 3
610 sys sys_utimes 2
611 sys sys_mbind 4
612 sys sys_ni_syscall 0 /* sys_get_mempolicy */
613 sys sys_ni_syscall 0 /* 4270 sys_set_mempolicy */
614 sys sys_mq_open 4
615 sys sys_mq_unlink 1
616 sys sys_mq_timedsend 5
617 sys sys_mq_timedreceive 5
618 sys sys_mq_notify 2 /* 4275 */
619 sys sys_mq_getsetattr 3
620 sys sys_ni_syscall 0 /* sys_vserver */
621 sys sys_waitid 4
622 sys sys_ni_syscall 0 /* available, was setaltroot */
623 sys sys_add_key 5
624 sys sys_request_key 4
625 sys sys_keyctl 5
626
627 .endm
628
629 /* We pre-compute the number of _instruction_ bytes needed to
630 load or store the arguments 6-8. Negative values are ignored. */
631
632 .macro sys function, nargs
633 PTR \function
634 LONG (\nargs << 2) - (5 << 2)
635 .endm
636
637 .align 3
638 .type sys_call_table,@object
639EXPORT(sys_call_table)
640 syscalltable
641 .size sys_call_table, . - sys_call_table
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
new file mode 100644
index 000000000000..32efb888160a
--- /dev/null
+++ b/arch/mips/kernel/scall64-64.S
@@ -0,0 +1,451 @@
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) 1995, 96, 97, 98, 99, 2000, 01, 02 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#include <linux/config.h>
11#include <linux/errno.h>
12#include <asm/asm.h>
13#include <asm/asmmacro.h>
14#include <asm/mipsregs.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17#include <asm/offset.h>
18#include <asm/sysmips.h>
19#include <asm/thread_info.h>
20#include <asm/unistd.h>
21#include <asm/war.h>
22
23#ifndef CONFIG_BINFMT_ELF32
24/* Neither O32 nor N32, so define handle_sys here */
25#define handle_sys64 handle_sys
26#endif
27
28 .align 5
29NESTED(handle_sys64, PT_SIZE, sp)
30#if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
31 /*
32 * When 32-bit compatibility is configured scall_o32.S
33 * already did this.
34 */
35 .set noat
36 SAVE_SOME
37 STI
38 .set at
39#endif
40
41 dsubu t0, v0, __NR_64_Linux # check syscall number
42 sltiu t0, t0, __NR_64_Linux_syscalls + 1
43#if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
44 ld t1, PT_EPC(sp) # skip syscall on return
45 daddiu t1, 4 # skip to next instruction
46 sd t1, PT_EPC(sp)
47#endif
48 beqz t0, illegal_syscall
49
50 dsll t0, v0, 3 # offset into table
51 ld t2, (sys_call_table - (__NR_64_Linux * 8))(t0)
52 # syscall routine
53
54 sd a3, PT_R26(sp) # save a3 for syscall restarting
55
56 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
57 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
58 and t0, t1, t0
59 bnez t0, syscall_trace_entry
60
61 jalr t2 # Do The Real Thing (TM)
62
63 li t0, -EMAXERRNO - 1 # error?
64 sltu t0, t0, v0
65 sd t0, PT_R7(sp) # set error flag
66 beqz t0, 1f
67
68 dnegu v0 # error
69 sd v0, PT_R0(sp) # set flag for syscall
70 # restarting
711: sd v0, PT_R2(sp) # result
72
73n64_syscall_exit:
74 local_irq_disable # make sure need_resched and
75 # signals dont change between
76 # sampling and return
77 LONG_L a2, TI_FLAGS($28) # current->work
78 li t0, _TIF_ALLWORK_MASK
79 and t0, a2, t0
80 bnez t0, n64_syscall_exit_work
81
82 j restore_partial
83
84n64_syscall_exit_work:
85 j syscall_exit_work_partial
86
87/* ------------------------------------------------------------------------ */
88
89syscall_trace_entry:
90 SAVE_STATIC
91 move s0, t2
92 move a0, sp
93 li a1, 0
94 jal do_syscall_trace
95
96 ld a0, PT_R4(sp) # Restore argument registers
97 ld a1, PT_R5(sp)
98 ld a2, PT_R6(sp)
99 ld a3, PT_R7(sp)
100 ld a4, PT_R8(sp)
101 ld a5, PT_R9(sp)
102 jalr s0
103
104 li t0, -EMAXERRNO - 1 # error?
105 sltu t0, t0, v0
106 sd t0, PT_R7(sp) # set error flag
107 beqz t0, 1f
108
109 dnegu v0 # error
110 sd v0, PT_R0(sp) # set flag for syscall restarting
1111: sd v0, PT_R2(sp) # result
112
113 j syscall_exit
114
115illegal_syscall:
116 /* This also isn't a 64-bit syscall, throw an error. */
117 li v0, -ENOSYS # error
118 sd v0, PT_R2(sp)
119 li t0, 1 # set error flag
120 sd t0, PT_R7(sp)
121 j n64_syscall_exit
122 END(handle_sys64)
123
124 LEAF(mips_atomic_set)
125 andi v0, a1, 3 # must be word aligned
126 bnez v0, bad_alignment
127
128 LONG_L v1, TI_ADDR_LIMIT($28) # in legal address range?
129 LONG_ADDIU a0, a1, 4
130 or a0, a0, a1
131 and a0, a0, v1
132 bltz a0, bad_address
133
134#ifdef CONFIG_CPU_HAS_LLSC
135 /* Ok, this is the ll/sc case. World is sane :-) */
1361: ll v0, (a1)
137 move a0, a2
1382: sc a0, (a1)
139#if R10000_LLSC_WAR
140 beqzl a0, 1b
141#else
142 beqz a0, 1b
143#endif
144
145 .section __ex_table,"a"
146 PTR 1b, bad_stack
147 PTR 2b, bad_stack
148 .previous
149#else
150 sw a1, 16(sp)
151 sw a2, 20(sp)
152
153 move a0, sp
154 move a2, a1
155 li a1, 1
156 jal do_page_fault
157
158 lw a1, 16(sp)
159 lw a2, 20(sp)
160
161 /*
162 * At this point the page should be readable and writable unless
163 * there was no more memory available.
164 */
1651: lw v0, (a1)
1662: sw a2, (a1)
167
168 .section __ex_table,"a"
169 PTR 1b, no_mem
170 PTR 2b, no_mem
171 .previous
172#endif
173
174 sd zero, PT_R7(sp) # success
175 sd v0, PT_R2(sp) # result
176
177 /* Success, so skip usual error handling garbage. */
178 li t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
179 LONG_L a2, TI_FLAGS($28) # syscall tracing enabled?
180 and t0, a2, t0
181 bnez t0, 1f
182
183 j n64_syscall_exit
184
1851: SAVE_STATIC
186 move a0, sp
187 li a1, 1
188 jal do_syscall_trace
189 j syscall_exit
190
191no_mem: li v0, -ENOMEM
192 jr ra
193
194bad_address:
195 li v0, -EFAULT
196 jr ra
197
198bad_alignment:
199 li v0, -EINVAL
200 jr ra
201 END(mips_atomic_set)
202
203 LEAF(sys_sysmips)
204 beq a0, MIPS_ATOMIC_SET, mips_atomic_set
205 j _sys_sysmips
206 END(sys_sysmips)
207
208 .align 3
209sys_call_table:
210 PTR sys_read /* 5000 */
211 PTR sys_write
212 PTR sys_open
213 PTR sys_close
214 PTR sys_newstat
215 PTR sys_newfstat /* 5005 */
216 PTR sys_newlstat
217 PTR sys_poll
218 PTR sys_lseek
219 PTR old_mmap
220 PTR sys_mprotect /* 5010 */
221 PTR sys_munmap
222 PTR sys_brk
223 PTR sys_rt_sigaction
224 PTR sys_rt_sigprocmask
225 PTR sys_ioctl /* 5015 */
226 PTR sys_pread64
227 PTR sys_pwrite64
228 PTR sys_readv
229 PTR sys_writev
230 PTR sys_access /* 5020 */
231 PTR sys_pipe
232 PTR sys_select
233 PTR sys_sched_yield
234 PTR sys_mremap
235 PTR sys_msync /* 5025 */
236 PTR sys_mincore
237 PTR sys_madvise
238 PTR sys_shmget
239 PTR sys_shmat
240 PTR sys_shmctl /* 5030 */
241 PTR sys_dup
242 PTR sys_dup2
243 PTR sys_pause
244 PTR sys_nanosleep
245 PTR sys_getitimer /* 5035 */
246 PTR sys_setitimer
247 PTR sys_alarm
248 PTR sys_getpid
249 PTR sys_sendfile64
250 PTR sys_socket /* 5040 */
251 PTR sys_connect
252 PTR sys_accept
253 PTR sys_sendto
254 PTR sys_recvfrom
255 PTR sys_sendmsg /* 5045 */
256 PTR sys_recvmsg
257 PTR sys_shutdown
258 PTR sys_bind
259 PTR sys_listen
260 PTR sys_getsockname /* 5050 */
261 PTR sys_getpeername
262 PTR sys_socketpair
263 PTR sys_setsockopt
264 PTR sys_getsockopt
265 PTR sys_clone /* 5055 */
266 PTR sys_fork
267 PTR sys_execve
268 PTR sys_exit
269 PTR sys_wait4
270 PTR sys_kill /* 5060 */
271 PTR sys_newuname
272 PTR sys_semget
273 PTR sys_semop
274 PTR sys_semctl
275 PTR sys_shmdt /* 5065 */
276 PTR sys_msgget
277 PTR sys_msgsnd
278 PTR sys_msgrcv
279 PTR sys_msgctl
280 PTR sys_fcntl /* 5070 */
281 PTR sys_flock
282 PTR sys_fsync
283 PTR sys_fdatasync
284 PTR sys_truncate
285 PTR sys_ftruncate /* 5075 */
286 PTR sys_getdents
287 PTR sys_getcwd
288 PTR sys_chdir
289 PTR sys_fchdir
290 PTR sys_rename /* 5080 */
291 PTR sys_mkdir
292 PTR sys_rmdir
293 PTR sys_creat
294 PTR sys_link
295 PTR sys_unlink /* 5085 */
296 PTR sys_symlink
297 PTR sys_readlink
298 PTR sys_chmod
299 PTR sys_fchmod
300 PTR sys_chown /* 5090 */
301 PTR sys_fchown
302 PTR sys_lchown
303 PTR sys_umask
304 PTR sys_gettimeofday
305 PTR sys_getrlimit /* 5095 */
306 PTR sys_getrusage
307 PTR sys_sysinfo
308 PTR sys_times
309 PTR sys_ptrace
310 PTR sys_getuid /* 5100 */
311 PTR sys_syslog
312 PTR sys_getgid
313 PTR sys_setuid
314 PTR sys_setgid
315 PTR sys_geteuid /* 5105 */
316 PTR sys_getegid
317 PTR sys_setpgid
318 PTR sys_getppid
319 PTR sys_getpgrp
320 PTR sys_setsid /* 5110 */
321 PTR sys_setreuid
322 PTR sys_setregid
323 PTR sys_getgroups
324 PTR sys_setgroups
325 PTR sys_setresuid /* 5115 */
326 PTR sys_getresuid
327 PTR sys_setresgid
328 PTR sys_getresgid
329 PTR sys_getpgid
330 PTR sys_setfsuid /* 5120 */
331 PTR sys_setfsgid
332 PTR sys_getsid
333 PTR sys_capget
334 PTR sys_capset
335 PTR sys_rt_sigpending /* 5125 */
336 PTR sys_rt_sigtimedwait
337 PTR sys_rt_sigqueueinfo
338 PTR sys_rt_sigsuspend
339 PTR sys_sigaltstack
340 PTR sys_utime /* 5130 */
341 PTR sys_mknod
342 PTR sys_personality
343 PTR sys_ustat
344 PTR sys_statfs
345 PTR sys_fstatfs /* 5135 */
346 PTR sys_sysfs
347 PTR sys_getpriority
348 PTR sys_setpriority
349 PTR sys_sched_setparam
350 PTR sys_sched_getparam /* 5140 */
351 PTR sys_sched_setscheduler
352 PTR sys_sched_getscheduler
353 PTR sys_sched_get_priority_max
354 PTR sys_sched_get_priority_min
355 PTR sys_sched_rr_get_interval /* 5145 */
356 PTR sys_mlock
357 PTR sys_munlock
358 PTR sys_mlockall
359 PTR sys_munlockall
360 PTR sys_vhangup /* 5150 */
361 PTR sys_pivot_root
362 PTR sys_sysctl
363 PTR sys_prctl
364 PTR sys_adjtimex
365 PTR sys_setrlimit /* 5155 */
366 PTR sys_chroot
367 PTR sys_sync
368 PTR sys_acct
369 PTR sys_settimeofday
370 PTR sys_mount /* 5160 */
371 PTR sys_umount
372 PTR sys_swapon
373 PTR sys_swapoff
374 PTR sys_reboot
375 PTR sys_sethostname /* 5165 */
376 PTR sys_setdomainname
377 PTR sys_ni_syscall /* was create_module */
378 PTR sys_init_module
379 PTR sys_delete_module
380 PTR sys_ni_syscall /* 5170, was get_kernel_syms */
381 PTR sys_ni_syscall /* was query_module */
382 PTR sys_quotactl
383 PTR sys_nfsservctl
384 PTR sys_ni_syscall /* res. for getpmsg */
385 PTR sys_ni_syscall /* 5175 for putpmsg */
386 PTR sys_ni_syscall /* res. for afs_syscall */
387 PTR sys_ni_syscall /* res. for security */
388 PTR sys_gettid
389 PTR sys_readahead
390 PTR sys_setxattr /* 5180 */
391 PTR sys_lsetxattr
392 PTR sys_fsetxattr
393 PTR sys_getxattr
394 PTR sys_lgetxattr
395 PTR sys_fgetxattr /* 5185 */
396 PTR sys_listxattr
397 PTR sys_llistxattr
398 PTR sys_flistxattr
399 PTR sys_removexattr
400 PTR sys_lremovexattr /* 5190 */
401 PTR sys_fremovexattr
402 PTR sys_tkill
403 PTR sys_ni_syscall
404 PTR sys_futex
405 PTR sys_sched_setaffinity /* 5195 */
406 PTR sys_sched_getaffinity
407 PTR sys_cacheflush
408 PTR sys_cachectl
409 PTR sys_sysmips
410 PTR sys_io_setup /* 5200 */
411 PTR sys_io_destroy
412 PTR sys_io_getevents
413 PTR sys_io_submit
414 PTR sys_io_cancel
415 PTR sys_exit_group /* 5205 */
416 PTR sys_lookup_dcookie
417 PTR sys_epoll_create
418 PTR sys_epoll_ctl
419 PTR sys_epoll_wait
420 PTR sys_remap_file_pages /* 5210 */
421 PTR sys_rt_sigreturn
422 PTR sys_set_tid_address
423 PTR sys_restart_syscall
424 PTR sys_semtimedop
425 PTR sys_fadvise64_64 /* 5215 */
426 PTR sys_timer_create
427 PTR sys_timer_settime
428 PTR sys_timer_gettime
429 PTR sys_timer_getoverrun
430 PTR sys_timer_delete /* 5220 */
431 PTR sys_clock_settime
432 PTR sys_clock_gettime
433 PTR sys_clock_getres
434 PTR sys_clock_nanosleep
435 PTR sys_tgkill /* 5225 */
436 PTR sys_utimes
437 PTR sys_mbind
438 PTR sys_ni_syscall /* sys_get_mempolicy */
439 PTR sys_ni_syscall /* sys_set_mempolicy */
440 PTR sys_mq_open /* 5230 */
441 PTR sys_mq_unlink
442 PTR sys_mq_timedsend
443 PTR sys_mq_timedreceive
444 PTR sys_mq_notify
445 PTR sys_mq_getsetattr /* 5235 */
446 PTR sys_ni_syscall /* sys_vserver */
447 PTR sys_waitid
448 PTR sys_ni_syscall /* available, was setaltroot */
449 PTR sys_add_key
450 PTR sys_request_key /* 5240 */
451 PTR sys_keyctl
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
new file mode 100644
index 000000000000..e52049c87bc3
--- /dev/null
+++ b/arch/mips/kernel/scall64-n32.S
@@ -0,0 +1,365 @@
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) 1995, 96, 97, 98, 99, 2000, 01 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#include <linux/config.h>
11#include <linux/errno.h>
12#include <asm/asm.h>
13#include <asm/asmmacro.h>
14#include <asm/mipsregs.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17#include <asm/thread_info.h>
18#include <asm/unistd.h>
19
20/* This duplicates the definition from <linux/sched.h> */
21#define PT_TRACESYS 0x00000002 /* tracing system calls */
22
23/* This duplicates the definition from <asm/signal.h> */
24#define SIGILL 4 /* Illegal instruction (ANSI). */
25
26#ifndef CONFIG_MIPS32_O32
27/* No O32, so define handle_sys here */
28#define handle_sysn32 handle_sys
29#endif
30
31 .align 5
32NESTED(handle_sysn32, PT_SIZE, sp)
33#ifndef CONFIG_MIPS32_O32
34 .set noat
35 SAVE_SOME
36 STI
37 .set at
38#endif
39
40 dsubu t0, v0, __NR_N32_Linux # check syscall number
41 sltiu t0, t0, __NR_N32_Linux_syscalls + 1
42
43#ifndef CONFIG_MIPS32_O32
44 ld t1, PT_EPC(sp) # skip syscall on return
45 daddiu t1, 4 # skip to next instruction
46 sd t1, PT_EPC(sp)
47#endif
48 beqz t0, not_n32_scall
49
50 dsll t0, v0, 3 # offset into table
51 ld t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0)
52
53 sd a3, PT_R26(sp) # save a3 for syscall restarting
54
55 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
56 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
57 and t0, t1, t0
58 bnez t0, n32_syscall_trace_entry
59
60 jalr t2 # Do The Real Thing (TM)
61
62 li t0, -EMAXERRNO - 1 # error?
63 sltu t0, t0, v0
64 sd t0, PT_R7(sp) # set error flag
65 beqz t0, 1f
66
67 dnegu v0 # error
68 sd v0, PT_R0(sp) # set flag for syscall restarting
691: sd v0, PT_R2(sp) # result
70
71 local_irq_disable # make sure need_resched and
72 # signals dont change between
73 # sampling and return
74 LONG_L a2, TI_FLAGS($28) # current->work
75 li t0, _TIF_ALLWORK_MASK
76 and t0, a2, t0
77 bnez t0, n32_syscall_exit_work
78
79 j restore_partial
80
81n32_syscall_exit_work:
82 j syscall_exit_work_partial
83
84/* ------------------------------------------------------------------------ */
85
86n32_syscall_trace_entry:
87 SAVE_STATIC
88 move s0, t2
89 move a0, sp
90 li a1, 0
91 jal do_syscall_trace
92
93 ld a0, PT_R4(sp) # Restore argument registers
94 ld a1, PT_R5(sp)
95 ld a2, PT_R6(sp)
96 ld a3, PT_R7(sp)
97 ld a4, PT_R8(sp)
98 ld a5, PT_R9(sp)
99 jalr s0
100
101 li t0, -EMAXERRNO - 1 # error?
102 sltu t0, t0, v0
103 sd t0, PT_R7(sp) # set error flag
104 beqz t0, 1f
105
106 dnegu v0 # error
107 sd v0, PT_R0(sp) # set flag for syscall restarting
1081: sd v0, PT_R2(sp) # result
109
110 j syscall_exit
111
112not_n32_scall:
113 /* This is not an n32 compatibility syscall, pass it on to
114 the n64 syscall handlers. */
115 j handle_sys64
116
117 END(handle_sysn32)
118
119EXPORT(sysn32_call_table)
120 PTR sys_read /* 6000 */
121 PTR sys_write
122 PTR sys_open
123 PTR sys_close
124 PTR sys_newstat
125 PTR sys_newfstat /* 6005 */
126 PTR sys_newlstat
127 PTR sys_poll
128 PTR sys_lseek
129 PTR old_mmap
130 PTR sys_mprotect /* 6010 */
131 PTR sys_munmap
132 PTR sys_brk
133 PTR sys32_rt_sigaction
134 PTR sys32_rt_sigprocmask
135 PTR compat_sys_ioctl /* 6015 */
136 PTR sys_pread64
137 PTR sys_pwrite64
138 PTR compat_sys_readv
139 PTR compat_sys_writev
140 PTR sys_access /* 6020 */
141 PTR sys_pipe
142 PTR compat_sys_select
143 PTR sys_sched_yield
144 PTR sys_mremap
145 PTR sys_msync /* 6025 */
146 PTR sys_mincore
147 PTR sys_madvise
148 PTR sys_shmget
149 PTR sys32_shmat
150 PTR sys_shmctl /* 6030 */
151 PTR sys_dup
152 PTR sys_dup2
153 PTR sys_pause
154 PTR compat_sys_nanosleep
155 PTR compat_sys_getitimer /* 6035 */
156 PTR compat_sys_setitimer
157 PTR sys_alarm
158 PTR sys_getpid
159 PTR sys32_sendfile
160 PTR sys_socket /* 6040 */
161 PTR sys_connect
162 PTR sys_accept
163 PTR sys_sendto
164 PTR sys_recvfrom
165 PTR compat_sys_sendmsg /* 6045 */
166 PTR compat_sys_recvmsg
167 PTR sys_shutdown
168 PTR sys_bind
169 PTR sys_listen
170 PTR sys_getsockname /* 6050 */
171 PTR sys_getpeername
172 PTR sys_socketpair
173 PTR compat_sys_setsockopt
174 PTR sys_getsockopt
175 PTR sys_clone /* 6055 */
176 PTR sys_fork
177 PTR sys32_execve
178 PTR sys_exit
179 PTR sys32_wait4
180 PTR sys_kill /* 6060 */
181 PTR sys32_newuname
182 PTR sys_semget
183 PTR sys_semop
184 PTR sys_semctl
185 PTR sys_shmdt /* 6065 */
186 PTR sys_msgget
187 PTR sys_msgsnd
188 PTR sys_msgrcv
189 PTR sys_msgctl
190 PTR compat_sys_fcntl /* 6070 */
191 PTR sys_flock
192 PTR sys_fsync
193 PTR sys_fdatasync
194 PTR sys_truncate
195 PTR sys_ftruncate /* 6075 */
196 PTR sys32_getdents
197 PTR sys_getcwd
198 PTR sys_chdir
199 PTR sys_fchdir
200 PTR sys_rename /* 6080 */
201 PTR sys_mkdir
202 PTR sys_rmdir
203 PTR sys_creat
204 PTR sys_link
205 PTR sys_unlink /* 6085 */
206 PTR sys_symlink
207 PTR sys_readlink
208 PTR sys_chmod
209 PTR sys_fchmod
210 PTR sys_chown /* 6090 */
211 PTR sys_fchown
212 PTR sys_lchown
213 PTR sys_umask
214 PTR sys32_gettimeofday
215 PTR compat_sys_getrlimit /* 6095 */
216 PTR compat_sys_getrusage
217 PTR sys32_sysinfo
218 PTR compat_sys_times
219 PTR sys_ptrace
220 PTR sys_getuid /* 6100 */
221 PTR sys_syslog
222 PTR sys_getgid
223 PTR sys_setuid
224 PTR sys_setgid
225 PTR sys_geteuid /* 6105 */
226 PTR sys_getegid
227 PTR sys_setpgid
228 PTR sys_getppid
229 PTR sys_getpgrp
230 PTR sys_setsid /* 6110 */
231 PTR sys_setreuid
232 PTR sys_setregid
233 PTR sys_getgroups
234 PTR sys_setgroups
235 PTR sys_setresuid /* 6115 */
236 PTR sys_getresuid
237 PTR sys_setresgid
238 PTR sys_getresgid
239 PTR sys_getpgid
240 PTR sys_setfsuid /* 6120 */
241 PTR sys_setfsgid
242 PTR sys_getsid
243 PTR sys_capget
244 PTR sys_capset
245 PTR sys32_rt_sigpending /* 6125 */
246 PTR compat_sys_rt_sigtimedwait
247 PTR sys32_rt_sigqueueinfo
248 PTR sys32_rt_sigsuspend
249 PTR sys32_sigaltstack
250 PTR compat_sys_utime /* 6130 */
251 PTR sys_mknod
252 PTR sys32_personality
253 PTR sys_ustat
254 PTR compat_sys_statfs
255 PTR compat_sys_fstatfs /* 6135 */
256 PTR sys_sysfs
257 PTR sys_getpriority
258 PTR sys_setpriority
259 PTR sys_sched_setparam
260 PTR sys_sched_getparam /* 6140 */
261 PTR sys_sched_setscheduler
262 PTR sys_sched_getscheduler
263 PTR sys_sched_get_priority_max
264 PTR sys_sched_get_priority_min
265 PTR sys32_sched_rr_get_interval /* 6145 */
266 PTR sys_mlock
267 PTR sys_munlock
268 PTR sys_mlockall
269 PTR sys_munlockall
270 PTR sys_vhangup /* 6150 */
271 PTR sys_pivot_root
272 PTR sys32_sysctl
273 PTR sys_prctl
274 PTR sys32_adjtimex
275 PTR compat_sys_setrlimit /* 6155 */
276 PTR sys_chroot
277 PTR sys_sync
278 PTR sys_acct
279 PTR sys32_settimeofday
280 PTR sys_mount /* 6160 */
281 PTR sys_umount
282 PTR sys_swapon
283 PTR sys_swapoff
284 PTR sys_reboot
285 PTR sys_sethostname /* 6165 */
286 PTR sys_setdomainname
287 PTR sys_ni_syscall /* was create_module */
288 PTR sys_init_module
289 PTR sys_delete_module
290 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
291 PTR sys_ni_syscall /* was query_module */
292 PTR sys_quotactl
293 PTR sys_nfsservctl
294 PTR sys_ni_syscall /* res. for getpmsg */
295 PTR sys_ni_syscall /* 6175 for putpmsg */
296 PTR sys_ni_syscall /* res. for afs_syscall */
297 PTR sys_ni_syscall /* res. for security */
298 PTR sys_gettid
299 PTR sys32_readahead
300 PTR sys_setxattr /* 6180 */
301 PTR sys_lsetxattr
302 PTR sys_fsetxattr
303 PTR sys_getxattr
304 PTR sys_lgetxattr
305 PTR sys_fgetxattr /* 6185 */
306 PTR sys_listxattr
307 PTR sys_llistxattr
308 PTR sys_flistxattr
309 PTR sys_removexattr
310 PTR sys_lremovexattr /* 6190 */
311 PTR sys_fremovexattr
312 PTR sys_tkill
313 PTR sys_ni_syscall
314 PTR compat_sys_futex
315 PTR compat_sys_sched_setaffinity /* 6195 */
316 PTR compat_sys_sched_getaffinity
317 PTR sys_cacheflush
318 PTR sys_cachectl
319 PTR sys_sysmips
320 PTR sys_io_setup /* 6200 */
321 PTR sys_io_destroy
322 PTR sys_io_getevents
323 PTR sys_io_submit
324 PTR sys_io_cancel
325 PTR sys_exit_group /* 6205 */
326 PTR sys_lookup_dcookie
327 PTR sys_epoll_create
328 PTR sys_epoll_ctl
329 PTR sys_epoll_wait
330 PTR sys_remap_file_pages /* 6210 */
331 PTR sysn32_rt_sigreturn
332 PTR sys_fcntl
333 PTR sys_set_tid_address
334 PTR sys_restart_syscall
335 PTR sys_semtimedop /* 6215 */
336 PTR sys_fadvise64_64
337 PTR compat_sys_statfs64
338 PTR compat_sys_fstatfs64
339 PTR sys_sendfile64
340 PTR sys_timer_create /* 6220 */
341 PTR sys_timer_settime
342 PTR sys_timer_gettime
343 PTR sys_timer_getoverrun
344 PTR sys_timer_delete
345 PTR sys_clock_settime /* 6225 */
346 PTR sys_clock_gettime
347 PTR sys_clock_getres
348 PTR sys_clock_nanosleep
349 PTR sys_tgkill
350 PTR compat_sys_utimes /* 6230 */
351 PTR sys_ni_syscall /* sys_mbind */
352 PTR sys_ni_syscall /* sys_get_mempolicy */
353 PTR sys_ni_syscall /* sys_set_mempolicy */
354 PTR compat_sys_mq_open
355 PTR sys_mq_unlink /* 6235 */
356 PTR compat_sys_mq_timedsend
357 PTR compat_sys_mq_timedreceive
358 PTR compat_sys_mq_notify
359 PTR compat_sys_mq_getsetattr
360 PTR sys_ni_syscall /* 6240, sys_vserver */
361 PTR sys_waitid
362 PTR sys_ni_syscall /* available, was setaltroot */
363 PTR sys_add_key
364 PTR sys_request_key
365 PTR sys_keyctl /* 6245 */
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
new file mode 100644
index 000000000000..739f3998d76b
--- /dev/null
+++ b/arch/mips/kernel/scall64-o32.S
@@ -0,0 +1,488 @@
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) 1995 - 2000, 2001 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 * Copyright (C) 2004 Thiemo Seufer
10 *
11 * Hairy, the userspace application uses a different argument passing
12 * convention than the kernel, so we have to translate things from o32
13 * to ABI64 calling convention. 64-bit syscalls are also processed
14 * here for now.
15 */
16#include <linux/config.h>
17#include <linux/errno.h>
18#include <asm/asm.h>
19#include <asm/asmmacro.h>
20#include <asm/mipsregs.h>
21#include <asm/regdef.h>
22#include <asm/stackframe.h>
23#include <asm/thread_info.h>
24#include <asm/unistd.h>
25#include <asm/sysmips.h>
26
27 .align 5
28NESTED(handle_sys, PT_SIZE, sp)
29 .set noat
30 SAVE_SOME
31 STI
32 .set at
33 ld t1, PT_EPC(sp) # skip syscall on return
34
35 dsubu t0, v0, __NR_O32_Linux # check syscall number
36 sltiu t0, t0, __NR_O32_Linux_syscalls + 1
37 daddiu t1, 4 # skip to next instruction
38 sd t1, PT_EPC(sp)
39 beqz t0, not_o32_scall
40#if 0
41 SAVE_ALL
42 move a1, v0
43 PRINT("Scall %ld\n")
44 RESTORE_ALL
45#endif
46
47 /* We don't want to stumble over broken sign extensions from
48 userland. O32 does never use the upper half. */
49 sll a0, a0, 0
50 sll a1, a1, 0
51 sll a2, a2, 0
52 sll a3, a3, 0
53
54 dsll t0, v0, 3 # offset into table
55 ld t2, (sys_call_table - (__NR_O32_Linux * 8))(t0)
56
57 sd a3, PT_R26(sp) # save a3 for syscall restarting
58
59 /*
60 * More than four arguments. Try to deal with it by copying the
61 * stack arguments from the user stack to the kernel stack.
62 * This Sucks (TM).
63 *
64 * We intentionally keep the kernel stack a little below the top of
65 * userspace so we don't have to do a slower byte accurate check here.
66 */
67 ld t0, PT_R29(sp) # get old user stack pointer
68 daddu t1, t0, 32
69 bltz t1, bad_stack
70
711: lw a4, 16(t0) # argument #5 from usp
722: lw a5, 20(t0) # argument #6 from usp
733: lw a6, 24(t0) # argument #7 from usp
744: lw a7, 28(t0) # argument #8 from usp (for indirect syscalls)
75
76 .section __ex_table,"a"
77 PTR 1b, bad_stack
78 PTR 2b, bad_stack
79 PTR 3b, bad_stack
80 PTR 4b, bad_stack
81 .previous
82
83 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
84 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
85 and t0, t1, t0
86 bnez t0, trace_a_syscall
87
88 jalr t2 # Do The Real Thing (TM)
89
90 li t0, -EMAXERRNO - 1 # error?
91 sltu t0, t0, v0
92 sd t0, PT_R7(sp) # set error flag
93 beqz t0, 1f
94
95 dnegu v0 # error
96 sd v0, PT_R0(sp) # flag for syscall restarting
971: sd v0, PT_R2(sp) # result
98
99o32_syscall_exit:
100 local_irq_disable # make need_resched and
101 # signals dont change between
102 # sampling and return
103 LONG_L a2, TI_FLAGS($28)
104 li t0, _TIF_ALLWORK_MASK
105 and t0, a2, t0
106 bnez t0, o32_syscall_exit_work
107
108 j restore_partial
109
110o32_syscall_exit_work:
111 j syscall_exit_work_partial
112
113/* ------------------------------------------------------------------------ */
114
115trace_a_syscall:
116 SAVE_STATIC
117 sd a4, PT_R8(sp) # Save argument registers
118 sd a5, PT_R9(sp)
119 sd a6, PT_R10(sp)
120 sd a7, PT_R11(sp) # For indirect syscalls
121
122 move s0, t2 # Save syscall pointer
123 move a0, sp
124 li a1, 0
125 jal do_syscall_trace
126
127 ld a0, PT_R4(sp) # Restore argument registers
128 ld a1, PT_R5(sp)
129 ld a2, PT_R6(sp)
130 ld a3, PT_R7(sp)
131 ld a4, PT_R8(sp)
132 ld a5, PT_R9(sp)
133 ld a6, PT_R10(sp)
134 ld a7, PT_R11(sp) # For indirect syscalls
135 jalr s0
136
137 li t0, -EMAXERRNO - 1 # error?
138 sltu t0, t0, v0
139 sd t0, PT_R7(sp) # set error flag
140 beqz t0, 1f
141
142 dnegu v0 # error
143 sd v0, PT_R0(sp) # set flag for syscall restarting
1441: sd v0, PT_R2(sp) # result
145
146 j syscall_exit
147
148/* ------------------------------------------------------------------------ */
149
150 /*
151 * The stackpointer for a call with more than 4 arguments is bad.
152 */
153bad_stack:
154 dnegu v0 # error
155 sd v0, PT_R0(sp)
156 sd v0, PT_R2(sp)
157 li t0, 1 # set error flag
158 sd t0, PT_R7(sp)
159 j o32_syscall_exit
160
161not_o32_scall:
162 /*
163 * This is not an o32 compatibility syscall, pass it on
164 * to the 64-bit syscall handlers.
165 */
166#ifdef CONFIG_MIPS32_N32
167 j handle_sysn32
168#else
169 j handle_sys64
170#endif
171 END(handle_sys)
172
173LEAF(sys32_syscall)
174 sltu v0, a0, __NR_O32_Linux + __NR_O32_Linux_syscalls + 1
175 beqz v0, einval
176
177 dsll v0, a0, 3
178 ld t2, (sys_call_table - (__NR_O32_Linux * 8))(v0)
179
180 li v1, 4000 # indirect syscall number
181 beq a0, v1, einval # do not recurse
182
183 move a0, a1 # shift argument registers
184 move a1, a2
185 move a2, a3
186 move a3, a4
187 move a4, a5
188 move a5, a6
189 move a6, a7
190 sd a0, PT_R4(sp) # ... and push back a0 - a3, some
191 sd a1, PT_R5(sp) # syscalls expect them there
192 sd a2, PT_R6(sp)
193 sd a3, PT_R7(sp)
194 sd a3, PT_R26(sp) # update a3 for syscall restarting
195 jr t2
196 /* Unreached */
197
198einval: li v0, -EINVAL
199 jr ra
200 END(sys32_syscall)
201
202 .align 3
203 .type sys_call_table,@object
204sys_call_table:
205 PTR sys32_syscall /* 4000 */
206 PTR sys_exit
207 PTR sys_fork
208 PTR sys_read
209 PTR sys_write
210 PTR sys_open /* 4005 */
211 PTR sys_close
212 PTR sys_waitpid
213 PTR sys_creat
214 PTR sys_link
215 PTR sys_unlink /* 4010 */
216 PTR sys32_execve
217 PTR sys_chdir
218 PTR compat_sys_time
219 PTR sys_mknod
220 PTR sys_chmod /* 4015 */
221 PTR sys_lchown
222 PTR sys_ni_syscall
223 PTR sys_ni_syscall /* was sys_stat */
224 PTR sys_lseek
225 PTR sys_getpid /* 4020 */
226 PTR sys_mount
227 PTR sys_oldumount
228 PTR sys_setuid
229 PTR sys_getuid
230 PTR compat_sys_stime /* 4025 */
231 PTR sys32_ptrace
232 PTR sys_alarm
233 PTR sys_ni_syscall /* was sys_fstat */
234 PTR sys_pause
235 PTR compat_sys_utime /* 4030 */
236 PTR sys_ni_syscall
237 PTR sys_ni_syscall
238 PTR sys_access
239 PTR sys_nice
240 PTR sys_ni_syscall /* 4035 */
241 PTR sys_sync
242 PTR sys_kill
243 PTR sys_rename
244 PTR sys_mkdir
245 PTR sys_rmdir /* 4040 */
246 PTR sys_dup
247 PTR sys_pipe
248 PTR compat_sys_times
249 PTR sys_ni_syscall
250 PTR sys_brk /* 4045 */
251 PTR sys_setgid
252 PTR sys_getgid
253 PTR sys_ni_syscall /* was signal 2 */
254 PTR sys_geteuid
255 PTR sys_getegid /* 4050 */
256 PTR sys_acct
257 PTR sys_umount
258 PTR sys_ni_syscall
259 PTR compat_sys_ioctl
260 PTR compat_sys_fcntl /* 4055 */
261 PTR sys_ni_syscall
262 PTR sys_setpgid
263 PTR sys_ni_syscall
264 PTR sys_olduname
265 PTR sys_umask /* 4060 */
266 PTR sys_chroot
267 PTR sys32_ustat
268 PTR sys_dup2
269 PTR sys_getppid
270 PTR sys_getpgrp /* 4065 */
271 PTR sys_setsid
272 PTR sys32_sigaction
273 PTR sys_sgetmask
274 PTR sys_ssetmask
275 PTR sys_setreuid /* 4070 */
276 PTR sys_setregid
277 PTR sys32_sigsuspend
278 PTR compat_sys_sigpending
279 PTR sys_sethostname
280 PTR compat_sys_setrlimit /* 4075 */
281 PTR compat_sys_getrlimit
282 PTR compat_sys_getrusage
283 PTR sys32_gettimeofday
284 PTR sys32_settimeofday
285 PTR sys_getgroups /* 4080 */
286 PTR sys_setgroups
287 PTR sys_ni_syscall /* old_select */
288 PTR sys_symlink
289 PTR sys_ni_syscall /* was sys_lstat */
290 PTR sys_readlink /* 4085 */
291 PTR sys_uselib
292 PTR sys_swapon
293 PTR sys_reboot
294 PTR sys32_readdir
295 PTR old_mmap /* 4090 */
296 PTR sys_munmap
297 PTR sys_truncate
298 PTR sys_ftruncate
299 PTR sys_fchmod
300 PTR sys_fchown /* 4095 */
301 PTR sys_getpriority
302 PTR sys_setpriority
303 PTR sys_ni_syscall
304 PTR compat_sys_statfs
305 PTR compat_sys_fstatfs /* 4100 */
306 PTR sys_ni_syscall /* sys_ioperm */
307 PTR sys32_socketcall
308 PTR sys_syslog
309 PTR compat_sys_setitimer
310 PTR compat_sys_getitimer /* 4105 */
311 PTR compat_sys_newstat
312 PTR compat_sys_newlstat
313 PTR compat_sys_newfstat
314 PTR sys_uname
315 PTR sys_ni_syscall /* sys_ioperm *//* 4110 */
316 PTR sys_vhangup
317 PTR sys_ni_syscall /* was sys_idle */
318 PTR sys_ni_syscall /* sys_vm86 */
319 PTR sys32_wait4
320 PTR sys_swapoff /* 4115 */
321 PTR sys32_sysinfo
322 PTR sys32_ipc
323 PTR sys_fsync
324 PTR sys32_sigreturn
325 PTR sys_clone /* 4120 */
326 PTR sys_setdomainname
327 PTR sys32_newuname
328 PTR sys_ni_syscall /* sys_modify_ldt */
329 PTR sys32_adjtimex
330 PTR sys_mprotect /* 4125 */
331 PTR compat_sys_sigprocmask
332 PTR sys_ni_syscall /* was creat_module */
333 PTR sys_init_module
334 PTR sys_delete_module
335 PTR sys_ni_syscall /* 4130, get_kernel_syms */
336 PTR sys_quotactl
337 PTR sys_getpgid
338 PTR sys_fchdir
339 PTR sys_bdflush
340 PTR sys_sysfs /* 4135 */
341 PTR sys32_personality
342 PTR sys_ni_syscall /* for afs_syscall */
343 PTR sys_setfsuid
344 PTR sys_setfsgid
345 PTR sys32_llseek /* 4140 */
346 PTR sys32_getdents
347 PTR compat_sys_select
348 PTR sys_flock
349 PTR sys_msync
350 PTR compat_sys_readv /* 4145 */
351 PTR compat_sys_writev
352 PTR sys_cacheflush
353 PTR sys_cachectl
354 PTR sys_sysmips
355 PTR sys_ni_syscall /* 4150 */
356 PTR sys_getsid
357 PTR sys_fdatasync
358 PTR sys32_sysctl
359 PTR sys_mlock
360 PTR sys_munlock /* 4155 */
361 PTR sys_mlockall
362 PTR sys_munlockall
363 PTR sys_sched_setparam
364 PTR sys_sched_getparam
365 PTR sys_sched_setscheduler /* 4160 */
366 PTR sys_sched_getscheduler
367 PTR sys_sched_yield
368 PTR sys_sched_get_priority_max
369 PTR sys_sched_get_priority_min
370 PTR sys32_sched_rr_get_interval /* 4165 */
371 PTR compat_sys_nanosleep
372 PTR sys_mremap
373 PTR sys_accept
374 PTR sys_bind
375 PTR sys_connect /* 4170 */
376 PTR sys_getpeername
377 PTR sys_getsockname
378 PTR sys_getsockopt
379 PTR sys_listen
380 PTR sys_recv /* 4175 */
381 PTR sys_recvfrom
382 PTR compat_sys_recvmsg
383 PTR sys_send
384 PTR compat_sys_sendmsg
385 PTR sys_sendto /* 4180 */
386 PTR compat_sys_setsockopt
387 PTR sys_shutdown
388 PTR sys_socket
389 PTR sys_socketpair
390 PTR sys_setresuid /* 4185 */
391 PTR sys_getresuid
392 PTR sys_ni_syscall /* was query_module */
393 PTR sys_poll
394 PTR sys_nfsservctl
395 PTR sys_setresgid /* 4190 */
396 PTR sys_getresgid
397 PTR sys_prctl
398 PTR sys32_rt_sigreturn
399 PTR sys32_rt_sigaction
400 PTR sys32_rt_sigprocmask /* 4195 */
401 PTR sys32_rt_sigpending
402 PTR compat_sys_rt_sigtimedwait
403 PTR sys32_rt_sigqueueinfo
404 PTR sys32_rt_sigsuspend
405 PTR sys32_pread /* 4200 */
406 PTR sys32_pwrite
407 PTR sys_chown
408 PTR sys_getcwd
409 PTR sys_capget
410 PTR sys_capset /* 4205 */
411 PTR sys32_sigaltstack
412 PTR sys32_sendfile
413 PTR sys_ni_syscall
414 PTR sys_ni_syscall
415 PTR sys32_mmap2 /* 4210 */
416 PTR sys32_truncate64
417 PTR sys32_ftruncate64
418 PTR sys_newstat
419 PTR sys_newlstat
420 PTR sys_newfstat /* 4215 */
421 PTR sys_pivot_root
422 PTR sys_mincore
423 PTR sys_madvise
424 PTR sys_getdents64
425 PTR compat_sys_fcntl64 /* 4220 */
426 PTR sys_ni_syscall
427 PTR sys_gettid
428 PTR sys32_readahead
429 PTR sys_setxattr
430 PTR sys_lsetxattr /* 4225 */
431 PTR sys_fsetxattr
432 PTR sys_getxattr
433 PTR sys_lgetxattr
434 PTR sys_fgetxattr
435 PTR sys_listxattr /* 4230 */
436 PTR sys_llistxattr
437 PTR sys_flistxattr
438 PTR sys_removexattr
439 PTR sys_lremovexattr
440 PTR sys_fremovexattr /* 4235 */
441 PTR sys_tkill
442 PTR sys_sendfile64
443 PTR compat_sys_futex
444 PTR compat_sys_sched_setaffinity
445 PTR compat_sys_sched_getaffinity /* 4240 */
446 PTR sys_io_setup
447 PTR sys_io_destroy
448 PTR sys_io_getevents
449 PTR sys_io_submit
450 PTR sys_io_cancel /* 4245 */
451 PTR sys_exit_group
452 PTR sys_lookup_dcookie
453 PTR sys_epoll_create
454 PTR sys_epoll_ctl
455 PTR sys_epoll_wait /* 4250 */
456 PTR sys_remap_file_pages
457 PTR sys_set_tid_address
458 PTR sys_restart_syscall
459 PTR sys_fadvise64_64
460 PTR compat_sys_statfs64 /* 4255 */
461 PTR compat_sys_fstatfs64
462 PTR sys_timer_create
463 PTR compat_sys_timer_settime
464 PTR compat_sys_timer_gettime
465 PTR sys_timer_getoverrun /* 4260 */
466 PTR sys_timer_delete
467 PTR compat_sys_clock_settime
468 PTR compat_sys_clock_gettime
469 PTR compat_sys_clock_getres
470 PTR compat_sys_clock_nanosleep /* 4265 */
471 PTR sys_tgkill
472 PTR compat_sys_utimes
473 PTR sys_ni_syscall /* sys_mbind */
474 PTR sys_ni_syscall /* sys_get_mempolicy */
475 PTR sys_ni_syscall /* 4270 sys_set_mempolicy */
476 PTR compat_sys_mq_open
477 PTR sys_mq_unlink
478 PTR compat_sys_mq_timedsend
479 PTR compat_sys_mq_timedreceive
480 PTR compat_sys_mq_notify /* 4275 */
481 PTR compat_sys_mq_getsetattr
482 PTR sys_ni_syscall /* sys_vserver */
483 PTR sys_waitid
484 PTR sys_ni_syscall /* available, was setaltroot */
485 PTR sys_add_key /* 4280 */
486 PTR sys_request_key
487 PTR sys_keyctl
488 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/semaphore.c b/arch/mips/kernel/semaphore.c
new file mode 100644
index 000000000000..9c40fe5a8e8d
--- /dev/null
+++ b/arch/mips/kernel/semaphore.c
@@ -0,0 +1,164 @@
1/*
2 * MIPS-specific semaphore code.
3 *
4 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
5 * Copyright (C) 2004 Ralf Baechle <ralf@linux-mips.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 * April 2001 - Reworked by Paul Mackerras <paulus@samba.org>
13 * to eliminate the SMP races in the old version between the updates
14 * of `count' and `waking'. Now we use negative `count' values to
15 * indicate that some process(es) are waiting for the semaphore.
16 */
17
18#include <linux/module.h>
19#include <linux/sched.h>
20#include <linux/init.h>
21#include <asm/atomic.h>
22#include <asm/cpu-features.h>
23#include <asm/errno.h>
24#include <asm/semaphore.h>
25#include <asm/war.h>
26/*
27 * Atomically update sem->count.
28 * This does the equivalent of the following:
29 *
30 * old_count = sem->count;
31 * tmp = MAX(old_count, 0) + incr;
32 * sem->count = tmp;
33 * return old_count;
34 *
35 * On machines without lld/scd we need a spinlock to make the manipulation of
36 * sem->count and sem->waking atomic. Scalability isn't an issue because
37 * this lock is used on UP only so it's just an empty variable.
38 */
39static inline int __sem_update_count(struct semaphore *sem, int incr)
40{
41 int old_count, tmp;
42
43 if (cpu_has_llsc && R10000_LLSC_WAR) {
44 __asm__ __volatile__(
45 "1: ll %0, %2 \n"
46 " sra %1, %0, 31 \n"
47 " not %1 \n"
48 " and %1, %0, %1 \n"
49 " add %1, %1, %3 \n"
50 " sc %1, %2 \n"
51 " beqzl %1, 1b \n"
52 : "=&r" (old_count), "=&r" (tmp), "=m" (sem->count)
53 : "r" (incr), "m" (sem->count));
54 } else if (cpu_has_llsc) {
55 __asm__ __volatile__(
56 "1: ll %0, %2 \n"
57 " sra %1, %0, 31 \n"
58 " not %1 \n"
59 " and %1, %0, %1 \n"
60 " add %1, %1, %3 \n"
61 " sc %1, %2 \n"
62 " beqz %1, 1b \n"
63 : "=&r" (old_count), "=&r" (tmp), "=m" (sem->count)
64 : "r" (incr), "m" (sem->count));
65 } else {
66 static DEFINE_SPINLOCK(semaphore_lock);
67 unsigned long flags;
68
69 spin_lock_irqsave(&semaphore_lock, flags);
70 old_count = atomic_read(&sem->count);
71 tmp = max_t(int, old_count, 0) + incr;
72 atomic_set(&sem->count, tmp);
73 spin_unlock_irqrestore(&semaphore_lock, flags);
74 }
75
76 return old_count;
77}
78
79void __up(struct semaphore *sem)
80{
81 /*
82 * Note that we incremented count in up() before we came here,
83 * but that was ineffective since the result was <= 0, and
84 * any negative value of count is equivalent to 0.
85 * This ends up setting count to 1, unless count is now > 0
86 * (i.e. because some other cpu has called up() in the meantime),
87 * in which case we just increment count.
88 */
89 __sem_update_count(sem, 1);
90 wake_up(&sem->wait);
91}
92
93EXPORT_SYMBOL(__up);
94
95/*
96 * Note that when we come in to __down or __down_interruptible,
97 * we have already decremented count, but that decrement was
98 * ineffective since the result was < 0, and any negative value
99 * of count is equivalent to 0.
100 * Thus it is only when we decrement count from some value > 0
101 * that we have actually got the semaphore.
102 */
103void __sched __down(struct semaphore *sem)
104{
105 struct task_struct *tsk = current;
106 DECLARE_WAITQUEUE(wait, tsk);
107
108 __set_task_state(tsk, TASK_UNINTERRUPTIBLE);
109 add_wait_queue_exclusive(&sem->wait, &wait);
110
111 /*
112 * Try to get the semaphore. If the count is > 0, then we've
113 * got the semaphore; we decrement count and exit the loop.
114 * If the count is 0 or negative, we set it to -1, indicating
115 * that we are asleep, and then sleep.
116 */
117 while (__sem_update_count(sem, -1) <= 0) {
118 schedule();
119 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
120 }
121 remove_wait_queue(&sem->wait, &wait);
122 __set_task_state(tsk, TASK_RUNNING);
123
124 /*
125 * If there are any more sleepers, wake one of them up so
126 * that it can either get the semaphore, or set count to -1
127 * indicating that there are still processes sleeping.
128 */
129 wake_up(&sem->wait);
130}
131
132EXPORT_SYMBOL(__down);
133
134int __sched __down_interruptible(struct semaphore * sem)
135{
136 int retval = 0;
137 struct task_struct *tsk = current;
138 DECLARE_WAITQUEUE(wait, tsk);
139
140 __set_task_state(tsk, TASK_INTERRUPTIBLE);
141 add_wait_queue_exclusive(&sem->wait, &wait);
142
143 while (__sem_update_count(sem, -1) <= 0) {
144 if (signal_pending(current)) {
145 /*
146 * A signal is pending - give up trying.
147 * Set sem->count to 0 if it is negative,
148 * since we are no longer sleeping.
149 */
150 __sem_update_count(sem, 0);
151 retval = -EINTR;
152 break;
153 }
154 schedule();
155 set_task_state(tsk, TASK_INTERRUPTIBLE);
156 }
157 remove_wait_queue(&sem->wait, &wait);
158 __set_task_state(tsk, TASK_RUNNING);
159
160 wake_up(&sem->wait);
161 return retval;
162}
163
164EXPORT_SYMBOL(__down_interruptible);
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
new file mode 100644
index 000000000000..6018ca25aceb
--- /dev/null
+++ b/arch/mips/kernel/setup.c
@@ -0,0 +1,571 @@
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) 1995 Linus Torvalds
7 * Copyright (C) 1995 Waldorf Electronics
8 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 Ralf Baechle
9 * Copyright (C) 1996 Stoned Elipot
10 * Copyright (C) 1999 Silicon Graphics, Inc.
11 * Copyright (C) 2000 2001, 2002 Maciej W. Rozycki
12 */
13#include <linux/config.h>
14#include <linux/errno.h>
15#include <linux/init.h>
16#include <linux/ioport.h>
17#include <linux/sched.h>
18#include <linux/kernel.h>
19#include <linux/mm.h>
20#include <linux/module.h>
21#include <linux/stddef.h>
22#include <linux/string.h>
23#include <linux/unistd.h>
24#include <linux/slab.h>
25#include <linux/user.h>
26#include <linux/utsname.h>
27#include <linux/a.out.h>
28#include <linux/tty.h>
29#include <linux/bootmem.h>
30#include <linux/initrd.h>
31#include <linux/major.h>
32#include <linux/kdev_t.h>
33#include <linux/root_dev.h>
34#include <linux/highmem.h>
35#include <linux/console.h>
36
37#include <asm/addrspace.h>
38#include <asm/bootinfo.h>
39#include <asm/cpu.h>
40#include <asm/sections.h>
41#include <asm/setup.h>
42#include <asm/system.h>
43
44struct cpuinfo_mips cpu_data[NR_CPUS];
45
46EXPORT_SYMBOL(cpu_data);
47
48#ifdef CONFIG_VT
49struct screen_info screen_info;
50#endif
51
52/*
53 * Despite it's name this variable is even if we don't have PCI
54 */
55unsigned int PCI_DMA_BUS_IS_PHYS;
56
57EXPORT_SYMBOL(PCI_DMA_BUS_IS_PHYS);
58
59/*
60 * Setup information
61 *
62 * These are initialized so they are in the .data section
63 */
64unsigned long mips_machtype = MACH_UNKNOWN;
65unsigned long mips_machgroup = MACH_GROUP_UNKNOWN;
66
67EXPORT_SYMBOL(mips_machtype);
68EXPORT_SYMBOL(mips_machgroup);
69
70struct boot_mem_map boot_mem_map;
71
72static char command_line[CL_SIZE];
73 char arcs_cmdline[CL_SIZE]=CONFIG_CMDLINE;
74
75/*
76 * mips_io_port_base is the begin of the address space to which x86 style
77 * I/O ports are mapped.
78 */
79const unsigned long mips_io_port_base = -1;
80EXPORT_SYMBOL(mips_io_port_base);
81
82/*
83 * isa_slot_offset is the address where E(ISA) busaddress 0 is mapped
84 * for the processor.
85 */
86unsigned long isa_slot_offset;
87EXPORT_SYMBOL(isa_slot_offset);
88
89static struct resource code_resource = { .name = "Kernel code", };
90static struct resource data_resource = { .name = "Kernel data", };
91
92void __init add_memory_region(phys_t start, phys_t size, long type)
93{
94 int x = boot_mem_map.nr_map;
95 struct boot_mem_map_entry *prev = boot_mem_map.map + x - 1;
96
97 /*
98 * Try to merge with previous entry if any. This is far less than
99 * perfect but is sufficient for most real world cases.
100 */
101 if (x && prev->addr + prev->size == start && prev->type == type) {
102 prev->size += size;
103 return;
104 }
105
106 if (x == BOOT_MEM_MAP_MAX) {
107 printk("Ooops! Too many entries in the memory map!\n");
108 return;
109 }
110
111 boot_mem_map.map[x].addr = start;
112 boot_mem_map.map[x].size = size;
113 boot_mem_map.map[x].type = type;
114 boot_mem_map.nr_map++;
115}
116
117static void __init print_memory_map(void)
118{
119 int i;
120 const int field = 2 * sizeof(unsigned long);
121
122 for (i = 0; i < boot_mem_map.nr_map; i++) {
123 printk(" memory: %0*Lx @ %0*Lx ",
124 field, (unsigned long long) boot_mem_map.map[i].size,
125 field, (unsigned long long) boot_mem_map.map[i].addr);
126
127 switch (boot_mem_map.map[i].type) {
128 case BOOT_MEM_RAM:
129 printk("(usable)\n");
130 break;
131 case BOOT_MEM_ROM_DATA:
132 printk("(ROM data)\n");
133 break;
134 case BOOT_MEM_RESERVED:
135 printk("(reserved)\n");
136 break;
137 default:
138 printk("type %lu\n", boot_mem_map.map[i].type);
139 break;
140 }
141 }
142}
143
144static inline void parse_cmdline_early(void)
145{
146 char c = ' ', *to = command_line, *from = saved_command_line;
147 unsigned long start_at, mem_size;
148 int len = 0;
149 int usermem = 0;
150
151 printk("Determined physical RAM map:\n");
152 print_memory_map();
153
154 for (;;) {
155 /*
156 * "mem=XXX[kKmM]" defines a memory region from
157 * 0 to <XXX>, overriding the determined size.
158 * "mem=XXX[KkmM]@YYY[KkmM]" defines a memory region from
159 * <YYY> to <YYY>+<XXX>, overriding the determined size.
160 */
161 if (c == ' ' && !memcmp(from, "mem=", 4)) {
162 if (to != command_line)
163 to--;
164 /*
165 * If a user specifies memory size, we
166 * blow away any automatically generated
167 * size.
168 */
169 if (usermem == 0) {
170 boot_mem_map.nr_map = 0;
171 usermem = 1;
172 }
173 mem_size = memparse(from + 4, &from);
174 if (*from == '@')
175 start_at = memparse(from + 1, &from);
176 else
177 start_at = 0;
178 add_memory_region(start_at, mem_size, BOOT_MEM_RAM);
179 }
180 c = *(from++);
181 if (!c)
182 break;
183 if (CL_SIZE <= ++len)
184 break;
185 *(to++) = c;
186 }
187 *to = '\0';
188
189 if (usermem) {
190 printk("User-defined physical RAM map:\n");
191 print_memory_map();
192 }
193}
194
195static inline int parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_end)
196{
197 /*
198 * "rd_start=0xNNNNNNNN" defines the memory address of an initrd
199 * "rd_size=0xNN" it's size
200 */
201 unsigned long start = 0;
202 unsigned long size = 0;
203 unsigned long end;
204 char cmd_line[CL_SIZE];
205 char *start_str;
206 char *size_str;
207 char *tmp;
208
209 strcpy(cmd_line, command_line);
210 *command_line = 0;
211 tmp = cmd_line;
212 /* Ignore "rd_start=" strings in other parameters. */
213 start_str = strstr(cmd_line, "rd_start=");
214 if (start_str && start_str != cmd_line && *(start_str - 1) != ' ')
215 start_str = strstr(start_str, " rd_start=");
216 while (start_str) {
217 if (start_str != cmd_line)
218 strncat(command_line, tmp, start_str - tmp);
219 start = memparse(start_str + 9, &start_str);
220 tmp = start_str + 1;
221 start_str = strstr(start_str, " rd_start=");
222 }
223 if (*tmp)
224 strcat(command_line, tmp);
225
226 strcpy(cmd_line, command_line);
227 *command_line = 0;
228 tmp = cmd_line;
229 /* Ignore "rd_size" strings in other parameters. */
230 size_str = strstr(cmd_line, "rd_size=");
231 if (size_str && size_str != cmd_line && *(size_str - 1) != ' ')
232 size_str = strstr(size_str, " rd_size=");
233 while (size_str) {
234 if (size_str != cmd_line)
235 strncat(command_line, tmp, size_str - tmp);
236 size = memparse(size_str + 8, &size_str);
237 tmp = size_str + 1;
238 size_str = strstr(size_str, " rd_size=");
239 }
240 if (*tmp)
241 strcat(command_line, tmp);
242
243#ifdef CONFIG_MIPS64
244 /* HACK: Guess if the sign extension was forgotten */
245 if (start > 0x0000000080000000 && start < 0x00000000ffffffff)
246 start |= 0xffffffff00000000;
247#endif
248
249 end = start + size;
250 if (start && end) {
251 *rd_start = start;
252 *rd_end = end;
253 return 1;
254 }
255 return 0;
256}
257
258#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
259#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
260#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
261
262#define MAXMEM HIGHMEM_START
263#define MAXMEM_PFN PFN_DOWN(MAXMEM)
264
265static inline void bootmem_init(void)
266{
267 unsigned long start_pfn;
268 unsigned long reserved_end = (unsigned long)&_end;
269#ifndef CONFIG_SGI_IP27
270 unsigned long first_usable_pfn;
271 unsigned long bootmap_size;
272 int i;
273#endif
274#ifdef CONFIG_BLK_DEV_INITRD
275 int initrd_reserve_bootmem = 0;
276
277 /* Board specific code should have set up initrd_start and initrd_end */
278 ROOT_DEV = Root_RAM0;
279 if (parse_rd_cmdline(&initrd_start, &initrd_end)) {
280 reserved_end = max(reserved_end, initrd_end);
281 initrd_reserve_bootmem = 1;
282 } else {
283 unsigned long tmp;
284 u32 *initrd_header;
285
286 tmp = ((reserved_end + PAGE_SIZE-1) & PAGE_MASK) - sizeof(u32) * 2;
287 if (tmp < reserved_end)
288 tmp += PAGE_SIZE;
289 initrd_header = (u32 *)tmp;
290 if (initrd_header[0] == 0x494E5244) {
291 initrd_start = (unsigned long)&initrd_header[2];
292 initrd_end = initrd_start + initrd_header[1];
293 reserved_end = max(reserved_end, initrd_end);
294 initrd_reserve_bootmem = 1;
295 }
296 }
297#endif /* CONFIG_BLK_DEV_INITRD */
298
299 /*
300 * Partially used pages are not usable - thus
301 * we are rounding upwards.
302 */
303 start_pfn = PFN_UP(CPHYSADDR(reserved_end));
304
305#ifndef CONFIG_SGI_IP27
306 /* Find the highest page frame number we have available. */
307 max_pfn = 0;
308 first_usable_pfn = -1UL;
309 for (i = 0; i < boot_mem_map.nr_map; i++) {
310 unsigned long start, end;
311
312 if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
313 continue;
314
315 start = PFN_UP(boot_mem_map.map[i].addr);
316 end = PFN_DOWN(boot_mem_map.map[i].addr
317 + boot_mem_map.map[i].size);
318
319 if (start >= end)
320 continue;
321 if (end > max_pfn)
322 max_pfn = end;
323 if (start < first_usable_pfn) {
324 if (start > start_pfn) {
325 first_usable_pfn = start;
326 } else if (end > start_pfn) {
327 first_usable_pfn = start_pfn;
328 }
329 }
330 }
331
332 /*
333 * Determine low and high memory ranges
334 */
335 max_low_pfn = max_pfn;
336 if (max_low_pfn > MAXMEM_PFN) {
337 max_low_pfn = MAXMEM_PFN;
338#ifndef CONFIG_HIGHMEM
339 /* Maximum memory usable is what is directly addressable */
340 printk(KERN_WARNING "Warning only %ldMB will be used.\n",
341 MAXMEM >> 20);
342 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
343#endif
344 }
345
346#ifdef CONFIG_HIGHMEM
347 /*
348 * Crude, we really should make a better attempt at detecting
349 * highstart_pfn
350 */
351 highstart_pfn = highend_pfn = max_pfn;
352 if (max_pfn > MAXMEM_PFN) {
353 highstart_pfn = MAXMEM_PFN;
354 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
355 (highend_pfn - highstart_pfn) >> (20 - PAGE_SHIFT));
356 }
357#endif
358
359 /* Initialize the boot-time allocator with low memory only. */
360 bootmap_size = init_bootmem(first_usable_pfn, max_low_pfn);
361
362 /*
363 * Register fully available low RAM pages with the bootmem allocator.
364 */
365 for (i = 0; i < boot_mem_map.nr_map; i++) {
366 unsigned long curr_pfn, last_pfn, size;
367
368 /*
369 * Reserve usable memory.
370 */
371 if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
372 continue;
373
374 /*
375 * We are rounding up the start address of usable memory:
376 */
377 curr_pfn = PFN_UP(boot_mem_map.map[i].addr);
378 if (curr_pfn >= max_low_pfn)
379 continue;
380 if (curr_pfn < start_pfn)
381 curr_pfn = start_pfn;
382
383 /*
384 * ... and at the end of the usable range downwards:
385 */
386 last_pfn = PFN_DOWN(boot_mem_map.map[i].addr
387 + boot_mem_map.map[i].size);
388
389 if (last_pfn > max_low_pfn)
390 last_pfn = max_low_pfn;
391
392 /*
393 * Only register lowmem part of lowmem segment with bootmem.
394 */
395 size = last_pfn - curr_pfn;
396 if (curr_pfn > PFN_DOWN(HIGHMEM_START))
397 continue;
398 if (curr_pfn + size - 1 > PFN_DOWN(HIGHMEM_START))
399 size = PFN_DOWN(HIGHMEM_START) - curr_pfn;
400 if (!size)
401 continue;
402
403 /*
404 * ... finally, did all the rounding and playing
405 * around just make the area go away?
406 */
407 if (last_pfn <= curr_pfn)
408 continue;
409
410 /* Register lowmem ranges */
411 free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
412 }
413
414 /* Reserve the bootmap memory. */
415 reserve_bootmem(PFN_PHYS(first_usable_pfn), bootmap_size);
416#endif /* CONFIG_SGI_IP27 */
417
418#ifdef CONFIG_BLK_DEV_INITRD
419 initrd_below_start_ok = 1;
420 if (initrd_start) {
421 unsigned long initrd_size = ((unsigned char *)initrd_end) - ((unsigned char *)initrd_start);
422 printk("Initial ramdisk at: 0x%p (%lu bytes)\n",
423 (void *)initrd_start, initrd_size);
424
425 if (CPHYSADDR(initrd_end) > PFN_PHYS(max_low_pfn)) {
426 printk("initrd extends beyond end of memory "
427 "(0x%0*Lx > 0x%0*Lx)\ndisabling initrd\n",
428 sizeof(long) * 2,
429 (unsigned long long)CPHYSADDR(initrd_end),
430 sizeof(long) * 2,
431 (unsigned long long)PFN_PHYS(max_low_pfn));
432 initrd_start = initrd_end = 0;
433 initrd_reserve_bootmem = 0;
434 }
435
436 if (initrd_reserve_bootmem)
437 reserve_bootmem(CPHYSADDR(initrd_start), initrd_size);
438 }
439#endif /* CONFIG_BLK_DEV_INITRD */
440}
441
442static inline void resource_init(void)
443{
444 int i;
445
446#if defined(CONFIG_MIPS64) && !defined(CONFIG_BUILD_ELF64)
447 /*
448 * The 64bit code in 32bit object format trick can't represent
449 * 64bit wide relocations for linker script symbols.
450 */
451 code_resource.start = CPHYSADDR(&_text);
452 code_resource.end = CPHYSADDR(&_etext) - 1;
453 data_resource.start = CPHYSADDR(&_etext);
454 data_resource.end = CPHYSADDR(&_edata) - 1;
455#else
456 code_resource.start = virt_to_phys(&_text);
457 code_resource.end = virt_to_phys(&_etext) - 1;
458 data_resource.start = virt_to_phys(&_etext);
459 data_resource.end = virt_to_phys(&_edata) - 1;
460#endif
461
462 /*
463 * Request address space for all standard RAM.
464 */
465 for (i = 0; i < boot_mem_map.nr_map; i++) {
466 struct resource *res;
467 unsigned long start, end;
468
469 start = boot_mem_map.map[i].addr;
470 end = boot_mem_map.map[i].addr + boot_mem_map.map[i].size - 1;
471 if (start >= MAXMEM)
472 continue;
473 if (end >= MAXMEM)
474 end = MAXMEM - 1;
475
476 res = alloc_bootmem(sizeof(struct resource));
477 switch (boot_mem_map.map[i].type) {
478 case BOOT_MEM_RAM:
479 case BOOT_MEM_ROM_DATA:
480 res->name = "System RAM";
481 break;
482 case BOOT_MEM_RESERVED:
483 default:
484 res->name = "reserved";
485 }
486
487 res->start = start;
488 res->end = end;
489
490 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
491 request_resource(&iomem_resource, res);
492
493 /*
494 * We don't know which RAM region contains kernel data,
495 * so we try it repeatedly and let the resource manager
496 * test it.
497 */
498 request_resource(res, &code_resource);
499 request_resource(res, &data_resource);
500 }
501}
502
503#undef PFN_UP
504#undef PFN_DOWN
505#undef PFN_PHYS
506
507#undef MAXMEM
508#undef MAXMEM_PFN
509
510static int __initdata earlyinit_debug;
511
512static int __init earlyinit_debug_setup(char *str)
513{
514 earlyinit_debug = 1;
515 return 1;
516}
517__setup("earlyinit_debug", earlyinit_debug_setup);
518
519extern initcall_t __earlyinitcall_start, __earlyinitcall_end;
520
521static void __init do_earlyinitcalls(void)
522{
523 initcall_t *call, *start, *end;
524
525 start = &__earlyinitcall_start;
526 end = &__earlyinitcall_end;
527
528 for (call = start; call < end; call++) {
529 if (earlyinit_debug)
530 printk("calling earlyinitcall 0x%p\n", *call);
531
532 (*call)();
533 }
534}
535
536void __init setup_arch(char **cmdline_p)
537{
538 cpu_probe();
539 prom_init();
540 cpu_report();
541
542#if defined(CONFIG_VT)
543#if defined(CONFIG_VGA_CONSOLE)
544 conswitchp = &vga_con;
545#elif defined(CONFIG_DUMMY_CONSOLE)
546 conswitchp = &dummy_con;
547#endif
548#endif
549
550 /* call board setup routine */
551 do_earlyinitcalls();
552
553 strlcpy(command_line, arcs_cmdline, sizeof(command_line));
554 strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
555
556 *cmdline_p = command_line;
557
558 parse_cmdline_early();
559 bootmem_init();
560 paging_init();
561 resource_init();
562}
563
564int __init fpu_disable(char *s)
565{
566 cpu_data[0].options &= ~MIPS_CPU_FPU;
567
568 return 1;
569}
570
571__setup("nofpu", fpu_disable);
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h
new file mode 100644
index 000000000000..f9234df53253
--- /dev/null
+++ b/arch/mips/kernel/signal-common.h
@@ -0,0 +1,137 @@
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) 1991, 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2000 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */
10
11static inline int
12setup_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
13{
14 int err = 0;
15
16 err |= __put_user(regs->cp0_epc, &sc->sc_pc);
17 err |= __put_user(regs->cp0_status, &sc->sc_status);
18
19#define save_gp_reg(i) do { \
20 err |= __put_user(regs->regs[i], &sc->sc_regs[i]); \
21} while(0)
22 __put_user(0, &sc->sc_regs[0]); save_gp_reg(1); save_gp_reg(2);
23 save_gp_reg(3); save_gp_reg(4); save_gp_reg(5); save_gp_reg(6);
24 save_gp_reg(7); save_gp_reg(8); save_gp_reg(9); save_gp_reg(10);
25 save_gp_reg(11); save_gp_reg(12); save_gp_reg(13); save_gp_reg(14);
26 save_gp_reg(15); save_gp_reg(16); save_gp_reg(17); save_gp_reg(18);
27 save_gp_reg(19); save_gp_reg(20); save_gp_reg(21); save_gp_reg(22);
28 save_gp_reg(23); save_gp_reg(24); save_gp_reg(25); save_gp_reg(26);
29 save_gp_reg(27); save_gp_reg(28); save_gp_reg(29); save_gp_reg(30);
30 save_gp_reg(31);
31#undef save_gp_reg
32
33 err |= __put_user(regs->hi, &sc->sc_mdhi);
34 err |= __put_user(regs->lo, &sc->sc_mdlo);
35 err |= __put_user(regs->cp0_cause, &sc->sc_cause);
36 err |= __put_user(regs->cp0_badvaddr, &sc->sc_badvaddr);
37
38 err |= __put_user(!!used_math(), &sc->sc_used_math);
39
40 if (!used_math())
41 goto out;
42
43 /*
44 * Save FPU state to signal context. Signal handler will "inherit"
45 * current FPU state.
46 */
47 preempt_disable();
48
49 if (!is_fpu_owner()) {
50 own_fpu();
51 restore_fp(current);
52 }
53 err |= save_fp_context(sc);
54
55 preempt_enable();
56
57out:
58 return err;
59}
60
61static inline int
62restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
63{
64 int err = 0;
65 unsigned int used_math;
66
67 /* Always make any pending restarted system calls return -EINTR */
68 current_thread_info()->restart_block.fn = do_no_restart_syscall;
69
70 err |= __get_user(regs->cp0_epc, &sc->sc_pc);
71 err |= __get_user(regs->hi, &sc->sc_mdhi);
72 err |= __get_user(regs->lo, &sc->sc_mdlo);
73
74#define restore_gp_reg(i) do { \
75 err |= __get_user(regs->regs[i], &sc->sc_regs[i]); \
76} while(0)
77 restore_gp_reg( 1); restore_gp_reg( 2); restore_gp_reg( 3);
78 restore_gp_reg( 4); restore_gp_reg( 5); restore_gp_reg( 6);
79 restore_gp_reg( 7); restore_gp_reg( 8); restore_gp_reg( 9);
80 restore_gp_reg(10); restore_gp_reg(11); restore_gp_reg(12);
81 restore_gp_reg(13); restore_gp_reg(14); restore_gp_reg(15);
82 restore_gp_reg(16); restore_gp_reg(17); restore_gp_reg(18);
83 restore_gp_reg(19); restore_gp_reg(20); restore_gp_reg(21);
84 restore_gp_reg(22); restore_gp_reg(23); restore_gp_reg(24);
85 restore_gp_reg(25); restore_gp_reg(26); restore_gp_reg(27);
86 restore_gp_reg(28); restore_gp_reg(29); restore_gp_reg(30);
87 restore_gp_reg(31);
88#undef restore_gp_reg
89
90 err |= __get_user(used_math, &sc->sc_used_math);
91 conditional_used_math(used_math);
92
93 preempt_disable();
94
95 if (used_math()) {
96 /* restore fpu context if we have used it before */
97 own_fpu();
98 err |= restore_fp_context(sc);
99 } else {
100 /* signal handler may have used FPU. Give it up. */
101 lose_fpu();
102 }
103
104 preempt_enable();
105
106 return err;
107}
108
109/*
110 * Determine which stack to use..
111 */
112static inline void *
113get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
114{
115 unsigned long sp, almask;
116
117 /* Default to using normal stack */
118 sp = regs->regs[29];
119
120 /*
121 * FPU emulator may have it's own trampoline active just
122 * above the user stack, 16-bytes before the next lowest
123 * 16 byte boundary. Try to avoid trashing it.
124 */
125 sp -= 32;
126
127 /* This is the X/Open sanctioned signal stack switching. */
128 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
129 sp = current->sas_ss_sp + current->sas_ss_size;
130
131 if (PLAT_TRAMPOLINE_STUFF_LINE)
132 almask = ~(PLAT_TRAMPOLINE_STUFF_LINE - 1);
133 else
134 almask = ALMASK;
135
136 return (void *)((sp - frame_size) & almask);
137}
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
new file mode 100644
index 000000000000..508026ae5842
--- /dev/null
+++ b/arch/mips/kernel/signal.c
@@ -0,0 +1,517 @@
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) 1991, 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2000 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */
10#include <linux/config.h>
11#include <linux/sched.h>
12#include <linux/mm.h>
13#include <linux/personality.h>
14#include <linux/smp.h>
15#include <linux/smp_lock.h>
16#include <linux/kernel.h>
17#include <linux/signal.h>
18#include <linux/errno.h>
19#include <linux/wait.h>
20#include <linux/ptrace.h>
21#include <linux/unistd.h>
22#include <linux/compiler.h>
23
24#include <asm/asm.h>
25#include <linux/bitops.h>
26#include <asm/cacheflush.h>
27#include <asm/fpu.h>
28#include <asm/sim.h>
29#include <asm/uaccess.h>
30#include <asm/ucontext.h>
31#include <asm/cpu-features.h>
32
33#include "signal-common.h"
34
35#define DEBUG_SIG 0
36
37#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
38
39static int do_signal(sigset_t *oldset, struct pt_regs *regs);
40
41/*
42 * Atomically swap in the new signal mask, and wait for a signal.
43 */
44
45#ifdef CONFIG_TRAD_SIGNALS
46save_static_function(sys_sigsuspend);
47__attribute_used__ noinline static int
48_sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
49{
50 sigset_t *uset, saveset, newset;
51
52 uset = (sigset_t *) regs.regs[4];
53 if (copy_from_user(&newset, uset, sizeof(sigset_t)))
54 return -EFAULT;
55 sigdelsetmask(&newset, ~_BLOCKABLE);
56
57 spin_lock_irq(&current->sighand->siglock);
58 saveset = current->blocked;
59 current->blocked = newset;
60 recalc_sigpending();
61 spin_unlock_irq(&current->sighand->siglock);
62
63 regs.regs[2] = EINTR;
64 regs.regs[7] = 1;
65 while (1) {
66 current->state = TASK_INTERRUPTIBLE;
67 schedule();
68 if (do_signal(&saveset, &regs))
69 return -EINTR;
70 }
71}
72#endif
73
74save_static_function(sys_rt_sigsuspend);
75__attribute_used__ noinline static int
76_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
77{
78 sigset_t *unewset, saveset, newset;
79 size_t sigsetsize;
80
81 /* XXX Don't preclude handling different sized sigset_t's. */
82 sigsetsize = regs.regs[5];
83 if (sigsetsize != sizeof(sigset_t))
84 return -EINVAL;
85
86 unewset = (sigset_t *) regs.regs[4];
87 if (copy_from_user(&newset, unewset, sizeof(newset)))
88 return -EFAULT;
89 sigdelsetmask(&newset, ~_BLOCKABLE);
90
91 spin_lock_irq(&current->sighand->siglock);
92 saveset = current->blocked;
93 current->blocked = newset;
94 recalc_sigpending();
95 spin_unlock_irq(&current->sighand->siglock);
96
97 regs.regs[2] = EINTR;
98 regs.regs[7] = 1;
99 while (1) {
100 current->state = TASK_INTERRUPTIBLE;
101 schedule();
102 if (do_signal(&saveset, &regs))
103 return -EINTR;
104 }
105}
106
107#ifdef CONFIG_TRAD_SIGNALS
108asmlinkage int sys_sigaction(int sig, const struct sigaction *act,
109 struct sigaction *oact)
110{
111 struct k_sigaction new_ka, old_ka;
112 int ret;
113 int err = 0;
114
115 if (act) {
116 old_sigset_t mask;
117
118 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
119 return -EFAULT;
120 err |= __get_user(new_ka.sa.sa_handler, &act->sa_handler);
121 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
122 err |= __get_user(mask, &act->sa_mask.sig[0]);
123 if (err)
124 return -EFAULT;
125
126 siginitset(&new_ka.sa.sa_mask, mask);
127 }
128
129 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
130
131 if (!ret && oact) {
132 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
133 return -EFAULT;
134 err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
135 err |= __put_user(old_ka.sa.sa_handler, &oact->sa_handler);
136 err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
137 err |= __put_user(0, &oact->sa_mask.sig[1]);
138 err |= __put_user(0, &oact->sa_mask.sig[2]);
139 err |= __put_user(0, &oact->sa_mask.sig[3]);
140 if (err)
141 return -EFAULT;
142 }
143
144 return ret;
145}
146#endif
147
148asmlinkage int sys_sigaltstack(nabi_no_regargs struct pt_regs regs)
149{
150 const stack_t *uss = (const stack_t *) regs.regs[4];
151 stack_t *uoss = (stack_t *) regs.regs[5];
152 unsigned long usp = regs.regs[29];
153
154 return do_sigaltstack(uss, uoss, usp);
155}
156
157#if PLAT_TRAMPOLINE_STUFF_LINE
158#define __tramp __attribute__((aligned(PLAT_TRAMPOLINE_STUFF_LINE)))
159#else
160#define __tramp
161#endif
162
163#ifdef CONFIG_TRAD_SIGNALS
164struct sigframe {
165 u32 sf_ass[4]; /* argument save space for o32 */
166 u32 sf_code[2] __tramp; /* signal trampoline */
167 struct sigcontext sf_sc __tramp;
168 sigset_t sf_mask;
169};
170#endif
171
172struct rt_sigframe {
173 u32 rs_ass[4]; /* argument save space for o32 */
174 u32 rs_code[2] __tramp; /* signal trampoline */
175 struct siginfo rs_info __tramp;
176 struct ucontext rs_uc;
177};
178
179#ifdef CONFIG_TRAD_SIGNALS
180save_static_function(sys_sigreturn);
181__attribute_used__ noinline static void
182_sys_sigreturn(nabi_no_regargs struct pt_regs regs)
183{
184 struct sigframe *frame;
185 sigset_t blocked;
186
187 frame = (struct sigframe *) regs.regs[29];
188 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
189 goto badframe;
190 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
191 goto badframe;
192
193 sigdelsetmask(&blocked, ~_BLOCKABLE);
194 spin_lock_irq(&current->sighand->siglock);
195 current->blocked = blocked;
196 recalc_sigpending();
197 spin_unlock_irq(&current->sighand->siglock);
198
199 if (restore_sigcontext(&regs, &frame->sf_sc))
200 goto badframe;
201
202 /*
203 * Don't let your children do this ...
204 */
205 if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
206 do_syscall_trace(&regs, 1);
207 __asm__ __volatile__(
208 "move\t$29, %0\n\t"
209 "j\tsyscall_exit"
210 :/* no outputs */
211 :"r" (&regs));
212 /* Unreached */
213
214badframe:
215 force_sig(SIGSEGV, current);
216}
217#endif
218
219save_static_function(sys_rt_sigreturn);
220__attribute_used__ noinline static void
221_sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
222{
223 struct rt_sigframe *frame;
224 sigset_t set;
225 stack_t st;
226
227 frame = (struct rt_sigframe *) regs.regs[29];
228 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
229 goto badframe;
230 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
231 goto badframe;
232
233 sigdelsetmask(&set, ~_BLOCKABLE);
234 spin_lock_irq(&current->sighand->siglock);
235 current->blocked = set;
236 recalc_sigpending();
237 spin_unlock_irq(&current->sighand->siglock);
238
239 if (restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext))
240 goto badframe;
241
242 if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st)))
243 goto badframe;
244 /* It is more difficult to avoid calling this function than to
245 call it and ignore errors. */
246 do_sigaltstack(&st, NULL, regs.regs[29]);
247
248 /*
249 * Don't let your children do this ...
250 */
251 __asm__ __volatile__(
252 "move\t$29, %0\n\t"
253 "j\tsyscall_exit"
254 :/* no outputs */
255 :"r" (&regs));
256 /* Unreached */
257
258badframe:
259 force_sig(SIGSEGV, current);
260}
261
262#ifdef CONFIG_TRAD_SIGNALS
263static void inline setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
264 int signr, sigset_t *set)
265{
266 struct sigframe *frame;
267 int err = 0;
268
269 frame = get_sigframe(ka, regs, sizeof(*frame));
270 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
271 goto give_sigsegv;
272
273 /*
274 * Set up the return code ...
275 *
276 * li v0, __NR_sigreturn
277 * syscall
278 */
279 if (PLAT_TRAMPOLINE_STUFF_LINE)
280 __clear_user(frame->sf_code, PLAT_TRAMPOLINE_STUFF_LINE);
281 err |= __put_user(0x24020000 + __NR_sigreturn, frame->sf_code + 0);
282 err |= __put_user(0x0000000c , frame->sf_code + 1);
283 flush_cache_sigtramp((unsigned long) frame->sf_code);
284
285 err |= setup_sigcontext(regs, &frame->sf_sc);
286 err |= __copy_to_user(&frame->sf_mask, set, sizeof(*set));
287 if (err)
288 goto give_sigsegv;
289
290 /*
291 * Arguments to signal handler:
292 *
293 * a0 = signal number
294 * a1 = 0 (should be cause)
295 * a2 = pointer to struct sigcontext
296 *
297 * $25 and c0_epc point to the signal handler, $29 points to the
298 * struct sigframe.
299 */
300 regs->regs[ 4] = signr;
301 regs->regs[ 5] = 0;
302 regs->regs[ 6] = (unsigned long) &frame->sf_sc;
303 regs->regs[29] = (unsigned long) frame;
304 regs->regs[31] = (unsigned long) frame->sf_code;
305 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
306
307#if DEBUG_SIG
308 printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
309 current->comm, current->pid,
310 frame, regs->cp0_epc, frame->regs[31]);
311#endif
312 return;
313
314give_sigsegv:
315 force_sigsegv(signr, current);
316}
317#endif
318
319static void inline setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
320 int signr, sigset_t *set, siginfo_t *info)
321{
322 struct rt_sigframe *frame;
323 int err = 0;
324
325 frame = get_sigframe(ka, regs, sizeof(*frame));
326 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
327 goto give_sigsegv;
328
329 /*
330 * Set up the return code ...
331 *
332 * li v0, __NR_rt_sigreturn
333 * syscall
334 */
335 if (PLAT_TRAMPOLINE_STUFF_LINE)
336 __clear_user(frame->rs_code, PLAT_TRAMPOLINE_STUFF_LINE);
337 err |= __put_user(0x24020000 + __NR_rt_sigreturn, frame->rs_code + 0);
338 err |= __put_user(0x0000000c , frame->rs_code + 1);
339 flush_cache_sigtramp((unsigned long) frame->rs_code);
340
341 /* Create siginfo. */
342 err |= copy_siginfo_to_user(&frame->rs_info, info);
343
344 /* Create the ucontext. */
345 err |= __put_user(0, &frame->rs_uc.uc_flags);
346 err |= __put_user(0, &frame->rs_uc.uc_link);
347 err |= __put_user((void *)current->sas_ss_sp,
348 &frame->rs_uc.uc_stack.ss_sp);
349 err |= __put_user(sas_ss_flags(regs->regs[29]),
350 &frame->rs_uc.uc_stack.ss_flags);
351 err |= __put_user(current->sas_ss_size,
352 &frame->rs_uc.uc_stack.ss_size);
353 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
354 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
355
356 if (err)
357 goto give_sigsegv;
358
359 /*
360 * Arguments to signal handler:
361 *
362 * a0 = signal number
363 * a1 = 0 (should be cause)
364 * a2 = pointer to ucontext
365 *
366 * $25 and c0_epc point to the signal handler, $29 points to
367 * the struct rt_sigframe.
368 */
369 regs->regs[ 4] = signr;
370 regs->regs[ 5] = (unsigned long) &frame->rs_info;
371 regs->regs[ 6] = (unsigned long) &frame->rs_uc;
372 regs->regs[29] = (unsigned long) frame;
373 regs->regs[31] = (unsigned long) frame->rs_code;
374 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
375
376#if DEBUG_SIG
377 printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
378 current->comm, current->pid,
379 frame, regs->cp0_epc, regs->regs[31]);
380#endif
381 return;
382
383give_sigsegv:
384 force_sigsegv(signr, current);
385}
386
387extern void setup_rt_frame_n32(struct k_sigaction * ka,
388 struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info);
389
390static inline void handle_signal(unsigned long sig, siginfo_t *info,
391 struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs)
392{
393 switch(regs->regs[0]) {
394 case ERESTART_RESTARTBLOCK:
395 case ERESTARTNOHAND:
396 regs->regs[2] = EINTR;
397 break;
398 case ERESTARTSYS:
399 if(!(ka->sa.sa_flags & SA_RESTART)) {
400 regs->regs[2] = EINTR;
401 break;
402 }
403 /* fallthrough */
404 case ERESTARTNOINTR: /* Userland will reload $v0. */
405 regs->regs[7] = regs->regs[26];
406 regs->cp0_epc -= 8;
407 }
408
409 regs->regs[0] = 0; /* Don't deal with this again. */
410
411#ifdef CONFIG_TRAD_SIGNALS
412 if (ka->sa.sa_flags & SA_SIGINFO) {
413#else
414 if (1) {
415#endif
416#ifdef CONFIG_MIPS32_N32
417 if ((current->thread.mflags & MF_ABI_MASK) == MF_N32)
418 setup_rt_frame_n32 (ka, regs, sig, oldset, info);
419 else
420#endif
421 setup_rt_frame(ka, regs, sig, oldset, info);
422 }
423#ifdef CONFIG_TRAD_SIGNALS
424 else
425 setup_frame(ka, regs, sig, oldset);
426#endif
427
428 if (!(ka->sa.sa_flags & SA_NODEFER)) {
429 spin_lock_irq(&current->sighand->siglock);
430 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
431 sigaddset(&current->blocked,sig);
432 recalc_sigpending();
433 spin_unlock_irq(&current->sighand->siglock);
434 }
435}
436
437extern int do_signal32(sigset_t *oldset, struct pt_regs *regs);
438extern int do_irix_signal(sigset_t *oldset, struct pt_regs *regs);
439
440static int do_signal(sigset_t *oldset, struct pt_regs *regs)
441{
442 struct k_sigaction ka;
443 siginfo_t info;
444 int signr;
445
446#ifdef CONFIG_BINFMT_ELF32
447 if ((current->thread.mflags & MF_ABI_MASK) == MF_O32) {
448 return do_signal32(oldset, regs);
449 }
450#endif
451
452 /*
453 * We want the common case to go fast, which is why we may in certain
454 * cases get here from kernel mode. Just return without doing anything
455 * if so.
456 */
457 if (!user_mode(regs))
458 return 1;
459
460 if (try_to_freeze(0))
461 goto no_signal;
462
463 if (!oldset)
464 oldset = &current->blocked;
465
466 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
467 if (signr > 0) {
468 handle_signal(signr, &info, &ka, oldset, regs);
469 return 1;
470 }
471
472no_signal:
473 /*
474 * Who's code doesn't conform to the restartable syscall convention
475 * dies here!!! The li instruction, a single machine instruction,
476 * must directly be followed by the syscall instruction.
477 */
478 if (regs->regs[0]) {
479 if (regs->regs[2] == ERESTARTNOHAND ||
480 regs->regs[2] == ERESTARTSYS ||
481 regs->regs[2] == ERESTARTNOINTR) {
482 regs->regs[7] = regs->regs[26];
483 regs->cp0_epc -= 8;
484 }
485 if (regs->regs[2] == ERESTART_RESTARTBLOCK) {
486 regs->regs[2] = __NR_restart_syscall;
487 regs->regs[7] = regs->regs[26];
488 regs->cp0_epc -= 4;
489 }
490 }
491 return 0;
492}
493
494/*
495 * notification of userspace execution resumption
496 * - triggered by current->work.notify_resume
497 */
498asmlinkage void do_notify_resume(struct pt_regs *regs, sigset_t *oldset,
499 __u32 thread_info_flags)
500{
501 /* deal with pending signal delivery */
502 if (thread_info_flags & _TIF_SIGPENDING) {
503#ifdef CONFIG_BINFMT_ELF32
504 if (likely((current->thread.mflags & MF_ABI_MASK) == MF_O32)) {
505 do_signal32(oldset, regs);
506 return;
507 }
508#endif
509#ifdef CONFIG_BINFMT_IRIX
510 if (unlikely(current->personality != PER_LINUX)) {
511 do_irix_signal(oldset, regs);
512 return;
513 }
514#endif
515 do_signal(oldset, regs);
516 }
517}
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
new file mode 100644
index 000000000000..1f3b19124c01
--- /dev/null
+++ b/arch/mips/kernel/signal32.c
@@ -0,0 +1,905 @@
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) 1991, 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2000 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */
10#include <linux/sched.h>
11#include <linux/mm.h>
12#include <linux/smp.h>
13#include <linux/smp_lock.h>
14#include <linux/kernel.h>
15#include <linux/signal.h>
16#include <linux/syscalls.h>
17#include <linux/errno.h>
18#include <linux/wait.h>
19#include <linux/ptrace.h>
20#include <linux/compat.h>
21#include <linux/suspend.h>
22#include <linux/compiler.h>
23
24#include <asm/asm.h>
25#include <linux/bitops.h>
26#include <asm/cacheflush.h>
27#include <asm/sim.h>
28#include <asm/uaccess.h>
29#include <asm/ucontext.h>
30#include <asm/system.h>
31#include <asm/fpu.h>
32
33#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
34
35typedef struct compat_siginfo {
36 int si_signo;
37 int si_code;
38 int si_errno;
39
40 union {
41 int _pad[SI_PAD_SIZE32];
42
43 /* kill() */
44 struct {
45 compat_pid_t _pid; /* sender's pid */
46 compat_uid_t _uid; /* sender's uid */
47 } _kill;
48
49 /* SIGCHLD */
50 struct {
51 compat_pid_t _pid; /* which child */
52 compat_uid_t _uid; /* sender's uid */
53 int _status; /* exit code */
54 compat_clock_t _utime;
55 compat_clock_t _stime;
56 } _sigchld;
57
58 /* IRIX SIGCHLD */
59 struct {
60 compat_pid_t _pid; /* which child */
61 compat_clock_t _utime;
62 int _status; /* exit code */
63 compat_clock_t _stime;
64 } _irix_sigchld;
65
66 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
67 struct {
68 s32 _addr; /* faulting insn/memory ref. */
69 } _sigfault;
70
71 /* SIGPOLL, SIGXFSZ (To do ...) */
72 struct {
73 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
74 int _fd;
75 } _sigpoll;
76
77 /* POSIX.1b timers */
78 struct {
79 unsigned int _timer1;
80 unsigned int _timer2;
81 } _timer;
82
83 /* POSIX.1b signals */
84 struct {
85 compat_pid_t _pid; /* sender's pid */
86 compat_uid_t _uid; /* sender's uid */
87 compat_sigval_t _sigval;
88 } _rt;
89
90 } _sifields;
91} compat_siginfo_t;
92
93/*
94 * Including <asm/unistd.h> would give use the 64-bit syscall numbers ...
95 */
96#define __NR_O32_sigreturn 4119
97#define __NR_O32_rt_sigreturn 4193
98#define __NR_O32_restart_syscall 4253
99
100#define DEBUG_SIG 0
101
102#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
103
104extern int do_signal32(sigset_t *oldset, struct pt_regs *regs);
105
106/* 32-bit compatibility types */
107
108#define _NSIG_BPW32 32
109#define _NSIG_WORDS32 (_NSIG / _NSIG_BPW32)
110
111typedef struct {
112 unsigned int sig[_NSIG_WORDS32];
113} sigset_t32;
114
115typedef unsigned int __sighandler32_t;
116typedef void (*vfptr_t)(void);
117
118struct sigaction32 {
119 unsigned int sa_flags;
120 __sighandler32_t sa_handler;
121 compat_sigset_t sa_mask;
122};
123
124/* IRIX compatible stack_t */
125typedef struct sigaltstack32 {
126 s32 ss_sp;
127 compat_size_t ss_size;
128 int ss_flags;
129} stack32_t;
130
131struct ucontext32 {
132 u32 uc_flags;
133 s32 uc_link;
134 stack32_t uc_stack;
135 struct sigcontext32 uc_mcontext;
136 sigset_t32 uc_sigmask; /* mask last for extensibility */
137};
138
139extern void __put_sigset_unknown_nsig(void);
140extern void __get_sigset_unknown_nsig(void);
141
142static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t *ubuf)
143{
144 int err = 0;
145
146 if (!access_ok(VERIFY_WRITE, ubuf, sizeof(*ubuf)))
147 return -EFAULT;
148
149 switch (_NSIG_WORDS) {
150 default:
151 __put_sigset_unknown_nsig();
152 case 2:
153 err |= __put_user (kbuf->sig[1] >> 32, &ubuf->sig[3]);
154 err |= __put_user (kbuf->sig[1] & 0xffffffff, &ubuf->sig[2]);
155 case 1:
156 err |= __put_user (kbuf->sig[0] >> 32, &ubuf->sig[1]);
157 err |= __put_user (kbuf->sig[0] & 0xffffffff, &ubuf->sig[0]);
158 }
159
160 return err;
161}
162
163static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t *ubuf)
164{
165 int err = 0;
166 unsigned long sig[4];
167
168 if (!access_ok(VERIFY_READ, ubuf, sizeof(*ubuf)))
169 return -EFAULT;
170
171 switch (_NSIG_WORDS) {
172 default:
173 __get_sigset_unknown_nsig();
174 case 2:
175 err |= __get_user (sig[3], &ubuf->sig[3]);
176 err |= __get_user (sig[2], &ubuf->sig[2]);
177 kbuf->sig[1] = sig[2] | (sig[3] << 32);
178 case 1:
179 err |= __get_user (sig[1], &ubuf->sig[1]);
180 err |= __get_user (sig[0], &ubuf->sig[0]);
181 kbuf->sig[0] = sig[0] | (sig[1] << 32);
182 }
183
184 return err;
185}
186
187/*
188 * Atomically swap in the new signal mask, and wait for a signal.
189 */
190
191save_static_function(sys32_sigsuspend);
192__attribute_used__ noinline static int
193_sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
194{
195 compat_sigset_t *uset;
196 sigset_t newset, saveset;
197
198 uset = (compat_sigset_t *) regs.regs[4];
199 if (get_sigset(&newset, uset))
200 return -EFAULT;
201 sigdelsetmask(&newset, ~_BLOCKABLE);
202
203 spin_lock_irq(&current->sighand->siglock);
204 saveset = current->blocked;
205 current->blocked = newset;
206 recalc_sigpending();
207 spin_unlock_irq(&current->sighand->siglock);
208
209 regs.regs[2] = EINTR;
210 regs.regs[7] = 1;
211 while (1) {
212 current->state = TASK_INTERRUPTIBLE;
213 schedule();
214 if (do_signal32(&saveset, &regs))
215 return -EINTR;
216 }
217}
218
219save_static_function(sys32_rt_sigsuspend);
220__attribute_used__ noinline static int
221_sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
222{
223 compat_sigset_t *uset;
224 sigset_t newset, saveset;
225 size_t sigsetsize;
226
227 /* XXX Don't preclude handling different sized sigset_t's. */
228 sigsetsize = regs.regs[5];
229 if (sigsetsize != sizeof(compat_sigset_t))
230 return -EINVAL;
231
232 uset = (compat_sigset_t *) regs.regs[4];
233 if (get_sigset(&newset, uset))
234 return -EFAULT;
235 sigdelsetmask(&newset, ~_BLOCKABLE);
236
237 spin_lock_irq(&current->sighand->siglock);
238 saveset = current->blocked;
239 current->blocked = newset;
240 recalc_sigpending();
241 spin_unlock_irq(&current->sighand->siglock);
242
243 regs.regs[2] = EINTR;
244 regs.regs[7] = 1;
245 while (1) {
246 current->state = TASK_INTERRUPTIBLE;
247 schedule();
248 if (do_signal32(&saveset, &regs))
249 return -EINTR;
250 }
251}
252
253asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
254 struct sigaction32 *oact)
255{
256 struct k_sigaction new_ka, old_ka;
257 int ret;
258 int err = 0;
259
260 if (act) {
261 old_sigset_t mask;
262
263 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
264 return -EFAULT;
265 err |= __get_user((u32)(u64)new_ka.sa.sa_handler,
266 &act->sa_handler);
267 err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
268 err |= __get_user(mask, &act->sa_mask.sig[0]);
269 if (err)
270 return -EFAULT;
271
272 siginitset(&new_ka.sa.sa_mask, mask);
273 }
274
275 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
276
277 if (!ret && oact) {
278 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
279 return -EFAULT;
280 err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
281 err |= __put_user((u32)(u64)old_ka.sa.sa_handler,
282 &oact->sa_handler);
283 err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
284 err |= __put_user(0, &oact->sa_mask.sig[1]);
285 err |= __put_user(0, &oact->sa_mask.sig[2]);
286 err |= __put_user(0, &oact->sa_mask.sig[3]);
287 if (err)
288 return -EFAULT;
289 }
290
291 return ret;
292}
293
294asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
295{
296 const stack32_t *uss = (const stack32_t *) regs.regs[4];
297 stack32_t *uoss = (stack32_t *) regs.regs[5];
298 unsigned long usp = regs.regs[29];
299 stack_t kss, koss;
300 int ret, err = 0;
301 mm_segment_t old_fs = get_fs();
302 s32 sp;
303
304 if (uss) {
305 if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
306 return -EFAULT;
307 err |= __get_user(sp, &uss->ss_sp);
308 kss.ss_sp = (void *) (long) sp;
309 err |= __get_user(kss.ss_size, &uss->ss_size);
310 err |= __get_user(kss.ss_flags, &uss->ss_flags);
311 if (err)
312 return -EFAULT;
313 }
314
315 set_fs (KERNEL_DS);
316 ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, usp);
317 set_fs (old_fs);
318
319 if (!ret && uoss) {
320 if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
321 return -EFAULT;
322 sp = (int) (long) koss.ss_sp;
323 err |= __put_user(sp, &uoss->ss_sp);
324 err |= __put_user(koss.ss_size, &uoss->ss_size);
325 err |= __put_user(koss.ss_flags, &uoss->ss_flags);
326 if (err)
327 return -EFAULT;
328 }
329 return ret;
330}
331
332static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 *sc)
333{
334 int err = 0;
335 __u32 used_math;
336
337 /* Always make any pending restarted system calls return -EINTR */
338 current_thread_info()->restart_block.fn = do_no_restart_syscall;
339
340 err |= __get_user(regs->cp0_epc, &sc->sc_pc);
341 err |= __get_user(regs->hi, &sc->sc_mdhi);
342 err |= __get_user(regs->lo, &sc->sc_mdlo);
343
344#define restore_gp_reg(i) do { \
345 err |= __get_user(regs->regs[i], &sc->sc_regs[i]); \
346} while(0)
347 restore_gp_reg( 1); restore_gp_reg( 2); restore_gp_reg( 3);
348 restore_gp_reg( 4); restore_gp_reg( 5); restore_gp_reg( 6);
349 restore_gp_reg( 7); restore_gp_reg( 8); restore_gp_reg( 9);
350 restore_gp_reg(10); restore_gp_reg(11); restore_gp_reg(12);
351 restore_gp_reg(13); restore_gp_reg(14); restore_gp_reg(15);
352 restore_gp_reg(16); restore_gp_reg(17); restore_gp_reg(18);
353 restore_gp_reg(19); restore_gp_reg(20); restore_gp_reg(21);
354 restore_gp_reg(22); restore_gp_reg(23); restore_gp_reg(24);
355 restore_gp_reg(25); restore_gp_reg(26); restore_gp_reg(27);
356 restore_gp_reg(28); restore_gp_reg(29); restore_gp_reg(30);
357 restore_gp_reg(31);
358#undef restore_gp_reg
359
360 err |= __get_user(used_math, &sc->sc_used_math);
361 conditional_used_math(used_math);
362
363 preempt_disable();
364
365 if (used_math()) {
366 /* restore fpu context if we have used it before */
367 own_fpu();
368 err |= restore_fp_context32(sc);
369 } else {
370 /* signal handler may have used FPU. Give it up. */
371 lose_fpu();
372 }
373
374 preempt_enable();
375
376 return err;
377}
378
379struct sigframe {
380 u32 sf_ass[4]; /* argument save space for o32 */
381 u32 sf_code[2]; /* signal trampoline */
382 struct sigcontext32 sf_sc;
383 sigset_t sf_mask;
384};
385
386struct rt_sigframe32 {
387 u32 rs_ass[4]; /* argument save space for o32 */
388 u32 rs_code[2]; /* signal trampoline */
389 compat_siginfo_t rs_info;
390 struct ucontext32 rs_uc;
391};
392
393int copy_siginfo_to_user32(compat_siginfo_t *to, siginfo_t *from)
394{
395 int err;
396
397 if (!access_ok (VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
398 return -EFAULT;
399
400 /* If you change siginfo_t structure, please be sure
401 this code is fixed accordingly.
402 It should never copy any pad contained in the structure
403 to avoid security leaks, but must copy the generic
404 3 ints plus the relevant union member.
405 This routine must convert siginfo from 64bit to 32bit as well
406 at the same time. */
407 err = __put_user(from->si_signo, &to->si_signo);
408 err |= __put_user(from->si_errno, &to->si_errno);
409 err |= __put_user((short)from->si_code, &to->si_code);
410 if (from->si_code < 0)
411 err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
412 else {
413 switch (from->si_code >> 16) {
414 case __SI_CHLD >> 16:
415 err |= __put_user(from->si_utime, &to->si_utime);
416 err |= __put_user(from->si_stime, &to->si_stime);
417 err |= __put_user(from->si_status, &to->si_status);
418 default:
419 err |= __put_user(from->si_pid, &to->si_pid);
420 err |= __put_user(from->si_uid, &to->si_uid);
421 break;
422 case __SI_FAULT >> 16:
423 err |= __put_user((long)from->si_addr, &to->si_addr);
424 break;
425 case __SI_POLL >> 16:
426 err |= __put_user(from->si_band, &to->si_band);
427 err |= __put_user(from->si_fd, &to->si_fd);
428 break;
429 case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
430 case __SI_MESGQ >> 16:
431 err |= __put_user(from->si_pid, &to->si_pid);
432 err |= __put_user(from->si_uid, &to->si_uid);
433 err |= __put_user(from->si_int, &to->si_int);
434 break;
435 }
436 }
437 return err;
438}
439
440save_static_function(sys32_sigreturn);
441__attribute_used__ noinline static void
442_sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
443{
444 struct sigframe *frame;
445 sigset_t blocked;
446
447 frame = (struct sigframe *) regs.regs[29];
448 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
449 goto badframe;
450 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
451 goto badframe;
452
453 sigdelsetmask(&blocked, ~_BLOCKABLE);
454 spin_lock_irq(&current->sighand->siglock);
455 current->blocked = blocked;
456 recalc_sigpending();
457 spin_unlock_irq(&current->sighand->siglock);
458
459 if (restore_sigcontext32(&regs, &frame->sf_sc))
460 goto badframe;
461
462 /*
463 * Don't let your children do this ...
464 */
465 if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
466 do_syscall_trace(&regs, 1);
467 __asm__ __volatile__(
468 "move\t$29, %0\n\t"
469 "j\tsyscall_exit"
470 :/* no outputs */
471 :"r" (&regs));
472 /* Unreached */
473
474badframe:
475 force_sig(SIGSEGV, current);
476}
477
478save_static_function(sys32_rt_sigreturn);
479__attribute_used__ noinline static void
480_sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
481{
482 struct rt_sigframe32 *frame;
483 sigset_t set;
484 stack_t st;
485 s32 sp;
486
487 frame = (struct rt_sigframe32 *) regs.regs[29];
488 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
489 goto badframe;
490 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
491 goto badframe;
492
493 sigdelsetmask(&set, ~_BLOCKABLE);
494 spin_lock_irq(&current->sighand->siglock);
495 current->blocked = set;
496 recalc_sigpending();
497 spin_unlock_irq(&current->sighand->siglock);
498
499 if (restore_sigcontext32(&regs, &frame->rs_uc.uc_mcontext))
500 goto badframe;
501
502 /* The ucontext contains a stack32_t, so we must convert! */
503 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
504 goto badframe;
505 st.ss_size = (long) sp;
506 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
507 goto badframe;
508 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
509 goto badframe;
510
511 /* It is more difficult to avoid calling this function than to
512 call it and ignore errors. */
513 do_sigaltstack(&st, NULL, regs.regs[29]);
514
515 /*
516 * Don't let your children do this ...
517 */
518 __asm__ __volatile__(
519 "move\t$29, %0\n\t"
520 "j\tsyscall_exit"
521 :/* no outputs */
522 :"r" (&regs));
523 /* Unreached */
524
525badframe:
526 force_sig(SIGSEGV, current);
527}
528
529static inline int setup_sigcontext32(struct pt_regs *regs,
530 struct sigcontext32 *sc)
531{
532 int err = 0;
533
534 err |= __put_user(regs->cp0_epc, &sc->sc_pc);
535 err |= __put_user(regs->cp0_status, &sc->sc_status);
536
537#define save_gp_reg(i) { \
538 err |= __put_user(regs->regs[i], &sc->sc_regs[i]); \
539} while(0)
540 __put_user(0, &sc->sc_regs[0]); save_gp_reg(1); save_gp_reg(2);
541 save_gp_reg(3); save_gp_reg(4); save_gp_reg(5); save_gp_reg(6);
542 save_gp_reg(7); save_gp_reg(8); save_gp_reg(9); save_gp_reg(10);
543 save_gp_reg(11); save_gp_reg(12); save_gp_reg(13); save_gp_reg(14);
544 save_gp_reg(15); save_gp_reg(16); save_gp_reg(17); save_gp_reg(18);
545 save_gp_reg(19); save_gp_reg(20); save_gp_reg(21); save_gp_reg(22);
546 save_gp_reg(23); save_gp_reg(24); save_gp_reg(25); save_gp_reg(26);
547 save_gp_reg(27); save_gp_reg(28); save_gp_reg(29); save_gp_reg(30);
548 save_gp_reg(31);
549#undef save_gp_reg
550
551 err |= __put_user(regs->hi, &sc->sc_mdhi);
552 err |= __put_user(regs->lo, &sc->sc_mdlo);
553 err |= __put_user(regs->cp0_cause, &sc->sc_cause);
554 err |= __put_user(regs->cp0_badvaddr, &sc->sc_badvaddr);
555
556 err |= __put_user(!!used_math(), &sc->sc_used_math);
557
558 if (!used_math())
559 goto out;
560
561 /*
562 * Save FPU state to signal context. Signal handler will "inherit"
563 * current FPU state.
564 */
565 preempt_disable();
566
567 if (!is_fpu_owner()) {
568 own_fpu();
569 restore_fp(current);
570 }
571 err |= save_fp_context32(sc);
572
573 preempt_enable();
574
575out:
576 return err;
577}
578
579/*
580 * Determine which stack to use..
581 */
582static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
583 size_t frame_size)
584{
585 unsigned long sp;
586
587 /* Default to using normal stack */
588 sp = regs->regs[29];
589
590 /*
591 * FPU emulator may have it's own trampoline active just
592 * above the user stack, 16-bytes before the next lowest
593 * 16 byte boundary. Try to avoid trashing it.
594 */
595 sp -= 32;
596
597 /* This is the X/Open sanctioned signal stack switching. */
598 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
599 sp = current->sas_ss_sp + current->sas_ss_size;
600
601 return (void *)((sp - frame_size) & ALMASK);
602}
603
604static inline void setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
605 int signr, sigset_t *set)
606{
607 struct sigframe *frame;
608 int err = 0;
609
610 frame = get_sigframe(ka, regs, sizeof(*frame));
611 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
612 goto give_sigsegv;
613
614 /*
615 * Set up the return code ...
616 *
617 * li v0, __NR_O32_sigreturn
618 * syscall
619 */
620 err |= __put_user(0x24020000 + __NR_O32_sigreturn, frame->sf_code + 0);
621 err |= __put_user(0x0000000c , frame->sf_code + 1);
622 flush_cache_sigtramp((unsigned long) frame->sf_code);
623
624 err |= setup_sigcontext32(regs, &frame->sf_sc);
625 err |= __copy_to_user(&frame->sf_mask, set, sizeof(*set));
626 if (err)
627 goto give_sigsegv;
628
629 /*
630 * Arguments to signal handler:
631 *
632 * a0 = signal number
633 * a1 = 0 (should be cause)
634 * a2 = pointer to struct sigcontext
635 *
636 * $25 and c0_epc point to the signal handler, $29 points to the
637 * struct sigframe.
638 */
639 regs->regs[ 4] = signr;
640 regs->regs[ 5] = 0;
641 regs->regs[ 6] = (unsigned long) &frame->sf_sc;
642 regs->regs[29] = (unsigned long) frame;
643 regs->regs[31] = (unsigned long) frame->sf_code;
644 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
645
646#if DEBUG_SIG
647 printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
648 current->comm, current->pid,
649 frame, regs->cp0_epc, frame->sf_code);
650#endif
651 return;
652
653give_sigsegv:
654 force_sigsegv(signr, current);
655}
656
657static inline void setup_rt_frame(struct k_sigaction * ka,
658 struct pt_regs *regs, int signr,
659 sigset_t *set, siginfo_t *info)
660{
661 struct rt_sigframe32 *frame;
662 int err = 0;
663 s32 sp;
664
665 frame = get_sigframe(ka, regs, sizeof(*frame));
666 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
667 goto give_sigsegv;
668
669 /* Set up to return from userspace. If provided, use a stub already
670 in userspace. */
671 /*
672 * Set up the return code ...
673 *
674 * li v0, __NR_O32_rt_sigreturn
675 * syscall
676 */
677 err |= __put_user(0x24020000 + __NR_O32_rt_sigreturn, frame->rs_code + 0);
678 err |= __put_user(0x0000000c , frame->rs_code + 1);
679 flush_cache_sigtramp((unsigned long) frame->rs_code);
680
681 /* Convert (siginfo_t -> compat_siginfo_t) and copy to user. */
682 err |= copy_siginfo_to_user32(&frame->rs_info, info);
683
684 /* Create the ucontext. */
685 err |= __put_user(0, &frame->rs_uc.uc_flags);
686 err |= __put_user(0, &frame->rs_uc.uc_link);
687 sp = (int) (long) current->sas_ss_sp;
688 err |= __put_user(sp,
689 &frame->rs_uc.uc_stack.ss_sp);
690 err |= __put_user(sas_ss_flags(regs->regs[29]),
691 &frame->rs_uc.uc_stack.ss_flags);
692 err |= __put_user(current->sas_ss_size,
693 &frame->rs_uc.uc_stack.ss_size);
694 err |= setup_sigcontext32(regs, &frame->rs_uc.uc_mcontext);
695 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
696
697 if (err)
698 goto give_sigsegv;
699
700 /*
701 * Arguments to signal handler:
702 *
703 * a0 = signal number
704 * a1 = 0 (should be cause)
705 * a2 = pointer to ucontext
706 *
707 * $25 and c0_epc point to the signal handler, $29 points to
708 * the struct rt_sigframe32.
709 */
710 regs->regs[ 4] = signr;
711 regs->regs[ 5] = (unsigned long) &frame->rs_info;
712 regs->regs[ 6] = (unsigned long) &frame->rs_uc;
713 regs->regs[29] = (unsigned long) frame;
714 regs->regs[31] = (unsigned long) frame->rs_code;
715 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
716
717#if DEBUG_SIG
718 printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
719 current->comm, current->pid,
720 frame, regs->cp0_epc, frame->rs_code);
721#endif
722 return;
723
724give_sigsegv:
725 force_sigsegv(signr, current);
726}
727
728static inline void handle_signal(unsigned long sig, siginfo_t *info,
729 struct k_sigaction *ka, sigset_t *oldset, struct pt_regs * regs)
730{
731 switch (regs->regs[0]) {
732 case ERESTART_RESTARTBLOCK:
733 case ERESTARTNOHAND:
734 regs->regs[2] = EINTR;
735 break;
736 case ERESTARTSYS:
737 if(!(ka->sa.sa_flags & SA_RESTART)) {
738 regs->regs[2] = EINTR;
739 break;
740 }
741 /* fallthrough */
742 case ERESTARTNOINTR: /* Userland will reload $v0. */
743 regs->regs[7] = regs->regs[26];
744 regs->cp0_epc -= 8;
745 }
746
747 regs->regs[0] = 0; /* Don't deal with this again. */
748
749 if (ka->sa.sa_flags & SA_SIGINFO)
750 setup_rt_frame(ka, regs, sig, oldset, info);
751 else
752 setup_frame(ka, regs, sig, oldset);
753
754 if (!(ka->sa.sa_flags & SA_NODEFER)) {
755 spin_lock_irq(&current->sighand->siglock);
756 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
757 sigaddset(&current->blocked,sig);
758 recalc_sigpending();
759 spin_unlock_irq(&current->sighand->siglock);
760 }
761}
762
763int do_signal32(sigset_t *oldset, struct pt_regs *regs)
764{
765 struct k_sigaction ka;
766 siginfo_t info;
767 int signr;
768
769 /*
770 * We want the common case to go fast, which is why we may in certain
771 * cases get here from kernel mode. Just return without doing anything
772 * if so.
773 */
774 if (!user_mode(regs))
775 return 1;
776
777 if (try_to_freeze(0))
778 goto no_signal;
779
780 if (!oldset)
781 oldset = &current->blocked;
782
783 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
784 if (signr > 0) {
785 handle_signal(signr, &info, &ka, oldset, regs);
786 return 1;
787 }
788
789no_signal:
790 /*
791 * Who's code doesn't conform to the restartable syscall convention
792 * dies here!!! The li instruction, a single machine instruction,
793 * must directly be followed by the syscall instruction.
794 */
795 if (regs->regs[0]) {
796 if (regs->regs[2] == ERESTARTNOHAND ||
797 regs->regs[2] == ERESTARTSYS ||
798 regs->regs[2] == ERESTARTNOINTR) {
799 regs->regs[7] = regs->regs[26];
800 regs->cp0_epc -= 8;
801 }
802 if (regs->regs[2] == ERESTART_RESTARTBLOCK) {
803 regs->regs[2] = __NR_O32_restart_syscall;
804 regs->regs[7] = regs->regs[26];
805 regs->cp0_epc -= 4;
806 }
807 }
808 return 0;
809}
810
811asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
812 struct sigaction32 *oact,
813 unsigned int sigsetsize)
814{
815 struct k_sigaction new_sa, old_sa;
816 int ret = -EINVAL;
817
818 /* XXX: Don't preclude handling different sized sigset_t's. */
819 if (sigsetsize != sizeof(sigset_t))
820 goto out;
821
822 if (act) {
823 int err = 0;
824
825 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
826 return -EFAULT;
827 err |= __get_user((u32)(u64)new_sa.sa.sa_handler,
828 &act->sa_handler);
829 err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags);
830 err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask);
831 if (err)
832 return -EFAULT;
833 }
834
835 ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
836
837 if (!ret && oact) {
838 int err = 0;
839
840 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
841 return -EFAULT;
842
843 err |= __put_user((u32)(u64)old_sa.sa.sa_handler,
844 &oact->sa_handler);
845 err |= __put_user(old_sa.sa.sa_flags, &oact->sa_flags);
846 err |= put_sigset(&old_sa.sa.sa_mask, &oact->sa_mask);
847 if (err)
848 return -EFAULT;
849 }
850out:
851 return ret;
852}
853
854asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
855 compat_sigset_t *oset, unsigned int sigsetsize)
856{
857 sigset_t old_set, new_set;
858 int ret;
859 mm_segment_t old_fs = get_fs();
860
861 if (set && get_sigset(&new_set, set))
862 return -EFAULT;
863
864 set_fs (KERNEL_DS);
865 ret = sys_rt_sigprocmask(how, set ? &new_set : NULL,
866 oset ? &old_set : NULL, sigsetsize);
867 set_fs (old_fs);
868
869 if (!ret && oset && put_sigset(&old_set, oset))
870 return -EFAULT;
871
872 return ret;
873}
874
875asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset,
876 unsigned int sigsetsize)
877{
878 int ret;
879 sigset_t set;
880 mm_segment_t old_fs = get_fs();
881
882 set_fs (KERNEL_DS);
883 ret = sys_rt_sigpending(&set, sigsetsize);
884 set_fs (old_fs);
885
886 if (!ret && put_sigset(&set, uset))
887 return -EFAULT;
888
889 return ret;
890}
891
892asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo)
893{
894 siginfo_t info;
895 int ret;
896 mm_segment_t old_fs = get_fs();
897
898 if (copy_from_user (&info, uinfo, 3*sizeof(int)) ||
899 copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE))
900 return -EFAULT;
901 set_fs (KERNEL_DS);
902 ret = sys_rt_sigqueueinfo(pid, sig, &info);
903 set_fs (old_fs);
904 return ret;
905}
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
new file mode 100644
index 000000000000..3544208d4b4b
--- /dev/null
+++ b/arch/mips/kernel/signal_n32.c
@@ -0,0 +1,197 @@
1/*
2 * Copyright (C) 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/sched.h>
19#include <linux/mm.h>
20#include <linux/smp.h>
21#include <linux/smp_lock.h>
22#include <linux/kernel.h>
23#include <linux/signal.h>
24#include <linux/errno.h>
25#include <linux/wait.h>
26#include <linux/ptrace.h>
27#include <linux/unistd.h>
28#include <linux/compat.h>
29#include <linux/bitops.h>
30
31#include <asm/asm.h>
32#include <asm/cacheflush.h>
33#include <asm/sim.h>
34#include <asm/uaccess.h>
35#include <asm/ucontext.h>
36#include <asm/system.h>
37#include <asm/fpu.h>
38#include <asm/cpu-features.h>
39
40#include "signal-common.h"
41
42/*
43 * Including <asm/unistd.h> would give use the 64-bit syscall numbers ...
44 */
45#define __NR_N32_rt_sigreturn 6211
46#define __NR_N32_restart_syscall 6214
47
48#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
49
50/* IRIX compatible stack_t */
51typedef struct sigaltstack32 {
52 s32 ss_sp;
53 compat_size_t ss_size;
54 int ss_flags;
55} stack32_t;
56
57struct ucontextn32 {
58 u32 uc_flags;
59 s32 uc_link;
60 stack32_t uc_stack;
61 struct sigcontext uc_mcontext;
62 sigset_t uc_sigmask; /* mask last for extensibility */
63};
64
65#if PLAT_TRAMPOLINE_STUFF_LINE
66#define __tramp __attribute__((aligned(PLAT_TRAMPOLINE_STUFF_LINE)))
67#else
68#define __tramp
69#endif
70
71struct rt_sigframe_n32 {
72 u32 rs_ass[4]; /* argument save space for o32 */
73 u32 rs_code[2] __tramp; /* signal trampoline */
74 struct siginfo rs_info __tramp;
75 struct ucontextn32 rs_uc;
76};
77
78save_static_function(sysn32_rt_sigreturn);
79__attribute_used__ noinline static void
80_sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
81{
82 struct rt_sigframe_n32 *frame;
83 sigset_t set;
84 stack_t st;
85 s32 sp;
86
87 frame = (struct rt_sigframe_n32 *) regs.regs[29];
88 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
89 goto badframe;
90 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
91 goto badframe;
92
93 sigdelsetmask(&set, ~_BLOCKABLE);
94 spin_lock_irq(&current->sighand->siglock);
95 current->blocked = set;
96 recalc_sigpending();
97 spin_unlock_irq(&current->sighand->siglock);
98
99 if (restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext))
100 goto badframe;
101
102 /* The ucontext contains a stack32_t, so we must convert! */
103 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
104 goto badframe;
105 st.ss_size = (long) sp;
106 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
107 goto badframe;
108 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
109 goto badframe;
110
111 /* It is more difficult to avoid calling this function than to
112 call it and ignore errors. */
113 do_sigaltstack(&st, NULL, regs.regs[29]);
114
115 /*
116 * Don't let your children do this ...
117 */
118 __asm__ __volatile__(
119 "move\t$29, %0\n\t"
120 "j\tsyscall_exit"
121 :/* no outputs */
122 :"r" (&regs));
123 /* Unreached */
124
125badframe:
126 force_sig(SIGSEGV, current);
127}
128
129void setup_rt_frame_n32(struct k_sigaction * ka,
130 struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info)
131{
132 struct rt_sigframe_n32 *frame;
133 int err = 0;
134 s32 sp;
135
136 frame = get_sigframe(ka, regs, sizeof(*frame));
137 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
138 goto give_sigsegv;
139
140 /*
141 * Set up the return code ...
142 *
143 * li v0, __NR_rt_sigreturn
144 * syscall
145 */
146 if (PLAT_TRAMPOLINE_STUFF_LINE)
147 __clear_user(frame->rs_code, PLAT_TRAMPOLINE_STUFF_LINE);
148 err |= __put_user(0x24020000 + __NR_N32_rt_sigreturn, frame->rs_code + 0);
149 err |= __put_user(0x0000000c , frame->rs_code + 1);
150 flush_cache_sigtramp((unsigned long) frame->rs_code);
151
152 /* Create siginfo. */
153 err |= copy_siginfo_to_user(&frame->rs_info, info);
154
155 /* Create the ucontext. */
156 err |= __put_user(0, &frame->rs_uc.uc_flags);
157 err |= __put_user(0, &frame->rs_uc.uc_link);
158 sp = (int) (long) current->sas_ss_sp;
159 err |= __put_user(sp,
160 &frame->rs_uc.uc_stack.ss_sp);
161 err |= __put_user(sas_ss_flags(regs->regs[29]),
162 &frame->rs_uc.uc_stack.ss_flags);
163 err |= __put_user(current->sas_ss_size,
164 &frame->rs_uc.uc_stack.ss_size);
165 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
166 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
167
168 if (err)
169 goto give_sigsegv;
170
171 /*
172 * Arguments to signal handler:
173 *
174 * a0 = signal number
175 * a1 = 0 (should be cause)
176 * a2 = pointer to ucontext
177 *
178 * $25 and c0_epc point to the signal handler, $29 points to
179 * the struct rt_sigframe.
180 */
181 regs->regs[ 4] = signr;
182 regs->regs[ 5] = (unsigned long) &frame->rs_info;
183 regs->regs[ 6] = (unsigned long) &frame->rs_uc;
184 regs->regs[29] = (unsigned long) frame;
185 regs->regs[31] = (unsigned long) frame->rs_code;
186 regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
187
188#if DEBUG_SIG
189 printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
190 current->comm, current->pid,
191 frame, regs->cp0_epc, regs->regs[31]);
192#endif
193 return;
194
195give_sigsegv:
196 force_sigsegv(signr, current);
197}
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
new file mode 100644
index 000000000000..af5cd3b8a396
--- /dev/null
+++ b/arch/mips/kernel/smp.c
@@ -0,0 +1,425 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) 2000, 2001 Kanoj Sarcar
17 * Copyright (C) 2000, 2001 Ralf Baechle
18 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
19 * Copyright (C) 2000, 2001, 2003 Broadcom Corporation
20 */
21#include <linux/cache.h>
22#include <linux/delay.h>
23#include <linux/init.h>
24#include <linux/interrupt.h>
25#include <linux/spinlock.h>
26#include <linux/threads.h>
27#include <linux/module.h>
28#include <linux/time.h>
29#include <linux/timex.h>
30#include <linux/sched.h>
31#include <linux/cpumask.h>
32
33#include <asm/atomic.h>
34#include <asm/cpu.h>
35#include <asm/processor.h>
36#include <asm/system.h>
37#include <asm/mmu_context.h>
38#include <asm/smp.h>
39
40cpumask_t phys_cpu_present_map; /* Bitmask of available CPUs */
41volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */
42cpumask_t cpu_online_map; /* Bitmask of currently online CPUs */
43int __cpu_number_map[NR_CPUS]; /* Map physical to logical */
44int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
45
46EXPORT_SYMBOL(phys_cpu_present_map);
47EXPORT_SYMBOL(cpu_online_map);
48
49static void smp_tune_scheduling (void)
50{
51 struct cache_desc *cd = &current_cpu_data.scache;
52 unsigned long cachesize; /* kB */
53 unsigned long bandwidth = 350; /* MB/s */
54 unsigned long cpu_khz;
55
56 /*
57 * Crude estimate until we actually meassure ...
58 */
59 cpu_khz = loops_per_jiffy * 2 * HZ / 1000;
60
61 /*
62 * Rough estimation for SMP scheduling, this is the number of
63 * cycles it takes for a fully memory-limited process to flush
64 * the SMP-local cache.
65 *
66 * (For a P5 this pretty much means we will choose another idle
67 * CPU almost always at wakeup time (this is due to the small
68 * L1 cache), on PIIs it's around 50-100 usecs, depending on
69 * the cache size)
70 */
71 if (!cpu_khz)
72 return;
73
74 cachesize = cd->linesz * cd->sets * cd->ways;
75}
76
77extern void __init calibrate_delay(void);
78extern ATTRIB_NORET void cpu_idle(void);
79
80/*
81 * First C code run on the secondary CPUs after being started up by
82 * the master.
83 */
84asmlinkage void start_secondary(void)
85{
86 unsigned int cpu = smp_processor_id();
87
88 cpu_probe();
89 cpu_report();
90 per_cpu_trap_init();
91 prom_init_secondary();
92
93 /*
94 * XXX parity protection should be folded in here when it's converted
95 * to an option instead of something based on .cputype
96 */
97
98 calibrate_delay();
99 cpu_data[cpu].udelay_val = loops_per_jiffy;
100
101 prom_smp_finish();
102
103 cpu_set(cpu, cpu_callin_map);
104
105 cpu_idle();
106}
107
108DEFINE_SPINLOCK(smp_call_lock);
109
110struct call_data_struct *call_data;
111
112/*
113 * Run a function on all other CPUs.
114 * <func> The function to run. This must be fast and non-blocking.
115 * <info> An arbitrary pointer to pass to the function.
116 * <retry> If true, keep retrying until ready.
117 * <wait> If true, wait until function has completed on other CPUs.
118 * [RETURNS] 0 on success, else a negative status code.
119 *
120 * Does not return until remote CPUs are nearly ready to execute <func>
121 * or are or have executed.
122 *
123 * You must not call this function with disabled interrupts or from a
124 * hardware interrupt handler or from a bottom half handler.
125 */
126int smp_call_function (void (*func) (void *info), void *info, int retry,
127 int wait)
128{
129 struct call_data_struct data;
130 int i, cpus = num_online_cpus() - 1;
131 int cpu = smp_processor_id();
132
133 if (!cpus)
134 return 0;
135
136 /* Can deadlock when called with interrupts disabled */
137 WARN_ON(irqs_disabled());
138
139 data.func = func;
140 data.info = info;
141 atomic_set(&data.started, 0);
142 data.wait = wait;
143 if (wait)
144 atomic_set(&data.finished, 0);
145
146 spin_lock(&smp_call_lock);
147 call_data = &data;
148 mb();
149
150 /* Send a message to all other CPUs and wait for them to respond */
151 for (i = 0; i < NR_CPUS; i++)
152 if (cpu_online(i) && i != cpu)
153 core_send_ipi(i, SMP_CALL_FUNCTION);
154
155 /* Wait for response */
156 /* FIXME: lock-up detection, backtrace on lock-up */
157 while (atomic_read(&data.started) != cpus)
158 barrier();
159
160 if (wait)
161 while (atomic_read(&data.finished) != cpus)
162 barrier();
163 spin_unlock(&smp_call_lock);
164
165 return 0;
166}
167
168void smp_call_function_interrupt(void)
169{
170 void (*func) (void *info) = call_data->func;
171 void *info = call_data->info;
172 int wait = call_data->wait;
173
174 /*
175 * Notify initiating CPU that I've grabbed the data and am
176 * about to execute the function.
177 */
178 mb();
179 atomic_inc(&call_data->started);
180
181 /*
182 * At this point the info structure may be out of scope unless wait==1.
183 */
184 irq_enter();
185 (*func)(info);
186 irq_exit();
187
188 if (wait) {
189 mb();
190 atomic_inc(&call_data->finished);
191 }
192}
193
194static void stop_this_cpu(void *dummy)
195{
196 /*
197 * Remove this CPU:
198 */
199 cpu_clear(smp_processor_id(), cpu_online_map);
200 local_irq_enable(); /* May need to service _machine_restart IPI */
201 for (;;); /* Wait if available. */
202}
203
204void smp_send_stop(void)
205{
206 smp_call_function(stop_this_cpu, NULL, 1, 0);
207}
208
209void __init smp_cpus_done(unsigned int max_cpus)
210{
211 prom_cpus_done();
212}
213
214/* called from main before smp_init() */
215void __init smp_prepare_cpus(unsigned int max_cpus)
216{
217 cpu_data[0].udelay_val = loops_per_jiffy;
218 init_new_context(current, &init_mm);
219 current_thread_info()->cpu = 0;
220 smp_tune_scheduling();
221 prom_prepare_cpus(max_cpus);
222}
223
224/* preload SMP state for boot cpu */
225void __devinit smp_prepare_boot_cpu(void)
226{
227 /*
228 * This assumes that bootup is always handled by the processor
229 * with the logic and physical number 0.
230 */
231 __cpu_number_map[0] = 0;
232 __cpu_logical_map[0] = 0;
233 cpu_set(0, phys_cpu_present_map);
234 cpu_set(0, cpu_online_map);
235 cpu_set(0, cpu_callin_map);
236}
237
238/*
239 * Startup the CPU with this logical number
240 */
241static int __init do_boot_cpu(int cpu)
242{
243 struct task_struct *idle;
244
245 /*
246 * The following code is purely to make sure
247 * Linux can schedule processes on this slave.
248 */
249 idle = fork_idle(cpu);
250 if (IS_ERR(idle))
251 panic("failed fork for CPU %d\n", cpu);
252
253 prom_boot_secondary(cpu, idle);
254
255 /* XXXKW timeout */
256 while (!cpu_isset(cpu, cpu_callin_map))
257 udelay(100);
258
259 cpu_set(cpu, cpu_online_map);
260
261 return 0;
262}
263
264/*
265 * Called once for each "cpu_possible(cpu)". Needs to spin up the cpu
266 * and keep control until "cpu_online(cpu)" is set. Note: cpu is
267 * physical, not logical.
268 */
269int __devinit __cpu_up(unsigned int cpu)
270{
271 int ret;
272
273 /* Processor goes to start_secondary(), sets online flag */
274 ret = do_boot_cpu(cpu);
275 if (ret < 0)
276 return ret;
277
278 return 0;
279}
280
281/* Not really SMP stuff ... */
282int setup_profiling_timer(unsigned int multiplier)
283{
284 return 0;
285}
286
287static void flush_tlb_all_ipi(void *info)
288{
289 local_flush_tlb_all();
290}
291
292void flush_tlb_all(void)
293{
294 on_each_cpu(flush_tlb_all_ipi, 0, 1, 1);
295}
296
297static void flush_tlb_mm_ipi(void *mm)
298{
299 local_flush_tlb_mm((struct mm_struct *)mm);
300}
301
302/*
303 * The following tlb flush calls are invoked when old translations are
304 * being torn down, or pte attributes are changing. For single threaded
305 * address spaces, a new context is obtained on the current cpu, and tlb
306 * context on other cpus are invalidated to force a new context allocation
307 * at switch_mm time, should the mm ever be used on other cpus. For
308 * multithreaded address spaces, intercpu interrupts have to be sent.
309 * Another case where intercpu interrupts are required is when the target
310 * mm might be active on another cpu (eg debuggers doing the flushes on
311 * behalf of debugees, kswapd stealing pages from another process etc).
312 * Kanoj 07/00.
313 */
314
315void flush_tlb_mm(struct mm_struct *mm)
316{
317 preempt_disable();
318
319 if ((atomic_read(&mm->mm_users) != 1) || (current->mm != mm)) {
320 smp_call_function(flush_tlb_mm_ipi, (void *)mm, 1, 1);
321 } else {
322 int i;
323 for (i = 0; i < num_online_cpus(); i++)
324 if (smp_processor_id() != i)
325 cpu_context(i, mm) = 0;
326 }
327 local_flush_tlb_mm(mm);
328
329 preempt_enable();
330}
331
332struct flush_tlb_data {
333 struct vm_area_struct *vma;
334 unsigned long addr1;
335 unsigned long addr2;
336};
337
338static void flush_tlb_range_ipi(void *info)
339{
340 struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
341
342 local_flush_tlb_range(fd->vma, fd->addr1, fd->addr2);
343}
344
345void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
346{
347 struct mm_struct *mm = vma->vm_mm;
348
349 preempt_disable();
350 if ((atomic_read(&mm->mm_users) != 1) || (current->mm != mm)) {
351 struct flush_tlb_data fd;
352
353 fd.vma = vma;
354 fd.addr1 = start;
355 fd.addr2 = end;
356 smp_call_function(flush_tlb_range_ipi, (void *)&fd, 1, 1);
357 } else {
358 int i;
359 for (i = 0; i < num_online_cpus(); i++)
360 if (smp_processor_id() != i)
361 cpu_context(i, mm) = 0;
362 }
363 local_flush_tlb_range(vma, start, end);
364 preempt_enable();
365}
366
367static void flush_tlb_kernel_range_ipi(void *info)
368{
369 struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
370
371 local_flush_tlb_kernel_range(fd->addr1, fd->addr2);
372}
373
374void flush_tlb_kernel_range(unsigned long start, unsigned long end)
375{
376 struct flush_tlb_data fd;
377
378 fd.addr1 = start;
379 fd.addr2 = end;
380 on_each_cpu(flush_tlb_kernel_range_ipi, (void *)&fd, 1, 1);
381}
382
383static void flush_tlb_page_ipi(void *info)
384{
385 struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
386
387 local_flush_tlb_page(fd->vma, fd->addr1);
388}
389
390void flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
391{
392 preempt_disable();
393 if ((atomic_read(&vma->vm_mm->mm_users) != 1) || (current->mm != vma->vm_mm)) {
394 struct flush_tlb_data fd;
395
396 fd.vma = vma;
397 fd.addr1 = page;
398 smp_call_function(flush_tlb_page_ipi, (void *)&fd, 1, 1);
399 } else {
400 int i;
401 for (i = 0; i < num_online_cpus(); i++)
402 if (smp_processor_id() != i)
403 cpu_context(i, vma->vm_mm) = 0;
404 }
405 local_flush_tlb_page(vma, page);
406 preempt_enable();
407}
408
409static void flush_tlb_one_ipi(void *info)
410{
411 unsigned long vaddr = (unsigned long) info;
412
413 local_flush_tlb_one(vaddr);
414}
415
416void flush_tlb_one(unsigned long vaddr)
417{
418 smp_call_function(flush_tlb_one_ipi, (void *) vaddr, 1, 1);
419 local_flush_tlb_one(vaddr);
420}
421
422EXPORT_SYMBOL(flush_tlb_page);
423EXPORT_SYMBOL(flush_tlb_one);
424EXPORT_SYMBOL(cpu_data);
425EXPORT_SYMBOL(synchronize_irq);
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
new file mode 100644
index 000000000000..598bfe7426a2
--- /dev/null
+++ b/arch/mips/kernel/syscall.c
@@ -0,0 +1,407 @@
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) 1995, 1996, 1997, 2000, 2001, 05 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#include <linux/a.out.h>
11#include <linux/errno.h>
12#include <linux/linkage.h>
13#include <linux/mm.h>
14#include <linux/smp.h>
15#include <linux/smp_lock.h>
16#include <linux/mman.h>
17#include <linux/ptrace.h>
18#include <linux/sched.h>
19#include <linux/string.h>
20#include <linux/syscalls.h>
21#include <linux/file.h>
22#include <linux/slab.h>
23#include <linux/utsname.h>
24#include <linux/unistd.h>
25#include <linux/sem.h>
26#include <linux/msg.h>
27#include <linux/shm.h>
28#include <linux/compiler.h>
29
30#include <asm/branch.h>
31#include <asm/cachectl.h>
32#include <asm/cacheflush.h>
33#include <asm/ipc.h>
34#include <asm/offset.h>
35#include <asm/signal.h>
36#include <asm/sim.h>
37#include <asm/shmparam.h>
38#include <asm/sysmips.h>
39#include <asm/uaccess.h>
40
41asmlinkage int sys_pipe(nabi_no_regargs volatile struct pt_regs regs)
42{
43 int fd[2];
44 int error, res;
45
46 error = do_pipe(fd);
47 if (error) {
48 res = error;
49 goto out;
50 }
51 regs.regs[3] = fd[1];
52 res = fd[0];
53out:
54 return res;
55}
56
57unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */
58
59#define COLOUR_ALIGN(addr,pgoff) \
60 ((((addr) + shm_align_mask) & ~shm_align_mask) + \
61 (((pgoff) << PAGE_SHIFT) & shm_align_mask))
62
63unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
64 unsigned long len, unsigned long pgoff, unsigned long flags)
65{
66 struct vm_area_struct * vmm;
67 int do_color_align;
68 unsigned long task_size;
69
70 task_size = STACK_TOP;
71
72 if (flags & MAP_FIXED) {
73 /*
74 * We do not accept a shared mapping if it would violate
75 * cache aliasing constraints.
76 */
77 if ((flags & MAP_SHARED) && (addr & shm_align_mask))
78 return -EINVAL;
79 return addr;
80 }
81
82 if (len > task_size)
83 return -ENOMEM;
84 do_color_align = 0;
85 if (filp || (flags & MAP_SHARED))
86 do_color_align = 1;
87 if (addr) {
88 if (do_color_align)
89 addr = COLOUR_ALIGN(addr, pgoff);
90 else
91 addr = PAGE_ALIGN(addr);
92 vmm = find_vma(current->mm, addr);
93 if (task_size - len >= addr &&
94 (!vmm || addr + len <= vmm->vm_start))
95 return addr;
96 }
97 addr = TASK_UNMAPPED_BASE;
98 if (do_color_align)
99 addr = COLOUR_ALIGN(addr, pgoff);
100 else
101 addr = PAGE_ALIGN(addr);
102
103 for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
104 /* At this point: (!vmm || addr < vmm->vm_end). */
105 if (task_size - len < addr)
106 return -ENOMEM;
107 if (!vmm || addr + len <= vmm->vm_start)
108 return addr;
109 addr = vmm->vm_end;
110 if (do_color_align)
111 addr = COLOUR_ALIGN(addr, pgoff);
112 }
113}
114
115/* common code for old and new mmaps */
116static inline unsigned long
117do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
118 unsigned long flags, unsigned long fd, unsigned long pgoff)
119{
120 unsigned long error = -EBADF;
121 struct file * file = NULL;
122
123 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
124 if (!(flags & MAP_ANONYMOUS)) {
125 file = fget(fd);
126 if (!file)
127 goto out;
128 }
129
130 down_write(&current->mm->mmap_sem);
131 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
132 up_write(&current->mm->mmap_sem);
133
134 if (file)
135 fput(file);
136out:
137 return error;
138}
139
140asmlinkage unsigned long
141old_mmap(unsigned long addr, unsigned long len, int prot,
142 int flags, int fd, off_t offset)
143{
144 unsigned long result;
145
146 result = -EINVAL;
147 if (offset & ~PAGE_MASK)
148 goto out;
149
150 result = do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
151
152out:
153 return result;
154}
155
156asmlinkage unsigned long
157sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
158 unsigned long flags, unsigned long fd, unsigned long pgoff)
159{
160 return do_mmap2(addr, len, prot, flags, fd, pgoff);
161}
162
163save_static_function(sys_fork);
164__attribute_used__ noinline static int
165_sys_fork(nabi_no_regargs struct pt_regs regs)
166{
167 return do_fork(SIGCHLD, regs.regs[29], &regs, 0, NULL, NULL);
168}
169
170save_static_function(sys_clone);
171__attribute_used__ noinline static int
172_sys_clone(nabi_no_regargs struct pt_regs regs)
173{
174 unsigned long clone_flags;
175 unsigned long newsp;
176 int *parent_tidptr, *child_tidptr;
177
178 clone_flags = regs.regs[4];
179 newsp = regs.regs[5];
180 if (!newsp)
181 newsp = regs.regs[29];
182 parent_tidptr = (int *) regs.regs[6];
183 child_tidptr = (int *) regs.regs[7];
184 return do_fork(clone_flags, newsp, &regs, 0,
185 parent_tidptr, child_tidptr);
186}
187
188/*
189 * sys_execve() executes a new program.
190 */
191asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
192{
193 int error;
194 char * filename;
195
196 filename = getname((char *) (long)regs.regs[4]);
197 error = PTR_ERR(filename);
198 if (IS_ERR(filename))
199 goto out;
200 error = do_execve(filename, (char **) (long)regs.regs[5],
201 (char **) (long)regs.regs[6], &regs);
202 putname(filename);
203
204out:
205 return error;
206}
207
208/*
209 * Compacrapability ...
210 */
211asmlinkage int sys_uname(struct old_utsname * name)
212{
213 if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
214 return 0;
215 return -EFAULT;
216}
217
218/*
219 * Compacrapability ...
220 */
221asmlinkage int sys_olduname(struct oldold_utsname * name)
222{
223 int error;
224
225 if (!name)
226 return -EFAULT;
227 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
228 return -EFAULT;
229
230 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
231 error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
232 error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
233 error -= __put_user(0,name->nodename+__OLD_UTS_LEN);
234 error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN);
235 error -= __put_user(0,name->release+__OLD_UTS_LEN);
236 error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
237 error -= __put_user(0,name->version+__OLD_UTS_LEN);
238 error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
239 error = __put_user(0,name->machine+__OLD_UTS_LEN);
240 error = error ? -EFAULT : 0;
241
242 return error;
243}
244
245asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
246{
247 int tmp, len;
248 char *name;
249
250 switch(cmd) {
251 case SETNAME: {
252 char nodename[__NEW_UTS_LEN + 1];
253
254 if (!capable(CAP_SYS_ADMIN))
255 return -EPERM;
256
257 name = (char *) arg1;
258
259 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN);
260 if (len < 0)
261 return -EFAULT;
262
263 down_write(&uts_sem);
264 strncpy(system_utsname.nodename, nodename, len);
265 nodename[__NEW_UTS_LEN] = '\0';
266 strlcpy(system_utsname.nodename, nodename,
267 sizeof(system_utsname.nodename));
268 up_write(&uts_sem);
269 return 0;
270 }
271
272 case MIPS_ATOMIC_SET:
273 printk(KERN_CRIT "How did I get here?\n");
274 return -EINVAL;
275
276 case MIPS_FIXADE:
277 tmp = current->thread.mflags & ~3;
278 current->thread.mflags = tmp | (arg1 & 3);
279 return 0;
280
281 case FLUSH_CACHE:
282 __flush_cache_all();
283 return 0;
284
285 case MIPS_RDNVRAM:
286 return -EIO;
287 }
288
289 return -EINVAL;
290}
291
292/*
293 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
294 *
295 * This is really horribly ugly.
296 */
297asmlinkage int sys_ipc (uint call, int first, int second,
298 unsigned long third, void *ptr, long fifth)
299{
300 int version, ret;
301
302 version = call >> 16; /* hack for backward compatibility */
303 call &= 0xffff;
304
305 switch (call) {
306 case SEMOP:
307 return sys_semtimedop (first, (struct sembuf *)ptr, second,
308 NULL);
309 case SEMTIMEDOP:
310 return sys_semtimedop (first, (struct sembuf *)ptr, second,
311 (const struct timespec __user *)fifth);
312 case SEMGET:
313 return sys_semget (first, second, third);
314 case SEMCTL: {
315 union semun fourth;
316 if (!ptr)
317 return -EINVAL;
318 if (get_user(fourth.__pad, (void **) ptr))
319 return -EFAULT;
320 return sys_semctl (first, second, third, fourth);
321 }
322
323 case MSGSND:
324 return sys_msgsnd (first, (struct msgbuf *) ptr,
325 second, third);
326 case MSGRCV:
327 switch (version) {
328 case 0: {
329 struct ipc_kludge tmp;
330 if (!ptr)
331 return -EINVAL;
332
333 if (copy_from_user(&tmp,
334 (struct ipc_kludge *) ptr,
335 sizeof (tmp)))
336 return -EFAULT;
337 return sys_msgrcv (first, tmp.msgp, second,
338 tmp.msgtyp, third);
339 }
340 default:
341 return sys_msgrcv (first,
342 (struct msgbuf *) ptr,
343 second, fifth, third);
344 }
345 case MSGGET:
346 return sys_msgget ((key_t) first, second);
347 case MSGCTL:
348 return sys_msgctl (first, second, (struct msqid_ds *) ptr);
349
350 case SHMAT:
351 switch (version) {
352 default: {
353 ulong raddr;
354 ret = do_shmat (first, (char *) ptr, second, &raddr);
355 if (ret)
356 return ret;
357 return put_user (raddr, (ulong *) third);
358 }
359 case 1: /* iBCS2 emulator entry point */
360 if (!segment_eq(get_fs(), get_ds()))
361 return -EINVAL;
362 return do_shmat (first, (char *) ptr, second, (ulong *) third);
363 }
364 case SHMDT:
365 return sys_shmdt ((char *)ptr);
366 case SHMGET:
367 return sys_shmget (first, second, third);
368 case SHMCTL:
369 return sys_shmctl (first, second,
370 (struct shmid_ds *) ptr);
371 default:
372 return -ENOSYS;
373 }
374}
375
376/*
377 * Native ABI that is O32 or N64 version
378 */
379asmlinkage long sys_shmat(int shmid, char __user *shmaddr,
380 int shmflg, unsigned long *addr)
381{
382 unsigned long raddr;
383 int err;
384
385 err = do_shmat(shmid, shmaddr, shmflg, &raddr);
386 if (err)
387 return err;
388
389 return put_user(raddr, addr);
390}
391
392/*
393 * No implemented yet ...
394 */
395asmlinkage int sys_cachectl(char *addr, int nbytes, int op)
396{
397 return -ENOSYS;
398}
399
400/*
401 * If we ever come here the user sp is bad. Zap the process right away.
402 * Due to the bad stack signaling wouldn't work.
403 */
404asmlinkage void bad_stack(void)
405{
406 do_exit(SIGSEGV);
407}
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
new file mode 100644
index 000000000000..f3bf0e43b8bb
--- /dev/null
+++ b/arch/mips/kernel/sysirix.c
@@ -0,0 +1,2179 @@
1/*
2 * sysirix.c: IRIX system call emulation.
3 *
4 * Copyright (C) 1996 David S. Miller
5 * Copyright (C) 1997 Miguel de Icaza
6 * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle
7 */
8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/binfmts.h>
11#include <linux/highuid.h>
12#include <linux/pagemap.h>
13#include <linux/mm.h>
14#include <linux/mman.h>
15#include <linux/slab.h>
16#include <linux/swap.h>
17#include <linux/errno.h>
18#include <linux/time.h>
19#include <linux/timex.h>
20#include <linux/times.h>
21#include <linux/elf.h>
22#include <linux/msg.h>
23#include <linux/shm.h>
24#include <linux/smp.h>
25#include <linux/smp_lock.h>
26#include <linux/utsname.h>
27#include <linux/file.h>
28#include <linux/vfs.h>
29#include <linux/namei.h>
30#include <linux/socket.h>
31#include <linux/security.h>
32#include <linux/syscalls.h>
33
34#include <asm/ptrace.h>
35#include <asm/page.h>
36#include <asm/uaccess.h>
37#include <asm/inventory.h>
38
39/* 2,191 lines of complete and utter shit coming up... */
40
41extern int max_threads;
42
43/* The sysmp commands supported thus far. */
44#define MP_NPROCS 1 /* # processor in complex */
45#define MP_NAPROCS 2 /* # active processors in complex */
46#define MP_PGSIZE 14 /* Return system page size in v1. */
47
48asmlinkage int irix_sysmp(struct pt_regs *regs)
49{
50 unsigned long cmd;
51 int base = 0;
52 int error = 0;
53
54 if(regs->regs[2] == 1000)
55 base = 1;
56 cmd = regs->regs[base + 4];
57 switch(cmd) {
58 case MP_PGSIZE:
59 error = PAGE_SIZE;
60 break;
61 case MP_NPROCS:
62 case MP_NAPROCS:
63 error = num_online_cpus();
64 break;
65 default:
66 printk("SYSMP[%s:%d]: Unsupported opcode %d\n",
67 current->comm, current->pid, (int)cmd);
68 error = -EINVAL;
69 break;
70 }
71
72 return error;
73}
74
75/* The prctl commands. */
76#define PR_MAXPROCS 1 /* Tasks/user. */
77#define PR_ISBLOCKED 2 /* If blocked, return 1. */
78#define PR_SETSTACKSIZE 3 /* Set largest task stack size. */
79#define PR_GETSTACKSIZE 4 /* Get largest task stack size. */
80#define PR_MAXPPROCS 5 /* Num parallel tasks. */
81#define PR_UNBLKONEXEC 6 /* When task exec/exit's, unblock. */
82#define PR_SETEXITSIG 8 /* When task exit's, set signal. */
83#define PR_RESIDENT 9 /* Make task unswappable. */
84#define PR_ATTACHADDR 10 /* (Re-)Connect a vma to a task. */
85#define PR_DETACHADDR 11 /* Disconnect a vma from a task. */
86#define PR_TERMCHILD 12 /* When parent sleeps with fishes, kill child. */
87#define PR_GETSHMASK 13 /* Get the sproc() share mask. */
88#define PR_GETNSHARE 14 /* Number of share group members. */
89#define PR_COREPID 15 /* Add task pid to name when it core. */
90#define PR_ATTACHADDRPERM 16 /* (Re-)Connect vma, with specified prot. */
91#define PR_PTHREADEXIT 17 /* Kill a pthread without prejudice. */
92
93asmlinkage int irix_prctl(struct pt_regs *regs)
94{
95 unsigned long cmd;
96 int error = 0, base = 0;
97
98 if (regs->regs[2] == 1000)
99 base = 1;
100 cmd = regs->regs[base + 4];
101 switch (cmd) {
102 case PR_MAXPROCS:
103 printk("irix_prctl[%s:%d]: Wants PR_MAXPROCS\n",
104 current->comm, current->pid);
105 error = max_threads;
106 break;
107
108 case PR_ISBLOCKED: {
109 struct task_struct *task;
110
111 printk("irix_prctl[%s:%d]: Wants PR_ISBLOCKED\n",
112 current->comm, current->pid);
113 read_lock(&tasklist_lock);
114 task = find_task_by_pid(regs->regs[base + 5]);
115 error = -ESRCH;
116 if (error)
117 error = (task->run_list.next != NULL);
118 read_unlock(&tasklist_lock);
119 /* Can _your_ OS find this out that fast? */
120 break;
121 }
122
123 case PR_SETSTACKSIZE: {
124 long value = regs->regs[base + 5];
125
126 printk("irix_prctl[%s:%d]: Wants PR_SETSTACKSIZE<%08lx>\n",
127 current->comm, current->pid, (unsigned long) value);
128 if (value > RLIM_INFINITY)
129 value = RLIM_INFINITY;
130 if (capable(CAP_SYS_ADMIN)) {
131 task_lock(current->group_leader);
132 current->signal->rlim[RLIMIT_STACK].rlim_max =
133 current->signal->rlim[RLIMIT_STACK].rlim_cur = value;
134 task_unlock(current->group_leader);
135 error = value;
136 break;
137 }
138 task_lock(current->group_leader);
139 if (value > current->signal->rlim[RLIMIT_STACK].rlim_max) {
140 error = -EINVAL;
141 task_unlock(current->group_leader);
142 break;
143 }
144 current->signal->rlim[RLIMIT_STACK].rlim_cur = value;
145 task_unlock(current->group_leader);
146 error = value;
147 break;
148 }
149
150 case PR_GETSTACKSIZE:
151 printk("irix_prctl[%s:%d]: Wants PR_GETSTACKSIZE\n",
152 current->comm, current->pid);
153 error = current->signal->rlim[RLIMIT_STACK].rlim_cur;
154 break;
155
156 case PR_MAXPPROCS:
157 printk("irix_prctl[%s:%d]: Wants PR_MAXPROCS\n",
158 current->comm, current->pid);
159 error = 1;
160 break;
161
162 case PR_UNBLKONEXEC:
163 printk("irix_prctl[%s:%d]: Wants PR_UNBLKONEXEC\n",
164 current->comm, current->pid);
165 error = -EINVAL;
166 break;
167
168 case PR_SETEXITSIG:
169 printk("irix_prctl[%s:%d]: Wants PR_SETEXITSIG\n",
170 current->comm, current->pid);
171
172 /* We can probably play some game where we set the task
173 * exit_code to some non-zero value when this is requested,
174 * and check whether exit_code is already set in do_exit().
175 */
176 error = -EINVAL;
177 break;
178
179 case PR_RESIDENT:
180 printk("irix_prctl[%s:%d]: Wants PR_RESIDENT\n",
181 current->comm, current->pid);
182 error = 0; /* Compatibility indeed. */
183 break;
184
185 case PR_ATTACHADDR:
186 printk("irix_prctl[%s:%d]: Wants PR_ATTACHADDR\n",
187 current->comm, current->pid);
188 error = -EINVAL;
189 break;
190
191 case PR_DETACHADDR:
192 printk("irix_prctl[%s:%d]: Wants PR_DETACHADDR\n",
193 current->comm, current->pid);
194 error = -EINVAL;
195 break;
196
197 case PR_TERMCHILD:
198 printk("irix_prctl[%s:%d]: Wants PR_TERMCHILD\n",
199 current->comm, current->pid);
200 error = -EINVAL;
201 break;
202
203 case PR_GETSHMASK:
204 printk("irix_prctl[%s:%d]: Wants PR_GETSHMASK\n",
205 current->comm, current->pid);
206 error = -EINVAL; /* Until I have the sproc() stuff in. */
207 break;
208
209 case PR_GETNSHARE:
210 error = 0; /* Until I have the sproc() stuff in. */
211 break;
212
213 case PR_COREPID:
214 printk("irix_prctl[%s:%d]: Wants PR_COREPID\n",
215 current->comm, current->pid);
216 error = -EINVAL;
217 break;
218
219 case PR_ATTACHADDRPERM:
220 printk("irix_prctl[%s:%d]: Wants PR_ATTACHADDRPERM\n",
221 current->comm, current->pid);
222 error = -EINVAL;
223 break;
224
225 case PR_PTHREADEXIT:
226 printk("irix_prctl[%s:%d]: Wants PR_PTHREADEXIT\n",
227 current->comm, current->pid);
228 do_exit(regs->regs[base + 5]);
229
230 default:
231 printk("irix_prctl[%s:%d]: Non-existant opcode %d\n",
232 current->comm, current->pid, (int)cmd);
233 error = -EINVAL;
234 break;
235 }
236
237 return error;
238}
239
240#undef DEBUG_PROCGRPS
241
242extern unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt);
243extern int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
244extern char *prom_getenv(char *name);
245extern long prom_setenv(char *name, char *value);
246
247/* The syssgi commands supported thus far. */
248#define SGI_SYSID 1 /* Return unique per-machine identifier. */
249#define SGI_INVENT 5 /* Fetch inventory */
250# define SGI_INV_SIZEOF 1
251# define SGI_INV_READ 2
252#define SGI_RDNAME 6 /* Return string name of a process. */
253#define SGI_SETNVRAM 8 /* Set PROM variable. */
254#define SGI_GETNVRAM 9 /* Get PROM variable. */
255#define SGI_SETPGID 21 /* Set process group id. */
256#define SGI_SYSCONF 22 /* POSIX sysconf garbage. */
257#define SGI_PATHCONF 24 /* POSIX sysconf garbage. */
258#define SGI_SETGROUPS 40 /* POSIX sysconf garbage. */
259#define SGI_GETGROUPS 41 /* POSIX sysconf garbage. */
260#define SGI_RUSAGE 56 /* BSD style rusage(). */
261#define SGI_SSYNC 62 /* Synchronous fs sync. */
262#define SGI_GETSID 65 /* SysVr4 get session id. */
263#define SGI_ELFMAP 68 /* Map an elf image. */
264#define SGI_TOSSTSAVE 108 /* Toss saved vma's. */
265#define SGI_FP_BCOPY 129 /* Should FPU bcopy be used on this machine? */
266#define SGI_PHYSP 1011 /* Translate virtual into physical page. */
267
268asmlinkage int irix_syssgi(struct pt_regs *regs)
269{
270 unsigned long cmd;
271 int retval, base = 0;
272
273 if (regs->regs[2] == 1000)
274 base = 1;
275
276 cmd = regs->regs[base + 4];
277 switch(cmd) {
278 case SGI_SYSID: {
279 char *buf = (char *) regs->regs[base + 5];
280
281 /* XXX Use ethernet addr.... */
282 retval = clear_user(buf, 64);
283 break;
284 }
285#if 0
286 case SGI_RDNAME: {
287 int pid = (int) regs->regs[base + 5];
288 char *buf = (char *) regs->regs[base + 6];
289 struct task_struct *p;
290 char tcomm[sizeof(current->comm)];
291
292 if (!access_ok(VERIFY_WRITE, buf, sizeof(tcomm))) {
293 retval = -EFAULT;
294 break;
295 }
296 read_lock(&tasklist_lock);
297 p = find_task_by_pid(pid);
298 if (!p) {
299 read_unlock(&tasklist_lock);
300 retval = -ESRCH;
301 break;
302 }
303 get_task_comm(tcomm, p);
304 read_unlock(&tasklist_lock);
305
306 /* XXX Need to check sizes. */
307 copy_to_user(buf, tcomm, sizeof(tcomm));
308 retval = 0;
309 break;
310 }
311
312 case SGI_GETNVRAM: {
313 char *name = (char *) regs->regs[base+5];
314 char *buf = (char *) regs->regs[base+6];
315 char *value;
316 return -EINVAL; /* til I fix it */
317 if (!access_ok(VERIFY_WRITE, buf, 128)) {
318 retval = -EFAULT;
319 break;
320 }
321 value = prom_getenv(name); /* PROM lock? */
322 if (!value) {
323 retval = -EINVAL;
324 break;
325 }
326 /* Do I strlen() for the length? */
327 copy_to_user(buf, value, 128);
328 retval = 0;
329 break;
330 }
331
332 case SGI_SETNVRAM: {
333 char *name = (char *) regs->regs[base+5];
334 char *value = (char *) regs->regs[base+6];
335 return -EINVAL; /* til I fix it */
336 retval = prom_setenv(name, value);
337 /* XXX make sure retval conforms to syssgi(2) */
338 printk("[%s:%d] setnvram(\"%s\", \"%s\"): retval %d",
339 current->comm, current->pid, name, value, retval);
340/* if (retval == PROM_ENOENT)
341 retval = -ENOENT; */
342 break;
343 }
344#endif
345
346 case SGI_SETPGID: {
347#ifdef DEBUG_PROCGRPS
348 printk("[%s:%d] setpgid(%d, %d) ",
349 current->comm, current->pid,
350 (int) regs->regs[base + 5], (int)regs->regs[base + 6]);
351#endif
352 retval = sys_setpgid(regs->regs[base + 5], regs->regs[base + 6]);
353
354#ifdef DEBUG_PROCGRPS
355 printk("retval=%d\n", retval);
356#endif
357 }
358
359 case SGI_SYSCONF: {
360 switch(regs->regs[base + 5]) {
361 case 1:
362 retval = (MAX_ARG_PAGES >> 4); /* XXX estimate... */
363 goto out;
364 case 2:
365 retval = max_threads;
366 goto out;
367 case 3:
368 retval = HZ;
369 goto out;
370 case 4:
371 retval = NGROUPS_MAX;
372 goto out;
373 case 5:
374 retval = NR_OPEN;
375 goto out;
376 case 6:
377 retval = 1;
378 goto out;
379 case 7:
380 retval = 1;
381 goto out;
382 case 8:
383 retval = 199009;
384 goto out;
385 case 11:
386 retval = PAGE_SIZE;
387 goto out;
388 case 12:
389 retval = 4;
390 goto out;
391 case 25:
392 case 26:
393 case 27:
394 case 28:
395 case 29:
396 case 30:
397 retval = 0;
398 goto out;
399 case 31:
400 retval = 32;
401 goto out;
402 default:
403 retval = -EINVAL;
404 goto out;
405 };
406 }
407
408 case SGI_SETGROUPS:
409 retval = sys_setgroups((int) regs->regs[base + 5],
410 (gid_t *) regs->regs[base + 6]);
411 break;
412
413 case SGI_GETGROUPS:
414 retval = sys_getgroups((int) regs->regs[base + 5],
415 (gid_t *) regs->regs[base + 6]);
416 break;
417
418 case SGI_RUSAGE: {
419 struct rusage *ru = (struct rusage *) regs->regs[base + 6];
420
421 switch((int) regs->regs[base + 5]) {
422 case 0:
423 /* rusage self */
424 retval = getrusage(current, RUSAGE_SELF, ru);
425 goto out;
426
427 case -1:
428 /* rusage children */
429 retval = getrusage(current, RUSAGE_CHILDREN, ru);
430 goto out;
431
432 default:
433 retval = -EINVAL;
434 goto out;
435 };
436 }
437
438 case SGI_SSYNC:
439 sys_sync();
440 retval = 0;
441 break;
442
443 case SGI_GETSID:
444#ifdef DEBUG_PROCGRPS
445 printk("[%s:%d] getsid(%d) ", current->comm, current->pid,
446 (int) regs->regs[base + 5]);
447#endif
448 retval = sys_getsid(regs->regs[base + 5]);
449#ifdef DEBUG_PROCGRPS
450 printk("retval=%d\n", retval);
451#endif
452 break;
453
454 case SGI_ELFMAP:
455 retval = irix_mapelf((int) regs->regs[base + 5],
456 (struct elf_phdr *) regs->regs[base + 6],
457 (int) regs->regs[base + 7]);
458 break;
459
460 case SGI_TOSSTSAVE:
461 /* XXX We don't need to do anything? */
462 retval = 0;
463 break;
464
465 case SGI_FP_BCOPY:
466 retval = 0;
467 break;
468
469 case SGI_PHYSP: {
470 unsigned long addr = regs->regs[base + 5];
471 int *pageno = (int *) (regs->regs[base + 6]);
472 struct mm_struct *mm = current->mm;
473 pgd_t *pgdp;
474 pmd_t *pmdp;
475 pte_t *ptep;
476
477 if (!access_ok(VERIFY_WRITE, pageno, sizeof(int)))
478 return -EFAULT;
479
480 down_read(&mm->mmap_sem);
481 pgdp = pgd_offset(mm, addr);
482 pmdp = pmd_offset(pgdp, addr);
483 ptep = pte_offset(pmdp, addr);
484 retval = -EINVAL;
485 if (ptep) {
486 pte_t pte = *ptep;
487
488 if (pte_val(pte) & (_PAGE_VALID | _PAGE_PRESENT)) {
489 retval = put_user((pte_val(pte) & PAGE_MASK) >>
490 PAGE_SHIFT, pageno);
491 }
492 }
493 up_read(&mm->mmap_sem);
494 break;
495 }
496
497 case SGI_INVENT: {
498 int arg1 = (int) regs->regs [base + 5];
499 void *buffer = (void *) regs->regs [base + 6];
500 int count = (int) regs->regs [base + 7];
501
502 switch (arg1) {
503 case SGI_INV_SIZEOF:
504 retval = sizeof (inventory_t);
505 break;
506 case SGI_INV_READ:
507 retval = dump_inventory_to_user (buffer, count);
508 break;
509 default:
510 retval = -EINVAL;
511 }
512 break;
513 }
514
515 default:
516 printk("irix_syssgi: Unsupported command %d\n", (int)cmd);
517 retval = -EINVAL;
518 break;
519 };
520
521out:
522 return retval;
523}
524
525asmlinkage int irix_gtime(struct pt_regs *regs)
526{
527 return get_seconds();
528}
529
530/*
531 * IRIX is completely broken... it returns 0 on success, otherwise
532 * ENOMEM.
533 */
534asmlinkage int irix_brk(unsigned long brk)
535{
536 unsigned long rlim;
537 unsigned long newbrk, oldbrk;
538 struct mm_struct *mm = current->mm;
539 int ret;
540
541 down_write(&mm->mmap_sem);
542 if (brk < mm->end_code) {
543 ret = -ENOMEM;
544 goto out;
545 }
546
547 newbrk = PAGE_ALIGN(brk);
548 oldbrk = PAGE_ALIGN(mm->brk);
549 if (oldbrk == newbrk) {
550 mm->brk = brk;
551 ret = 0;
552 goto out;
553 }
554
555 /*
556 * Always allow shrinking brk
557 */
558 if (brk <= mm->brk) {
559 mm->brk = brk;
560 do_munmap(mm, newbrk, oldbrk-newbrk);
561 ret = 0;
562 goto out;
563 }
564 /*
565 * Check against rlimit and stack..
566 */
567 rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
568 if (rlim >= RLIM_INFINITY)
569 rlim = ~0;
570 if (brk - mm->end_code > rlim) {
571 ret = -ENOMEM;
572 goto out;
573 }
574
575 /*
576 * Check against existing mmap mappings.
577 */
578 if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE)) {
579 ret = -ENOMEM;
580 goto out;
581 }
582
583 /*
584 * Check if we have enough memory..
585 */
586 if (security_vm_enough_memory((newbrk-oldbrk) >> PAGE_SHIFT)) {
587 ret = -ENOMEM;
588 goto out;
589 }
590
591 /*
592 * Ok, looks good - let it rip.
593 */
594 mm->brk = brk;
595 do_brk(oldbrk, newbrk-oldbrk);
596 ret = 0;
597
598out:
599 up_write(&mm->mmap_sem);
600 return ret;
601}
602
603asmlinkage int irix_getpid(struct pt_regs *regs)
604{
605 regs->regs[3] = current->real_parent->pid;
606 return current->pid;
607}
608
609asmlinkage int irix_getuid(struct pt_regs *regs)
610{
611 regs->regs[3] = current->euid;
612 return current->uid;
613}
614
615asmlinkage int irix_getgid(struct pt_regs *regs)
616{
617 regs->regs[3] = current->egid;
618 return current->gid;
619}
620
621asmlinkage int irix_stime(int value)
622{
623 int err;
624 struct timespec tv;
625
626 tv.tv_sec = value;
627 tv.tv_nsec = 0;
628 err = security_settime(&tv, NULL);
629 if (err)
630 return err;
631
632 write_seqlock_irq(&xtime_lock);
633 xtime.tv_sec = value;
634 xtime.tv_nsec = 0;
635 time_adjust = 0; /* stop active adjtime() */
636 time_status |= STA_UNSYNC;
637 time_maxerror = NTP_PHASE_LIMIT;
638 time_esterror = NTP_PHASE_LIMIT;
639 write_sequnlock_irq(&xtime_lock);
640
641 return 0;
642}
643
644static inline void jiffiestotv(unsigned long jiffies, struct timeval *value)
645{
646 value->tv_usec = (jiffies % HZ) * (1000000 / HZ);
647 value->tv_sec = jiffies / HZ;
648}
649
650static inline void getitimer_real(struct itimerval *value)
651{
652 register unsigned long val, interval;
653
654 interval = current->it_real_incr;
655 val = 0;
656 if (del_timer(&current->real_timer)) {
657 unsigned long now = jiffies;
658 val = current->real_timer.expires;
659 add_timer(&current->real_timer);
660 /* look out for negative/zero itimer.. */
661 if (val <= now)
662 val = now+1;
663 val -= now;
664 }
665 jiffiestotv(val, &value->it_value);
666 jiffiestotv(interval, &value->it_interval);
667}
668
669asmlinkage unsigned int irix_alarm(unsigned int seconds)
670{
671 struct itimerval it_new, it_old;
672 unsigned int oldalarm;
673
674 if (!seconds) {
675 getitimer_real(&it_old);
676 del_timer(&current->real_timer);
677 } else {
678 it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;
679 it_new.it_value.tv_sec = seconds;
680 it_new.it_value.tv_usec = 0;
681 do_setitimer(ITIMER_REAL, &it_new, &it_old);
682 }
683 oldalarm = it_old.it_value.tv_sec;
684 /*
685 * ehhh.. We can't return 0 if we have an alarm pending ...
686 * And we'd better return too much than too little anyway
687 */
688 if (it_old.it_value.tv_usec)
689 oldalarm++;
690
691 return oldalarm;
692}
693
694asmlinkage int irix_pause(void)
695{
696 current->state = TASK_INTERRUPTIBLE;
697 schedule();
698
699 return -EINTR;
700}
701
702/* XXX need more than this... */
703asmlinkage int irix_mount(char *dev_name, char *dir_name, unsigned long flags,
704 char *type, void *data, int datalen)
705{
706 printk("[%s:%d] irix_mount(%p,%p,%08lx,%p,%p,%d)\n",
707 current->comm, current->pid,
708 dev_name, dir_name, flags, type, data, datalen);
709
710 return sys_mount(dev_name, dir_name, type, flags, data);
711}
712
713struct irix_statfs {
714 short f_type;
715 long f_bsize, f_frsize, f_blocks, f_bfree, f_files, f_ffree;
716 char f_fname[6], f_fpack[6];
717};
718
719asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf,
720 int len, int fs_type)
721{
722 struct nameidata nd;
723 struct kstatfs kbuf;
724 int error, i;
725
726 /* We don't support this feature yet. */
727 if (fs_type) {
728 error = -EINVAL;
729 goto out;
730 }
731 if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statfs))) {
732 error = -EFAULT;
733 goto out;
734 }
735 error = user_path_walk(path, &nd);
736 if (error)
737 goto out;
738
739 error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf);
740 if (error)
741 goto dput_and_out;
742
743 __put_user(kbuf.f_type, &buf->f_type);
744 __put_user(kbuf.f_bsize, &buf->f_bsize);
745 __put_user(kbuf.f_frsize, &buf->f_frsize);
746 __put_user(kbuf.f_blocks, &buf->f_blocks);
747 __put_user(kbuf.f_bfree, &buf->f_bfree);
748 __put_user(kbuf.f_files, &buf->f_files);
749 __put_user(kbuf.f_ffree, &buf->f_ffree);
750 for (i = 0; i < 6; i++) {
751 __put_user(0, &buf->f_fname[i]);
752 __put_user(0, &buf->f_fpack[i]);
753 }
754 error = 0;
755
756dput_and_out:
757 path_release(&nd);
758out:
759 return error;
760}
761
762asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs *buf)
763{
764 struct kstatfs kbuf;
765 struct file *file;
766 int error, i;
767
768 if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statfs))) {
769 error = -EFAULT;
770 goto out;
771 }
772 if (!(file = fget(fd))) {
773 error = -EBADF;
774 goto out;
775 }
776
777 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf);
778 if (error)
779 goto out_f;
780
781 __put_user(kbuf.f_type, &buf->f_type);
782 __put_user(kbuf.f_bsize, &buf->f_bsize);
783 __put_user(kbuf.f_frsize, &buf->f_frsize);
784 __put_user(kbuf.f_blocks, &buf->f_blocks);
785 __put_user(kbuf.f_bfree, &buf->f_bfree);
786 __put_user(kbuf.f_files, &buf->f_files);
787 __put_user(kbuf.f_ffree, &buf->f_ffree);
788 for(i = 0; i < 6; i++) {
789 __put_user(0, &buf->f_fname[i]);
790 __put_user(0, &buf->f_fpack[i]);
791 }
792
793out_f:
794 fput(file);
795out:
796 return error;
797}
798
799asmlinkage int irix_setpgrp(int flags)
800{
801 int error;
802
803#ifdef DEBUG_PROCGRPS
804 printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags);
805#endif
806 if(!flags)
807 error = process_group(current);
808 else
809 error = sys_setsid();
810#ifdef DEBUG_PROCGRPS
811 printk("returning %d\n", process_group(current));
812#endif
813
814 return error;
815}
816
817asmlinkage int irix_times(struct tms * tbuf)
818{
819 int err = 0;
820
821 if (tbuf) {
822 if (!access_ok(VERIFY_WRITE,tbuf,sizeof *tbuf))
823 return -EFAULT;
824 err |= __put_user(current->utime, &tbuf->tms_utime);
825 err |= __put_user(current->stime, &tbuf->tms_stime);
826 err |= __put_user(current->signal->cutime, &tbuf->tms_cutime);
827 err |= __put_user(current->signal->cstime, &tbuf->tms_cstime);
828 }
829
830 return err;
831}
832
833asmlinkage int irix_exec(struct pt_regs *regs)
834{
835 int error, base = 0;
836 char *filename;
837
838 if(regs->regs[2] == 1000)
839 base = 1;
840 filename = getname((char *) (long)regs->regs[base + 4]);
841 error = PTR_ERR(filename);
842 if (IS_ERR(filename))
843 return error;
844
845 error = do_execve(filename, (char **) (long)regs->regs[base + 5],
846 (char **) 0, regs);
847 putname(filename);
848
849 return error;
850}
851
852asmlinkage int irix_exece(struct pt_regs *regs)
853{
854 int error, base = 0;
855 char *filename;
856
857 if (regs->regs[2] == 1000)
858 base = 1;
859 filename = getname((char *) (long)regs->regs[base + 4]);
860 error = PTR_ERR(filename);
861 if (IS_ERR(filename))
862 return error;
863 error = do_execve(filename, (char **) (long)regs->regs[base + 5],
864 (char **) (long)regs->regs[base + 6], regs);
865 putname(filename);
866
867 return error;
868}
869
870asmlinkage unsigned long irix_gethostid(void)
871{
872 printk("[%s:%d]: irix_gethostid() called...\n",
873 current->comm, current->pid);
874
875 return -EINVAL;
876}
877
878asmlinkage unsigned long irix_sethostid(unsigned long val)
879{
880 printk("[%s:%d]: irix_sethostid(%08lx) called...\n",
881 current->comm, current->pid, val);
882
883 return -EINVAL;
884}
885
886asmlinkage int irix_socket(int family, int type, int protocol)
887{
888 switch(type) {
889 case 1:
890 type = SOCK_DGRAM;
891 break;
892
893 case 2:
894 type = SOCK_STREAM;
895 break;
896
897 case 3:
898 type = 9; /* Invalid... */
899 break;
900
901 case 4:
902 type = SOCK_RAW;
903 break;
904
905 case 5:
906 type = SOCK_RDM;
907 break;
908
909 case 6:
910 type = SOCK_SEQPACKET;
911 break;
912
913 default:
914 break;
915 }
916
917 return sys_socket(family, type, protocol);
918}
919
920asmlinkage int irix_getdomainname(char *name, int len)
921{
922 int error;
923
924 if (!access_ok(VERIFY_WRITE, name, len))
925 return -EFAULT;
926
927 down_read(&uts_sem);
928 if (len > __NEW_UTS_LEN)
929 len = __NEW_UTS_LEN;
930 error = 0;
931 if (copy_to_user(name, system_utsname.domainname, len))
932 error = -EFAULT;
933 up_read(&uts_sem);
934
935 return error;
936}
937
938asmlinkage unsigned long irix_getpagesize(void)
939{
940 return PAGE_SIZE;
941}
942
943asmlinkage int irix_msgsys(int opcode, unsigned long arg0, unsigned long arg1,
944 unsigned long arg2, unsigned long arg3,
945 unsigned long arg4)
946{
947 switch (opcode) {
948 case 0:
949 return sys_msgget((key_t) arg0, (int) arg1);
950 case 1:
951 return sys_msgctl((int) arg0, (int) arg1, (struct msqid_ds *)arg2);
952 case 2:
953 return sys_msgrcv((int) arg0, (struct msgbuf *) arg1,
954 (size_t) arg2, (long) arg3, (int) arg4);
955 case 3:
956 return sys_msgsnd((int) arg0, (struct msgbuf *) arg1,
957 (size_t) arg2, (int) arg3);
958 default:
959 return -EINVAL;
960 }
961}
962
963asmlinkage int irix_shmsys(int opcode, unsigned long arg0, unsigned long arg1,
964 unsigned long arg2, unsigned long arg3)
965{
966 switch (opcode) {
967 case 0:
968 return do_shmat((int) arg0, (char *)arg1, (int) arg2,
969 (unsigned long *) arg3);
970 case 1:
971 return sys_shmctl((int)arg0, (int)arg1, (struct shmid_ds *)arg2);
972 case 2:
973 return sys_shmdt((char *)arg0);
974 case 3:
975 return sys_shmget((key_t) arg0, (int) arg1, (int) arg2);
976 default:
977 return -EINVAL;
978 }
979}
980
981asmlinkage int irix_semsys(int opcode, unsigned long arg0, unsigned long arg1,
982 unsigned long arg2, int arg3)
983{
984 switch (opcode) {
985 case 0:
986 return sys_semctl((int) arg0, (int) arg1, (int) arg2,
987 (union semun) arg3);
988 case 1:
989 return sys_semget((key_t) arg0, (int) arg1, (int) arg2);
990 case 2:
991 return sys_semop((int) arg0, (struct sembuf *)arg1,
992 (unsigned int) arg2);
993 default:
994 return -EINVAL;
995 }
996}
997
998static inline loff_t llseek(struct file *file, loff_t offset, int origin)
999{
1000 loff_t (*fn)(struct file *, loff_t, int);
1001 loff_t retval;
1002
1003 fn = default_llseek;
1004 if (file->f_op && file->f_op->llseek)
1005 fn = file->f_op->llseek;
1006 lock_kernel();
1007 retval = fn(file, offset, origin);
1008 unlock_kernel();
1009 return retval;
1010}
1011
1012asmlinkage int irix_lseek64(int fd, int _unused, int offhi, int offlow,
1013 int origin)
1014{
1015 int retval;
1016 struct file * file;
1017 loff_t offset;
1018
1019 retval = -EBADF;
1020 file = fget(fd);
1021 if (!file)
1022 goto bad;
1023 retval = -EINVAL;
1024 if (origin > 2)
1025 goto out_putf;
1026
1027 offset = llseek(file, ((loff_t) offhi << 32) | offlow, origin);
1028 retval = (int) offset;
1029
1030out_putf:
1031 fput(file);
1032bad:
1033 return retval;
1034}
1035
1036asmlinkage int irix_sginap(int ticks)
1037{
1038 current->state = TASK_INTERRUPTIBLE;
1039 schedule_timeout(ticks);
1040 return 0;
1041}
1042
1043asmlinkage int irix_sgikopt(char *istring, char *ostring, int len)
1044{
1045 return -EINVAL;
1046}
1047
1048asmlinkage int irix_gettimeofday(struct timeval *tv)
1049{
1050 time_t sec;
1051 long nsec, seq;
1052 int err;
1053
1054 if (!access_ok(VERIFY_WRITE, tv, sizeof(struct timeval)))
1055 return -EFAULT;
1056
1057 do {
1058 seq = read_seqbegin(&xtime_lock);
1059 sec = xtime.tv_sec;
1060 nsec = xtime.tv_nsec;
1061 } while (read_seqretry(&xtime_lock, seq));
1062
1063 err = __put_user(sec, &tv->tv_sec);
1064 err |= __put_user((nsec / 1000), &tv->tv_usec);
1065
1066 return err;
1067}
1068
1069#define IRIX_MAP_AUTOGROW 0x40
1070
1071asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot,
1072 int flags, int fd, off_t offset)
1073{
1074 struct file *file = NULL;
1075 unsigned long retval;
1076
1077 if (!(flags & MAP_ANONYMOUS)) {
1078 if (!(file = fget(fd)))
1079 return -EBADF;
1080
1081 /* Ok, bad taste hack follows, try to think in something else
1082 * when reading this. */
1083 if (flags & IRIX_MAP_AUTOGROW) {
1084 unsigned long old_pos;
1085 long max_size = offset + len;
1086
1087 if (max_size > file->f_dentry->d_inode->i_size) {
1088 old_pos = sys_lseek (fd, max_size - 1, 0);
1089 sys_write (fd, "", 1);
1090 sys_lseek (fd, old_pos, 0);
1091 }
1092 }
1093 }
1094
1095 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
1096
1097 down_write(&current->mm->mmap_sem);
1098 retval = do_mmap(file, addr, len, prot, flags, offset);
1099 up_write(&current->mm->mmap_sem);
1100 if (file)
1101 fput(file);
1102
1103 return retval;
1104}
1105
1106asmlinkage int irix_madvise(unsigned long addr, int len, int behavior)
1107{
1108 printk("[%s:%d] Wheee.. irix_madvise(%08lx,%d,%d)\n",
1109 current->comm, current->pid, addr, len, behavior);
1110
1111 return -EINVAL;
1112}
1113
1114asmlinkage int irix_pagelock(char *addr, int len, int op)
1115{
1116 printk("[%s:%d] Wheee.. irix_pagelock(%p,%d,%d)\n",
1117 current->comm, current->pid, addr, len, op);
1118
1119 return -EINVAL;
1120}
1121
1122asmlinkage int irix_quotactl(struct pt_regs *regs)
1123{
1124 printk("[%s:%d] Wheee.. irix_quotactl()\n",
1125 current->comm, current->pid);
1126
1127 return -EINVAL;
1128}
1129
1130asmlinkage int irix_BSDsetpgrp(int pid, int pgrp)
1131{
1132 int error;
1133
1134#ifdef DEBUG_PROCGRPS
1135 printk("[%s:%d] BSDsetpgrp(%d, %d) ", current->comm, current->pid,
1136 pid, pgrp);
1137#endif
1138 if(!pid)
1139 pid = current->pid;
1140
1141 /* Wheee, weird sysv thing... */
1142 if ((pgrp == 0) && (pid == current->pid))
1143 error = sys_setsid();
1144 else
1145 error = sys_setpgid(pid, pgrp);
1146
1147#ifdef DEBUG_PROCGRPS
1148 printk("error = %d\n", error);
1149#endif
1150
1151 return error;
1152}
1153
1154asmlinkage int irix_systeminfo(int cmd, char *buf, int cnt)
1155{
1156 printk("[%s:%d] Wheee.. irix_systeminfo(%d,%p,%d)\n",
1157 current->comm, current->pid, cmd, buf, cnt);
1158
1159 return -EINVAL;
1160}
1161
1162struct iuname {
1163 char sysname[257], nodename[257], release[257];
1164 char version[257], machine[257];
1165 char m_type[257], base_rel[257];
1166 char _unused0[257], _unused1[257], _unused2[257];
1167 char _unused3[257], _unused4[257], _unused5[257];
1168};
1169
1170asmlinkage int irix_uname(struct iuname *buf)
1171{
1172 down_read(&uts_sem);
1173 if (copy_to_user(system_utsname.sysname, buf->sysname, 65)
1174 || copy_to_user(system_utsname.nodename, buf->nodename, 65)
1175 || copy_to_user(system_utsname.release, buf->release, 65)
1176 || copy_to_user(system_utsname.version, buf->version, 65)
1177 || copy_to_user(system_utsname.machine, buf->machine, 65)) {
1178 return -EFAULT;
1179 }
1180 up_read(&uts_sem);
1181
1182 return 1;
1183}
1184
1185#undef DEBUG_XSTAT
1186
1187static int irix_xstat32_xlate(struct kstat *stat, void *ubuf)
1188{
1189 struct xstat32 {
1190 u32 st_dev, st_pad1[3], st_ino, st_mode, st_nlink, st_uid, st_gid;
1191 u32 st_rdev, st_pad2[2], st_size, st_pad3;
1192 u32 st_atime0, st_atime1;
1193 u32 st_mtime0, st_mtime1;
1194 u32 st_ctime0, st_ctime1;
1195 u32 st_blksize, st_blocks;
1196 char st_fstype[16];
1197 u32 st_pad4[8];
1198 } ub;
1199
1200 if (!sysv_valid_dev(stat->dev) || !sysv_valid_dev(stat->rdev))
1201 return -EOVERFLOW;
1202 ub.st_dev = sysv_encode_dev(stat->dev);
1203 ub.st_ino = stat->ino;
1204 ub.st_mode = stat->mode;
1205 ub.st_nlink = stat->nlink;
1206 SET_UID(ub.st_uid, stat->uid);
1207 SET_GID(ub.st_gid, stat->gid);
1208 ub.st_rdev = sysv_encode_dev(stat->rdev);
1209#if BITS_PER_LONG == 32
1210 if (stat->size > MAX_NON_LFS)
1211 return -EOVERFLOW;
1212#endif
1213 ub.st_size = stat->size;
1214 ub.st_atime0 = stat->atime.tv_sec;
1215 ub.st_atime1 = stat->atime.tv_nsec;
1216 ub.st_mtime0 = stat->mtime.tv_sec;
1217 ub.st_mtime1 = stat->atime.tv_nsec;
1218 ub.st_ctime0 = stat->ctime.tv_sec;
1219 ub.st_ctime1 = stat->atime.tv_nsec;
1220 ub.st_blksize = stat->blksize;
1221 ub.st_blocks = stat->blocks;
1222 strcpy (ub.st_fstype, "efs");
1223
1224 return copy_to_user(ubuf, &ub, sizeof(ub)) ? -EFAULT : 0;
1225}
1226
1227static int irix_xstat64_xlate(struct kstat *stat, void *ubuf)
1228{
1229 struct xstat64 {
1230 u32 st_dev; s32 st_pad1[3];
1231 unsigned long long st_ino;
1232 u32 st_mode;
1233 u32 st_nlink; s32 st_uid; s32 st_gid; u32 st_rdev;
1234 s32 st_pad2[2];
1235 long long st_size;
1236 s32 st_pad3;
1237 struct { s32 tv_sec, tv_nsec; } st_atime, st_mtime, st_ctime;
1238 s32 st_blksize;
1239 long long st_blocks;
1240 char st_fstype[16];
1241 s32 st_pad4[8];
1242 } ks;
1243
1244 if (!sysv_valid_dev(stat->dev) || !sysv_valid_dev(stat->rdev))
1245 return -EOVERFLOW;
1246
1247 ks.st_dev = sysv_encode_dev(stat->dev);
1248 ks.st_pad1[0] = ks.st_pad1[1] = ks.st_pad1[2] = 0;
1249 ks.st_ino = (unsigned long long) stat->ino;
1250 ks.st_mode = (u32) stat->mode;
1251 ks.st_nlink = (u32) stat->nlink;
1252 ks.st_uid = (s32) stat->uid;
1253 ks.st_gid = (s32) stat->gid;
1254 ks.st_rdev = sysv_encode_dev (stat->rdev);
1255 ks.st_pad2[0] = ks.st_pad2[1] = 0;
1256 ks.st_size = (long long) stat->size;
1257 ks.st_pad3 = 0;
1258
1259 /* XXX hackety hack... */
1260 ks.st_atime.tv_sec = (s32) stat->atime.tv_sec;
1261 ks.st_atime.tv_nsec = stat->atime.tv_nsec;
1262 ks.st_mtime.tv_sec = (s32) stat->mtime.tv_sec;
1263 ks.st_mtime.tv_nsec = stat->mtime.tv_nsec;
1264 ks.st_ctime.tv_sec = (s32) stat->ctime.tv_sec;
1265 ks.st_ctime.tv_nsec = stat->ctime.tv_nsec;
1266
1267 ks.st_blksize = (s32) stat->blksize;
1268 ks.st_blocks = (long long) stat->blocks;
1269 memset(ks.st_fstype, 0, 16);
1270 ks.st_pad4[0] = ks.st_pad4[1] = ks.st_pad4[2] = ks.st_pad4[3] = 0;
1271 ks.st_pad4[4] = ks.st_pad4[5] = ks.st_pad4[6] = ks.st_pad4[7] = 0;
1272
1273 /* Now write it all back. */
1274 return copy_to_user(ubuf, &ks, sizeof(ks)) ? -EFAULT : 0;
1275}
1276
1277asmlinkage int irix_xstat(int version, char *filename, struct stat *statbuf)
1278{
1279 int retval;
1280 struct kstat stat;
1281
1282#ifdef DEBUG_XSTAT
1283 printk("[%s:%d] Wheee.. irix_xstat(%d,%s,%p) ",
1284 current->comm, current->pid, version, filename, statbuf);
1285#endif
1286
1287 retval = vfs_stat(filename, &stat);
1288 if (!retval) {
1289 switch(version) {
1290 case 2:
1291 retval = irix_xstat32_xlate(&stat, statbuf);
1292 break;
1293 case 3:
1294 retval = irix_xstat64_xlate(&stat, statbuf);
1295 break;
1296 default:
1297 retval = -EINVAL;
1298 }
1299 }
1300 return retval;
1301}
1302
1303asmlinkage int irix_lxstat(int version, char *filename, struct stat *statbuf)
1304{
1305 int error;
1306 struct kstat stat;
1307
1308#ifdef DEBUG_XSTAT
1309 printk("[%s:%d] Wheee.. irix_lxstat(%d,%s,%p) ",
1310 current->comm, current->pid, version, filename, statbuf);
1311#endif
1312
1313 error = vfs_lstat(filename, &stat);
1314
1315 if (!error) {
1316 switch (version) {
1317 case 2:
1318 error = irix_xstat32_xlate(&stat, statbuf);
1319 break;
1320 case 3:
1321 error = irix_xstat64_xlate(&stat, statbuf);
1322 break;
1323 default:
1324 error = -EINVAL;
1325 }
1326 }
1327 return error;
1328}
1329
1330asmlinkage int irix_fxstat(int version, int fd, struct stat *statbuf)
1331{
1332 int error;
1333 struct kstat stat;
1334
1335#ifdef DEBUG_XSTAT
1336 printk("[%s:%d] Wheee.. irix_fxstat(%d,%d,%p) ",
1337 current->comm, current->pid, version, fd, statbuf);
1338#endif
1339
1340 error = vfs_fstat(fd, &stat);
1341 if (!error) {
1342 switch (version) {
1343 case 2:
1344 error = irix_xstat32_xlate(&stat, statbuf);
1345 break;
1346 case 3:
1347 error = irix_xstat64_xlate(&stat, statbuf);
1348 break;
1349 default:
1350 error = -EINVAL;
1351 }
1352 }
1353 return error;
1354}
1355
1356asmlinkage int irix_xmknod(int ver, char *filename, int mode, unsigned dev)
1357{
1358 int retval;
1359 printk("[%s:%d] Wheee.. irix_xmknod(%d,%s,%x,%x)\n",
1360 current->comm, current->pid, ver, filename, mode, dev);
1361
1362 switch(ver) {
1363 case 2:
1364 /* shouldn't we convert here as well as on stat()? */
1365 retval = sys_mknod(filename, mode, dev);
1366 break;
1367
1368 default:
1369 retval = -EINVAL;
1370 break;
1371 };
1372
1373 return retval;
1374}
1375
1376asmlinkage int irix_swapctl(int cmd, char *arg)
1377{
1378 printk("[%s:%d] Wheee.. irix_swapctl(%d,%p)\n",
1379 current->comm, current->pid, cmd, arg);
1380
1381 return -EINVAL;
1382}
1383
1384struct irix_statvfs {
1385 u32 f_bsize; u32 f_frsize; u32 f_blocks;
1386 u32 f_bfree; u32 f_bavail; u32 f_files; u32 f_ffree; u32 f_favail;
1387 u32 f_fsid; char f_basetype[16];
1388 u32 f_flag; u32 f_namemax;
1389 char f_fstr[32]; u32 f_filler[16];
1390};
1391
1392asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf)
1393{
1394 struct nameidata nd;
1395 struct kstatfs kbuf;
1396 int error, i;
1397
1398 printk("[%s:%d] Wheee.. irix_statvfs(%s,%p)\n",
1399 current->comm, current->pid, fname, buf);
1400 if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs))) {
1401 error = -EFAULT;
1402 goto out;
1403 }
1404 error = user_path_walk(fname, &nd);
1405 if (error)
1406 goto out;
1407 error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf);
1408 if (error)
1409 goto dput_and_out;
1410
1411 __put_user(kbuf.f_bsize, &buf->f_bsize);
1412 __put_user(kbuf.f_frsize, &buf->f_frsize);
1413 __put_user(kbuf.f_blocks, &buf->f_blocks);
1414 __put_user(kbuf.f_bfree, &buf->f_bfree);
1415 __put_user(kbuf.f_bfree, &buf->f_bavail); /* XXX hackety hack... */
1416 __put_user(kbuf.f_files, &buf->f_files);
1417 __put_user(kbuf.f_ffree, &buf->f_ffree);
1418 __put_user(kbuf.f_ffree, &buf->f_favail); /* XXX hackety hack... */
1419#ifdef __MIPSEB__
1420 __put_user(kbuf.f_fsid.val[1], &buf->f_fsid);
1421#else
1422 __put_user(kbuf.f_fsid.val[0], &buf->f_fsid);
1423#endif
1424 for (i = 0; i < 16; i++)
1425 __put_user(0, &buf->f_basetype[i]);
1426 __put_user(0, &buf->f_flag);
1427 __put_user(kbuf.f_namelen, &buf->f_namemax);
1428 for (i = 0; i < 32; i++)
1429 __put_user(0, &buf->f_fstr[i]);
1430
1431 error = 0;
1432
1433dput_and_out:
1434 path_release(&nd);
1435out:
1436 return error;
1437}
1438
1439asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs *buf)
1440{
1441 struct kstatfs kbuf;
1442 struct file *file;
1443 int error, i;
1444
1445 printk("[%s:%d] Wheee.. irix_fstatvfs(%d,%p)\n",
1446 current->comm, current->pid, fd, buf);
1447
1448 if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs))) {
1449 error = -EFAULT;
1450 goto out;
1451 }
1452 if (!(file = fget(fd))) {
1453 error = -EBADF;
1454 goto out;
1455 }
1456 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf);
1457 if (error)
1458 goto out_f;
1459
1460 __put_user(kbuf.f_bsize, &buf->f_bsize);
1461 __put_user(kbuf.f_frsize, &buf->f_frsize);
1462 __put_user(kbuf.f_blocks, &buf->f_blocks);
1463 __put_user(kbuf.f_bfree, &buf->f_bfree);
1464 __put_user(kbuf.f_bfree, &buf->f_bavail); /* XXX hackety hack... */
1465 __put_user(kbuf.f_files, &buf->f_files);
1466 __put_user(kbuf.f_ffree, &buf->f_ffree);
1467 __put_user(kbuf.f_ffree, &buf->f_favail); /* XXX hackety hack... */
1468#ifdef __MIPSEB__
1469 __put_user(kbuf.f_fsid.val[1], &buf->f_fsid);
1470#else
1471 __put_user(kbuf.f_fsid.val[0], &buf->f_fsid);
1472#endif
1473 for(i = 0; i < 16; i++)
1474 __put_user(0, &buf->f_basetype[i]);
1475 __put_user(0, &buf->f_flag);
1476 __put_user(kbuf.f_namelen, &buf->f_namemax);
1477 __clear_user(&buf->f_fstr, sizeof(buf->f_fstr));
1478
1479out_f:
1480 fput(file);
1481out:
1482 return error;
1483}
1484
1485asmlinkage int irix_priocntl(struct pt_regs *regs)
1486{
1487 printk("[%s:%d] Wheee.. irix_priocntl()\n",
1488 current->comm, current->pid);
1489
1490 return -EINVAL;
1491}
1492
1493asmlinkage int irix_sigqueue(int pid, int sig, int code, int val)
1494{
1495 printk("[%s:%d] Wheee.. irix_sigqueue(%d,%d,%d,%d)\n",
1496 current->comm, current->pid, pid, sig, code, val);
1497
1498 return -EINVAL;
1499}
1500
1501asmlinkage int irix_truncate64(char *name, int pad, int size1, int size2)
1502{
1503 int retval;
1504
1505 if (size1) {
1506 retval = -EINVAL;
1507 goto out;
1508 }
1509 retval = sys_truncate(name, size2);
1510
1511out:
1512 return retval;
1513}
1514
1515asmlinkage int irix_ftruncate64(int fd, int pad, int size1, int size2)
1516{
1517 int retval;
1518
1519 if (size1) {
1520 retval = -EINVAL;
1521 goto out;
1522 }
1523 retval = sys_ftruncate(fd, size2);
1524
1525out:
1526 return retval;
1527}
1528
1529asmlinkage int irix_mmap64(struct pt_regs *regs)
1530{
1531 int len, prot, flags, fd, off1, off2, error, base = 0;
1532 unsigned long addr, pgoff, *sp;
1533 struct file *file = NULL;
1534
1535 if (regs->regs[2] == 1000)
1536 base = 1;
1537 sp = (unsigned long *) (regs->regs[29] + 16);
1538 addr = regs->regs[base + 4];
1539 len = regs->regs[base + 5];
1540 prot = regs->regs[base + 6];
1541 if (!base) {
1542 flags = regs->regs[base + 7];
1543 if (!access_ok(VERIFY_READ, sp, (4 * sizeof(unsigned long)))) {
1544 error = -EFAULT;
1545 goto out;
1546 }
1547 fd = sp[0];
1548 __get_user(off1, &sp[1]);
1549 __get_user(off2, &sp[2]);
1550 } else {
1551 if (!access_ok(VERIFY_READ, sp, (5 * sizeof(unsigned long)))) {
1552 error = -EFAULT;
1553 goto out;
1554 }
1555 __get_user(flags, &sp[0]);
1556 __get_user(fd, &sp[1]);
1557 __get_user(off1, &sp[2]);
1558 __get_user(off2, &sp[3]);
1559 }
1560
1561 if (off1 & PAGE_MASK) {
1562 error = -EOVERFLOW;
1563 goto out;
1564 }
1565
1566 pgoff = (off1 << (32 - PAGE_SHIFT)) | (off2 >> PAGE_SHIFT);
1567
1568 if (!(flags & MAP_ANONYMOUS)) {
1569 if (!(file = fget(fd))) {
1570 error = -EBADF;
1571 goto out;
1572 }
1573
1574 /* Ok, bad taste hack follows, try to think in something else
1575 when reading this */
1576 if (flags & IRIX_MAP_AUTOGROW) {
1577 unsigned long old_pos;
1578 long max_size = off2 + len;
1579
1580 if (max_size > file->f_dentry->d_inode->i_size) {
1581 old_pos = sys_lseek (fd, max_size - 1, 0);
1582 sys_write (fd, "", 1);
1583 sys_lseek (fd, old_pos, 0);
1584 }
1585 }
1586 }
1587
1588 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
1589
1590 down_write(&current->mm->mmap_sem);
1591 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
1592 up_write(&current->mm->mmap_sem);
1593
1594 if (file)
1595 fput(file);
1596
1597out:
1598 return error;
1599}
1600
1601asmlinkage int irix_dmi(struct pt_regs *regs)
1602{
1603 printk("[%s:%d] Wheee.. irix_dmi()\n",
1604 current->comm, current->pid);
1605
1606 return -EINVAL;
1607}
1608
1609asmlinkage int irix_pread(int fd, char *buf, int cnt, int off64,
1610 int off1, int off2)
1611{
1612 printk("[%s:%d] Wheee.. irix_pread(%d,%p,%d,%d,%d,%d)\n",
1613 current->comm, current->pid, fd, buf, cnt, off64, off1, off2);
1614
1615 return -EINVAL;
1616}
1617
1618asmlinkage int irix_pwrite(int fd, char *buf, int cnt, int off64,
1619 int off1, int off2)
1620{
1621 printk("[%s:%d] Wheee.. irix_pwrite(%d,%p,%d,%d,%d,%d)\n",
1622 current->comm, current->pid, fd, buf, cnt, off64, off1, off2);
1623
1624 return -EINVAL;
1625}
1626
1627asmlinkage int irix_sgifastpath(int cmd, unsigned long arg0, unsigned long arg1,
1628 unsigned long arg2, unsigned long arg3,
1629 unsigned long arg4, unsigned long arg5)
1630{
1631 printk("[%s:%d] Wheee.. irix_fastpath(%d,%08lx,%08lx,%08lx,%08lx,"
1632 "%08lx,%08lx)\n",
1633 current->comm, current->pid, cmd, arg0, arg1, arg2,
1634 arg3, arg4, arg5);
1635
1636 return -EINVAL;
1637}
1638
1639struct irix_statvfs64 {
1640 u32 f_bsize; u32 f_frsize;
1641 u64 f_blocks; u64 f_bfree; u64 f_bavail;
1642 u64 f_files; u64 f_ffree; u64 f_favail;
1643 u32 f_fsid;
1644 char f_basetype[16];
1645 u32 f_flag; u32 f_namemax;
1646 char f_fstr[32];
1647 u32 f_filler[16];
1648};
1649
1650asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf)
1651{
1652 struct nameidata nd;
1653 struct kstatfs kbuf;
1654 int error, i;
1655
1656 printk("[%s:%d] Wheee.. irix_statvfs64(%s,%p)\n",
1657 current->comm, current->pid, fname, buf);
1658 if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs64))) {
1659 error = -EFAULT;
1660 goto out;
1661 }
1662 error = user_path_walk(fname, &nd);
1663 if (error)
1664 goto out;
1665 error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf);
1666 if (error)
1667 goto dput_and_out;
1668
1669 __put_user(kbuf.f_bsize, &buf->f_bsize);
1670 __put_user(kbuf.f_frsize, &buf->f_frsize);
1671 __put_user(kbuf.f_blocks, &buf->f_blocks);
1672 __put_user(kbuf.f_bfree, &buf->f_bfree);
1673 __put_user(kbuf.f_bfree, &buf->f_bavail); /* XXX hackety hack... */
1674 __put_user(kbuf.f_files, &buf->f_files);
1675 __put_user(kbuf.f_ffree, &buf->f_ffree);
1676 __put_user(kbuf.f_ffree, &buf->f_favail); /* XXX hackety hack... */
1677#ifdef __MIPSEB__
1678 __put_user(kbuf.f_fsid.val[1], &buf->f_fsid);
1679#else
1680 __put_user(kbuf.f_fsid.val[0], &buf->f_fsid);
1681#endif
1682 for(i = 0; i < 16; i++)
1683 __put_user(0, &buf->f_basetype[i]);
1684 __put_user(0, &buf->f_flag);
1685 __put_user(kbuf.f_namelen, &buf->f_namemax);
1686 for(i = 0; i < 32; i++)
1687 __put_user(0, &buf->f_fstr[i]);
1688
1689 error = 0;
1690
1691dput_and_out:
1692 path_release(&nd);
1693out:
1694 return error;
1695}
1696
1697asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf)
1698{
1699 struct kstatfs kbuf;
1700 struct file *file;
1701 int error, i;
1702
1703 printk("[%s:%d] Wheee.. irix_fstatvfs64(%d,%p)\n",
1704 current->comm, current->pid, fd, buf);
1705
1706 if (!access_ok(VERIFY_WRITE, buf, sizeof(struct irix_statvfs))) {
1707 error = -EFAULT;
1708 goto out;
1709 }
1710 if (!(file = fget(fd))) {
1711 error = -EBADF;
1712 goto out;
1713 }
1714 error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf);
1715 if (error)
1716 goto out_f;
1717
1718 __put_user(kbuf.f_bsize, &buf->f_bsize);
1719 __put_user(kbuf.f_frsize, &buf->f_frsize);
1720 __put_user(kbuf.f_blocks, &buf->f_blocks);
1721 __put_user(kbuf.f_bfree, &buf->f_bfree);
1722 __put_user(kbuf.f_bfree, &buf->f_bavail); /* XXX hackety hack... */
1723 __put_user(kbuf.f_files, &buf->f_files);
1724 __put_user(kbuf.f_ffree, &buf->f_ffree);
1725 __put_user(kbuf.f_ffree, &buf->f_favail); /* XXX hackety hack... */
1726#ifdef __MIPSEB__
1727 __put_user(kbuf.f_fsid.val[1], &buf->f_fsid);
1728#else
1729 __put_user(kbuf.f_fsid.val[0], &buf->f_fsid);
1730#endif
1731 for(i = 0; i < 16; i++)
1732 __put_user(0, &buf->f_basetype[i]);
1733 __put_user(0, &buf->f_flag);
1734 __put_user(kbuf.f_namelen, &buf->f_namemax);
1735 __clear_user(buf->f_fstr, sizeof(buf->f_fstr[i]));
1736
1737out_f:
1738 fput(file);
1739out:
1740 return error;
1741}
1742
1743asmlinkage int irix_getmountid(char *fname, unsigned long *midbuf)
1744{
1745 int err = 0;
1746
1747 printk("[%s:%d] irix_getmountid(%s, %p)\n",
1748 current->comm, current->pid, fname, midbuf);
1749 if (!access_ok(VERIFY_WRITE, midbuf, (sizeof(unsigned long) * 4)))
1750 return -EFAULT;
1751
1752 /*
1753 * The idea with this system call is that when trying to determine
1754 * 'pwd' and it's a toss-up for some reason, userland can use the
1755 * fsid of the filesystem to try and make the right decision, but
1756 * we don't have this so for now. XXX
1757 */
1758 err |= __put_user(0, &midbuf[0]);
1759 err |= __put_user(0, &midbuf[1]);
1760 err |= __put_user(0, &midbuf[2]);
1761 err |= __put_user(0, &midbuf[3]);
1762
1763 return err;
1764}
1765
1766asmlinkage int irix_nsproc(unsigned long entry, unsigned long mask,
1767 unsigned long arg, unsigned long sp, int slen)
1768{
1769 printk("[%s:%d] Wheee.. irix_nsproc(%08lx,%08lx,%08lx,%08lx,%d)\n",
1770 current->comm, current->pid, entry, mask, arg, sp, slen);
1771
1772 return -EINVAL;
1773}
1774
1775#undef DEBUG_GETDENTS
1776
1777struct irix_dirent32 {
1778 u32 d_ino;
1779 u32 d_off;
1780 unsigned short d_reclen;
1781 char d_name[1];
1782};
1783
1784struct irix_dirent32_callback {
1785 struct irix_dirent32 *current_dir;
1786 struct irix_dirent32 *previous;
1787 int count;
1788 int error;
1789};
1790
1791#define NAME_OFFSET32(de) ((int) ((de)->d_name - (char *) (de)))
1792#define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
1793
1794static int irix_filldir32(void *__buf, const char *name, int namlen,
1795 loff_t offset, ino_t ino, unsigned int d_type)
1796{
1797 struct irix_dirent32 *dirent;
1798 struct irix_dirent32_callback *buf =
1799 (struct irix_dirent32_callback *)__buf;
1800 unsigned short reclen = ROUND_UP32(NAME_OFFSET32(dirent) + namlen + 1);
1801
1802#ifdef DEBUG_GETDENTS
1803 printk("\nirix_filldir32[reclen<%d>namlen<%d>count<%d>]",
1804 reclen, namlen, buf->count);
1805#endif
1806 buf->error = -EINVAL; /* only used if we fail.. */
1807 if (reclen > buf->count)
1808 return -EINVAL;
1809 dirent = buf->previous;
1810 if (dirent)
1811 __put_user(offset, &dirent->d_off);
1812 dirent = buf->current_dir;
1813 buf->previous = dirent;
1814 __put_user(ino, &dirent->d_ino);
1815 __put_user(reclen, &dirent->d_reclen);
1816 copy_to_user(dirent->d_name, name, namlen);
1817 __put_user(0, &dirent->d_name[namlen]);
1818 ((char *) dirent) += reclen;
1819 buf->current_dir = dirent;
1820 buf->count -= reclen;
1821
1822 return 0;
1823}
1824
1825asmlinkage int irix_ngetdents(unsigned int fd, void * dirent,
1826 unsigned int count, int *eob)
1827{
1828 struct file *file;
1829 struct irix_dirent32 *lastdirent;
1830 struct irix_dirent32_callback buf;
1831 int error;
1832
1833#ifdef DEBUG_GETDENTS
1834 printk("[%s:%d] ngetdents(%d, %p, %d, %p) ", current->comm,
1835 current->pid, fd, dirent, count, eob);
1836#endif
1837 error = -EBADF;
1838 file = fget(fd);
1839 if (!file)
1840 goto out;
1841
1842 buf.current_dir = (struct irix_dirent32 *) dirent;
1843 buf.previous = NULL;
1844 buf.count = count;
1845 buf.error = 0;
1846
1847 error = vfs_readdir(file, irix_filldir32, &buf);
1848 if (error < 0)
1849 goto out_putf;
1850
1851 error = buf.error;
1852 lastdirent = buf.previous;
1853 if (lastdirent) {
1854 put_user(file->f_pos, &lastdirent->d_off);
1855 error = count - buf.count;
1856 }
1857
1858 if (put_user(0, eob) < 0) {
1859 error = -EFAULT;
1860 goto out_putf;
1861 }
1862
1863#ifdef DEBUG_GETDENTS
1864 printk("eob=%d returning %d\n", *eob, count - buf.count);
1865#endif
1866 error = count - buf.count;
1867
1868out_putf:
1869 fput(file);
1870out:
1871 return error;
1872}
1873
1874struct irix_dirent64 {
1875 u64 d_ino;
1876 u64 d_off;
1877 unsigned short d_reclen;
1878 char d_name[1];
1879};
1880
1881struct irix_dirent64_callback {
1882 struct irix_dirent64 *curr;
1883 struct irix_dirent64 *previous;
1884 int count;
1885 int error;
1886};
1887
1888#define NAME_OFFSET64(de) ((int) ((de)->d_name - (char *) (de)))
1889#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
1890
1891static int irix_filldir64(void * __buf, const char * name, int namlen,
1892 loff_t offset, ino_t ino, unsigned int d_type)
1893{
1894 struct irix_dirent64 *dirent;
1895 struct irix_dirent64_callback * buf =
1896 (struct irix_dirent64_callback *) __buf;
1897 unsigned short reclen = ROUND_UP64(NAME_OFFSET64(dirent) + namlen + 1);
1898
1899 buf->error = -EINVAL; /* only used if we fail.. */
1900 if (reclen > buf->count)
1901 return -EINVAL;
1902 dirent = buf->previous;
1903 if (dirent)
1904 __put_user(offset, &dirent->d_off);
1905 dirent = buf->curr;
1906 buf->previous = dirent;
1907 __put_user(ino, &dirent->d_ino);
1908 __put_user(reclen, &dirent->d_reclen);
1909 __copy_to_user(dirent->d_name, name, namlen);
1910 __put_user(0, &dirent->d_name[namlen]);
1911 ((char *) dirent) += reclen;
1912 buf->curr = dirent;
1913 buf->count -= reclen;
1914
1915 return 0;
1916}
1917
1918asmlinkage int irix_getdents64(int fd, void *dirent, int cnt)
1919{
1920 struct file *file;
1921 struct irix_dirent64 *lastdirent;
1922 struct irix_dirent64_callback buf;
1923 int error;
1924
1925#ifdef DEBUG_GETDENTS
1926 printk("[%s:%d] getdents64(%d, %p, %d) ", current->comm,
1927 current->pid, fd, dirent, cnt);
1928#endif
1929 error = -EBADF;
1930 if (!(file = fget(fd)))
1931 goto out;
1932
1933 error = -EFAULT;
1934 if (!access_ok(VERIFY_WRITE, dirent, cnt))
1935 goto out_f;
1936
1937 error = -EINVAL;
1938 if (cnt < (sizeof(struct irix_dirent64) + 255))
1939 goto out_f;
1940
1941 buf.curr = (struct irix_dirent64 *) dirent;
1942 buf.previous = NULL;
1943 buf.count = cnt;
1944 buf.error = 0;
1945 error = vfs_readdir(file, irix_filldir64, &buf);
1946 if (error < 0)
1947 goto out_f;
1948 lastdirent = buf.previous;
1949 if (!lastdirent) {
1950 error = buf.error;
1951 goto out_f;
1952 }
1953 lastdirent->d_off = (u64) file->f_pos;
1954#ifdef DEBUG_GETDENTS
1955 printk("returning %d\n", cnt - buf.count);
1956#endif
1957 error = cnt - buf.count;
1958
1959out_f:
1960 fput(file);
1961out:
1962 return error;
1963}
1964
1965asmlinkage int irix_ngetdents64(int fd, void *dirent, int cnt, int *eob)
1966{
1967 struct file *file;
1968 struct irix_dirent64 *lastdirent;
1969 struct irix_dirent64_callback buf;
1970 int error;
1971
1972#ifdef DEBUG_GETDENTS
1973 printk("[%s:%d] ngetdents64(%d, %p, %d) ", current->comm,
1974 current->pid, fd, dirent, cnt);
1975#endif
1976 error = -EBADF;
1977 if (!(file = fget(fd)))
1978 goto out;
1979
1980 error = -EFAULT;
1981 if (!access_ok(VERIFY_WRITE, dirent, cnt) ||
1982 !access_ok(VERIFY_WRITE, eob, sizeof(*eob)))
1983 goto out_f;
1984
1985 error = -EINVAL;
1986 if (cnt < (sizeof(struct irix_dirent64) + 255))
1987 goto out_f;
1988
1989 *eob = 0;
1990 buf.curr = (struct irix_dirent64 *) dirent;
1991 buf.previous = NULL;
1992 buf.count = cnt;
1993 buf.error = 0;
1994 error = vfs_readdir(file, irix_filldir64, &buf);
1995 if (error < 0)
1996 goto out_f;
1997 lastdirent = buf.previous;
1998 if (!lastdirent) {
1999 error = buf.error;
2000 goto out_f;
2001 }
2002 lastdirent->d_off = (u64) file->f_pos;
2003#ifdef DEBUG_GETDENTS
2004 printk("eob=%d returning %d\n", *eob, cnt - buf.count);
2005#endif
2006 error = cnt - buf.count;
2007
2008out_f:
2009 fput(file);
2010out:
2011 return error;
2012}
2013
2014asmlinkage int irix_uadmin(unsigned long op, unsigned long func, unsigned long arg)
2015{
2016 int retval;
2017
2018 switch (op) {
2019 case 1:
2020 /* Reboot */
2021 printk("[%s:%d] irix_uadmin: Wants to reboot...\n",
2022 current->comm, current->pid);
2023 retval = -EINVAL;
2024 goto out;
2025
2026 case 2:
2027 /* Shutdown */
2028 printk("[%s:%d] irix_uadmin: Wants to shutdown...\n",
2029 current->comm, current->pid);
2030 retval = -EINVAL;
2031 goto out;
2032
2033 case 4:
2034 /* Remount-root */
2035 printk("[%s:%d] irix_uadmin: Wants to remount root...\n",
2036 current->comm, current->pid);
2037 retval = -EINVAL;
2038 goto out;
2039
2040 case 8:
2041 /* Kill all tasks. */
2042 printk("[%s:%d] irix_uadmin: Wants to kill all tasks...\n",
2043 current->comm, current->pid);
2044 retval = -EINVAL;
2045 goto out;
2046
2047 case 256:
2048 /* Set magic mushrooms... */
2049 printk("[%s:%d] irix_uadmin: Wants to set magic mushroom[%d]...\n",
2050 current->comm, current->pid, (int) func);
2051 retval = -EINVAL;
2052 goto out;
2053
2054 default:
2055 printk("[%s:%d] irix_uadmin: Unknown operation [%d]...\n",
2056 current->comm, current->pid, (int) op);
2057 retval = -EINVAL;
2058 goto out;
2059 };
2060
2061out:
2062 return retval;
2063}
2064
2065asmlinkage int irix_utssys(char *inbuf, int arg, int type, char *outbuf)
2066{
2067 int retval;
2068
2069 switch(type) {
2070 case 0:
2071 /* uname() */
2072 retval = irix_uname((struct iuname *)inbuf);
2073 goto out;
2074
2075 case 2:
2076 /* ustat() */
2077 printk("[%s:%d] irix_utssys: Wants to do ustat()\n",
2078 current->comm, current->pid);
2079 retval = -EINVAL;
2080 goto out;
2081
2082 case 3:
2083 /* fusers() */
2084 printk("[%s:%d] irix_utssys: Wants to do fusers()\n",
2085 current->comm, current->pid);
2086 retval = -EINVAL;
2087 goto out;
2088
2089 default:
2090 printk("[%s:%d] irix_utssys: Wants to do unknown type[%d]\n",
2091 current->comm, current->pid, (int) type);
2092 retval = -EINVAL;
2093 goto out;
2094 }
2095
2096out:
2097 return retval;
2098}
2099
2100#undef DEBUG_FCNTL
2101
2102#define IRIX_F_ALLOCSP 10
2103
2104asmlinkage int irix_fcntl(int fd, int cmd, int arg)
2105{
2106 int retval;
2107
2108#ifdef DEBUG_FCNTL
2109 printk("[%s:%d] irix_fcntl(%d, %d, %d) ", current->comm,
2110 current->pid, fd, cmd, arg);
2111#endif
2112 if (cmd == IRIX_F_ALLOCSP){
2113 return 0;
2114 }
2115 retval = sys_fcntl(fd, cmd, arg);
2116#ifdef DEBUG_FCNTL
2117 printk("%d\n", retval);
2118#endif
2119 return retval;
2120}
2121
2122asmlinkage int irix_ulimit(int cmd, int arg)
2123{
2124 int retval;
2125
2126 switch(cmd) {
2127 case 1:
2128 printk("[%s:%d] irix_ulimit: Wants to get file size limit.\n",
2129 current->comm, current->pid);
2130 retval = -EINVAL;
2131 goto out;
2132
2133 case 2:
2134 printk("[%s:%d] irix_ulimit: Wants to set file size limit.\n",
2135 current->comm, current->pid);
2136 retval = -EINVAL;
2137 goto out;
2138
2139 case 3:
2140 printk("[%s:%d] irix_ulimit: Wants to get brk limit.\n",
2141 current->comm, current->pid);
2142 retval = -EINVAL;
2143 goto out;
2144
2145 case 4:
2146#if 0
2147 printk("[%s:%d] irix_ulimit: Wants to get fd limit.\n",
2148 current->comm, current->pid);
2149 retval = -EINVAL;
2150 goto out;
2151#endif
2152 retval = current->signal->rlim[RLIMIT_NOFILE].rlim_cur;
2153 goto out;
2154
2155 case 5:
2156 printk("[%s:%d] irix_ulimit: Wants to get txt offset.\n",
2157 current->comm, current->pid);
2158 retval = -EINVAL;
2159 goto out;
2160
2161 default:
2162 printk("[%s:%d] irix_ulimit: Unknown command [%d].\n",
2163 current->comm, current->pid, cmd);
2164 retval = -EINVAL;
2165 goto out;
2166 }
2167out:
2168 return retval;
2169}
2170
2171asmlinkage int irix_unimp(struct pt_regs *regs)
2172{
2173 printk("irix_unimp [%s:%d] v0=%d v1=%d a0=%08lx a1=%08lx a2=%08lx "
2174 "a3=%08lx\n", current->comm, current->pid,
2175 (int) regs->regs[2], (int) regs->regs[3],
2176 regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]);
2177
2178 return -ENOSYS;
2179}
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
new file mode 100644
index 000000000000..648c82292ed6
--- /dev/null
+++ b/arch/mips/kernel/time.c
@@ -0,0 +1,755 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 * Copyright (c) 2003, 2004 Maciej W. Rozycki
5 *
6 * Common time service routines for MIPS machines. See
7 * Documentation/mips/time.README.
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/types.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/sched.h>
18#include <linux/param.h>
19#include <linux/time.h>
20#include <linux/timex.h>
21#include <linux/smp.h>
22#include <linux/kernel_stat.h>
23#include <linux/spinlock.h>
24#include <linux/interrupt.h>
25#include <linux/module.h>
26
27#include <asm/bootinfo.h>
28#include <asm/compiler.h>
29#include <asm/cpu.h>
30#include <asm/cpu-features.h>
31#include <asm/div64.h>
32#include <asm/sections.h>
33#include <asm/time.h>
34
35/*
36 * The integer part of the number of usecs per jiffy is taken from tick,
37 * but the fractional part is not recorded, so we calculate it using the
38 * initial value of HZ. This aids systems where tick isn't really an
39 * integer (e.g. for HZ = 128).
40 */
41#define USECS_PER_JIFFY TICK_SIZE
42#define USECS_PER_JIFFY_FRAC ((unsigned long)(u32)((1000000ULL << 32) / HZ))
43
44#define TICK_SIZE (tick_nsec / 1000)
45
46u64 jiffies_64 = INITIAL_JIFFIES;
47
48EXPORT_SYMBOL(jiffies_64);
49
50/*
51 * forward reference
52 */
53extern volatile unsigned long wall_jiffies;
54
55DEFINE_SPINLOCK(rtc_lock);
56
57/*
58 * By default we provide the null RTC ops
59 */
60static unsigned long null_rtc_get_time(void)
61{
62 return mktime(2000, 1, 1, 0, 0, 0);
63}
64
65static int null_rtc_set_time(unsigned long sec)
66{
67 return 0;
68}
69
70unsigned long (*rtc_get_time)(void) = null_rtc_get_time;
71int (*rtc_set_time)(unsigned long) = null_rtc_set_time;
72int (*rtc_set_mmss)(unsigned long);
73
74
75/* usecs per counter cycle, shifted to left by 32 bits */
76static unsigned int sll32_usecs_per_cycle;
77
78/* how many counter cycles in a jiffy */
79static unsigned long cycles_per_jiffy;
80
81/* Cycle counter value at the previous timer interrupt.. */
82static unsigned int timerhi, timerlo;
83
84/* expirelo is the count value for next CPU timer interrupt */
85static unsigned int expirelo;
86
87
88/*
89 * Null timer ack for systems not needing one (e.g. i8254).
90 */
91static void null_timer_ack(void) { /* nothing */ }
92
93/*
94 * Null high precision timer functions for systems lacking one.
95 */
96static unsigned int null_hpt_read(void)
97{
98 return 0;
99}
100
101static void null_hpt_init(unsigned int count) { /* nothing */ }
102
103
104/*
105 * Timer ack for an R4k-compatible timer of a known frequency.
106 */
107static void c0_timer_ack(void)
108{
109 unsigned int count;
110
111 /* Ack this timer interrupt and set the next one. */
112 expirelo += cycles_per_jiffy;
113 write_c0_compare(expirelo);
114
115 /* Check to see if we have missed any timer interrupts. */
116 count = read_c0_count();
117 if ((count - expirelo) < 0x7fffffff) {
118 /* missed_timer_count++; */
119 expirelo = count + cycles_per_jiffy;
120 write_c0_compare(expirelo);
121 }
122}
123
124/*
125 * High precision timer functions for a R4k-compatible timer.
126 */
127static unsigned int c0_hpt_read(void)
128{
129 return read_c0_count();
130}
131
132/* For use solely as a high precision timer. */
133static void c0_hpt_init(unsigned int count)
134{
135 write_c0_count(read_c0_count() - count);
136}
137
138/* For use both as a high precision timer and an interrupt source. */
139static void c0_hpt_timer_init(unsigned int count)
140{
141 count = read_c0_count() - count;
142 expirelo = (count / cycles_per_jiffy + 1) * cycles_per_jiffy;
143 write_c0_count(expirelo - cycles_per_jiffy);
144 write_c0_compare(expirelo);
145 write_c0_count(count);
146}
147
148int (*mips_timer_state)(void);
149void (*mips_timer_ack)(void);
150unsigned int (*mips_hpt_read)(void);
151void (*mips_hpt_init)(unsigned int);
152
153
154/*
155 * This version of gettimeofday has microsecond resolution and better than
156 * microsecond precision on fast machines with cycle counter.
157 */
158void do_gettimeofday(struct timeval *tv)
159{
160 unsigned long seq;
161 unsigned long lost;
162 unsigned long usec, sec;
163 unsigned long max_ntp_tick = tick_usec - tickadj;
164
165 do {
166 seq = read_seqbegin(&xtime_lock);
167
168 usec = do_gettimeoffset();
169
170 lost = jiffies - wall_jiffies;
171
172 /*
173 * If time_adjust is negative then NTP is slowing the clock
174 * so make sure not to go into next possible interval.
175 * Better to lose some accuracy than have time go backwards..
176 */
177 if (unlikely(time_adjust < 0)) {
178 usec = min(usec, max_ntp_tick);
179
180 if (lost)
181 usec += lost * max_ntp_tick;
182 } else if (unlikely(lost))
183 usec += lost * tick_usec;
184
185 sec = xtime.tv_sec;
186 usec += (xtime.tv_nsec / 1000);
187
188 } while (read_seqretry(&xtime_lock, seq));
189
190 while (usec >= 1000000) {
191 usec -= 1000000;
192 sec++;
193 }
194
195 tv->tv_sec = sec;
196 tv->tv_usec = usec;
197}
198
199EXPORT_SYMBOL(do_gettimeofday);
200
201int do_settimeofday(struct timespec *tv)
202{
203 time_t wtm_sec, sec = tv->tv_sec;
204 long wtm_nsec, nsec = tv->tv_nsec;
205
206 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
207 return -EINVAL;
208
209 write_seqlock_irq(&xtime_lock);
210
211 /*
212 * This is revolting. We need to set "xtime" correctly. However,
213 * the value in this location is the value at the most recent update
214 * of wall time. Discover what correction gettimeofday() would have
215 * made, and then undo it!
216 */
217 nsec -= do_gettimeoffset() * NSEC_PER_USEC;
218 nsec -= (jiffies - wall_jiffies) * tick_nsec;
219
220 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
221 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
222
223 set_normalized_timespec(&xtime, sec, nsec);
224 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
225
226 time_adjust = 0; /* stop active adjtime() */
227 time_status |= STA_UNSYNC;
228 time_maxerror = NTP_PHASE_LIMIT;
229 time_esterror = NTP_PHASE_LIMIT;
230
231 write_sequnlock_irq(&xtime_lock);
232 clock_was_set();
233 return 0;
234}
235
236EXPORT_SYMBOL(do_settimeofday);
237
238/*
239 * Gettimeoffset routines. These routines returns the time duration
240 * since last timer interrupt in usecs.
241 *
242 * If the exact CPU counter frequency is known, use fixed_rate_gettimeoffset.
243 * Otherwise use calibrate_gettimeoffset()
244 *
245 * If the CPU does not have the counter register, you can either supply
246 * your own gettimeoffset() routine, or use null_gettimeoffset(), which
247 * gives the same resolution as HZ.
248 */
249
250static unsigned long null_gettimeoffset(void)
251{
252 return 0;
253}
254
255
256/* The function pointer to one of the gettimeoffset funcs. */
257unsigned long (*do_gettimeoffset)(void) = null_gettimeoffset;
258
259
260static unsigned long fixed_rate_gettimeoffset(void)
261{
262 u32 count;
263 unsigned long res;
264
265 /* Get last timer tick in absolute kernel time */
266 count = mips_hpt_read();
267
268 /* .. relative to previous jiffy (32 bits is enough) */
269 count -= timerlo;
270
271 __asm__("multu %1,%2"
272 : "=h" (res)
273 : "r" (count), "r" (sll32_usecs_per_cycle)
274 : "lo", GCC_REG_ACCUM);
275
276 /*
277 * Due to possible jiffies inconsistencies, we need to check
278 * the result so that we'll get a timer that is monotonic.
279 */
280 if (res >= USECS_PER_JIFFY)
281 res = USECS_PER_JIFFY - 1;
282
283 return res;
284}
285
286
287/*
288 * Cached "1/(clocks per usec) * 2^32" value.
289 * It has to be recalculated once each jiffy.
290 */
291static unsigned long cached_quotient;
292
293/* Last jiffy when calibrate_divXX_gettimeoffset() was called. */
294static unsigned long last_jiffies;
295
296/*
297 * This is moved from dec/time.c:do_ioasic_gettimeoffset() by Maciej.
298 */
299static unsigned long calibrate_div32_gettimeoffset(void)
300{
301 u32 count;
302 unsigned long res, tmp;
303 unsigned long quotient;
304
305 tmp = jiffies;
306
307 quotient = cached_quotient;
308
309 if (last_jiffies != tmp) {
310 last_jiffies = tmp;
311 if (last_jiffies != 0) {
312 unsigned long r0;
313 do_div64_32(r0, timerhi, timerlo, tmp);
314 do_div64_32(quotient, USECS_PER_JIFFY,
315 USECS_PER_JIFFY_FRAC, r0);
316 cached_quotient = quotient;
317 }
318 }
319
320 /* Get last timer tick in absolute kernel time */
321 count = mips_hpt_read();
322
323 /* .. relative to previous jiffy (32 bits is enough) */
324 count -= timerlo;
325
326 __asm__("multu %1,%2"
327 : "=h" (res)
328 : "r" (count), "r" (quotient)
329 : "lo", GCC_REG_ACCUM);
330
331 /*
332 * Due to possible jiffies inconsistencies, we need to check
333 * the result so that we'll get a timer that is monotonic.
334 */
335 if (res >= USECS_PER_JIFFY)
336 res = USECS_PER_JIFFY - 1;
337
338 return res;
339}
340
341static unsigned long calibrate_div64_gettimeoffset(void)
342{
343 u32 count;
344 unsigned long res, tmp;
345 unsigned long quotient;
346
347 tmp = jiffies;
348
349 quotient = cached_quotient;
350
351 if (last_jiffies != tmp) {
352 last_jiffies = tmp;
353 if (last_jiffies) {
354 unsigned long r0;
355 __asm__(".set push\n\t"
356 ".set mips3\n\t"
357 "lwu %0,%3\n\t"
358 "dsll32 %1,%2,0\n\t"
359 "or %1,%1,%0\n\t"
360 "ddivu $0,%1,%4\n\t"
361 "mflo %1\n\t"
362 "dsll32 %0,%5,0\n\t"
363 "or %0,%0,%6\n\t"
364 "ddivu $0,%0,%1\n\t"
365 "mflo %0\n\t"
366 ".set pop"
367 : "=&r" (quotient), "=&r" (r0)
368 : "r" (timerhi), "m" (timerlo),
369 "r" (tmp), "r" (USECS_PER_JIFFY),
370 "r" (USECS_PER_JIFFY_FRAC)
371 : "hi", "lo", GCC_REG_ACCUM);
372 cached_quotient = quotient;
373 }
374 }
375
376 /* Get last timer tick in absolute kernel time */
377 count = mips_hpt_read();
378
379 /* .. relative to previous jiffy (32 bits is enough) */
380 count -= timerlo;
381
382 __asm__("multu %1,%2"
383 : "=h" (res)
384 : "r" (count), "r" (quotient)
385 : "lo", GCC_REG_ACCUM);
386
387 /*
388 * Due to possible jiffies inconsistencies, we need to check
389 * the result so that we'll get a timer that is monotonic.
390 */
391 if (res >= USECS_PER_JIFFY)
392 res = USECS_PER_JIFFY - 1;
393
394 return res;
395}
396
397
398/* last time when xtime and rtc are sync'ed up */
399static long last_rtc_update;
400
401/*
402 * local_timer_interrupt() does profiling and process accounting
403 * on a per-CPU basis.
404 *
405 * In UP mode, it is invoked from the (global) timer_interrupt.
406 *
407 * In SMP mode, it might invoked by per-CPU timer interrupt, or
408 * a broadcasted inter-processor interrupt which itself is triggered
409 * by the global timer interrupt.
410 */
411void local_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
412{
413 if (current->pid)
414 profile_tick(CPU_PROFILING, regs);
415 update_process_times(user_mode(regs));
416}
417
418/*
419 * High-level timer interrupt service routines. This function
420 * is set as irqaction->handler and is invoked through do_IRQ.
421 */
422irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
423{
424 unsigned long j;
425 unsigned int count;
426
427 count = mips_hpt_read();
428 mips_timer_ack();
429
430 /* Update timerhi/timerlo for intra-jiffy calibration. */
431 timerhi += count < timerlo; /* Wrap around */
432 timerlo = count;
433
434 /*
435 * call the generic timer interrupt handling
436 */
437 do_timer(regs);
438
439 /*
440 * If we have an externally synchronized Linux clock, then update
441 * CMOS clock accordingly every ~11 minutes. rtc_set_time() has to be
442 * called as close as possible to 500 ms before the new second starts.
443 */
444 write_seqlock(&xtime_lock);
445 if ((time_status & STA_UNSYNC) == 0 &&
446 xtime.tv_sec > last_rtc_update + 660 &&
447 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
448 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
449 if (rtc_set_mmss(xtime.tv_sec) == 0) {
450 last_rtc_update = xtime.tv_sec;
451 } else {
452 /* do it again in 60 s */
453 last_rtc_update = xtime.tv_sec - 600;
454 }
455 }
456 write_sequnlock(&xtime_lock);
457
458 /*
459 * If jiffies has overflown in this timer_interrupt, we must
460 * update the timer[hi]/[lo] to make fast gettimeoffset funcs
461 * quotient calc still valid. -arca
462 *
463 * The first timer interrupt comes late as interrupts are
464 * enabled long after timers are initialized. Therefore the
465 * high precision timer is fast, leading to wrong gettimeoffset()
466 * calculations. We deal with it by setting it based on the
467 * number of its ticks between the second and the third interrupt.
468 * That is still somewhat imprecise, but it's a good estimate.
469 * --macro
470 */
471 j = jiffies;
472 if (j < 4) {
473 static unsigned int prev_count;
474 static int hpt_initialized;
475
476 switch (j) {
477 case 0:
478 timerhi = timerlo = 0;
479 mips_hpt_init(count);
480 break;
481 case 2:
482 prev_count = count;
483 break;
484 case 3:
485 if (!hpt_initialized) {
486 unsigned int c3 = 3 * (count - prev_count);
487
488 timerhi = 0;
489 timerlo = c3;
490 mips_hpt_init(count - c3);
491 hpt_initialized = 1;
492 }
493 break;
494 default:
495 break;
496 }
497 }
498
499 /*
500 * In UP mode, we call local_timer_interrupt() to do profiling
501 * and process accouting.
502 *
503 * In SMP mode, local_timer_interrupt() is invoked by appropriate
504 * low-level local timer interrupt handler.
505 */
506 local_timer_interrupt(irq, dev_id, regs);
507
508 return IRQ_HANDLED;
509}
510
511asmlinkage void ll_timer_interrupt(int irq, struct pt_regs *regs)
512{
513 irq_enter();
514 kstat_this_cpu.irqs[irq]++;
515
516 /* we keep interrupt disabled all the time */
517 timer_interrupt(irq, NULL, regs);
518
519 irq_exit();
520}
521
522asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs)
523{
524 irq_enter();
525 if (smp_processor_id() != 0)
526 kstat_this_cpu.irqs[irq]++;
527
528 /* we keep interrupt disabled all the time */
529 local_timer_interrupt(irq, NULL, regs);
530
531 irq_exit();
532}
533
534/*
535 * time_init() - it does the following things.
536 *
537 * 1) board_time_init() -
538 * a) (optional) set up RTC routines,
539 * b) (optional) calibrate and set the mips_hpt_frequency
540 * (only needed if you intended to use fixed_rate_gettimeoffset
541 * or use cpu counter as timer interrupt source)
542 * 2) setup xtime based on rtc_get_time().
543 * 3) choose a appropriate gettimeoffset routine.
544 * 4) calculate a couple of cached variables for later usage
545 * 5) board_timer_setup() -
546 * a) (optional) over-write any choices made above by time_init().
547 * b) machine specific code should setup the timer irqaction.
548 * c) enable the timer interrupt
549 */
550
551void (*board_time_init)(void);
552void (*board_timer_setup)(struct irqaction *irq);
553
554unsigned int mips_hpt_frequency;
555
556static struct irqaction timer_irqaction = {
557 .handler = timer_interrupt,
558 .flags = SA_INTERRUPT,
559 .name = "timer",
560};
561
562static unsigned int __init calibrate_hpt(void)
563{
564 u64 frequency;
565 u32 hpt_start, hpt_end, hpt_count, hz;
566
567 const int loops = HZ / 10;
568 int log_2_loops = 0;
569 int i;
570
571 /*
572 * We want to calibrate for 0.1s, but to avoid a 64-bit
573 * division we round the number of loops up to the nearest
574 * power of 2.
575 */
576 while (loops > 1 << log_2_loops)
577 log_2_loops++;
578 i = 1 << log_2_loops;
579
580 /*
581 * Wait for a rising edge of the timer interrupt.
582 */
583 while (mips_timer_state());
584 while (!mips_timer_state());
585
586 /*
587 * Now see how many high precision timer ticks happen
588 * during the calculated number of periods between timer
589 * interrupts.
590 */
591 hpt_start = mips_hpt_read();
592 do {
593 while (mips_timer_state());
594 while (!mips_timer_state());
595 } while (--i);
596 hpt_end = mips_hpt_read();
597
598 hpt_count = hpt_end - hpt_start;
599 hz = HZ;
600 frequency = (u64)hpt_count * (u64)hz;
601
602 return frequency >> log_2_loops;
603}
604
605void __init time_init(void)
606{
607 if (board_time_init)
608 board_time_init();
609
610 if (!rtc_set_mmss)
611 rtc_set_mmss = rtc_set_time;
612
613 xtime.tv_sec = rtc_get_time();
614 xtime.tv_nsec = 0;
615
616 set_normalized_timespec(&wall_to_monotonic,
617 -xtime.tv_sec, -xtime.tv_nsec);
618
619 /* Choose appropriate high precision timer routines. */
620 if (!cpu_has_counter && !mips_hpt_read) {
621 /* No high precision timer -- sorry. */
622 mips_hpt_read = null_hpt_read;
623 mips_hpt_init = null_hpt_init;
624 } else if (!mips_hpt_frequency && !mips_timer_state) {
625 /* A high precision timer of unknown frequency. */
626 if (!mips_hpt_read) {
627 /* No external high precision timer -- use R4k. */
628 mips_hpt_read = c0_hpt_read;
629 mips_hpt_init = c0_hpt_init;
630 }
631
632 if ((current_cpu_data.isa_level == MIPS_CPU_ISA_M32) ||
633 (current_cpu_data.isa_level == MIPS_CPU_ISA_I) ||
634 (current_cpu_data.isa_level == MIPS_CPU_ISA_II))
635 /*
636 * We need to calibrate the counter but we don't have
637 * 64-bit division.
638 */
639 do_gettimeoffset = calibrate_div32_gettimeoffset;
640 else
641 /*
642 * We need to calibrate the counter but we *do* have
643 * 64-bit division.
644 */
645 do_gettimeoffset = calibrate_div64_gettimeoffset;
646 } else {
647 /* We know counter frequency. Or we can get it. */
648 if (!mips_hpt_read) {
649 /* No external high precision timer -- use R4k. */
650 mips_hpt_read = c0_hpt_read;
651
652 if (mips_timer_state)
653 mips_hpt_init = c0_hpt_init;
654 else {
655 /* No external timer interrupt -- use R4k. */
656 mips_hpt_init = c0_hpt_timer_init;
657 mips_timer_ack = c0_timer_ack;
658 }
659 }
660 if (!mips_hpt_frequency)
661 mips_hpt_frequency = calibrate_hpt();
662
663 do_gettimeoffset = fixed_rate_gettimeoffset;
664
665 /* Calculate cache parameters. */
666 cycles_per_jiffy = (mips_hpt_frequency + HZ / 2) / HZ;
667
668 /* sll32_usecs_per_cycle = 10^6 * 2^32 / mips_counter_freq */
669 do_div64_32(sll32_usecs_per_cycle,
670 1000000, mips_hpt_frequency / 2,
671 mips_hpt_frequency);
672
673 /* Report the high precision timer rate for a reference. */
674 printk("Using %u.%03u MHz high precision timer.\n",
675 ((mips_hpt_frequency + 500) / 1000) / 1000,
676 ((mips_hpt_frequency + 500) / 1000) % 1000);
677 }
678
679 if (!mips_timer_ack)
680 /* No timer interrupt ack (e.g. i8254). */
681 mips_timer_ack = null_timer_ack;
682
683 /* This sets up the high precision timer for the first interrupt. */
684 mips_hpt_init(mips_hpt_read());
685
686 /*
687 * Call board specific timer interrupt setup.
688 *
689 * this pointer must be setup in machine setup routine.
690 *
691 * Even if a machine chooses to use a low-level timer interrupt,
692 * it still needs to setup the timer_irqaction.
693 * In that case, it might be better to set timer_irqaction.handler
694 * to be NULL function so that we are sure the high-level code
695 * is not invoked accidentally.
696 */
697 board_timer_setup(&timer_irqaction);
698}
699
700#define FEBRUARY 2
701#define STARTOFTIME 1970
702#define SECDAY 86400L
703#define SECYR (SECDAY * 365)
704#define leapyear(y) ((!((y) % 4) && ((y) % 100)) || !((y) % 400))
705#define days_in_year(y) (leapyear(y) ? 366 : 365)
706#define days_in_month(m) (month_days[(m) - 1])
707
708static int month_days[12] = {
709 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
710};
711
712void to_tm(unsigned long tim, struct rtc_time *tm)
713{
714 long hms, day, gday;
715 int i;
716
717 gday = day = tim / SECDAY;
718 hms = tim % SECDAY;
719
720 /* Hours, minutes, seconds are easy */
721 tm->tm_hour = hms / 3600;
722 tm->tm_min = (hms % 3600) / 60;
723 tm->tm_sec = (hms % 3600) % 60;
724
725 /* Number of years in days */
726 for (i = STARTOFTIME; day >= days_in_year(i); i++)
727 day -= days_in_year(i);
728 tm->tm_year = i;
729
730 /* Number of months in days left */
731 if (leapyear(tm->tm_year))
732 days_in_month(FEBRUARY) = 29;
733 for (i = 1; day >= days_in_month(i); i++)
734 day -= days_in_month(i);
735 days_in_month(FEBRUARY) = 28;
736 tm->tm_mon = i - 1; /* tm_mon starts from 0 to 11 */
737
738 /* Days are what is left over (+1) from all that. */
739 tm->tm_mday = day + 1;
740
741 /*
742 * Determine the day of week
743 */
744 tm->tm_wday = (gday + 4) % 7; /* 1970/1/1 was Thursday */
745}
746
747EXPORT_SYMBOL(rtc_lock);
748EXPORT_SYMBOL(to_tm);
749EXPORT_SYMBOL(rtc_set_time);
750EXPORT_SYMBOL(rtc_get_time);
751
752unsigned long long sched_clock(void)
753{
754 return (unsigned long long)jiffies*(1000000000/HZ);
755}
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
new file mode 100644
index 000000000000..56c36e42e0a6
--- /dev/null
+++ b/arch/mips/kernel/traps.c
@@ -0,0 +1,1062 @@
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) 1994 - 1999, 2000, 01 Ralf Baechle
7 * Copyright (C) 1995, 1996 Paul M. Antoine
8 * Copyright (C) 1998 Ulf Carlsson
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
11 * Copyright (C) 2000, 01 MIPS Technologies, Inc.
12 * Copyright (C) 2002, 2003, 2004 Maciej W. Rozycki
13 */
14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/mm.h>
17#include <linux/module.h>
18#include <linux/sched.h>
19#include <linux/smp.h>
20#include <linux/smp_lock.h>
21#include <linux/spinlock.h>
22#include <linux/kallsyms.h>
23
24#include <asm/bootinfo.h>
25#include <asm/branch.h>
26#include <asm/break.h>
27#include <asm/cpu.h>
28#include <asm/fpu.h>
29#include <asm/module.h>
30#include <asm/pgtable.h>
31#include <asm/ptrace.h>
32#include <asm/sections.h>
33#include <asm/system.h>
34#include <asm/tlbdebug.h>
35#include <asm/traps.h>
36#include <asm/uaccess.h>
37#include <asm/mmu_context.h>
38#include <asm/watch.h>
39#include <asm/types.h>
40
41extern asmlinkage void handle_tlbm(void);
42extern asmlinkage void handle_tlbl(void);
43extern asmlinkage void handle_tlbs(void);
44extern asmlinkage void handle_adel(void);
45extern asmlinkage void handle_ades(void);
46extern asmlinkage void handle_ibe(void);
47extern asmlinkage void handle_dbe(void);
48extern asmlinkage void handle_sys(void);
49extern asmlinkage void handle_bp(void);
50extern asmlinkage void handle_ri(void);
51extern asmlinkage void handle_cpu(void);
52extern asmlinkage void handle_ov(void);
53extern asmlinkage void handle_tr(void);
54extern asmlinkage void handle_fpe(void);
55extern asmlinkage void handle_mdmx(void);
56extern asmlinkage void handle_watch(void);
57extern asmlinkage void handle_mcheck(void);
58extern asmlinkage void handle_reserved(void);
59
60extern int fpu_emulator_cop1Handler(int xcptno, struct pt_regs *xcp,
61 struct mips_fpu_soft_struct *ctx);
62
63void (*board_be_init)(void);
64int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
65
66/*
67 * These constant is for searching for possible module text segments.
68 * MODULE_RANGE is a guess of how much space is likely to be vmalloced.
69 */
70#define MODULE_RANGE (8*1024*1024)
71
72/*
73 * This routine abuses get_user()/put_user() to reference pointers
74 * with at least a bit of error checking ...
75 */
76void show_stack(struct task_struct *task, unsigned long *sp)
77{
78 const int field = 2 * sizeof(unsigned long);
79 long stackdata;
80 int i;
81
82 if (!sp) {
83 if (task && task != current)
84 sp = (unsigned long *) task->thread.reg29;
85 else
86 sp = (unsigned long *) &sp;
87 }
88
89 printk("Stack :");
90 i = 0;
91 while ((unsigned long) sp & (PAGE_SIZE - 1)) {
92 if (i && ((i % (64 / field)) == 0))
93 printk("\n ");
94 if (i > 39) {
95 printk(" ...");
96 break;
97 }
98
99 if (__get_user(stackdata, sp++)) {
100 printk(" (Bad stack address)");
101 break;
102 }
103
104 printk(" %0*lx", field, stackdata);
105 i++;
106 }
107 printk("\n");
108}
109
110void show_trace(struct task_struct *task, unsigned long *stack)
111{
112 const int field = 2 * sizeof(unsigned long);
113 unsigned long addr;
114
115 if (!stack) {
116 if (task && task != current)
117 stack = (unsigned long *) task->thread.reg29;
118 else
119 stack = (unsigned long *) &stack;
120 }
121
122 printk("Call Trace:");
123#ifdef CONFIG_KALLSYMS
124 printk("\n");
125#endif
126 while (!kstack_end(stack)) {
127 addr = *stack++;
128 if (__kernel_text_address(addr)) {
129 printk(" [<%0*lx>] ", field, addr);
130 print_symbol("%s\n", addr);
131 }
132 }
133 printk("\n");
134}
135
136/*
137 * The architecture-independent dump_stack generator
138 */
139void dump_stack(void)
140{
141 unsigned long stack;
142
143 show_trace(current, &stack);
144}
145
146EXPORT_SYMBOL(dump_stack);
147
148void show_code(unsigned int *pc)
149{
150 long i;
151
152 printk("\nCode:");
153
154 for(i = -3 ; i < 6 ; i++) {
155 unsigned int insn;
156 if (__get_user(insn, pc + i)) {
157 printk(" (Bad address in epc)\n");
158 break;
159 }
160 printk("%c%08x%c", (i?' ':'<'), insn, (i?' ':'>'));
161 }
162}
163
164void show_regs(struct pt_regs *regs)
165{
166 const int field = 2 * sizeof(unsigned long);
167 unsigned int cause = regs->cp0_cause;
168 int i;
169
170 printk("Cpu %d\n", smp_processor_id());
171
172 /*
173 * Saved main processor registers
174 */
175 for (i = 0; i < 32; ) {
176 if ((i % 4) == 0)
177 printk("$%2d :", i);
178 if (i == 0)
179 printk(" %0*lx", field, 0UL);
180 else if (i == 26 || i == 27)
181 printk(" %*s", field, "");
182 else
183 printk(" %0*lx", field, regs->regs[i]);
184
185 i++;
186 if ((i % 4) == 0)
187 printk("\n");
188 }
189
190 printk("Hi : %0*lx\n", field, regs->hi);
191 printk("Lo : %0*lx\n", field, regs->lo);
192
193 /*
194 * Saved cp0 registers
195 */
196 printk("epc : %0*lx ", field, regs->cp0_epc);
197 print_symbol("%s ", regs->cp0_epc);
198 printk(" %s\n", print_tainted());
199 printk("ra : %0*lx ", field, regs->regs[31]);
200 print_symbol("%s\n", regs->regs[31]);
201
202 printk("Status: %08x ", (uint32_t) regs->cp0_status);
203
204 if (regs->cp0_status & ST0_KX)
205 printk("KX ");
206 if (regs->cp0_status & ST0_SX)
207 printk("SX ");
208 if (regs->cp0_status & ST0_UX)
209 printk("UX ");
210 switch (regs->cp0_status & ST0_KSU) {
211 case KSU_USER:
212 printk("USER ");
213 break;
214 case KSU_SUPERVISOR:
215 printk("SUPERVISOR ");
216 break;
217 case KSU_KERNEL:
218 printk("KERNEL ");
219 break;
220 default:
221 printk("BAD_MODE ");
222 break;
223 }
224 if (regs->cp0_status & ST0_ERL)
225 printk("ERL ");
226 if (regs->cp0_status & ST0_EXL)
227 printk("EXL ");
228 if (regs->cp0_status & ST0_IE)
229 printk("IE ");
230 printk("\n");
231
232 printk("Cause : %08x\n", cause);
233
234 cause = (cause & CAUSEF_EXCCODE) >> CAUSEB_EXCCODE;
235 if (1 <= cause && cause <= 5)
236 printk("BadVA : %0*lx\n", field, regs->cp0_badvaddr);
237
238 printk("PrId : %08x\n", read_c0_prid());
239}
240
241void show_registers(struct pt_regs *regs)
242{
243 show_regs(regs);
244 print_modules();
245 printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n",
246 current->comm, current->pid, current_thread_info(), current);
247 show_stack(current, (long *) regs->regs[29]);
248 show_trace(current, (long *) regs->regs[29]);
249 show_code((unsigned int *) regs->cp0_epc);
250 printk("\n");
251}
252
253static DEFINE_SPINLOCK(die_lock);
254
255NORET_TYPE void __die(const char * str, struct pt_regs * regs,
256 const char * file, const char * func, unsigned long line)
257{
258 static int die_counter;
259
260 console_verbose();
261 spin_lock_irq(&die_lock);
262 printk("%s", str);
263 if (file && func)
264 printk(" in %s:%s, line %ld", file, func, line);
265 printk("[#%d]:\n", ++die_counter);
266 show_registers(regs);
267 spin_unlock_irq(&die_lock);
268 do_exit(SIGSEGV);
269}
270
271void __die_if_kernel(const char * str, struct pt_regs * regs,
272 const char * file, const char * func, unsigned long line)
273{
274 if (!user_mode(regs))
275 __die(str, regs, file, func, line);
276}
277
278extern const struct exception_table_entry __start___dbe_table[];
279extern const struct exception_table_entry __stop___dbe_table[];
280
281void __declare_dbe_table(void)
282{
283 __asm__ __volatile__(
284 ".section\t__dbe_table,\"a\"\n\t"
285 ".previous"
286 );
287}
288
289/* Given an address, look for it in the exception tables. */
290static const struct exception_table_entry *search_dbe_tables(unsigned long addr)
291{
292 const struct exception_table_entry *e;
293
294 e = search_extable(__start___dbe_table, __stop___dbe_table - 1, addr);
295 if (!e)
296 e = search_module_dbetables(addr);
297 return e;
298}
299
300asmlinkage void do_be(struct pt_regs *regs)
301{
302 const int field = 2 * sizeof(unsigned long);
303 const struct exception_table_entry *fixup = NULL;
304 int data = regs->cp0_cause & 4;
305 int action = MIPS_BE_FATAL;
306
307 /* XXX For now. Fixme, this searches the wrong table ... */
308 if (data && !user_mode(regs))
309 fixup = search_dbe_tables(exception_epc(regs));
310
311 if (fixup)
312 action = MIPS_BE_FIXUP;
313
314 if (board_be_handler)
315 action = board_be_handler(regs, fixup != 0);
316
317 switch (action) {
318 case MIPS_BE_DISCARD:
319 return;
320 case MIPS_BE_FIXUP:
321 if (fixup) {
322 regs->cp0_epc = fixup->nextinsn;
323 return;
324 }
325 break;
326 default:
327 break;
328 }
329
330 /*
331 * Assume it would be too dangerous to continue ...
332 */
333 printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n",
334 data ? "Data" : "Instruction",
335 field, regs->cp0_epc, field, regs->regs[31]);
336 die_if_kernel("Oops", regs);
337 force_sig(SIGBUS, current);
338}
339
340static inline int get_insn_opcode(struct pt_regs *regs, unsigned int *opcode)
341{
342 unsigned int *epc;
343
344 epc = (unsigned int *) regs->cp0_epc +
345 ((regs->cp0_cause & CAUSEF_BD) != 0);
346 if (!get_user(*opcode, epc))
347 return 0;
348
349 force_sig(SIGSEGV, current);
350 return 1;
351}
352
353/*
354 * ll/sc emulation
355 */
356
357#define OPCODE 0xfc000000
358#define BASE 0x03e00000
359#define RT 0x001f0000
360#define OFFSET 0x0000ffff
361#define LL 0xc0000000
362#define SC 0xe0000000
363
364/*
365 * The ll_bit is cleared by r*_switch.S
366 */
367
368unsigned long ll_bit;
369
370static struct task_struct *ll_task = NULL;
371
372static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode)
373{
374 unsigned long value, *vaddr;
375 long offset;
376 int signal = 0;
377
378 /*
379 * analyse the ll instruction that just caused a ri exception
380 * and put the referenced address to addr.
381 */
382
383 /* sign extend offset */
384 offset = opcode & OFFSET;
385 offset <<= 16;
386 offset >>= 16;
387
388 vaddr = (unsigned long *)((long)(regs->regs[(opcode & BASE) >> 21]) + offset);
389
390 if ((unsigned long)vaddr & 3) {
391 signal = SIGBUS;
392 goto sig;
393 }
394 if (get_user(value, vaddr)) {
395 signal = SIGSEGV;
396 goto sig;
397 }
398
399 preempt_disable();
400
401 if (ll_task == NULL || ll_task == current) {
402 ll_bit = 1;
403 } else {
404 ll_bit = 0;
405 }
406 ll_task = current;
407
408 preempt_enable();
409
410 regs->regs[(opcode & RT) >> 16] = value;
411
412 compute_return_epc(regs);
413 return;
414
415sig:
416 force_sig(signal, current);
417}
418
419static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode)
420{
421 unsigned long *vaddr, reg;
422 long offset;
423 int signal = 0;
424
425 /*
426 * analyse the sc instruction that just caused a ri exception
427 * and put the referenced address to addr.
428 */
429
430 /* sign extend offset */
431 offset = opcode & OFFSET;
432 offset <<= 16;
433 offset >>= 16;
434
435 vaddr = (unsigned long *)((long)(regs->regs[(opcode & BASE) >> 21]) + offset);
436 reg = (opcode & RT) >> 16;
437
438 if ((unsigned long)vaddr & 3) {
439 signal = SIGBUS;
440 goto sig;
441 }
442
443 preempt_disable();
444
445 if (ll_bit == 0 || ll_task != current) {
446 regs->regs[reg] = 0;
447 preempt_enable();
448 compute_return_epc(regs);
449 return;
450 }
451
452 preempt_enable();
453
454 if (put_user(regs->regs[reg], vaddr)) {
455 signal = SIGSEGV;
456 goto sig;
457 }
458
459 regs->regs[reg] = 1;
460
461 compute_return_epc(regs);
462 return;
463
464sig:
465 force_sig(signal, current);
466}
467
468/*
469 * ll uses the opcode of lwc0 and sc uses the opcode of swc0. That is both
470 * opcodes are supposed to result in coprocessor unusable exceptions if
471 * executed on ll/sc-less processors. That's the theory. In practice a
472 * few processors such as NEC's VR4100 throw reserved instruction exceptions
473 * instead, so we're doing the emulation thing in both exception handlers.
474 */
475static inline int simulate_llsc(struct pt_regs *regs)
476{
477 unsigned int opcode;
478
479 if (unlikely(get_insn_opcode(regs, &opcode)))
480 return -EFAULT;
481
482 if ((opcode & OPCODE) == LL) {
483 simulate_ll(regs, opcode);
484 return 0;
485 }
486 if ((opcode & OPCODE) == SC) {
487 simulate_sc(regs, opcode);
488 return 0;
489 }
490
491 return -EFAULT; /* Strange things going on ... */
492}
493
494asmlinkage void do_ov(struct pt_regs *regs)
495{
496 siginfo_t info;
497
498 info.si_code = FPE_INTOVF;
499 info.si_signo = SIGFPE;
500 info.si_errno = 0;
501 info.si_addr = (void *)regs->cp0_epc;
502 force_sig_info(SIGFPE, &info, current);
503}
504
505/*
506 * XXX Delayed fp exceptions when doing a lazy ctx switch XXX
507 */
508asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
509{
510 if (fcr31 & FPU_CSR_UNI_X) {
511 int sig;
512
513 preempt_disable();
514
515 /*
516 * Unimplemented operation exception. If we've got the full
517 * software emulator on-board, let's use it...
518 *
519 * Force FPU to dump state into task/thread context. We're
520 * moving a lot of data here for what is probably a single
521 * instruction, but the alternative is to pre-decode the FP
522 * register operands before invoking the emulator, which seems
523 * a bit extreme for what should be an infrequent event.
524 */
525 save_fp(current);
526
527 /* Run the emulator */
528 sig = fpu_emulator_cop1Handler (0, regs,
529 &current->thread.fpu.soft);
530
531 /*
532 * We can't allow the emulated instruction to leave any of
533 * the cause bit set in $fcr31.
534 */
535 current->thread.fpu.soft.fcr31 &= ~FPU_CSR_ALL_X;
536
537 /* Restore the hardware register state */
538 restore_fp(current);
539
540 preempt_enable();
541
542 /* If something went wrong, signal */
543 if (sig)
544 force_sig(sig, current);
545
546 return;
547 }
548
549 force_sig(SIGFPE, current);
550}
551
552asmlinkage void do_bp(struct pt_regs *regs)
553{
554 unsigned int opcode, bcode;
555 siginfo_t info;
556
557 die_if_kernel("Break instruction in kernel code", regs);
558
559 if (get_insn_opcode(regs, &opcode))
560 return;
561
562 /*
563 * There is the ancient bug in the MIPS assemblers that the break
564 * code starts left to bit 16 instead to bit 6 in the opcode.
565 * Gas is bug-compatible, but not always, grrr...
566 * We handle both cases with a simple heuristics. --macro
567 */
568 bcode = ((opcode >> 6) & ((1 << 20) - 1));
569 if (bcode < (1 << 10))
570 bcode <<= 10;
571
572 /*
573 * (A short test says that IRIX 5.3 sends SIGTRAP for all break
574 * insns, even for break codes that indicate arithmetic failures.
575 * Weird ...)
576 * But should we continue the brokenness??? --macro
577 */
578 switch (bcode) {
579 case BRK_OVERFLOW << 10:
580 case BRK_DIVZERO << 10:
581 if (bcode == (BRK_DIVZERO << 10))
582 info.si_code = FPE_INTDIV;
583 else
584 info.si_code = FPE_INTOVF;
585 info.si_signo = SIGFPE;
586 info.si_errno = 0;
587 info.si_addr = (void *)regs->cp0_epc;
588 force_sig_info(SIGFPE, &info, current);
589 break;
590 default:
591 force_sig(SIGTRAP, current);
592 }
593}
594
595asmlinkage void do_tr(struct pt_regs *regs)
596{
597 unsigned int opcode, tcode = 0;
598 siginfo_t info;
599
600 die_if_kernel("Trap instruction in kernel code", regs);
601
602 if (get_insn_opcode(regs, &opcode))
603 return;
604
605 /* Immediate versions don't provide a code. */
606 if (!(opcode & OPCODE))
607 tcode = ((opcode >> 6) & ((1 << 10) - 1));
608
609 /*
610 * (A short test says that IRIX 5.3 sends SIGTRAP for all trap
611 * insns, even for trap codes that indicate arithmetic failures.
612 * Weird ...)
613 * But should we continue the brokenness??? --macro
614 */
615 switch (tcode) {
616 case BRK_OVERFLOW:
617 case BRK_DIVZERO:
618 if (tcode == BRK_DIVZERO)
619 info.si_code = FPE_INTDIV;
620 else
621 info.si_code = FPE_INTOVF;
622 info.si_signo = SIGFPE;
623 info.si_errno = 0;
624 info.si_addr = (void *)regs->cp0_epc;
625 force_sig_info(SIGFPE, &info, current);
626 break;
627 default:
628 force_sig(SIGTRAP, current);
629 }
630}
631
632asmlinkage void do_ri(struct pt_regs *regs)
633{
634 die_if_kernel("Reserved instruction in kernel code", regs);
635
636 if (!cpu_has_llsc)
637 if (!simulate_llsc(regs))
638 return;
639
640 force_sig(SIGILL, current);
641}
642
643asmlinkage void do_cpu(struct pt_regs *regs)
644{
645 unsigned int cpid;
646
647 die_if_kernel("do_cpu invoked from kernel context!", regs);
648
649 cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
650
651 switch (cpid) {
652 case 0:
653 if (cpu_has_llsc)
654 break;
655
656 if (!simulate_llsc(regs))
657 return;
658 break;
659
660 case 1:
661 preempt_disable();
662
663 own_fpu();
664 if (used_math()) { /* Using the FPU again. */
665 restore_fp(current);
666 } else { /* First time FPU user. */
667 init_fpu();
668 set_used_math();
669 }
670
671 if (!cpu_has_fpu) {
672 int sig = fpu_emulator_cop1Handler(0, regs,
673 &current->thread.fpu.soft);
674 if (sig)
675 force_sig(sig, current);
676 }
677
678 preempt_enable();
679
680 return;
681
682 case 2:
683 case 3:
684 break;
685 }
686
687 force_sig(SIGILL, current);
688}
689
690asmlinkage void do_mdmx(struct pt_regs *regs)
691{
692 force_sig(SIGILL, current);
693}
694
695asmlinkage void do_watch(struct pt_regs *regs)
696{
697 /*
698 * We use the watch exception where available to detect stack
699 * overflows.
700 */
701 dump_tlb_all();
702 show_regs(regs);
703 panic("Caught WATCH exception - probably caused by stack overflow.");
704}
705
706asmlinkage void do_mcheck(struct pt_regs *regs)
707{
708 show_regs(regs);
709 dump_tlb_all();
710 /*
711 * Some chips may have other causes of machine check (e.g. SB1
712 * graduation timer)
713 */
714 panic("Caught Machine Check exception - %scaused by multiple "
715 "matching entries in the TLB.",
716 (regs->cp0_status & ST0_TS) ? "" : "not ");
717}
718
719asmlinkage void do_reserved(struct pt_regs *regs)
720{
721 /*
722 * Game over - no way to handle this if it ever occurs. Most probably
723 * caused by a new unknown cpu type or after another deadly
724 * hard/software error.
725 */
726 show_regs(regs);
727 panic("Caught reserved exception %ld - should not happen.",
728 (regs->cp0_cause & 0x7f) >> 2);
729}
730
731/*
732 * Some MIPS CPUs can enable/disable for cache parity detection, but do
733 * it different ways.
734 */
735static inline void parity_protection_init(void)
736{
737 switch (current_cpu_data.cputype) {
738 case CPU_24K:
739 /* 24K cache parity not currently implemented in FPGA */
740 printk(KERN_INFO "Disable cache parity protection for "
741 "MIPS 24K CPU.\n");
742 write_c0_ecc(read_c0_ecc() & ~0x80000000);
743 break;
744 case CPU_5KC:
745 /* Set the PE bit (bit 31) in the c0_ecc register. */
746 printk(KERN_INFO "Enable cache parity protection for "
747 "MIPS 5KC/24K CPUs.\n");
748 write_c0_ecc(read_c0_ecc() | 0x80000000);
749 break;
750 case CPU_20KC:
751 case CPU_25KF:
752 /* Clear the DE bit (bit 16) in the c0_status register. */
753 printk(KERN_INFO "Enable cache parity protection for "
754 "MIPS 20KC/25KF CPUs.\n");
755 clear_c0_status(ST0_DE);
756 break;
757 default:
758 break;
759 }
760}
761
762asmlinkage void cache_parity_error(void)
763{
764 const int field = 2 * sizeof(unsigned long);
765 unsigned int reg_val;
766
767 /* For the moment, report the problem and hang. */
768 printk("Cache error exception:\n");
769 printk("cp0_errorepc == %0*lx\n", field, read_c0_errorepc());
770 reg_val = read_c0_cacheerr();
771 printk("c0_cacheerr == %08x\n", reg_val);
772
773 printk("Decoded c0_cacheerr: %s cache fault in %s reference.\n",
774 reg_val & (1<<30) ? "secondary" : "primary",
775 reg_val & (1<<31) ? "data" : "insn");
776 printk("Error bits: %s%s%s%s%s%s%s\n",
777 reg_val & (1<<29) ? "ED " : "",
778 reg_val & (1<<28) ? "ET " : "",
779 reg_val & (1<<26) ? "EE " : "",
780 reg_val & (1<<25) ? "EB " : "",
781 reg_val & (1<<24) ? "EI " : "",
782 reg_val & (1<<23) ? "E1 " : "",
783 reg_val & (1<<22) ? "E0 " : "");
784 printk("IDX: 0x%08x\n", reg_val & ((1<<22)-1));
785
786#if defined(CONFIG_CPU_MIPS32) || defined (CONFIG_CPU_MIPS64)
787 if (reg_val & (1<<22))
788 printk("DErrAddr0: 0x%0*lx\n", field, read_c0_derraddr0());
789
790 if (reg_val & (1<<23))
791 printk("DErrAddr1: 0x%0*lx\n", field, read_c0_derraddr1());
792#endif
793
794 panic("Can't handle the cache error!");
795}
796
797/*
798 * SDBBP EJTAG debug exception handler.
799 * We skip the instruction and return to the next instruction.
800 */
801void ejtag_exception_handler(struct pt_regs *regs)
802{
803 const int field = 2 * sizeof(unsigned long);
804 unsigned long depc, old_epc;
805 unsigned int debug;
806
807 printk("SDBBP EJTAG debug exception - not handled yet, just ignored!\n");
808 depc = read_c0_depc();
809 debug = read_c0_debug();
810 printk("c0_depc = %0*lx, DEBUG = %08x\n", field, depc, debug);
811 if (debug & 0x80000000) {
812 /*
813 * In branch delay slot.
814 * We cheat a little bit here and use EPC to calculate the
815 * debug return address (DEPC). EPC is restored after the
816 * calculation.
817 */
818 old_epc = regs->cp0_epc;
819 regs->cp0_epc = depc;
820 __compute_return_epc(regs);
821 depc = regs->cp0_epc;
822 regs->cp0_epc = old_epc;
823 } else
824 depc += 4;
825 write_c0_depc(depc);
826
827#if 0
828 printk("\n\n----- Enable EJTAG single stepping ----\n\n");
829 write_c0_debug(debug | 0x100);
830#endif
831}
832
833/*
834 * NMI exception handler.
835 */
836void nmi_exception_handler(struct pt_regs *regs)
837{
838 printk("NMI taken!!!!\n");
839 die("NMI", regs);
840 while(1) ;
841}
842
843unsigned long exception_handlers[32];
844
845/*
846 * As a side effect of the way this is implemented we're limited
847 * to interrupt handlers in the address range from
848 * KSEG0 <= x < KSEG0 + 256mb on the Nevada. Oh well ...
849 */
850void *set_except_vector(int n, void *addr)
851{
852 unsigned long handler = (unsigned long) addr;
853 unsigned long old_handler = exception_handlers[n];
854
855 exception_handlers[n] = handler;
856 if (n == 0 && cpu_has_divec) {
857 *(volatile u32 *)(CAC_BASE + 0x200) = 0x08000000 |
858 (0x03ffffff & (handler >> 2));
859 flush_icache_range(CAC_BASE + 0x200, CAC_BASE + 0x204);
860 }
861 return (void *)old_handler;
862}
863
864/*
865 * This is used by native signal handling
866 */
867asmlinkage int (*save_fp_context)(struct sigcontext *sc);
868asmlinkage int (*restore_fp_context)(struct sigcontext *sc);
869
870extern asmlinkage int _save_fp_context(struct sigcontext *sc);
871extern asmlinkage int _restore_fp_context(struct sigcontext *sc);
872
873extern asmlinkage int fpu_emulator_save_context(struct sigcontext *sc);
874extern asmlinkage int fpu_emulator_restore_context(struct sigcontext *sc);
875
876static inline void signal_init(void)
877{
878 if (cpu_has_fpu) {
879 save_fp_context = _save_fp_context;
880 restore_fp_context = _restore_fp_context;
881 } else {
882 save_fp_context = fpu_emulator_save_context;
883 restore_fp_context = fpu_emulator_restore_context;
884 }
885}
886
887#ifdef CONFIG_MIPS32_COMPAT
888
889/*
890 * This is used by 32-bit signal stuff on the 64-bit kernel
891 */
892asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc);
893asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc);
894
895extern asmlinkage int _save_fp_context32(struct sigcontext32 *sc);
896extern asmlinkage int _restore_fp_context32(struct sigcontext32 *sc);
897
898extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 *sc);
899extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 *sc);
900
901static inline void signal32_init(void)
902{
903 if (cpu_has_fpu) {
904 save_fp_context32 = _save_fp_context32;
905 restore_fp_context32 = _restore_fp_context32;
906 } else {
907 save_fp_context32 = fpu_emulator_save_context32;
908 restore_fp_context32 = fpu_emulator_restore_context32;
909 }
910}
911#endif
912
913extern void cpu_cache_init(void);
914extern void tlb_init(void);
915
916void __init per_cpu_trap_init(void)
917{
918 unsigned int cpu = smp_processor_id();
919 unsigned int status_set = ST0_CU0;
920
921 /*
922 * Disable coprocessors and select 32-bit or 64-bit addressing
923 * and the 16/32 or 32/32 FPR register model. Reset the BEV
924 * flag that some firmware may have left set and the TS bit (for
925 * IP27). Set XX for ISA IV code to work.
926 */
927#ifdef CONFIG_MIPS64
928 status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX;
929#endif
930 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV)
931 status_set |= ST0_XX;
932 change_c0_status(ST0_CU|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX,
933 status_set);
934
935 /*
936 * Some MIPS CPUs have a dedicated interrupt vector which reduces the
937 * interrupt processing overhead. Use it where available.
938 */
939 if (cpu_has_divec)
940 set_c0_cause(CAUSEF_IV);
941
942 cpu_data[cpu].asid_cache = ASID_FIRST_VERSION;
943 TLBMISS_HANDLER_SETUP();
944
945 atomic_inc(&init_mm.mm_count);
946 current->active_mm = &init_mm;
947 BUG_ON(current->mm);
948 enter_lazy_tlb(&init_mm, current);
949
950 cpu_cache_init();
951 tlb_init();
952}
953
954void __init trap_init(void)
955{
956 extern char except_vec3_generic, except_vec3_r4000;
957 extern char except_vec_ejtag_debug;
958 extern char except_vec4;
959 unsigned long i;
960
961 per_cpu_trap_init();
962
963 /*
964 * Copy the generic exception handlers to their final destination.
965 * This will be overriden later as suitable for a particular
966 * configuration.
967 */
968 memcpy((void *)(CAC_BASE + 0x180), &except_vec3_generic, 0x80);
969
970 /*
971 * Setup default vectors
972 */
973 for (i = 0; i <= 31; i++)
974 set_except_vector(i, handle_reserved);
975
976 /*
977 * Copy the EJTAG debug exception vector handler code to it's final
978 * destination.
979 */
980 if (cpu_has_ejtag)
981 memcpy((void *)(CAC_BASE + 0x300), &except_vec_ejtag_debug, 0x80);
982
983 /*
984 * Only some CPUs have the watch exceptions.
985 */
986 if (cpu_has_watch)
987 set_except_vector(23, handle_watch);
988
989 /*
990 * Some MIPS CPUs have a dedicated interrupt vector which reduces the
991 * interrupt processing overhead. Use it where available.
992 */
993 if (cpu_has_divec)
994 memcpy((void *)(CAC_BASE + 0x200), &except_vec4, 0x8);
995
996 /*
997 * Some CPUs can enable/disable for cache parity detection, but does
998 * it different ways.
999 */
1000 parity_protection_init();
1001
1002 /*
1003 * The Data Bus Errors / Instruction Bus Errors are signaled
1004 * by external hardware. Therefore these two exceptions
1005 * may have board specific handlers.
1006 */
1007 if (board_be_init)
1008 board_be_init();
1009
1010 set_except_vector(1, handle_tlbm);
1011 set_except_vector(2, handle_tlbl);
1012 set_except_vector(3, handle_tlbs);
1013
1014 set_except_vector(4, handle_adel);
1015 set_except_vector(5, handle_ades);
1016
1017 set_except_vector(6, handle_ibe);
1018 set_except_vector(7, handle_dbe);
1019
1020 set_except_vector(8, handle_sys);
1021 set_except_vector(9, handle_bp);
1022 set_except_vector(10, handle_ri);
1023 set_except_vector(11, handle_cpu);
1024 set_except_vector(12, handle_ov);
1025 set_except_vector(13, handle_tr);
1026 set_except_vector(22, handle_mdmx);
1027
1028 if (cpu_has_fpu && !cpu_has_nofpuex)
1029 set_except_vector(15, handle_fpe);
1030
1031 if (cpu_has_mcheck)
1032 set_except_vector(24, handle_mcheck);
1033
1034 if (cpu_has_vce)
1035 /* Special exception: R4[04]00 uses also the divec space. */
1036 memcpy((void *)(CAC_BASE + 0x180), &except_vec3_r4000, 0x100);
1037 else if (cpu_has_4kex)
1038 memcpy((void *)(CAC_BASE + 0x180), &except_vec3_generic, 0x80);
1039 else
1040 memcpy((void *)(CAC_BASE + 0x080), &except_vec3_generic, 0x80);
1041
1042 if (current_cpu_data.cputype == CPU_R6000 ||
1043 current_cpu_data.cputype == CPU_R6000A) {
1044 /*
1045 * The R6000 is the only R-series CPU that features a machine
1046 * check exception (similar to the R4000 cache error) and
1047 * unaligned ldc1/sdc1 exception. The handlers have not been
1048 * written yet. Well, anyway there is no R6000 machine on the
1049 * current list of targets for Linux/MIPS.
1050 * (Duh, crap, there is someone with a triple R6k machine)
1051 */
1052 //set_except_vector(14, handle_mc);
1053 //set_except_vector(15, handle_ndc);
1054 }
1055
1056 signal_init();
1057#ifdef CONFIG_MIPS32_COMPAT
1058 signal32_init();
1059#endif
1060
1061 flush_icache_range(CAC_BASE, CAC_BASE + 0x400);
1062}
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
new file mode 100644
index 000000000000..3f24a1d45865
--- /dev/null
+++ b/arch/mips/kernel/unaligned.c
@@ -0,0 +1,550 @@
1/*
2 * Handle unaligned accesses by emulation.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 1998, 1999, 2002 by Ralf Baechle
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 *
11 * This file contains exception handler for address error exception with the
12 * special capability to execute faulting instructions in software. The
13 * handler does not try to handle the case when the program counter points
14 * to an address not aligned to a word boundary.
15 *
16 * Putting data to unaligned addresses is a bad practice even on Intel where
17 * only the performance is affected. Much worse is that such code is non-
18 * portable. Due to several programs that die on MIPS due to alignment
19 * problems I decided to implement this handler anyway though I originally
20 * didn't intend to do this at all for user code.
21 *
22 * For now I enable fixing of address errors by default to make life easier.
23 * I however intend to disable this somewhen in the future when the alignment
24 * problems with user programs have been fixed. For programmers this is the
25 * right way to go.
26 *
27 * Fixing address errors is a per process option. The option is inherited
28 * across fork(2) and execve(2) calls. If you really want to use the
29 * option in your user programs - I discourage the use of the software
30 * emulation strongly - use the following code in your userland stuff:
31 *
32 * #include <sys/sysmips.h>
33 *
34 * ...
35 * sysmips(MIPS_FIXADE, x);
36 * ...
37 *
38 * The argument x is 0 for disabling software emulation, enabled otherwise.
39 *
40 * Below a little program to play around with this feature.
41 *
42 * #include <stdio.h>
43 * #include <sys/sysmips.h>
44 *
45 * struct foo {
46 * unsigned char bar[8];
47 * };
48 *
49 * main(int argc, char *argv[])
50 * {
51 * struct foo x = {0, 1, 2, 3, 4, 5, 6, 7};
52 * unsigned int *p = (unsigned int *) (x.bar + 3);
53 * int i;
54 *
55 * if (argc > 1)
56 * sysmips(MIPS_FIXADE, atoi(argv[1]));
57 *
58 * printf("*p = %08lx\n", *p);
59 *
60 * *p = 0xdeadface;
61 *
62 * for(i = 0; i <= 7; i++)
63 * printf("%02x ", x.bar[i]);
64 * printf("\n");
65 * }
66 *
67 * Coprocessor loads are not supported; I think this case is unimportant
68 * in the practice.
69 *
70 * TODO: Handle ndc (attempted store to doubleword in uncached memory)
71 * exception for the R6000.
72 * A store crossing a page boundary might be executed only partially.
73 * Undo the partial store in this case.
74 */
75#include <linux/config.h>
76#include <linux/mm.h>
77#include <linux/module.h>
78#include <linux/signal.h>
79#include <linux/smp.h>
80#include <linux/smp_lock.h>
81
82#include <asm/asm.h>
83#include <asm/branch.h>
84#include <asm/byteorder.h>
85#include <asm/inst.h>
86#include <asm/uaccess.h>
87#include <asm/system.h>
88
89#define STR(x) __STR(x)
90#define __STR(x) #x
91
92#ifdef CONFIG_PROC_FS
93unsigned long unaligned_instructions;
94#endif
95
96static inline int emulate_load_store_insn(struct pt_regs *regs,
97 void *addr, unsigned long pc,
98 unsigned long **regptr, unsigned long *newvalue)
99{
100 union mips_instruction insn;
101 unsigned long value;
102 unsigned int res;
103
104 regs->regs[0] = 0;
105 *regptr=NULL;
106
107 /*
108 * This load never faults.
109 */
110 __get_user(insn.word, (unsigned int *)pc);
111
112 switch (insn.i_format.opcode) {
113 /*
114 * These are instructions that a compiler doesn't generate. We
115 * can assume therefore that the code is MIPS-aware and
116 * really buggy. Emulating these instructions would break the
117 * semantics anyway.
118 */
119 case ll_op:
120 case lld_op:
121 case sc_op:
122 case scd_op:
123
124 /*
125 * For these instructions the only way to create an address
126 * error is an attempted access to kernel/supervisor address
127 * space.
128 */
129 case ldl_op:
130 case ldr_op:
131 case lwl_op:
132 case lwr_op:
133 case sdl_op:
134 case sdr_op:
135 case swl_op:
136 case swr_op:
137 case lb_op:
138 case lbu_op:
139 case sb_op:
140 goto sigbus;
141
142 /*
143 * The remaining opcodes are the ones that are really of interest.
144 */
145 case lh_op:
146 if (!access_ok(VERIFY_READ, addr, 2))
147 goto sigbus;
148
149 __asm__ __volatile__ (".set\tnoat\n"
150#ifdef __BIG_ENDIAN
151 "1:\tlb\t%0, 0(%2)\n"
152 "2:\tlbu\t$1, 1(%2)\n\t"
153#endif
154#ifdef __LITTLE_ENDIAN
155 "1:\tlb\t%0, 1(%2)\n"
156 "2:\tlbu\t$1, 0(%2)\n\t"
157#endif
158 "sll\t%0, 0x8\n\t"
159 "or\t%0, $1\n\t"
160 "li\t%1, 0\n"
161 "3:\t.set\tat\n\t"
162 ".section\t.fixup,\"ax\"\n\t"
163 "4:\tli\t%1, %3\n\t"
164 "j\t3b\n\t"
165 ".previous\n\t"
166 ".section\t__ex_table,\"a\"\n\t"
167 STR(PTR)"\t1b, 4b\n\t"
168 STR(PTR)"\t2b, 4b\n\t"
169 ".previous"
170 : "=&r" (value), "=r" (res)
171 : "r" (addr), "i" (-EFAULT));
172 if (res)
173 goto fault;
174 *newvalue = value;
175 *regptr = &regs->regs[insn.i_format.rt];
176 break;
177
178 case lw_op:
179 if (!access_ok(VERIFY_READ, addr, 4))
180 goto sigbus;
181
182 __asm__ __volatile__ (
183#ifdef __BIG_ENDIAN
184 "1:\tlwl\t%0, (%2)\n"
185 "2:\tlwr\t%0, 3(%2)\n\t"
186#endif
187#ifdef __LITTLE_ENDIAN
188 "1:\tlwl\t%0, 3(%2)\n"
189 "2:\tlwr\t%0, (%2)\n\t"
190#endif
191 "li\t%1, 0\n"
192 "3:\t.section\t.fixup,\"ax\"\n\t"
193 "4:\tli\t%1, %3\n\t"
194 "j\t3b\n\t"
195 ".previous\n\t"
196 ".section\t__ex_table,\"a\"\n\t"
197 STR(PTR)"\t1b, 4b\n\t"
198 STR(PTR)"\t2b, 4b\n\t"
199 ".previous"
200 : "=&r" (value), "=r" (res)
201 : "r" (addr), "i" (-EFAULT));
202 if (res)
203 goto fault;
204 *newvalue = value;
205 *regptr = &regs->regs[insn.i_format.rt];
206 break;
207
208 case lhu_op:
209 if (!access_ok(VERIFY_READ, addr, 2))
210 goto sigbus;
211
212 __asm__ __volatile__ (
213 ".set\tnoat\n"
214#ifdef __BIG_ENDIAN
215 "1:\tlbu\t%0, 0(%2)\n"
216 "2:\tlbu\t$1, 1(%2)\n\t"
217#endif
218#ifdef __LITTLE_ENDIAN
219 "1:\tlbu\t%0, 1(%2)\n"
220 "2:\tlbu\t$1, 0(%2)\n\t"
221#endif
222 "sll\t%0, 0x8\n\t"
223 "or\t%0, $1\n\t"
224 "li\t%1, 0\n"
225 "3:\t.set\tat\n\t"
226 ".section\t.fixup,\"ax\"\n\t"
227 "4:\tli\t%1, %3\n\t"
228 "j\t3b\n\t"
229 ".previous\n\t"
230 ".section\t__ex_table,\"a\"\n\t"
231 STR(PTR)"\t1b, 4b\n\t"
232 STR(PTR)"\t2b, 4b\n\t"
233 ".previous"
234 : "=&r" (value), "=r" (res)
235 : "r" (addr), "i" (-EFAULT));
236 if (res)
237 goto fault;
238 *newvalue = value;
239 *regptr = &regs->regs[insn.i_format.rt];
240 break;
241
242 case lwu_op:
243#ifdef CONFIG_MIPS64
244 /*
245 * A 32-bit kernel might be running on a 64-bit processor. But
246 * if we're on a 32-bit processor and an i-cache incoherency
247 * or race makes us see a 64-bit instruction here the sdl/sdr
248 * would blow up, so for now we don't handle unaligned 64-bit
249 * instructions on 32-bit kernels.
250 */
251 if (!access_ok(VERIFY_READ, addr, 4))
252 goto sigbus;
253
254 __asm__ __volatile__ (
255#ifdef __BIG_ENDIAN
256 "1:\tlwl\t%0, (%2)\n"
257 "2:\tlwr\t%0, 3(%2)\n\t"
258#endif
259#ifdef __LITTLE_ENDIAN
260 "1:\tlwl\t%0, 3(%2)\n"
261 "2:\tlwr\t%0, (%2)\n\t"
262#endif
263 "dsll\t%0, %0, 32\n\t"
264 "dsrl\t%0, %0, 32\n\t"
265 "li\t%1, 0\n"
266 "3:\t.section\t.fixup,\"ax\"\n\t"
267 "4:\tli\t%1, %3\n\t"
268 "j\t3b\n\t"
269 ".previous\n\t"
270 ".section\t__ex_table,\"a\"\n\t"
271 STR(PTR)"\t1b, 4b\n\t"
272 STR(PTR)"\t2b, 4b\n\t"
273 ".previous"
274 : "=&r" (value), "=r" (res)
275 : "r" (addr), "i" (-EFAULT));
276 if (res)
277 goto fault;
278 *newvalue = value;
279 *regptr = &regs->regs[insn.i_format.rt];
280 break;
281#endif /* CONFIG_MIPS64 */
282
283 /* Cannot handle 64-bit instructions in 32-bit kernel */
284 goto sigill;
285
286 case ld_op:
287#ifdef CONFIG_MIPS64
288 /*
289 * A 32-bit kernel might be running on a 64-bit processor. But
290 * if we're on a 32-bit processor and an i-cache incoherency
291 * or race makes us see a 64-bit instruction here the sdl/sdr
292 * would blow up, so for now we don't handle unaligned 64-bit
293 * instructions on 32-bit kernels.
294 */
295 if (!access_ok(VERIFY_READ, addr, 8))
296 goto sigbus;
297
298 __asm__ __volatile__ (
299#ifdef __BIG_ENDIAN
300 "1:\tldl\t%0, (%2)\n"
301 "2:\tldr\t%0, 7(%2)\n\t"
302#endif
303#ifdef __LITTLE_ENDIAN
304 "1:\tldl\t%0, 7(%2)\n"
305 "2:\tldr\t%0, (%2)\n\t"
306#endif
307 "li\t%1, 0\n"
308 "3:\t.section\t.fixup,\"ax\"\n\t"
309 "4:\tli\t%1, %3\n\t"
310 "j\t3b\n\t"
311 ".previous\n\t"
312 ".section\t__ex_table,\"a\"\n\t"
313 STR(PTR)"\t1b, 4b\n\t"
314 STR(PTR)"\t2b, 4b\n\t"
315 ".previous"
316 : "=&r" (value), "=r" (res)
317 : "r" (addr), "i" (-EFAULT));
318 if (res)
319 goto fault;
320 *newvalue = value;
321 *regptr = &regs->regs[insn.i_format.rt];
322 break;
323#endif /* CONFIG_MIPS64 */
324
325 /* Cannot handle 64-bit instructions in 32-bit kernel */
326 goto sigill;
327
328 case sh_op:
329 if (!access_ok(VERIFY_WRITE, addr, 2))
330 goto sigbus;
331
332 value = regs->regs[insn.i_format.rt];
333 __asm__ __volatile__ (
334#ifdef __BIG_ENDIAN
335 ".set\tnoat\n"
336 "1:\tsb\t%1, 1(%2)\n\t"
337 "srl\t$1, %1, 0x8\n"
338 "2:\tsb\t$1, 0(%2)\n\t"
339 ".set\tat\n\t"
340#endif
341#ifdef __LITTLE_ENDIAN
342 ".set\tnoat\n"
343 "1:\tsb\t%1, 0(%2)\n\t"
344 "srl\t$1,%1, 0x8\n"
345 "2:\tsb\t$1, 1(%2)\n\t"
346 ".set\tat\n\t"
347#endif
348 "li\t%0, 0\n"
349 "3:\n\t"
350 ".section\t.fixup,\"ax\"\n\t"
351 "4:\tli\t%0, %3\n\t"
352 "j\t3b\n\t"
353 ".previous\n\t"
354 ".section\t__ex_table,\"a\"\n\t"
355 STR(PTR)"\t1b, 4b\n\t"
356 STR(PTR)"\t2b, 4b\n\t"
357 ".previous"
358 : "=r" (res)
359 : "r" (value), "r" (addr), "i" (-EFAULT));
360 if (res)
361 goto fault;
362 break;
363
364 case sw_op:
365 if (!access_ok(VERIFY_WRITE, addr, 4))
366 goto sigbus;
367
368 value = regs->regs[insn.i_format.rt];
369 __asm__ __volatile__ (
370#ifdef __BIG_ENDIAN
371 "1:\tswl\t%1,(%2)\n"
372 "2:\tswr\t%1, 3(%2)\n\t"
373#endif
374#ifdef __LITTLE_ENDIAN
375 "1:\tswl\t%1, 3(%2)\n"
376 "2:\tswr\t%1, (%2)\n\t"
377#endif
378 "li\t%0, 0\n"
379 "3:\n\t"
380 ".section\t.fixup,\"ax\"\n\t"
381 "4:\tli\t%0, %3\n\t"
382 "j\t3b\n\t"
383 ".previous\n\t"
384 ".section\t__ex_table,\"a\"\n\t"
385 STR(PTR)"\t1b, 4b\n\t"
386 STR(PTR)"\t2b, 4b\n\t"
387 ".previous"
388 : "=r" (res)
389 : "r" (value), "r" (addr), "i" (-EFAULT));
390 if (res)
391 goto fault;
392 break;
393
394 case sd_op:
395#ifdef CONFIG_MIPS64
396 /*
397 * A 32-bit kernel might be running on a 64-bit processor. But
398 * if we're on a 32-bit processor and an i-cache incoherency
399 * or race makes us see a 64-bit instruction here the sdl/sdr
400 * would blow up, so for now we don't handle unaligned 64-bit
401 * instructions on 32-bit kernels.
402 */
403 if (!access_ok(VERIFY_WRITE, addr, 8))
404 goto sigbus;
405
406 value = regs->regs[insn.i_format.rt];
407 __asm__ __volatile__ (
408#ifdef __BIG_ENDIAN
409 "1:\tsdl\t%1,(%2)\n"
410 "2:\tsdr\t%1, 7(%2)\n\t"
411#endif
412#ifdef __LITTLE_ENDIAN
413 "1:\tsdl\t%1, 7(%2)\n"
414 "2:\tsdr\t%1, (%2)\n\t"
415#endif
416 "li\t%0, 0\n"
417 "3:\n\t"
418 ".section\t.fixup,\"ax\"\n\t"
419 "4:\tli\t%0, %3\n\t"
420 "j\t3b\n\t"
421 ".previous\n\t"
422 ".section\t__ex_table,\"a\"\n\t"
423 STR(PTR)"\t1b, 4b\n\t"
424 STR(PTR)"\t2b, 4b\n\t"
425 ".previous"
426 : "=r" (res)
427 : "r" (value), "r" (addr), "i" (-EFAULT));
428 if (res)
429 goto fault;
430 break;
431#endif /* CONFIG_MIPS64 */
432
433 /* Cannot handle 64-bit instructions in 32-bit kernel */
434 goto sigill;
435
436 case lwc1_op:
437 case ldc1_op:
438 case swc1_op:
439 case sdc1_op:
440 /*
441 * I herewith declare: this does not happen. So send SIGBUS.
442 */
443 goto sigbus;
444
445 case lwc2_op:
446 case ldc2_op:
447 case swc2_op:
448 case sdc2_op:
449 /*
450 * These are the coprocessor 2 load/stores. The current
451 * implementations don't use cp2 and cp2 should always be
452 * disabled in c0_status. So send SIGILL.
453 * (No longer true: The Sony Praystation uses cp2 for
454 * 3D matrix operations. Dunno if that thingy has a MMU ...)
455 */
456 default:
457 /*
458 * Pheeee... We encountered an yet unknown instruction or
459 * cache coherence problem. Die sucker, die ...
460 */
461 goto sigill;
462 }
463
464#ifdef CONFIG_PROC_FS
465 unaligned_instructions++;
466#endif
467
468 return 0;
469
470fault:
471 /* Did we have an exception handler installed? */
472 if (fixup_exception(regs))
473 return 1;
474
475 die_if_kernel ("Unhandled kernel unaligned access", regs);
476 send_sig(SIGSEGV, current, 1);
477
478 return 0;
479
480sigbus:
481 die_if_kernel("Unhandled kernel unaligned access", regs);
482 send_sig(SIGBUS, current, 1);
483
484 return 0;
485
486sigill:
487 die_if_kernel("Unhandled kernel unaligned access or invalid instruction", regs);
488 send_sig(SIGILL, current, 1);
489
490 return 0;
491}
492
493asmlinkage void do_ade(struct pt_regs *regs)
494{
495 unsigned long *regptr, newval;
496 extern int do_dsemulret(struct pt_regs *);
497 mm_segment_t seg;
498 unsigned long pc;
499
500 /*
501 * Address errors may be deliberately induced by the FPU emulator to
502 * retake control of the CPU after executing the instruction in the
503 * delay slot of an emulated branch.
504 */
505 /* Terminate if exception was recognized as a delay slot return */
506 if (do_dsemulret(regs))
507 return;
508
509 /* Otherwise handle as normal */
510
511 /*
512 * Did we catch a fault trying to load an instruction?
513 * Or are we running in MIPS16 mode?
514 */
515 if ((regs->cp0_badvaddr == regs->cp0_epc) || (regs->cp0_epc & 0x1))
516 goto sigbus;
517
518 pc = exception_epc(regs);
519 if ((current->thread.mflags & MF_FIXADE) == 0)
520 goto sigbus;
521
522 /*
523 * Do branch emulation only if we didn't forward the exception.
524 * This is all so but ugly ...
525 */
526 seg = get_fs();
527 if (!user_mode(regs))
528 set_fs(KERNEL_DS);
529 if (!emulate_load_store_insn(regs, (void *)regs->cp0_badvaddr, pc,
530 &regptr, &newval)) {
531 compute_return_epc(regs);
532 /*
533 * Now that branch is evaluated, update the dest
534 * register if necessary
535 */
536 if (regptr)
537 *regptr = newval;
538 }
539 set_fs(seg);
540
541 return;
542
543sigbus:
544 die_if_kernel("Kernel unaligned instruction access", regs);
545 force_sig(SIGBUS, current);
546
547 /*
548 * XXX On return from the signal handler we should advance the epc
549 */
550}
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
new file mode 100644
index 000000000000..e830d788c106
--- /dev/null
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -0,0 +1,183 @@
1#include <linux/config.h>
2#include <asm-generic/vmlinux.lds.h>
3
4#undef mips /* CPP really sucks for this job */
5#define mips mips
6OUTPUT_ARCH(mips)
7ENTRY(kernel_entry)
8jiffies = JIFFIES;
9SECTIONS
10{
11#ifdef CONFIG_BOOT_ELF64
12 /* Read-only sections, merged into text segment: */
13 /* . = 0xc000000000000000; */
14
15 /* This is the value for an Origin kernel, taken from an IRIX kernel. */
16 /* . = 0xc00000000001c000; */
17
18 /* Set the vaddr for the text segment to a value
19 >= 0xa800 0000 0001 9000 if no symmon is going to configured
20 >= 0xa800 0000 0030 0000 otherwise */
21
22 /* . = 0xa800000000300000; */
23 /* . = 0xa800000000300000; */
24 . = 0xffffffff80300000;
25#endif
26 . = LOADADDR;
27 /* read-only */
28 _text = .; /* Text and read-only data */
29 .text : {
30 *(.text)
31 SCHED_TEXT
32 LOCK_TEXT
33 *(.fixup)
34 *(.gnu.warning)
35 } =0
36
37 _etext = .; /* End of text section */
38
39 . = ALIGN(16); /* Exception table */
40 __start___ex_table = .;
41 __ex_table : { *(__ex_table) }
42 __stop___ex_table = .;
43
44 __start___dbe_table = .; /* Exception table for data bus errors */
45 __dbe_table : { *(__dbe_table) }
46 __stop___dbe_table = .;
47
48 RODATA
49
50 /* writeable */
51 .data : { /* Data */
52 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
53 *(.data.init_task)
54
55 *(.data)
56
57 /* Align the initial ramdisk image (INITRD) on page boundaries. */
58 . = ALIGN(4096);
59 __rd_start = .;
60 *(.initrd)
61 . = ALIGN(4096);
62 __rd_end = .;
63
64 CONSTRUCTORS
65 }
66 _gp = . + 0x8000;
67 .lit8 : { *(.lit8) }
68 .lit4 : { *(.lit4) }
69 /* We want the small data sections together, so single-instruction offsets
70 can access them all, and initialized data all before uninitialized, so
71 we can shorten the on-disk segment size. */
72 .sdata : { *(.sdata) }
73
74 . = ALIGN(4096);
75 __nosave_begin = .;
76 .data_nosave : { *(.data.nosave) }
77 . = ALIGN(4096);
78 __nosave_end = .;
79
80 . = ALIGN(32);
81 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
82
83 _edata = .; /* End of data section */
84
85 /* will be freed after init */
86 . = ALIGN(4096); /* Init code and data */
87 __init_begin = .;
88 .init.text : {
89 _sinittext = .;
90 *(.init.text)
91 _einittext = .;
92 }
93 .init.data : { *(.init.data) }
94 . = ALIGN(16);
95 __setup_start = .;
96 .init.setup : { *(.init.setup) }
97 __setup_end = .;
98
99 .early_initcall.init : {
100 __earlyinitcall_start = .;
101 *(.initcall.early1.init)
102 }
103 __earlyinitcall_end = .;
104
105 __initcall_start = .;
106 .initcall.init : {
107 *(.initcall1.init)
108 *(.initcall2.init)
109 *(.initcall3.init)
110 *(.initcall4.init)
111 *(.initcall5.init)
112 *(.initcall6.init)
113 *(.initcall7.init)
114 }
115 __initcall_end = .;
116
117 __con_initcall_start = .;
118 .con_initcall.init : { *(.con_initcall.init) }
119 __con_initcall_end = .;
120 SECURITY_INIT
121 . = ALIGN(4096);
122 __initramfs_start = .;
123 .init.ramfs : { *(.init.ramfs) }
124 __initramfs_end = .;
125 . = ALIGN(32);
126 __per_cpu_start = .;
127 .data.percpu : { *(.data.percpu) }
128 __per_cpu_end = .;
129 . = ALIGN(4096);
130 __init_end = .;
131 /* freed after init ends here */
132
133 __bss_start = .; /* BSS */
134 .sbss : {
135 *(.sbss)
136 *(.scommon)
137 }
138 .bss : {
139 *(.bss)
140 *(COMMON)
141 }
142 __bss_stop = .;
143
144 _end = . ;
145
146 /* Sections to be discarded */
147 /DISCARD/ : {
148 *(.exit.text)
149 *(.exit.data)
150 *(.exitcall.exit)
151
152 /* ABI crap starts here */
153 *(.comment)
154 *(.MIPS.options)
155 *(.note)
156 *(.options)
157 *(.pdr)
158 *(.reginfo)
159 *(.mdebug*)
160 }
161
162 /* This is the MIPS specific mdebug section. */
163 .mdebug : { *(.mdebug) }
164 /* These are needed for ELF backends which have not yet been
165 converted to the new style linker. */
166 .stab 0 : { *(.stab) }
167 .stabstr 0 : { *(.stabstr) }
168 /* DWARF debug sections.
169 Symbols in the .debug DWARF section are relative to the beginning of the
170 section so we begin .debug at 0. It's not clear yet what needs to happen
171 for the others. */
172 .debug 0 : { *(.debug) }
173 .debug_srcinfo 0 : { *(.debug_srcinfo) }
174 .debug_aranges 0 : { *(.debug_aranges) }
175 .debug_pubnames 0 : { *(.debug_pubnames) }
176 .debug_sfnames 0 : { *(.debug_sfnames) }
177 .line 0 : { *(.line) }
178 /* These must appear regardless of . */
179 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
180 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
181 .comment : { *(.comment) }
182 .note : { *(.note) }
183}
diff --git a/arch/mips/lasat/Makefile b/arch/mips/lasat/Makefile
new file mode 100644
index 000000000000..0d5aec436725
--- /dev/null
+++ b/arch/mips/lasat/Makefile
@@ -0,0 +1,14 @@
1#
2# Makefile for the LASAT specific kernel interface routines under Linux.
3#
4
5obj-y += reset.o setup.o prom.o lasat_board.o \
6 at93c.o interrupt.o lasatIRQ.o
7
8obj-$(CONFIG_LASAT_SYSCTL) += sysctl.o
9obj-$(CONFIG_DS1603) += ds1603.o
10obj-$(CONFIG_PICVUE) += picvue.o
11obj-$(CONFIG_PICVUE_PROC) += picvue_proc.o
12
13clean:
14 make -C image clean
diff --git a/arch/mips/lasat/at93c.c b/arch/mips/lasat/at93c.c
new file mode 100644
index 000000000000..f6add041ebec
--- /dev/null
+++ b/arch/mips/lasat/at93c.c
@@ -0,0 +1,148 @@
1/*
2 * Atmel AT93C46 serial eeprom driver
3 *
4 * Brian Murphy <brian.murphy@eicon.com>
5 *
6 */
7#include <linux/kernel.h>
8#include <linux/delay.h>
9#include <asm/lasat/lasat.h>
10#include <linux/module.h>
11#include <linux/init.h>
12
13#include "at93c.h"
14
15#define AT93C_ADDR_SHIFT 7
16#define AT93C_ADDR_MAX ((1 << AT93C_ADDR_SHIFT) - 1)
17#define AT93C_RCMD (0x6 << AT93C_ADDR_SHIFT)
18#define AT93C_WCMD (0x5 << AT93C_ADDR_SHIFT)
19#define AT93C_WENCMD 0x260
20#define AT93C_WDSCMD 0x200
21
22struct at93c_defs *at93c;
23
24static void at93c_reg_write(u32 val)
25{
26 *at93c->reg = val;
27}
28
29static u32 at93c_reg_read(void)
30{
31 u32 tmp = *at93c->reg;
32 return tmp;
33}
34
35static u32 at93c_datareg_read(void)
36{
37 u32 tmp = *at93c->rdata_reg;
38 return tmp;
39}
40
41static void at93c_cycle_clk(u32 data)
42{
43 at93c_reg_write(data | at93c->clk);
44 lasat_ndelay(250);
45 at93c_reg_write(data & ~at93c->clk);
46 lasat_ndelay(250);
47}
48
49static void at93c_write_databit(u8 bit)
50{
51 u32 data = at93c_reg_read();
52 if (bit)
53 data |= 1 << at93c->wdata_shift;
54 else
55 data &= ~(1 << at93c->wdata_shift);
56
57 at93c_reg_write(data);
58 lasat_ndelay(100);
59 at93c_cycle_clk(data);
60}
61
62static unsigned int at93c_read_databit(void)
63{
64 u32 data;
65
66 at93c_cycle_clk(at93c_reg_read());
67 data = (at93c_datareg_read() >> at93c->rdata_shift) & 1;
68 return data;
69}
70
71static u8 at93c_read_byte(void)
72{
73 int i;
74 u8 data = 0;
75
76 for (i = 0; i<=7; i++) {
77 data <<= 1;
78 data |= at93c_read_databit();
79 }
80 return data;
81}
82
83static void at93c_write_bits(u32 data, int size)
84{
85 int i;
86 int shift = size - 1;
87 u32 mask = (1 << shift);
88
89 for (i = 0; i < size; i++) {
90 at93c_write_databit((data & mask) >> shift);
91 data <<= 1;
92 }
93}
94
95static void at93c_init_op(void)
96{
97 at93c_reg_write((at93c_reg_read() | at93c->cs) & ~at93c->clk & ~(1 << at93c->rdata_shift));
98 lasat_ndelay(50);
99}
100
101static void at93c_end_op(void)
102{
103 at93c_reg_write(at93c_reg_read() & ~at93c->cs);
104 lasat_ndelay(250);
105}
106
107static void at93c_wait(void)
108{
109 at93c_init_op();
110 while (!at93c_read_databit())
111 ;
112 at93c_end_op();
113};
114
115static void at93c_disable_wp(void)
116{
117 at93c_init_op();
118 at93c_write_bits(AT93C_WENCMD, 10);
119 at93c_end_op();
120}
121
122static void at93c_enable_wp(void)
123{
124 at93c_init_op();
125 at93c_write_bits(AT93C_WDSCMD, 10);
126 at93c_end_op();
127}
128
129u8 at93c_read(u8 addr)
130{
131 u8 byte;
132 at93c_init_op();
133 at93c_write_bits((addr & AT93C_ADDR_MAX)|AT93C_RCMD, 10);
134 byte = at93c_read_byte();
135 at93c_end_op();
136 return byte;
137}
138
139void at93c_write(u8 addr, u8 data)
140{
141 at93c_disable_wp();
142 at93c_init_op();
143 at93c_write_bits((addr & AT93C_ADDR_MAX)|AT93C_WCMD, 10);
144 at93c_write_bits(data, 8);
145 at93c_end_op();
146 at93c_wait();
147 at93c_enable_wp();
148}
diff --git a/arch/mips/lasat/at93c.h b/arch/mips/lasat/at93c.h
new file mode 100644
index 000000000000..a912ac2171b0
--- /dev/null
+++ b/arch/mips/lasat/at93c.h
@@ -0,0 +1,18 @@
1/*
2 * Atmel AT93C46 serial eeprom driver
3 *
4 * Brian Murphy <brian.murphy@eicon.com>
5 *
6 */
7
8extern struct at93c_defs {
9 volatile u32 *reg;
10 volatile u32 *rdata_reg;
11 int rdata_shift;
12 int wdata_shift;
13 u32 cs;
14 u32 clk;
15} *at93c;
16
17u8 at93c_read(u8 addr);
18void at93c_write(u8 addr, u8 data);
diff --git a/arch/mips/lasat/ds1603.c b/arch/mips/lasat/ds1603.c
new file mode 100644
index 000000000000..7bbf6cf923c9
--- /dev/null
+++ b/arch/mips/lasat/ds1603.c
@@ -0,0 +1,174 @@
1/*
2 * Dallas Semiconductors 1603 RTC driver
3 *
4 * Brian Murphy <brian@murphy.dk>
5 *
6 */
7#include <linux/kernel.h>
8#include <asm/lasat/lasat.h>
9#include <linux/delay.h>
10#include <asm/lasat/ds1603.h>
11
12#include "ds1603.h"
13
14#define READ_TIME_CMD 0x81
15#define SET_TIME_CMD 0x80
16#define TRIMMER_SET_CMD 0xC0
17#define TRIMMER_VALUE_MASK 0x38
18#define TRIMMER_SHIFT 3
19
20struct ds_defs *ds1603 = NULL;
21
22/* HW specific register functions */
23static void rtc_reg_write(unsigned long val)
24{
25 *ds1603->reg = val;
26}
27
28static unsigned long rtc_reg_read(void)
29{
30 unsigned long tmp = *ds1603->reg;
31 return tmp;
32}
33
34static unsigned long rtc_datareg_read(void)
35{
36 unsigned long tmp = *ds1603->data_reg;
37 return tmp;
38}
39
40static void rtc_nrst_high(void)
41{
42 rtc_reg_write(rtc_reg_read() | ds1603->rst);
43}
44
45static void rtc_nrst_low(void)
46{
47 rtc_reg_write(rtc_reg_read() & ~ds1603->rst);
48}
49
50static void rtc_cycle_clock(unsigned long data)
51{
52 data |= ds1603->clk;
53 rtc_reg_write(data);
54 lasat_ndelay(250);
55 if (ds1603->data_reversed)
56 data &= ~ds1603->data;
57 else
58 data |= ds1603->data;
59 data &= ~ds1603->clk;
60 rtc_reg_write(data);
61 lasat_ndelay(250 + ds1603->huge_delay);
62}
63
64static void rtc_write_databit(unsigned int bit)
65{
66 unsigned long data = rtc_reg_read();
67 if (ds1603->data_reversed)
68 bit = !bit;
69 if (bit)
70 data |= ds1603->data;
71 else
72 data &= ~ds1603->data;
73
74 rtc_reg_write(data);
75 lasat_ndelay(50 + ds1603->huge_delay);
76 rtc_cycle_clock(data);
77}
78
79static unsigned int rtc_read_databit(void)
80{
81 unsigned int data;
82
83 data = (rtc_datareg_read() & (1 << ds1603->data_read_shift))
84 >> ds1603->data_read_shift;
85 rtc_cycle_clock(rtc_reg_read());
86 return data;
87}
88
89static void rtc_write_byte(unsigned int byte)
90{
91 int i;
92
93 for (i = 0; i<=7; i++) {
94 rtc_write_databit(byte & 1L);
95 byte >>= 1;
96 }
97}
98
99static void rtc_write_word(unsigned long word)
100{
101 int i;
102
103 for (i = 0; i<=31; i++) {
104 rtc_write_databit(word & 1L);
105 word >>= 1;
106 }
107}
108
109static unsigned long rtc_read_word(void)
110{
111 int i;
112 unsigned long word = 0;
113 unsigned long shift = 0;
114
115 for (i = 0; i<=31; i++) {
116 word |= rtc_read_databit() << shift;
117 shift++;
118 }
119 return word;
120}
121
122static void rtc_init_op(void)
123{
124 rtc_nrst_high();
125
126 rtc_reg_write(rtc_reg_read() & ~ds1603->clk);
127
128 lasat_ndelay(50);
129}
130
131static void rtc_end_op(void)
132{
133 rtc_nrst_low();
134 lasat_ndelay(1000);
135}
136
137/* interface */
138unsigned long ds1603_read(void)
139{
140 unsigned long word;
141 rtc_init_op();
142 rtc_write_byte(READ_TIME_CMD);
143 word = rtc_read_word();
144 rtc_end_op();
145 return word;
146}
147
148int ds1603_set(unsigned long time)
149{
150 rtc_init_op();
151 rtc_write_byte(SET_TIME_CMD);
152 rtc_write_word(time);
153 rtc_end_op();
154
155 return 0;
156}
157
158void ds1603_set_trimmer(unsigned int trimval)
159{
160 rtc_init_op();
161 rtc_write_byte(((trimval << TRIMMER_SHIFT) & TRIMMER_VALUE_MASK)
162 | (TRIMMER_SET_CMD));
163 rtc_end_op();
164}
165
166void ds1603_disable(void)
167{
168 ds1603_set_trimmer(TRIMMER_DISABLE_RTC);
169}
170
171void ds1603_enable(void)
172{
173 ds1603_set_trimmer(TRIMMER_DEFAULT);
174}
diff --git a/arch/mips/lasat/ds1603.h b/arch/mips/lasat/ds1603.h
new file mode 100644
index 000000000000..55f3b0423c20
--- /dev/null
+++ b/arch/mips/lasat/ds1603.h
@@ -0,0 +1,33 @@
1/*
2 * Dallas Semiconductors 1603 RTC driver
3 *
4 * Brian Murphy <brian@murphy.dk>
5 *
6 */
7#ifndef __DS1603_H
8#define __DS1603_H
9
10struct ds_defs {
11 volatile u32 *reg;
12 volatile u32 *data_reg;
13 u32 rst;
14 u32 clk;
15 u32 data;
16 u32 data_read_shift;
17 char data_reversed;
18 u32 huge_delay;
19};
20
21extern struct ds_defs *ds1603;
22
23unsigned long ds1603_read(void);
24int ds1603_set(unsigned long);
25void ds1603_set_trimmer(unsigned int);
26void ds1603_enable(void);
27void ds1603_disable(void);
28void ds1603_init(struct ds_defs *);
29
30#define TRIMMER_DEFAULT 3
31#define TRIMMER_DISABLE_RTC 0
32
33#endif
diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
new file mode 100644
index 000000000000..18b6430f11be
--- /dev/null
+++ b/arch/mips/lasat/image/Makefile
@@ -0,0 +1,53 @@
1#
2# MAKEFILE FOR THE MIPS LINUX BOOTLOADER AND ROM DEBUGGER
3#
4# i-data Networks
5#
6# Author: Thomas Horsten <thh@i-data.com>
7#
8
9ifndef Version
10 Version = "$(USER)-test"
11endif
12
13MKLASATIMG = mklasatimg
14MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
15KERNEL_IMAGE = $(TOPDIR)/vmlinux
16KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
17KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
18
19LDSCRIPT= -L$(obj) -Tromscript.normal
20
21HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
22 -D_kernel_entry=0x$(KERNEL_ENTRY) \
23 -D VERSION="\"$(Version)\"" \
24 -D TIMESTAMP=$(shell date +%s)
25
26$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
27 $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
28
29OBJECTS = head.o kImage.o
30
31rom.sw: $(obj)/rom.sw
32
33$(obj)/rom.sw: $(obj)/rom.bin
34 $(MKLASATIMG) -o $@ -k $^ -m $(MKLASATIMG_ARCH)
35
36$(obj)/rom.bin: $(obj)/rom
37 $(OBJCOPY) -O binary -S $^ $@
38
39# Rule to make the bootloader
40$(obj)/rom: $(addprefix $(obj)/,$(OBJECTS))
41 $(LD) $(LDFLAGS) $(LDSCRIPT) -o $@ $^
42
43$(obj)/%.o: $(obj)/%.gz
44 $(LD) -r -o $@ -b binary $<
45
46$(obj)/%.gz: $(obj)/%.bin
47 gzip -cf -9 $< > $@
48
49$(obj)/kImage.bin: $(KERNEL_IMAGE)
50 $(OBJCOPY) -O binary -S $^ $@
51
52clean:
53 rm -f rom rom.bin rom.sw kImage.bin kImage.o
diff --git a/arch/mips/lasat/image/head.S b/arch/mips/lasat/image/head.S
new file mode 100644
index 000000000000..426bd7de17bb
--- /dev/null
+++ b/arch/mips/lasat/image/head.S
@@ -0,0 +1,31 @@
1#include <asm/lasat/head.h>
2
3 .text
4 .section .text.start, "ax"
5 .set noreorder
6 .set mips3
7
8 /* Magic words identifying a software image */
9 .word LASAT_K_MAGIC0_VAL
10 .word LASAT_K_MAGIC1_VAL
11
12 /* Image header version */
13 .word 0x00000002
14
15 /* image start and size */
16 .word _image_start
17 .word _image_size
18
19 /* start of kernel and entrypoint in uncompressed image */
20 .word _kernel_start
21 .word _kernel_entry
22
23 /* Here we have room for future flags */
24
25 .org 0x40
26reldate:
27 .word TIMESTAMP
28
29 .org 0x50
30release:
31 .string VERSION
diff --git a/arch/mips/lasat/image/romscript.normal b/arch/mips/lasat/image/romscript.normal
new file mode 100644
index 000000000000..ca22336f6c36
--- /dev/null
+++ b/arch/mips/lasat/image/romscript.normal
@@ -0,0 +1,22 @@
1OUTPUT_ARCH(mips)
2
3SECTIONS
4{
5 .text :
6 {
7 *(.text.start)
8 }
9
10 /* Data in ROM */
11
12 .data ALIGN(0x10) :
13 {
14 *(.data)
15 }
16 _image_start = ADDR(.data);
17 _image_size = SIZEOF(.data);
18
19 .other : {
20 *(.*)
21 }
22}
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
new file mode 100644
index 000000000000..1148a2d20aa7
--- /dev/null
+++ b/arch/mips/lasat/interrupt.c
@@ -0,0 +1,160 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Routines for generic manipulation of the interrupts found on the
19 * Lasat boards.
20 */
21#include <linux/init.h>
22#include <linux/sched.h>
23#include <linux/slab.h>
24#include <linux/interrupt.h>
25#include <linux/kernel_stat.h>
26
27#include <asm/bootinfo.h>
28#include <asm/irq.h>
29#include <asm/lasat/lasatint.h>
30#include <asm/gdb-stub.h>
31
32static volatile int *lasat_int_status = NULL;
33static volatile int *lasat_int_mask = NULL;
34static volatile int lasat_int_mask_shift;
35
36extern asmlinkage void lasatIRQ(void);
37
38void disable_lasat_irq(unsigned int irq_nr)
39{
40 unsigned long flags;
41
42 local_irq_save(flags);
43 *lasat_int_mask &= ~(1 << irq_nr) << lasat_int_mask_shift;
44 local_irq_restore(flags);
45}
46
47void enable_lasat_irq(unsigned int irq_nr)
48{
49 unsigned long flags;
50
51 local_irq_save(flags);
52 *lasat_int_mask |= (1 << irq_nr) << lasat_int_mask_shift;
53 local_irq_restore(flags);
54}
55
56static unsigned int startup_lasat_irq(unsigned int irq)
57{
58 enable_lasat_irq(irq);
59
60 return 0; /* never anything pending */
61}
62
63#define shutdown_lasat_irq disable_lasat_irq
64
65#define mask_and_ack_lasat_irq disable_lasat_irq
66
67static void end_lasat_irq(unsigned int irq)
68{
69 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
70 enable_lasat_irq(irq);
71}
72
73static struct hw_interrupt_type lasat_irq_type = {
74 "Lasat",
75 startup_lasat_irq,
76 shutdown_lasat_irq,
77 enable_lasat_irq,
78 disable_lasat_irq,
79 mask_and_ack_lasat_irq,
80 end_lasat_irq,
81 NULL
82};
83
84static inline int ls1bit32(unsigned int x)
85{
86 int b = 31, s;
87
88 s = 16; if (x << 16 == 0) s = 0; b -= s; x <<= s;
89 s = 8; if (x << 8 == 0) s = 0; b -= s; x <<= s;
90 s = 4; if (x << 4 == 0) s = 0; b -= s; x <<= s;
91 s = 2; if (x << 2 == 0) s = 0; b -= s; x <<= s;
92 s = 1; if (x << 1 == 0) s = 0; b -= s;
93
94 return b;
95}
96
97static unsigned long (* get_int_status)(void);
98
99static unsigned long get_int_status_100(void)
100{
101 return *lasat_int_status & *lasat_int_mask;
102}
103
104static unsigned long get_int_status_200(void)
105{
106 unsigned long int_status;
107
108 int_status = *lasat_int_status;
109 int_status &= (int_status >> LASATINT_MASK_SHIFT_200) & 0xffff;
110 return int_status;
111}
112
113void lasat_hw0_irqdispatch(struct pt_regs *regs)
114{
115 unsigned long int_status;
116 int irq;
117
118 int_status = get_int_status();
119
120 /* if int_status == 0, then the interrupt has already been cleared */
121 if (int_status) {
122 irq = ls1bit32(int_status);
123
124 do_IRQ(irq, regs);
125 }
126}
127
128void __init arch_init_irq(void)
129{
130 int i;
131
132 switch (mips_machtype) {
133 case MACH_LASAT_100:
134 lasat_int_status = (void *)LASAT_INT_STATUS_REG_100;
135 lasat_int_mask = (void *)LASAT_INT_MASK_REG_100;
136 lasat_int_mask_shift = LASATINT_MASK_SHIFT_100;
137 get_int_status = get_int_status_100;
138 *lasat_int_mask = 0;
139 break;
140 case MACH_LASAT_200:
141 lasat_int_status = (void *)LASAT_INT_STATUS_REG_200;
142 lasat_int_mask = (void *)LASAT_INT_MASK_REG_200;
143 lasat_int_mask_shift = LASATINT_MASK_SHIFT_200;
144 get_int_status = get_int_status_200;
145 *lasat_int_mask &= 0xffff;
146 break;
147 default:
148 panic("arch_init_irq: mips_machtype incorrect");
149 }
150
151 /* Now safe to set the exception vector. */
152 set_except_vector(0, lasatIRQ);
153
154 for (i = 0; i <= LASATINT_END; i++) {
155 irq_desc[i].status = IRQ_DISABLED;
156 irq_desc[i].action = 0;
157 irq_desc[i].depth = 1;
158 irq_desc[i].handler = &lasat_irq_type;
159 }
160}
diff --git a/arch/mips/lasat/lasatIRQ.S b/arch/mips/lasat/lasatIRQ.S
new file mode 100644
index 000000000000..2a2b0d056561
--- /dev/null
+++ b/arch/mips/lasat/lasatIRQ.S
@@ -0,0 +1,69 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Interrupt exception dispatch code.
19 */
20#include <asm/asm.h>
21#include <asm/mipsregs.h>
22#include <asm/regdef.h>
23#include <asm/stackframe.h>
24
25 .text
26 .set noreorder
27 .align 5
28 NESTED(lasatIRQ, PT_SIZE, sp)
29 .set noat
30 SAVE_ALL
31 CLI
32 .set at
33 .set noreorder
34
35 mfc0 s0, CP0_CAUSE # get irq mask
36
37 /* First we check for r4k counter/timer IRQ. */
38 andi a0, s0, CAUSEF_IP7
39 beq a0, zero, 1f
40 andi a0, s0, CAUSEF_IP2 # delay slot, check hw0 interrupt
41
42 /* Wheee, a timer interrupt. */
43 li a0, 7
44 jal ll_timer_interrupt
45 move a1, sp
46
47 j ret_from_irq
48 nop
49
501:
51 /* Wheee, combined hardware level zero interrupt. */
52 jal lasat_hw0_irqdispatch
53 move a0, sp # delay slot
54
55 j ret_from_irq
56 nop # delay slot
57
581:
59 /*
60 * Here by mistake? This is possible, what can happen is that by the
61 * time we take the exception the IRQ pin goes low, so just leave if
62 * this is the case.
63 */
64 move a1,s0
65 mfc0 a1, CP0_EPC
66
67 j ret_from_irq
68 nop
69 END(lasatIRQ)
diff --git a/arch/mips/lasat/lasat_board.c b/arch/mips/lasat/lasat_board.c
new file mode 100644
index 000000000000..8c784bcf1111
--- /dev/null
+++ b/arch/mips/lasat/lasat_board.c
@@ -0,0 +1,277 @@
1/*
2 * Thomas Horsten <thh@lasat.com>
3 * Copyright (C) 2000 LASAT Networks A/S.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Routines specific to the LASAT boards
19 */
20#include <linux/config.h>
21#include <linux/types.h>
22#include <linux/crc32.h>
23#include <asm/lasat/lasat.h>
24#include <linux/kernel.h>
25#include <linux/string.h>
26#include <linux/ctype.h>
27#include <asm/bootinfo.h>
28#include <asm/addrspace.h>
29#include "at93c.h"
30/* New model description table */
31#include "lasat_models.h"
32
33#define EEPROM_CRC(data, len) (~0 ^ crc32(~0, data, len))
34
35struct lasat_info lasat_board_info;
36
37void update_bcastaddr(void);
38
39int EEPROMRead(unsigned int pos, unsigned char *data, int len)
40{
41 int i;
42
43 for (i=0; i<len; i++)
44 *data++ = at93c_read(pos++);
45
46 return 0;
47}
48int EEPROMWrite(unsigned int pos, unsigned char *data, int len)
49{
50 int i;
51
52 for (i=0; i<len; i++)
53 at93c_write(pos++, *data++);
54
55 return 0;
56}
57
58static void init_flash_sizes(void)
59{
60 int i;
61 unsigned long *lb = lasat_board_info.li_flashpart_base;
62 unsigned long *ls = lasat_board_info.li_flashpart_size;
63
64 ls[LASAT_MTD_BOOTLOADER] = 0x40000;
65 ls[LASAT_MTD_SERVICE] = 0xC0000;
66 ls[LASAT_MTD_NORMAL] = 0x100000;
67
68 if (mips_machtype == MACH_LASAT_100) {
69 lasat_board_info.li_flash_base = 0x1e000000;
70
71 lb[LASAT_MTD_BOOTLOADER] = 0x1e400000;
72
73 if (lasat_board_info.li_flash_size > 0x200000) {
74 ls[LASAT_MTD_CONFIG] = 0x100000;
75 ls[LASAT_MTD_FS] = 0x500000;
76 }
77 } else {
78 lasat_board_info.li_flash_base = 0x10000000;
79
80 if (lasat_board_info.li_flash_size < 0x1000000) {
81 lb[LASAT_MTD_BOOTLOADER] = 0x10000000;
82 ls[LASAT_MTD_CONFIG] = 0x100000;
83 if (lasat_board_info.li_flash_size >= 0x400000) {
84 ls[LASAT_MTD_FS] = lasat_board_info.li_flash_size - 0x300000;
85 }
86 }
87 }
88
89 for (i = 1; i < LASAT_MTD_LAST; i++)
90 lb[i] = lb[i-1] + ls[i-1];
91}
92
93int lasat_init_board_info(void)
94{
95 int c;
96 unsigned long crc;
97 unsigned long cfg0, cfg1;
98 const product_info_t *ppi;
99 int i_n_base_models = N_BASE_MODELS;
100 const char * const * i_txt_base_models = txt_base_models;
101 int i_n_prids = N_PRIDS;
102
103 memset(&lasat_board_info, 0, sizeof(lasat_board_info));
104
105 /* First read the EEPROM info */
106 EEPROMRead(0, (unsigned char *)&lasat_board_info.li_eeprom_info,
107 sizeof(struct lasat_eeprom_struct));
108
109 /* Check the CRC */
110 crc = EEPROM_CRC((unsigned char *)(&lasat_board_info.li_eeprom_info),
111 sizeof(struct lasat_eeprom_struct) - 4);
112
113 if (crc != lasat_board_info.li_eeprom_info.crc32) {
114 prom_printf("WARNING...\nWARNING...\nEEPROM CRC does not match calculated, attempting to soldier on...\n");
115 }
116
117 if (lasat_board_info.li_eeprom_info.version != LASAT_EEPROM_VERSION)
118 {
119 prom_printf("WARNING...\nWARNING...\nEEPROM version %d, wanted version %d, attempting to soldier on...\n",
120 (unsigned int)lasat_board_info.li_eeprom_info.version,
121 LASAT_EEPROM_VERSION);
122 }
123
124 cfg0 = lasat_board_info.li_eeprom_info.cfg[0];
125 cfg1 = lasat_board_info.li_eeprom_info.cfg[1];
126
127 if ( LASAT_W0_DSCTYPE(cfg0) != 1) {
128 prom_printf("WARNING...\nWARNING...\nInvalid configuration read from EEPROM, attempting to soldier on...");
129 }
130 /* We have a valid configuration */
131
132 switch (LASAT_W0_SDRAMBANKSZ(cfg0)) {
133 case 0:
134 lasat_board_info.li_memsize = 0x0800000;
135 break;
136 case 1:
137 lasat_board_info.li_memsize = 0x1000000;
138 break;
139 case 2:
140 lasat_board_info.li_memsize = 0x2000000;
141 break;
142 case 3:
143 lasat_board_info.li_memsize = 0x4000000;
144 break;
145 case 4:
146 lasat_board_info.li_memsize = 0x8000000;
147 break;
148 default:
149 lasat_board_info.li_memsize = 0;
150 }
151
152 switch (LASAT_W0_SDRAMBANKS(cfg0)) {
153 case 0:
154 break;
155 case 1:
156 lasat_board_info.li_memsize *= 2;
157 break;
158 default:
159 break;
160 }
161
162 switch (LASAT_W0_BUSSPEED(cfg0)) {
163 case 0x0:
164 lasat_board_info.li_bus_hz = 60000000;
165 break;
166 case 0x1:
167 lasat_board_info.li_bus_hz = 66000000;
168 break;
169 case 0x2:
170 lasat_board_info.li_bus_hz = 66666667;
171 break;
172 case 0x3:
173 lasat_board_info.li_bus_hz = 80000000;
174 break;
175 case 0x4:
176 lasat_board_info.li_bus_hz = 83333333;
177 break;
178 case 0x5:
179 lasat_board_info.li_bus_hz = 100000000;
180 break;
181 }
182
183 switch (LASAT_W0_CPUCLK(cfg0)) {
184 case 0x0:
185 lasat_board_info.li_cpu_hz =
186 lasat_board_info.li_bus_hz;
187 break;
188 case 0x1:
189 lasat_board_info.li_cpu_hz =
190 lasat_board_info.li_bus_hz +
191 (lasat_board_info.li_bus_hz >> 1);
192 break;
193 case 0x2:
194 lasat_board_info.li_cpu_hz =
195 lasat_board_info.li_bus_hz +
196 lasat_board_info.li_bus_hz;
197 break;
198 case 0x3:
199 lasat_board_info.li_cpu_hz =
200 lasat_board_info.li_bus_hz +
201 lasat_board_info.li_bus_hz +
202 (lasat_board_info.li_bus_hz >> 1);
203 break;
204 case 0x4:
205 lasat_board_info.li_cpu_hz =
206 lasat_board_info.li_bus_hz +
207 lasat_board_info.li_bus_hz +
208 lasat_board_info.li_bus_hz;
209 break;
210 }
211
212 /* Flash size */
213 switch (LASAT_W1_FLASHSIZE(cfg1)) {
214 case 0:
215 lasat_board_info.li_flash_size = 0x200000;
216 break;
217 case 1:
218 lasat_board_info.li_flash_size = 0x400000;
219 break;
220 case 2:
221 lasat_board_info.li_flash_size = 0x800000;
222 break;
223 case 3:
224 lasat_board_info.li_flash_size = 0x1000000;
225 break;
226 case 4:
227 lasat_board_info.li_flash_size = 0x2000000;
228 break;
229 }
230
231 init_flash_sizes();
232
233 lasat_board_info.li_bmid = LASAT_W0_BMID(cfg0);
234 lasat_board_info.li_prid = lasat_board_info.li_eeprom_info.prid;
235 if (lasat_board_info.li_prid == 0xffff || lasat_board_info.li_prid == 0)
236 lasat_board_info.li_prid = lasat_board_info.li_bmid;
237
238 /* Base model stuff */
239 if (lasat_board_info.li_bmid > i_n_base_models)
240 lasat_board_info.li_bmid = i_n_base_models;
241 strcpy(lasat_board_info.li_bmstr, i_txt_base_models[lasat_board_info.li_bmid]);
242
243 /* Product ID dependent values */
244 c = lasat_board_info.li_prid;
245 if (c >= i_n_prids) {
246 strcpy(lasat_board_info.li_namestr, "Unknown Model");
247 strcpy(lasat_board_info.li_typestr, "Unknown Type");
248 } else {
249 ppi = &vendor_info_table[0].vi_product_info[c];
250 strcpy(lasat_board_info.li_namestr, ppi->pi_name);
251 if (ppi->pi_type)
252 strcpy(lasat_board_info.li_typestr, ppi->pi_type);
253 else
254 sprintf(lasat_board_info.li_typestr, "%d",10*c);
255 }
256
257#if defined(CONFIG_INET) && defined(CONFIG_SYSCTL)
258 update_bcastaddr();
259#endif
260
261 return 0;
262}
263
264void lasat_write_eeprom_info(void)
265{
266 unsigned long crc;
267
268 /* Generate the CRC */
269 crc = EEPROM_CRC((unsigned char *)(&lasat_board_info.li_eeprom_info),
270 sizeof(struct lasat_eeprom_struct) - 4);
271 lasat_board_info.li_eeprom_info.crc32 = crc;
272
273 /* Write the EEPROM info */
274 EEPROMWrite(0, (unsigned char *)&lasat_board_info.li_eeprom_info,
275 sizeof(struct lasat_eeprom_struct));
276}
277
diff --git a/arch/mips/lasat/lasat_models.h b/arch/mips/lasat/lasat_models.h
new file mode 100644
index 000000000000..ae0c5d0bd403
--- /dev/null
+++ b/arch/mips/lasat/lasat_models.h
@@ -0,0 +1,63 @@
1/*
2 * Model description tables
3 */
4
5typedef struct product_info_t {
6 const char *pi_name;
7 const char *pi_type;
8} product_info_t;
9
10typedef struct vendor_info_t {
11 const char *vi_name;
12 const product_info_t *vi_product_info;
13} vendor_info_t;
14
15/*
16 * Base models
17 */
18static const char * const txt_base_models[] = {
19 "MQ 2", "MQ Pro", "SP 25", "SP 50", "SP 100", "SP 5000", "SP 7000", "SP 1000", "Unknown"
20};
21#define N_BASE_MODELS (sizeof(txt_base_models)/sizeof(char*)-1)
22
23/*
24 * Eicon Networks
25 */
26static const char txt_en_mq[] = "Masquerade";
27static const char txt_en_sp[] = "Safepipe";
28
29static const product_info_t product_info_eicon[] = {
30 { txt_en_mq, "II" }, /* 0 */
31 { txt_en_mq, "Pro" }, /* 1 */
32 { txt_en_sp, "25" }, /* 2 */
33 { txt_en_sp, "50" }, /* 3 */
34 { txt_en_sp, "100" }, /* 4 */
35 { txt_en_sp, "5000" }, /* 5 */
36 { txt_en_sp, "7000" }, /* 6 */
37 { txt_en_sp, "30" }, /* 7 */
38 { txt_en_sp, "5100" }, /* 8 */
39 { txt_en_sp, "7100" }, /* 9 */
40 { txt_en_sp, "1110" }, /* 10 */
41 { txt_en_sp, "3020" }, /* 11 */
42 { txt_en_sp, "3030" }, /* 12 */
43 { txt_en_sp, "5020" }, /* 13 */
44 { txt_en_sp, "5030" }, /* 14 */
45 { txt_en_sp, "1120" }, /* 15 */
46 { txt_en_sp, "1130" }, /* 16 */
47 { txt_en_sp, "6010" }, /* 17 */
48 { txt_en_sp, "6110" }, /* 18 */
49 { txt_en_sp, "6210" }, /* 19 */
50 { txt_en_sp, "1020" }, /* 20 */
51 { txt_en_sp, "1040" }, /* 21 */
52 { txt_en_sp, "1050" }, /* 22 */
53 { txt_en_sp, "1060" }, /* 23 */
54};
55#define N_PRIDS (sizeof(product_info_eicon)/sizeof(product_info_t))
56
57/*
58 * The vendor table
59 */
60static vendor_info_t const vendor_info_table[] = {
61 { "Eicon Networks", product_info_eicon },
62};
63#define N_VENDORS (sizeof(vendor_info_table)/sizeof(vendor_info_t))
diff --git a/arch/mips/lasat/picvue.c b/arch/mips/lasat/picvue.c
new file mode 100644
index 000000000000..5637cd153926
--- /dev/null
+++ b/arch/mips/lasat/picvue.c
@@ -0,0 +1,240 @@
1/*
2 * Picvue PVC160206 display driver
3 *
4 * Brian Murphy <brian@murphy.dk>
5 *
6 */
7#include <linux/kernel.h>
8#include <linux/delay.h>
9#include <asm/bootinfo.h>
10#include <asm/lasat/lasat.h>
11#include <linux/module.h>
12#include <linux/init.h>
13#include <linux/errno.h>
14#include <linux/string.h>
15
16#include "picvue.h"
17
18#define PVC_BUSY 0x80
19#define PVC_NLINES 2
20#define PVC_DISPMEM 80
21#define PVC_LINELEN PVC_DISPMEM / PVC_NLINES
22
23struct pvc_defs *picvue = NULL;
24
25DECLARE_MUTEX(pvc_sem);
26
27static void pvc_reg_write(u32 val)
28{
29 *picvue->reg = val;
30}
31
32static u32 pvc_reg_read(void)
33{
34 u32 tmp = *picvue->reg;
35 return tmp;
36}
37
38static void pvc_write_byte(u32 data, u8 byte)
39{
40 data |= picvue->e;
41 pvc_reg_write(data);
42 data &= ~picvue->data_mask;
43 data |= byte << picvue->data_shift;
44 pvc_reg_write(data);
45 ndelay(220);
46 pvc_reg_write(data & ~picvue->e);
47 ndelay(220);
48}
49
50static u8 pvc_read_byte(u32 data)
51{
52 u8 byte;
53
54 data |= picvue->e;
55 pvc_reg_write(data);
56 ndelay(220);
57 byte = (pvc_reg_read() & picvue->data_mask) >> picvue->data_shift;
58 data &= ~picvue->e;
59 pvc_reg_write(data);
60 ndelay(220);
61 return byte;
62}
63
64static u8 pvc_read_data(void)
65{
66 u32 data = pvc_reg_read();
67 u8 byte;
68 data |= picvue->rw;
69 data &= ~picvue->rs;
70 pvc_reg_write(data);
71 ndelay(40);
72 byte = pvc_read_byte(data);
73 data |= picvue->rs;
74 pvc_reg_write(data);
75 return byte;
76}
77
78#define TIMEOUT 1000
79static int pvc_wait(void)
80{
81 int i = TIMEOUT;
82 int err = 0;
83
84 while ((pvc_read_data() & PVC_BUSY) && i)
85 i--;
86 if (i == 0)
87 err = -ETIME;
88
89 return err;
90}
91
92#define MODE_INST 0
93#define MODE_DATA 1
94static void pvc_write(u8 byte, int mode)
95{
96 u32 data = pvc_reg_read();
97 data &= ~picvue->rw;
98 if (mode == MODE_DATA)
99 data |= picvue->rs;
100 else
101 data &= ~picvue->rs;
102 pvc_reg_write(data);
103 ndelay(40);
104 pvc_write_byte(data, byte);
105 if (mode == MODE_DATA)
106 data &= ~picvue->rs;
107 else
108 data |= picvue->rs;
109 pvc_reg_write(data);
110 pvc_wait();
111}
112
113void pvc_write_string(const unsigned char *str, u8 addr, int line)
114{
115 int i = 0;
116
117 if (line > 0 && (PVC_NLINES > 1))
118 addr += 0x40 * line;
119 pvc_write(0x80 | addr, MODE_INST);
120
121 while (*str != 0 && i < PVC_LINELEN) {
122 pvc_write(*str++, MODE_DATA);
123 i++;
124 }
125}
126
127void pvc_write_string_centered(const unsigned char *str, int line)
128{
129 int len = strlen(str);
130 u8 addr;
131
132 if (len > PVC_VISIBLE_CHARS)
133 addr = 0;
134 else
135 addr = (PVC_VISIBLE_CHARS - strlen(str))/2;
136
137 pvc_write_string(str, addr, line);
138}
139
140void pvc_dump_string(const unsigned char *str)
141{
142 int len = strlen(str);
143
144 pvc_write_string(str, 0, 0);
145 if (len > PVC_VISIBLE_CHARS)
146 pvc_write_string(&str[PVC_VISIBLE_CHARS], 0, 1);
147}
148
149#define BM_SIZE 8
150#define MAX_PROGRAMMABLE_CHARS 8
151int pvc_program_cg(int charnum, u8 bitmap[BM_SIZE])
152{
153 int i;
154 int addr;
155
156 if (charnum > MAX_PROGRAMMABLE_CHARS)
157 return -ENOENT;
158
159 addr = charnum * 8;
160 pvc_write(0x40 | addr, MODE_INST);
161
162 for (i=0; i<BM_SIZE; i++)
163 pvc_write(bitmap[i], MODE_DATA);
164 return 0;
165}
166
167#define FUNC_SET_CMD 0x20
168#define EIGHT_BYTE (1 << 4)
169#define FOUR_BYTE 0
170#define TWO_LINES (1 << 3)
171#define ONE_LINE 0
172#define LARGE_FONT (1 << 2)
173#define SMALL_FONT 0
174static void pvc_funcset(u8 cmd)
175{
176 pvc_write(FUNC_SET_CMD | (cmd & (EIGHT_BYTE|TWO_LINES|LARGE_FONT)), MODE_INST);
177}
178
179#define ENTRYMODE_CMD 0x4
180#define AUTO_INC (1 << 1)
181#define AUTO_DEC 0
182#define CURSOR_FOLLOWS_DISP (1 << 0)
183static void pvc_entrymode(u8 cmd)
184{
185 pvc_write(ENTRYMODE_CMD | (cmd & (AUTO_INC|CURSOR_FOLLOWS_DISP)), MODE_INST);
186}
187
188#define DISP_CNT_CMD 0x08
189#define DISP_OFF 0
190#define DISP_ON (1 << 2)
191#define CUR_ON (1 << 1)
192#define CUR_BLINK (1 << 0)
193void pvc_dispcnt(u8 cmd)
194{
195 pvc_write(DISP_CNT_CMD | (cmd & (DISP_ON|CUR_ON|CUR_BLINK)), MODE_INST);
196}
197
198#define MOVE_CMD 0x10
199#define DISPLAY (1 << 3)
200#define CURSOR 0
201#define RIGHT (1 << 2)
202#define LEFT 0
203void pvc_move(u8 cmd)
204{
205 pvc_write(MOVE_CMD | (cmd & (DISPLAY|RIGHT)), MODE_INST);
206}
207
208#define CLEAR_CMD 0x1
209void pvc_clear(void)
210{
211 pvc_write(CLEAR_CMD, MODE_INST);
212}
213
214#define HOME_CMD 0x2
215void pvc_home(void)
216{
217 pvc_write(HOME_CMD, MODE_INST);
218}
219
220int pvc_init(void)
221{
222 u8 cmd = EIGHT_BYTE;
223
224 if (PVC_NLINES == 2)
225 cmd |= (SMALL_FONT|TWO_LINES);
226 else
227 cmd |= (LARGE_FONT|ONE_LINE);
228 pvc_funcset(cmd);
229 pvc_dispcnt(DISP_ON);
230 pvc_entrymode(AUTO_INC);
231
232 pvc_clear();
233 pvc_write_string_centered("Display", 0);
234 pvc_write_string_centered("Initialized", 1);
235
236 return 0;
237}
238
239module_init(pvc_init);
240MODULE_LICENSE("GPL");
diff --git a/arch/mips/lasat/picvue.h b/arch/mips/lasat/picvue.h
new file mode 100644
index 000000000000..74a39039135d
--- /dev/null
+++ b/arch/mips/lasat/picvue.h
@@ -0,0 +1,48 @@
1/*
2 * Picvue PVC160206 display driver
3 *
4 * Brian Murphy <brian.murphy@eicon.com>
5 *
6 */
7#include <asm/semaphore.h>
8
9struct pvc_defs {
10 volatile u32 *reg;
11 u32 data_shift;
12 u32 data_mask;
13 u32 e;
14 u32 rw;
15 u32 rs;
16};
17
18extern struct pvc_defs *picvue;
19
20#define PVC_NLINES 2
21#define PVC_DISPMEM 80
22#define PVC_LINELEN PVC_DISPMEM / PVC_NLINES
23#define PVC_VISIBLE_CHARS 16
24
25void pvc_write_string(const unsigned char *str, u8 addr, int line);
26void pvc_write_string_centered(const unsigned char *str, int line);
27void pvc_dump_string(const unsigned char *str);
28
29#define BM_SIZE 8
30#define MAX_PROGRAMMABLE_CHARS 8
31int pvc_program_cg(int charnum, u8 bitmap[BM_SIZE]);
32
33void pvc_dispcnt(u8 cmd);
34#define DISP_OFF 0
35#define DISP_ON (1 << 2)
36#define CUR_ON (1 << 1)
37#define CUR_BLINK (1 << 0)
38
39void pvc_move(u8 cmd);
40#define DISPLAY (1 << 3)
41#define CURSOR 0
42#define RIGHT (1 << 2)
43#define LEFT 0
44
45void pvc_clear(void);
46void pvc_home(void);
47
48extern struct semaphore pvc_sem;
diff --git a/arch/mips/lasat/picvue_proc.c b/arch/mips/lasat/picvue_proc.c
new file mode 100644
index 000000000000..eaa2b4625124
--- /dev/null
+++ b/arch/mips/lasat/picvue_proc.c
@@ -0,0 +1,186 @@
1/*
2 * Picvue PVC160206 display driver
3 *
4 * Brian Murphy <brian.murphy@eicon.com>
5 *
6 */
7#include <linux/kernel.h>
8#include <linux/module.h>
9#include <linux/init.h>
10#include <linux/errno.h>
11
12#include <linux/proc_fs.h>
13#include <linux/interrupt.h>
14
15#include <linux/timer.h>
16
17#include "picvue.h"
18
19static char pvc_lines[PVC_NLINES][PVC_LINELEN+1];
20static int pvc_linedata[PVC_NLINES];
21static struct proc_dir_entry *pvc_display_dir;
22static char *pvc_linename[PVC_NLINES] = {"line1", "line2"};
23#define DISPLAY_DIR_NAME "display"
24static int scroll_dir = 0, scroll_interval = 0;
25
26static struct timer_list timer;
27
28static void pvc_display(unsigned long data) {
29 int i;
30
31 pvc_clear();
32 for (i=0; i<PVC_NLINES; i++)
33 pvc_write_string(pvc_lines[i], 0, i);
34}
35
36static DECLARE_TASKLET(pvc_display_tasklet, &pvc_display, 0);
37
38static int pvc_proc_read_line(char *page, char **start,
39 off_t off, int count,
40 int *eof, void *data)
41{
42 char *origpage = page;
43 int lineno = *(int *)data;
44
45 if (lineno < 0 || lineno > PVC_NLINES) {
46 printk("proc_read_line: invalid lineno %d\n", lineno);
47 return 0;
48 }
49
50 down(&pvc_sem);
51 page += sprintf(page, "%s\n", pvc_lines[lineno]);
52 up(&pvc_sem);
53
54 return page - origpage;
55}
56
57static int pvc_proc_write_line(struct file *file, const char *buffer,
58 unsigned long count, void *data)
59{
60 int origcount = count;
61 int lineno = *(int *)data;
62
63 if (lineno < 0 || lineno > PVC_NLINES) {
64 printk("proc_write_line: invalid lineno %d\n", lineno);
65 return origcount;
66 }
67
68 if (count > PVC_LINELEN)
69 count = PVC_LINELEN;
70
71 if (buffer[count-1] == '\n')
72 count--;
73
74 down(&pvc_sem);
75 strncpy(pvc_lines[lineno], buffer, count);
76 pvc_lines[lineno][count] = '\0';
77 up(&pvc_sem);
78
79 tasklet_schedule(&pvc_display_tasklet);
80
81 return origcount;
82}
83
84static int pvc_proc_write_scroll(struct file *file, const char *buffer,
85 unsigned long count, void *data)
86{
87 int origcount = count;
88 int cmd = simple_strtol(buffer, NULL, 10);
89
90 down(&pvc_sem);
91 if (scroll_interval != 0)
92 del_timer(&timer);
93
94 if (cmd == 0) {
95 scroll_dir = 0;
96 scroll_interval = 0;
97 } else {
98 if (cmd < 0) {
99 scroll_dir = -1;
100 scroll_interval = -cmd;
101 } else {
102 scroll_dir = 1;
103 scroll_interval = cmd;
104 }
105 add_timer(&timer);
106 }
107 up(&pvc_sem);
108
109 return origcount;
110}
111
112static int pvc_proc_read_scroll(char *page, char **start,
113 off_t off, int count,
114 int *eof, void *data)
115{
116 char *origpage = page;
117
118 down(&pvc_sem);
119 page += sprintf(page, "%d\n", scroll_dir * scroll_interval);
120 up(&pvc_sem);
121
122 return page - origpage;
123}
124
125
126void pvc_proc_timerfunc(unsigned long data)
127{
128 if (scroll_dir < 0)
129 pvc_move(DISPLAY|RIGHT);
130 else if (scroll_dir > 0)
131 pvc_move(DISPLAY|LEFT);
132
133 timer.expires = jiffies + scroll_interval;
134 add_timer(&timer);
135}
136
137static void pvc_proc_cleanup(void)
138{
139 int i;
140 for (i=0; i<PVC_NLINES; i++)
141 remove_proc_entry(pvc_linename[i], pvc_display_dir);
142 remove_proc_entry("scroll", pvc_display_dir);
143 remove_proc_entry(DISPLAY_DIR_NAME, NULL);
144
145 del_timer(&timer);
146}
147
148static int __init pvc_proc_init(void)
149{
150 struct proc_dir_entry *proc_entry;
151 int i;
152
153 pvc_display_dir = proc_mkdir(DISPLAY_DIR_NAME, NULL);
154 if (pvc_display_dir == NULL)
155 goto error;
156
157 for (i=0; i<PVC_NLINES; i++) {
158 strcpy(pvc_lines[i], "");
159 pvc_linedata[i] = i;
160 }
161 for (i=0; i<PVC_NLINES; i++) {
162 proc_entry = create_proc_entry(pvc_linename[i], 0644, pvc_display_dir);
163 if (proc_entry == NULL)
164 goto error;
165 proc_entry->read_proc = pvc_proc_read_line;
166 proc_entry->write_proc = pvc_proc_write_line;
167 proc_entry->data = &pvc_linedata[i];
168 }
169 proc_entry = create_proc_entry("scroll", 0644, pvc_display_dir);
170 if (proc_entry == NULL)
171 goto error;
172 proc_entry->write_proc = pvc_proc_write_scroll;
173 proc_entry->read_proc = pvc_proc_read_scroll;
174
175 init_timer(&timer);
176 timer.function = pvc_proc_timerfunc;
177
178 return 0;
179error:
180 pvc_proc_cleanup();
181 return -ENOMEM;
182}
183
184module_init(pvc_proc_init);
185module_exit(pvc_proc_cleanup);
186MODULE_LICENSE("GPL");
diff --git a/arch/mips/lasat/prom.c b/arch/mips/lasat/prom.c
new file mode 100644
index 000000000000..ca62881c9e52
--- /dev/null
+++ b/arch/mips/lasat/prom.c
@@ -0,0 +1,143 @@
1/*
2 * PROM interface routines.
3 */
4#include <linux/types.h>
5#include <linux/init.h>
6#include <linux/string.h>
7#include <linux/ctype.h>
8#include <linux/kernel.h>
9#include <linux/mm.h>
10#include <linux/bootmem.h>
11#include <linux/ioport.h>
12#include <asm/bootinfo.h>
13#include <asm/lasat/lasat.h>
14#include <asm/cpu.h>
15
16#include "at93c.h"
17#include <asm/lasat/eeprom.h>
18#include "prom.h"
19
20#define RESET_VECTOR 0xbfc00000
21#define PROM_JUMP_TABLE_ENTRY(n) (*((u32 *)(RESET_VECTOR + 0x20) + n))
22#define PROM_DISPLAY_ADDR PROM_JUMP_TABLE_ENTRY(0)
23#define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1)
24#define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2)
25
26static void null_prom_printf(const char * fmt, ...)
27{
28}
29
30static void null_prom_display(const char *string, int pos, int clear)
31{
32}
33
34static void null_prom_monitor(void)
35{
36}
37
38static void null_prom_putc(char c)
39{
40}
41
42/* these are functions provided by the bootloader */
43static void (* prom_putc)(char c) = null_prom_putc;
44void (* prom_printf)(const char * fmt, ...) = null_prom_printf;
45void (* prom_display)(const char *string, int pos, int clear) =
46 null_prom_display;
47void (* prom_monitor)(void) = null_prom_monitor;
48
49unsigned int lasat_ndelay_divider;
50
51#define PROM_PRINTFBUF_SIZE 256
52static char prom_printfbuf[PROM_PRINTFBUF_SIZE];
53
54static void real_prom_printf(const char * fmt, ...)
55{
56 va_list ap;
57 int len;
58 char *c = prom_printfbuf;
59 int i;
60
61 va_start(ap, fmt);
62 len = vsnprintf(prom_printfbuf, PROM_PRINTFBUF_SIZE, fmt, ap);
63 va_end(ap);
64
65 /* output overflowed the buffer */
66 if (len < 0 || len > PROM_PRINTFBUF_SIZE)
67 len = PROM_PRINTFBUF_SIZE;
68
69 for (i=0; i < len; i++) {
70 if (*c == '\n')
71 prom_putc('\r');
72 prom_putc(*c++);
73 }
74}
75
76static void setup_prom_vectors(void)
77{
78 u32 version = *(u32 *)(RESET_VECTOR + 0x90);
79
80 if (version >= 307) {
81 prom_display = (void *)PROM_DISPLAY_ADDR;
82 prom_putc = (void *)PROM_PUTC_ADDR;
83 prom_printf = real_prom_printf;
84 prom_monitor = (void *)PROM_MONITOR_ADDR;
85 }
86 prom_printf("prom vectors set up\n");
87}
88
89static struct at93c_defs at93c_defs[N_MACHTYPES] = {
90 {(void *)AT93C_REG_100, (void *)AT93C_RDATA_REG_100, AT93C_RDATA_SHIFT_100,
91 AT93C_WDATA_SHIFT_100, AT93C_CS_M_100, AT93C_CLK_M_100},
92 {(void *)AT93C_REG_200, (void *)AT93C_RDATA_REG_200, AT93C_RDATA_SHIFT_200,
93 AT93C_WDATA_SHIFT_200, AT93C_CS_M_200, AT93C_CLK_M_200},
94};
95
96void __init prom_init(void)
97{
98 int argc = fw_arg0;
99 char **argv = (char **) fw_arg1;
100
101 setup_prom_vectors();
102
103 if (current_cpu_data.cputype == CPU_R5000) {
104 prom_printf("LASAT 200 board\n");
105 mips_machtype = MACH_LASAT_200;
106 lasat_ndelay_divider = LASAT_200_DIVIDER;
107 } else {
108 prom_printf("LASAT 100 board\n");
109 mips_machtype = MACH_LASAT_100;
110 lasat_ndelay_divider = LASAT_100_DIVIDER;
111 }
112
113 at93c = &at93c_defs[mips_machtype];
114
115 lasat_init_board_info(); /* Read info from EEPROM */
116
117 mips_machgroup = MACH_GROUP_LASAT;
118
119 /* Get the command line */
120 if (argc > 0) {
121 strncpy(arcs_cmdline, argv[0], CL_SIZE-1);
122 arcs_cmdline[CL_SIZE-1] = '\0';
123 }
124
125 /* Set the I/O base address */
126 set_io_port_base(KSEG1);
127
128 /* Set memory regions */
129 ioport_resource.start = 0;
130 ioport_resource.end = 0xffffffff; /* Wrong, fixme. */
131
132 add_memory_region(0, lasat_board_info.li_memsize, BOOT_MEM_RAM);
133}
134
135unsigned long __init prom_free_prom_memory(void)
136{
137 return 0;
138}
139
140const char *get_system_type(void)
141{
142 return lasat_board_info.li_bmstr;
143}
diff --git a/arch/mips/lasat/prom.h b/arch/mips/lasat/prom.h
new file mode 100644
index 000000000000..07be7bf1e4a3
--- /dev/null
+++ b/arch/mips/lasat/prom.h
@@ -0,0 +1,6 @@
1#ifndef PROM_H
2#define PROM_H
3extern void (* prom_display)(const char *string, int pos, int clear);
4extern void (* prom_monitor)(void);
5extern void (* prom_printf)(const char * fmt, ...);
6#endif
diff --git a/arch/mips/lasat/reset.c b/arch/mips/lasat/reset.c
new file mode 100644
index 000000000000..37e4912ee1c8
--- /dev/null
+++ b/arch/mips/lasat/reset.c
@@ -0,0 +1,67 @@
1/*
2 * Thomas Horsten <thh@lasat.com>
3 * Copyright (C) 2000 LASAT Networks A/S.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Reset the LASAT board.
19 */
20#include <linux/config.h>
21#include <linux/kernel.h>
22#include <asm/reboot.h>
23#include <asm/system.h>
24#include <asm/lasat/lasat.h>
25#include "picvue.h"
26#include "prom.h"
27
28static void lasat_machine_restart(char *command);
29static void lasat_machine_halt(void);
30
31/* Used to set machine to boot in service mode via /proc interface */
32int lasat_boot_to_service = 0;
33
34static void lasat_machine_restart(char *command)
35{
36 local_irq_disable();
37
38 if (lasat_boot_to_service) {
39 printk("machine_restart: Rebooting to service mode\n");
40 *(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
41 *(volatile unsigned int *)0xa00000fc = 0xfedeabba;
42 }
43 *lasat_misc->reset_reg = 0xbedead;
44 for (;;) ;
45}
46
47#define MESSAGE "System halted"
48static void lasat_machine_halt(void)
49{
50 local_irq_disable();
51
52 /* Disable interrupts and loop forever */
53 printk(KERN_NOTICE MESSAGE "\n");
54#ifdef CONFIG_PICVUE
55 pvc_clear();
56 pvc_write_string(MESSAGE, 0, 0);
57#endif
58 prom_monitor();
59 for (;;) ;
60}
61
62void lasat_reboot_setup(void)
63{
64 _machine_restart = lasat_machine_restart;
65 _machine_halt = lasat_machine_halt;
66 _machine_power_off = lasat_machine_halt;
67}
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
new file mode 100644
index 000000000000..e371ed5cbe34
--- /dev/null
+++ b/arch/mips/lasat/setup.c
@@ -0,0 +1,192 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved.
4 *
5 * Thomas Horsten <thh@lasat.com>
6 * Copyright (C) 2000 LASAT Networks A/S.
7 *
8 * Brian Murphy <brian@murphy.dk>
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Lasat specific setup.
24 */
25#include <linux/config.h>
26#include <linux/init.h>
27#include <linux/sched.h>
28#include <linux/pci.h>
29#include <linux/interrupt.h>
30#include <linux/tty.h>
31#include <linux/serial.h>
32#include <linux/serial_core.h>
33
34#include <asm/time.h>
35#include <asm/cpu.h>
36#include <asm/bootinfo.h>
37#include <asm/irq.h>
38#include <asm/serial.h>
39#include <asm/lasat/lasat.h>
40#include <asm/lasat/serial.h>
41
42#ifdef CONFIG_PICVUE
43#include <linux/notifier.h>
44#endif
45
46#include "ds1603.h"
47#include <asm/lasat/ds1603.h>
48#include <asm/lasat/picvue.h>
49#include <asm/lasat/eeprom.h>
50
51#include "prom.h"
52
53int lasat_command_line = 0;
54void lasatint_init(void);
55
56extern void lasat_reboot_setup(void);
57extern void pcisetup(void);
58extern void edhac_init(void *, void *, void *);
59extern void addrflt_init(void);
60
61struct lasat_misc lasat_misc_info[N_MACHTYPES] = {
62 {(void *)KSEG1ADDR(0x1c840000), (void *)KSEG1ADDR(0x1c800000), 2},
63 {(void *)KSEG1ADDR(0x11080000), (void *)KSEG1ADDR(0x11000000), 6}
64};
65
66struct lasat_misc *lasat_misc = NULL;
67
68#ifdef CONFIG_DS1603
69static struct ds_defs ds_defs[N_MACHTYPES] = {
70 { (void *)DS1603_REG_100, (void *)DS1603_REG_100,
71 DS1603_RST_100, DS1603_CLK_100, DS1603_DATA_100,
72 DS1603_DATA_SHIFT_100, 0, 0 },
73 { (void *)DS1603_REG_200, (void *)DS1603_DATA_REG_200,
74 DS1603_RST_200, DS1603_CLK_200, DS1603_DATA_200,
75 DS1603_DATA_READ_SHIFT_200, 1, 2000 }
76};
77#endif
78
79#ifdef CONFIG_PICVUE
80#include "picvue.h"
81static struct pvc_defs pvc_defs[N_MACHTYPES] = {
82 { (void *)PVC_REG_100, PVC_DATA_SHIFT_100, PVC_DATA_M_100,
83 PVC_E_100, PVC_RW_100, PVC_RS_100 },
84 { (void *)PVC_REG_200, PVC_DATA_SHIFT_200, PVC_DATA_M_200,
85 PVC_E_200, PVC_RW_200, PVC_RS_200 }
86};
87#endif
88
89static int lasat_panic_display(struct notifier_block *this,
90 unsigned long event, void *ptr)
91{
92#ifdef CONFIG_PICVUE
93 unsigned char *string = ptr;
94 if (string == NULL)
95 string = "Kernel Panic";
96 pvc_dump_string(string);
97#endif
98 return NOTIFY_DONE;
99}
100
101static int lasat_panic_prom_monitor(struct notifier_block *this,
102 unsigned long event, void *ptr)
103{
104 prom_monitor();
105 return NOTIFY_DONE;
106}
107
108static struct notifier_block lasat_panic_block[] =
109{
110 { lasat_panic_display, NULL, INT_MAX },
111 { lasat_panic_prom_monitor, NULL, INT_MIN }
112};
113
114static void lasat_time_init(void)
115{
116 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2;
117}
118
119static void lasat_timer_setup(struct irqaction *irq)
120{
121
122 write_c0_compare(
123 read_c0_count() +
124 mips_hpt_frequency / HZ);
125 change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5);
126}
127
128#define DYNAMIC_SERIAL_INIT
129#ifdef DYNAMIC_SERIAL_INIT
130void __init serial_init(void)
131{
132#ifdef CONFIG_SERIAL_8250
133 struct uart_port s;
134
135 memset(&s, 0, sizeof(s));
136
137 s.flags = STD_COM_FLAGS;
138 s.iotype = SERIAL_IO_MEM;
139
140 if (mips_machtype == MACH_LASAT_100) {
141 s.uartclk = LASAT_BASE_BAUD_100 * 16;
142 s.irq = LASATINT_UART_100;
143 s.regshift = LASAT_UART_REGS_SHIFT_100;
144 s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_100);
145 } else {
146 s.uartclk = LASAT_BASE_BAUD_200 * 16;
147 s.irq = LASATINT_UART_200;
148 s.regshift = LASAT_UART_REGS_SHIFT_200;
149 s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_200);
150 }
151
152 if (early_serial_setup(&s) != 0)
153 printk(KERN_ERR "Serial setup failed!\n");
154#endif
155}
156#endif
157
158static int __init lasat_setup(void)
159{
160 int i;
161 lasat_misc = &lasat_misc_info[mips_machtype];
162#ifdef CONFIG_PICVUE
163 picvue = &pvc_defs[mips_machtype];
164#endif
165
166 /* Set up panic notifier */
167 for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++)
168 notifier_chain_register(&panic_notifier_list, &lasat_panic_block[i]);
169
170 lasat_reboot_setup();
171
172 board_time_init = lasat_time_init;
173 board_timer_setup = lasat_timer_setup;
174
175#ifdef CONFIG_DS1603
176 ds1603 = &ds_defs[mips_machtype];
177 rtc_get_time = ds1603_read;
178 rtc_set_time = ds1603_set;
179#endif
180
181#ifdef DYNAMIC_SERIAL_INIT
182 serial_init();
183#endif
184 /* Switch from prom exception handler to normal mode */
185 change_c0_status(ST0_BEV,0);
186
187 prom_printf("Lasat specific initialization complete\n");
188
189 return 0;
190}
191
192early_initcall(lasat_setup);
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c
new file mode 100644
index 000000000000..1c0cc620a43f
--- /dev/null
+++ b/arch/mips/lasat/sysctl.c
@@ -0,0 +1,355 @@
1/*
2 * Thomas Horsten <thh@lasat.com>
3 * Copyright (C) 2000 LASAT Networks A/S.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Routines specific to the LASAT boards
19 */
20#include <linux/types.h>
21#include <asm/lasat/lasat.h>
22
23#include <linux/config.h>
24#include <linux/module.h>
25#include <linux/sysctl.h>
26#include <linux/stddef.h>
27#include <linux/init.h>
28#include <linux/fs.h>
29#include <linux/ctype.h>
30#include <linux/string.h>
31#include <linux/net.h>
32#include <linux/inet.h>
33#include <asm/uaccess.h>
34
35#include "sysctl.h"
36#include "ds1603.h"
37
38static DECLARE_MUTEX(lasat_info_sem);
39
40/* Strategy function to write EEPROM after changing string entry */
41int sysctl_lasatstring(ctl_table *table, int *name, int nlen,
42 void *oldval, size_t *oldlenp,
43 void *newval, size_t newlen, void **context)
44{
45 int r;
46 down(&lasat_info_sem);
47 r = sysctl_string(table, name,
48 nlen, oldval, oldlenp, newval, newlen, context);
49 if (r < 0) {
50 up(&lasat_info_sem);
51 return r;
52 }
53 if (newval && newlen) {
54 lasat_write_eeprom_info();
55 }
56 up(&lasat_info_sem);
57 return 1;
58}
59
60
61/* And the same for proc */
62int proc_dolasatstring(ctl_table *table, int write, struct file *filp,
63 void *buffer, size_t *lenp, loff_t *ppos)
64{
65 int r;
66 down(&lasat_info_sem);
67 r = proc_dostring(table, write, filp, buffer, lenp, ppos);
68 if ( (!write) || r) {
69 up(&lasat_info_sem);
70 return r;
71 }
72 lasat_write_eeprom_info();
73 up(&lasat_info_sem);
74 return 0;
75}
76
77/* proc function to write EEPROM after changing int entry */
78int proc_dolasatint(ctl_table *table, int write, struct file *filp,
79 void *buffer, size_t *lenp, loff_t *ppos)
80{
81 int r;
82 down(&lasat_info_sem);
83 r = proc_dointvec(table, write, filp, buffer, lenp, ppos);
84 if ( (!write) || r) {
85 up(&lasat_info_sem);
86 return r;
87 }
88 lasat_write_eeprom_info();
89 up(&lasat_info_sem);
90 return 0;
91}
92
93static int rtctmp;
94
95#ifdef CONFIG_DS1603
96/* proc function to read/write RealTime Clock */
97int proc_dolasatrtc(ctl_table *table, int write, struct file *filp,
98 void *buffer, size_t *lenp, loff_t *ppos)
99{
100 int r;
101 down(&lasat_info_sem);
102 if (!write) {
103 rtctmp = ds1603_read();
104 /* check for time < 0 and set to 0 */
105 if (rtctmp < 0)
106 rtctmp = 0;
107 }
108 r = proc_dointvec(table, write, filp, buffer, lenp, ppos);
109 if ( (!write) || r) {
110 up(&lasat_info_sem);
111 return r;
112 }
113 ds1603_set(rtctmp);
114 up(&lasat_info_sem);
115 return 0;
116}
117#endif
118
119/* Sysctl for setting the IP addresses */
120int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen,
121 void *oldval, size_t *oldlenp,
122 void *newval, size_t newlen, void **context)
123{
124 int r;
125 down(&lasat_info_sem);
126 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context);
127 if (r < 0) {
128 up(&lasat_info_sem);
129 return r;
130 }
131 if (newval && newlen) {
132 lasat_write_eeprom_info();
133 }
134 up(&lasat_info_sem);
135 return 1;
136}
137
138#ifdef CONFIG_DS1603
139/* Same for RTC */
140int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen,
141 void *oldval, size_t *oldlenp,
142 void *newval, size_t newlen, void **context)
143{
144 int r;
145 down(&lasat_info_sem);
146 rtctmp = ds1603_read();
147 if (rtctmp < 0)
148 rtctmp = 0;
149 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context);
150 if (r < 0) {
151 up(&lasat_info_sem);
152 return r;
153 }
154 if (newval && newlen) {
155 ds1603_set(rtctmp);
156 }
157 up(&lasat_info_sem);
158 return 1;
159}
160#endif
161
162#ifdef CONFIG_INET
163static char lasat_bcastaddr[16];
164
165void update_bcastaddr(void)
166{
167 unsigned int ip;
168
169 ip = (lasat_board_info.li_eeprom_info.ipaddr &
170 lasat_board_info.li_eeprom_info.netmask) |
171 ~lasat_board_info.li_eeprom_info.netmask;
172
173 sprintf(lasat_bcastaddr, "%d.%d.%d.%d",
174 (ip ) & 0xff,
175 (ip >> 8) & 0xff,
176 (ip >> 16) & 0xff,
177 (ip >> 24) & 0xff);
178}
179
180static char proc_lasat_ipbuf[32];
181/* Parsing of IP address */
182int proc_lasat_ip(ctl_table *table, int write, struct file *filp,
183 void *buffer, size_t *lenp, loff_t *ppos)
184{
185 int len;
186 unsigned int ip;
187 char *p, c;
188
189 if (!table->data || !table->maxlen || !*lenp ||
190 (*ppos && !write)) {
191 *lenp = 0;
192 return 0;
193 }
194
195 down(&lasat_info_sem);
196 if (write) {
197 len = 0;
198 p = buffer;
199 while (len < *lenp) {
200 if(get_user(c, p++)) {
201 up(&lasat_info_sem);
202 return -EFAULT;
203 }
204 if (c == 0 || c == '\n')
205 break;
206 len++;
207 }
208 if (len >= sizeof(proc_lasat_ipbuf)-1)
209 len = sizeof(proc_lasat_ipbuf) - 1;
210 if (copy_from_user(proc_lasat_ipbuf, buffer, len))
211 {
212 up(&lasat_info_sem);
213 return -EFAULT;
214 }
215 proc_lasat_ipbuf[len] = 0;
216 *ppos += *lenp;
217 /* Now see if we can convert it to a valid IP */
218 ip = in_aton(proc_lasat_ipbuf);
219 *(unsigned int *)(table->data) = ip;
220 lasat_write_eeprom_info();
221 } else {
222 ip = *(unsigned int *)(table->data);
223 sprintf(proc_lasat_ipbuf, "%d.%d.%d.%d",
224 (ip ) & 0xff,
225 (ip >> 8) & 0xff,
226 (ip >> 16) & 0xff,
227 (ip >> 24) & 0xff);
228 len = strlen(proc_lasat_ipbuf);
229 if (len > *lenp)
230 len = *lenp;
231 if (len)
232 if(copy_to_user(buffer, proc_lasat_ipbuf, len)) {
233 up(&lasat_info_sem);
234 return -EFAULT;
235 }
236 if (len < *lenp) {
237 if(put_user('\n', ((char *) buffer) + len)) {
238 up(&lasat_info_sem);
239 return -EFAULT;
240 }
241 len++;
242 }
243 *lenp = len;
244 *ppos += len;
245 }
246 update_bcastaddr();
247 up(&lasat_info_sem);
248 return 0;
249}
250#endif /* defined(CONFIG_INET) */
251
252static int sysctl_lasat_eeprom_value(ctl_table *table, int *name, int nlen,
253 void *oldval, size_t *oldlenp,
254 void *newval, size_t newlen,
255 void **context)
256{
257 int r;
258
259 down(&lasat_info_sem);
260 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context);
261 if (r < 0) {
262 up(&lasat_info_sem);
263 return r;
264 }
265
266 if (newval && newlen)
267 {
268 if (name && *name == LASAT_PRID)
269 lasat_board_info.li_eeprom_info.prid = *(int*)newval;
270
271 lasat_write_eeprom_info();
272 lasat_init_board_info();
273 }
274 up(&lasat_info_sem);
275
276 return 0;
277}
278
279int proc_lasat_eeprom_value(ctl_table *table, int write, struct file *filp,
280 void *buffer, size_t *lenp, loff_t *ppos)
281{
282 int r;
283 down(&lasat_info_sem);
284 r = proc_dointvec(table, write, filp, buffer, lenp, ppos);
285 if ( (!write) || r) {
286 up(&lasat_info_sem);
287 return r;
288 }
289 if (filp && filp->f_dentry)
290 {
291 if (!strcmp(filp->f_dentry->d_name.name, "prid"))
292 lasat_board_info.li_eeprom_info.prid = lasat_board_info.li_prid;
293 if (!strcmp(filp->f_dentry->d_name.name, "debugaccess"))
294 lasat_board_info.li_eeprom_info.debugaccess = lasat_board_info.li_debugaccess;
295 }
296 lasat_write_eeprom_info();
297 up(&lasat_info_sem);
298 return 0;
299}
300
301extern int lasat_boot_to_service;
302
303#ifdef CONFIG_SYSCTL
304
305static ctl_table lasat_table[] = {
306 {LASAT_CPU_HZ, "cpu-hz", &lasat_board_info.li_cpu_hz, sizeof(int),
307 0444, NULL, &proc_dointvec, &sysctl_intvec},
308 {LASAT_BUS_HZ, "bus-hz", &lasat_board_info.li_bus_hz, sizeof(int),
309 0444, NULL, &proc_dointvec, &sysctl_intvec},
310 {LASAT_MODEL, "bmid", &lasat_board_info.li_bmid, sizeof(int),
311 0444, NULL, &proc_dointvec, &sysctl_intvec},
312 {LASAT_PRID, "prid", &lasat_board_info.li_prid, sizeof(int),
313 0644, NULL, &proc_lasat_eeprom_value, &sysctl_lasat_eeprom_value},
314#ifdef CONFIG_INET
315 {LASAT_IPADDR, "ipaddr", &lasat_board_info.li_eeprom_info.ipaddr, sizeof(int),
316 0644, NULL, &proc_lasat_ip, &sysctl_lasat_intvec},
317 {LASAT_NETMASK, "netmask", &lasat_board_info.li_eeprom_info.netmask, sizeof(int),
318 0644, NULL, &proc_lasat_ip, &sysctl_lasat_intvec},
319 {LASAT_BCAST, "bcastaddr", &lasat_bcastaddr,
320 sizeof(lasat_bcastaddr), 0600, NULL,
321 &proc_dostring, &sysctl_string},
322#endif
323 {LASAT_PASSWORD, "passwd_hash", &lasat_board_info.li_eeprom_info.passwd_hash, sizeof(lasat_board_info.li_eeprom_info.passwd_hash),
324 0600, NULL, &proc_dolasatstring, &sysctl_lasatstring},
325 {LASAT_SBOOT, "boot-service", &lasat_boot_to_service, sizeof(int),
326 0644, NULL, &proc_dointvec, &sysctl_intvec},
327#ifdef CONFIG_DS1603
328 {LASAT_RTC, "rtc", &rtctmp, sizeof(int),
329 0644, NULL, &proc_dolasatrtc, &sysctl_lasat_rtc},
330#endif
331 {LASAT_NAMESTR, "namestr", &lasat_board_info.li_namestr, sizeof(lasat_board_info.li_namestr),
332 0444, NULL, &proc_dostring, &sysctl_string},
333 {LASAT_TYPESTR, "typestr", &lasat_board_info.li_typestr, sizeof(lasat_board_info.li_typestr),
334 0444, NULL, &proc_dostring, &sysctl_string},
335 {0}
336};
337
338#define CTL_LASAT 1 // CTL_ANY ???
339static ctl_table lasat_root_table[] = {
340 { CTL_LASAT, "lasat", NULL, 0, 0555, lasat_table },
341 { 0 }
342};
343
344static int __init lasat_register_sysctl(void)
345{
346 struct ctl_table_header *lasat_table_header;
347
348 lasat_table_header =
349 register_sysctl_table(lasat_root_table, 0);
350
351 return 0;
352}
353
354__initcall(lasat_register_sysctl);
355#endif /* CONFIG_SYSCTL */
diff --git a/arch/mips/lasat/sysctl.h b/arch/mips/lasat/sysctl.h
new file mode 100644
index 000000000000..4d139d2adbdf
--- /dev/null
+++ b/arch/mips/lasat/sysctl.h
@@ -0,0 +1,24 @@
1/*
2 * LASAT sysctl values
3 */
4
5#ifndef _LASAT_SYSCTL_H
6#define _LASAT_SYSCTL_H
7
8/* /proc/sys/lasat */
9enum {
10 LASAT_CPU_HZ=1,
11 LASAT_BUS_HZ,
12 LASAT_MODEL,
13 LASAT_PRID,
14 LASAT_IPADDR,
15 LASAT_NETMASK,
16 LASAT_BCAST,
17 LASAT_PASSWORD,
18 LASAT_SBOOT,
19 LASAT_RTC,
20 LASAT_NAMESTR,
21 LASAT_TYPESTR,
22};
23
24#endif /* _LASAT_SYSCTL_H */
diff --git a/arch/mips/lib-32/Makefile b/arch/mips/lib-32/Makefile
new file mode 100644
index 000000000000..fd6a2bafdfcf
--- /dev/null
+++ b/arch/mips/lib-32/Makefile
@@ -0,0 +1,25 @@
1#
2# Makefile for MIPS-specific library files..
3#
4
5lib-y += csum_partial.o memset.o watch.o
6
7obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o
8obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o
9obj-$(CONFIG_CPU_NEVADA) += dump_tlb.o
10obj-$(CONFIG_CPU_R10000) += dump_tlb.o
11obj-$(CONFIG_CPU_R3000) += r3k_dump_tlb.o
12obj-$(CONFIG_CPU_R4300) += dump_tlb.o
13obj-$(CONFIG_CPU_R4X00) += dump_tlb.o
14obj-$(CONFIG_CPU_R5000) += dump_tlb.o
15obj-$(CONFIG_CPU_R5432) += dump_tlb.o
16obj-$(CONFIG_CPU_R6000) +=
17obj-$(CONFIG_CPU_R8000) +=
18obj-$(CONFIG_CPU_RM7000) += dump_tlb.o
19obj-$(CONFIG_CPU_RM9000) += dump_tlb.o
20obj-$(CONFIG_CPU_SB1) += dump_tlb.o
21obj-$(CONFIG_CPU_TX39XX) += r3k_dump_tlb.o
22obj-$(CONFIG_CPU_TX49XX) += dump_tlb.o
23obj-$(CONFIG_CPU_VR41XX) += dump_tlb.o
24
25EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/lib-32/csum_partial.S b/arch/mips/lib-32/csum_partial.S
new file mode 100644
index 000000000000..ea257dbdcc40
--- /dev/null
+++ b/arch/mips/lib-32/csum_partial.S
@@ -0,0 +1,240 @@
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) 1998 Ralf Baechle
7 */
8#include <asm/asm.h>
9#include <asm/regdef.h>
10
11#define ADDC(sum,reg) \
12 addu sum, reg; \
13 sltu v1, sum, reg; \
14 addu sum, v1
15
16#define CSUM_BIGCHUNK(src, offset, sum, t0, t1, t2, t3) \
17 lw t0, (offset + 0x00)(src); \
18 lw t1, (offset + 0x04)(src); \
19 lw t2, (offset + 0x08)(src); \
20 lw t3, (offset + 0x0c)(src); \
21 ADDC(sum, t0); \
22 ADDC(sum, t1); \
23 ADDC(sum, t2); \
24 ADDC(sum, t3); \
25 lw t0, (offset + 0x10)(src); \
26 lw t1, (offset + 0x14)(src); \
27 lw t2, (offset + 0x18)(src); \
28 lw t3, (offset + 0x1c)(src); \
29 ADDC(sum, t0); \
30 ADDC(sum, t1); \
31 ADDC(sum, t2); \
32 ADDC(sum, t3); \
33
34/*
35 * a0: source address
36 * a1: length of the area to checksum
37 * a2: partial checksum
38 */
39
40#define src a0
41#define dest a1
42#define sum v0
43
44 .text
45 .set noreorder
46
47/* unknown src alignment and < 8 bytes to go */
48small_csumcpy:
49 move a1, t2
50
51 andi t0, a1, 4
52 beqz t0, 1f
53 andi t0, a1, 2
54
55 /* Still a full word to go */
56 ulw t1, (src)
57 addiu src, 4
58 ADDC(sum, t1)
59
601: move t1, zero
61 beqz t0, 1f
62 andi t0, a1, 1
63
64 /* Still a halfword to go */
65 ulhu t1, (src)
66 addiu src, 2
67
681: beqz t0, 1f
69 sll t1, t1, 16
70
71 lbu t2, (src)
72 nop
73
74#ifdef __MIPSEB__
75 sll t2, t2, 8
76#endif
77 or t1, t2
78
791: ADDC(sum, t1)
80
81 /* fold checksum */
82 sll v1, sum, 16
83 addu sum, v1
84 sltu v1, sum, v1
85 srl sum, sum, 16
86 addu sum, v1
87
88 /* odd buffer alignment? */
89 beqz t7, 1f
90 nop
91 sll v1, sum, 8
92 srl sum, sum, 8
93 or sum, v1
94 andi sum, 0xffff
951:
96 .set reorder
97 /* Add the passed partial csum. */
98 ADDC(sum, a2)
99 jr ra
100 .set noreorder
101
102/* ------------------------------------------------------------------------- */
103
104 .align 5
105LEAF(csum_partial)
106 move sum, zero
107 move t7, zero
108
109 sltiu t8, a1, 0x8
110 bnez t8, small_csumcpy /* < 8 bytes to copy */
111 move t2, a1
112
113 beqz a1, out
114 andi t7, src, 0x1 /* odd buffer? */
115
116hword_align:
117 beqz t7, word_align
118 andi t8, src, 0x2
119
120 lbu t0, (src)
121 subu a1, a1, 0x1
122#ifdef __MIPSEL__
123 sll t0, t0, 8
124#endif
125 ADDC(sum, t0)
126 addu src, src, 0x1
127 andi t8, src, 0x2
128
129word_align:
130 beqz t8, dword_align
131 sltiu t8, a1, 56
132
133 lhu t0, (src)
134 subu a1, a1, 0x2
135 ADDC(sum, t0)
136 sltiu t8, a1, 56
137 addu src, src, 0x2
138
139dword_align:
140 bnez t8, do_end_words
141 move t8, a1
142
143 andi t8, src, 0x4
144 beqz t8, qword_align
145 andi t8, src, 0x8
146
147 lw t0, 0x00(src)
148 subu a1, a1, 0x4
149 ADDC(sum, t0)
150 addu src, src, 0x4
151 andi t8, src, 0x8
152
153qword_align:
154 beqz t8, oword_align
155 andi t8, src, 0x10
156
157 lw t0, 0x00(src)
158 lw t1, 0x04(src)
159 subu a1, a1, 0x8
160 ADDC(sum, t0)
161 ADDC(sum, t1)
162 addu src, src, 0x8
163 andi t8, src, 0x10
164
165oword_align:
166 beqz t8, begin_movement
167 srl t8, a1, 0x7
168
169 lw t3, 0x08(src)
170 lw t4, 0x0c(src)
171 lw t0, 0x00(src)
172 lw t1, 0x04(src)
173 ADDC(sum, t3)
174 ADDC(sum, t4)
175 ADDC(sum, t0)
176 ADDC(sum, t1)
177 subu a1, a1, 0x10
178 addu src, src, 0x10
179 srl t8, a1, 0x7
180
181begin_movement:
182 beqz t8, 1f
183 andi t2, a1, 0x40
184
185move_128bytes:
186 CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4)
187 CSUM_BIGCHUNK(src, 0x20, sum, t0, t1, t3, t4)
188 CSUM_BIGCHUNK(src, 0x40, sum, t0, t1, t3, t4)
189 CSUM_BIGCHUNK(src, 0x60, sum, t0, t1, t3, t4)
190 subu t8, t8, 0x01
191 bnez t8, move_128bytes
192 addu src, src, 0x80
193
1941:
195 beqz t2, 1f
196 andi t2, a1, 0x20
197
198move_64bytes:
199 CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4)
200 CSUM_BIGCHUNK(src, 0x20, sum, t0, t1, t3, t4)
201 addu src, src, 0x40
202
2031:
204 beqz t2, do_end_words
205 andi t8, a1, 0x1c
206
207move_32bytes:
208 CSUM_BIGCHUNK(src, 0x00, sum, t0, t1, t3, t4)
209 andi t8, a1, 0x1c
210 addu src, src, 0x20
211
212do_end_words:
213 beqz t8, maybe_end_cruft
214 srl t8, t8, 0x2
215
216end_words:
217 lw t0, (src)
218 subu t8, t8, 0x1
219 ADDC(sum, t0)
220 bnez t8, end_words
221 addu src, src, 0x4
222
223maybe_end_cruft:
224 andi t2, a1, 0x3
225
226small_memcpy:
227 j small_csumcpy; move a1, t2
228 beqz t2, out
229 move a1, t2
230
231end_bytes:
232 lb t0, (src)
233 subu a1, a1, 0x1
234 bnez a2, end_bytes
235 addu src, src, 0x1
236
237out:
238 jr ra
239 move v0, sum
240 END(csum_partial)
diff --git a/arch/mips/lib-32/dump_tlb.c b/arch/mips/lib-32/dump_tlb.c
new file mode 100644
index 000000000000..019ac8f005d7
--- /dev/null
+++ b/arch/mips/lib-32/dump_tlb.c
@@ -0,0 +1,222 @@
1/*
2 * Dump R4x00 TLB for debugging purposes.
3 *
4 * Copyright (C) 1994, 1995 by Waldorf Electronics, written by Ralf Baechle.
5 * Copyright (C) 1999 by Silicon Graphics, Inc.
6 */
7#include <linux/config.h>
8#include <linux/kernel.h>
9#include <linux/mm.h>
10#include <linux/sched.h>
11#include <linux/string.h>
12
13#include <asm/bootinfo.h>
14#include <asm/cachectl.h>
15#include <asm/cpu.h>
16#include <asm/mipsregs.h>
17#include <asm/page.h>
18#include <asm/pgtable.h>
19
20static inline const char *msk2str(unsigned int mask)
21{
22 switch (mask) {
23 case PM_4K: return "4kb";
24 case PM_16K: return "16kb";
25 case PM_64K: return "64kb";
26 case PM_256K: return "256kb";
27#ifndef CONFIG_CPU_VR41XX
28 case PM_1M: return "1Mb";
29 case PM_4M: return "4Mb";
30 case PM_16M: return "16Mb";
31 case PM_64M: return "64Mb";
32 case PM_256M: return "256Mb";
33#endif
34 }
35
36 return "unknown";
37}
38
39#define BARRIER() \
40 __asm__ __volatile__( \
41 ".set\tnoreorder\n\t" \
42 "nop;nop;nop;nop;nop;nop;nop\n\t" \
43 ".set\treorder");
44
45void dump_tlb(int first, int last)
46{
47 unsigned int pagemask, c0, c1, asid;
48 unsigned long long entrylo0, entrylo1;
49 unsigned long entryhi;
50 int i;
51
52 asid = read_c0_entryhi() & 0xff;
53
54 printk("\n");
55 for (i = first; i <= last; i++) {
56 write_c0_index(i);
57 BARRIER();
58 tlb_read();
59 BARRIER();
60 pagemask = read_c0_pagemask();
61 entryhi = read_c0_entryhi();
62 entrylo0 = read_c0_entrylo0();
63 entrylo1 = read_c0_entrylo1();
64
65 /* Unused entries have a virtual address in KSEG0. */
66 if ((entryhi & 0xf0000000) != 0x80000000
67 && (entryhi & 0xff) == asid) {
68 /*
69 * Only print entries in use
70 */
71 printk("Index: %2d pgmask=%s ", i, msk2str(pagemask));
72
73 c0 = (entrylo0 >> 3) & 7;
74 c1 = (entrylo1 >> 3) & 7;
75
76 printk("va=%08lx asid=%02lx\n",
77 (entryhi & 0xffffe000), (entryhi & 0xff));
78 printk("\t\t\t[pa=%08Lx c=%d d=%d v=%d g=%Ld]\n",
79 (entrylo0 << 6) & PAGE_MASK, c0,
80 (entrylo0 & 4) ? 1 : 0,
81 (entrylo0 & 2) ? 1 : 0,
82 (entrylo0 & 1));
83 printk("\t\t\t[pa=%08Lx c=%d d=%d v=%d g=%Ld]\n",
84 (entrylo1 << 6) & PAGE_MASK, c1,
85 (entrylo1 & 4) ? 1 : 0,
86 (entrylo1 & 2) ? 1 : 0,
87 (entrylo1 & 1));
88 printk("\n");
89 }
90 }
91
92 write_c0_entryhi(asid);
93}
94
95void dump_tlb_all(void)
96{
97 dump_tlb(0, current_cpu_data.tlbsize - 1);
98}
99
100void dump_tlb_wired(void)
101{
102 int wired;
103
104 wired = read_c0_wired();
105 printk("Wired: %d", wired);
106 dump_tlb(0, read_c0_wired());
107}
108
109void dump_tlb_addr(unsigned long addr)
110{
111 unsigned int flags, oldpid;
112 int index;
113
114 local_irq_save(flags);
115 oldpid = read_c0_entryhi() & 0xff;
116 BARRIER();
117 write_c0_entryhi((addr & PAGE_MASK) | oldpid);
118 BARRIER();
119 tlb_probe();
120 BARRIER();
121 index = read_c0_index();
122 write_c0_entryhi(oldpid);
123 local_irq_restore(flags);
124
125 if (index < 0) {
126 printk("No entry for address 0x%08lx in TLB\n", addr);
127 return;
128 }
129
130 printk("Entry %d maps address 0x%08lx\n", index, addr);
131 dump_tlb(index, index);
132}
133
134void dump_tlb_nonwired(void)
135{
136 dump_tlb(read_c0_wired(), current_cpu_data.tlbsize - 1);
137}
138
139void dump_list_process(struct task_struct *t, void *address)
140{
141 pgd_t *page_dir, *pgd;
142 pmd_t *pmd;
143 pte_t *pte, page;
144 unsigned long addr, val;
145
146 addr = (unsigned long) address;
147
148 printk("Addr == %08lx\n", addr);
149 printk("task == %8p\n", t);
150 printk("task->mm == %8p\n", t->mm);
151 //printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd);
152
153 if (addr > KSEG0)
154 page_dir = pgd_offset_k(0);
155 else
156 page_dir = pgd_offset(t->mm, 0);
157 printk("page_dir == %08x\n", (unsigned int) page_dir);
158
159 if (addr > KSEG0)
160 pgd = pgd_offset_k(addr);
161 else
162 pgd = pgd_offset(t->mm, addr);
163 printk("pgd == %08x, ", (unsigned int) pgd);
164
165 pmd = pmd_offset(pgd, addr);
166 printk("pmd == %08x, ", (unsigned int) pmd);
167
168 pte = pte_offset(pmd, addr);
169 printk("pte == %08x, ", (unsigned int) pte);
170
171 page = *pte;
172#ifdef CONFIG_64BIT_PHYS_ADDR
173 printk("page == %08Lx\n", pte_val(page));
174#else
175 printk("page == %08lx\n", pte_val(page));
176#endif
177
178 val = pte_val(page);
179 if (val & _PAGE_PRESENT) printk("present ");
180 if (val & _PAGE_READ) printk("read ");
181 if (val & _PAGE_WRITE) printk("write ");
182 if (val & _PAGE_ACCESSED) printk("accessed ");
183 if (val & _PAGE_MODIFIED) printk("modified ");
184 if (val & _PAGE_R4KBUG) printk("r4kbug ");
185 if (val & _PAGE_GLOBAL) printk("global ");
186 if (val & _PAGE_VALID) printk("valid ");
187 printk("\n");
188}
189
190void dump_list_current(void *address)
191{
192 dump_list_process(current, address);
193}
194
195unsigned int vtop(void *address)
196{
197 pgd_t *pgd;
198 pmd_t *pmd;
199 pte_t *pte;
200 unsigned int addr, paddr;
201
202 addr = (unsigned long) address;
203 pgd = pgd_offset(current->mm, addr);
204 pmd = pmd_offset(pgd, addr);
205 pte = pte_offset(pmd, addr);
206 paddr = (KSEG1 | (unsigned int) pte_val(*pte)) & PAGE_MASK;
207 paddr |= (addr & ~PAGE_MASK);
208
209 return paddr;
210}
211
212void dump16(unsigned long *p)
213{
214 int i;
215
216 for (i = 0; i < 8; i++) {
217 printk("*%08lx == %08lx, ", (unsigned long)p, *p);
218 p++;
219 printk("*%08lx == %08lx\n", (unsigned long)p, *p);
220 p++;
221 }
222}
diff --git a/arch/mips/lib-32/memset.S b/arch/mips/lib-32/memset.S
new file mode 100644
index 000000000000..ad9ff4071ce9
--- /dev/null
+++ b/arch/mips/lib-32/memset.S
@@ -0,0 +1,145 @@
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) 1998, 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#include <asm/asm.h>
10#include <asm/offset.h>
11#include <asm/regdef.h>
12
13#define EX(insn,reg,addr,handler) \
149: insn reg, addr; \
15 .section __ex_table,"a"; \
16 PTR 9b, handler; \
17 .previous
18
19 .macro f_fill64 dst, offset, val, fixup
20 EX(LONG_S, \val, (\offset + 0 * LONGSIZE)(\dst), \fixup)
21 EX(LONG_S, \val, (\offset + 1 * LONGSIZE)(\dst), \fixup)
22 EX(LONG_S, \val, (\offset + 2 * LONGSIZE)(\dst), \fixup)
23 EX(LONG_S, \val, (\offset + 3 * LONGSIZE)(\dst), \fixup)
24 EX(LONG_S, \val, (\offset + 4 * LONGSIZE)(\dst), \fixup)
25 EX(LONG_S, \val, (\offset + 5 * LONGSIZE)(\dst), \fixup)
26 EX(LONG_S, \val, (\offset + 6 * LONGSIZE)(\dst), \fixup)
27 EX(LONG_S, \val, (\offset + 7 * LONGSIZE)(\dst), \fixup)
28 EX(LONG_S, \val, (\offset + 8 * LONGSIZE)(\dst), \fixup)
29 EX(LONG_S, \val, (\offset + 9 * LONGSIZE)(\dst), \fixup)
30 EX(LONG_S, \val, (\offset + 10 * LONGSIZE)(\dst), \fixup)
31 EX(LONG_S, \val, (\offset + 11 * LONGSIZE)(\dst), \fixup)
32 EX(LONG_S, \val, (\offset + 12 * LONGSIZE)(\dst), \fixup)
33 EX(LONG_S, \val, (\offset + 13 * LONGSIZE)(\dst), \fixup)
34 EX(LONG_S, \val, (\offset + 14 * LONGSIZE)(\dst), \fixup)
35 EX(LONG_S, \val, (\offset + 15 * LONGSIZE)(\dst), \fixup)
36 .endm
37
38/*
39 * memset(void *s, int c, size_t n)
40 *
41 * a0: start of area to clear
42 * a1: char to fill with
43 * a2: size of area to clear
44 */
45 .set noreorder
46 .align 5
47LEAF(memset)
48 beqz a1, 1f
49 move v0, a0 /* result */
50
51 andi a1, 0xff /* spread fillword */
52 sll t1, a1, 8
53 or a1, t1
54 sll t1, a1, 16
55 or a1, t1
561:
57
58FEXPORT(__bzero)
59 sltiu t0, a2, LONGSIZE /* very small region? */
60 bnez t0, small_memset
61 andi t0, a0, LONGMASK /* aligned? */
62
63 beqz t0, 1f
64 PTR_SUBU t0, LONGSIZE /* alignment in bytes */
65
66#ifdef __MIPSEB__
67 EX(swl, a1, (a0), first_fixup) /* make word aligned */
68#endif
69#ifdef __MIPSEL__
70 EX(swr, a1, (a0), first_fixup) /* make word aligned */
71#endif
72 PTR_SUBU a0, t0 /* long align ptr */
73 PTR_ADDU a2, t0 /* correct size */
74
751: ori t1, a2, 0x3f /* # of full blocks */
76 xori t1, 0x3f
77 beqz t1, memset_partial /* no block to fill */
78 andi t0, a2, 0x3c
79
80 PTR_ADDU t1, a0 /* end address */
81 .set reorder
821: PTR_ADDIU a0, 64
83 f_fill64 a0, -64, a1, fwd_fixup
84 bne t1, a0, 1b
85 .set noreorder
86
87memset_partial:
88 PTR_LA t1, 2f /* where to start */
89 PTR_SUBU t1, t0
90 jr t1
91 PTR_ADDU a0, t0 /* dest ptr */
92
93 .set push
94 .set noreorder
95 .set nomacro
96 f_fill64 a0, -64, a1, partial_fixup /* ... but first do longs ... */
972: .set pop
98 andi a2, LONGMASK /* At most one long to go */
99
100 beqz a2, 1f
101 PTR_ADDU a0, a2 /* What's left */
102#ifdef __MIPSEB__
103 EX(swr, a1, -1(a0), last_fixup)
104#endif
105#ifdef __MIPSEL__
106 EX(swl, a1, -1(a0), last_fixup)
107#endif
1081: jr ra
109 move a2, zero
110
111small_memset:
112 beqz a2, 2f
113 PTR_ADDU t1, a0, a2
114
1151: PTR_ADDIU a0, 1 /* fill bytewise */
116 bne t1, a0, 1b
117 sb a1, -1(a0)
118
1192: jr ra /* done */
120 move a2, zero
121 END(memset)
122
123first_fixup:
124 jr ra
125 nop
126
127fwd_fixup:
128 PTR_L t0, TI_TASK($28)
129 LONG_L t0, THREAD_BUADDR(t0)
130 andi a2, 0x3f
131 LONG_ADDU a2, t1
132 jr ra
133 LONG_SUBU a2, t0
134
135partial_fixup:
136 PTR_L t0, TI_TASK($28)
137 LONG_L t0, THREAD_BUADDR(t0)
138 andi a2, LONGMASK
139 LONG_ADDU a2, t1
140 jr ra
141 LONG_SUBU a2, t0
142
143last_fixup:
144 jr ra
145 andi v1, a2, LONGMASK
diff --git a/arch/mips/lib-32/r3k_dump_tlb.c b/arch/mips/lib-32/r3k_dump_tlb.c
new file mode 100644
index 000000000000..a878224004e5
--- /dev/null
+++ b/arch/mips/lib-32/r3k_dump_tlb.c
@@ -0,0 +1,176 @@
1/*
2 * Dump R3000 TLB for debugging purposes.
3 *
4 * Copyright (C) 1994, 1995 by Waldorf Electronics, written by Ralf Baechle.
5 * Copyright (C) 1999 by Silicon Graphics, Inc.
6 * Copyright (C) 1999 by Harald Koerfgen
7 */
8#include <linux/kernel.h>
9#include <linux/mm.h>
10#include <linux/sched.h>
11#include <linux/string.h>
12
13#include <asm/bootinfo.h>
14#include <asm/cachectl.h>
15#include <asm/cpu.h>
16#include <asm/mipsregs.h>
17#include <asm/page.h>
18#include <asm/pgtable.h>
19
20extern int r3k_have_wired_reg; /* defined in tlb-r3k.c */
21
22void dump_tlb(int first, int last)
23{
24 int i;
25 unsigned int asid;
26 unsigned long entryhi, entrylo0;
27
28 asid = read_c0_entryhi() & 0xfc0;
29
30 for (i = first; i <= last; i++) {
31 write_c0_index(i<<8);
32 __asm__ __volatile__(
33 ".set\tnoreorder\n\t"
34 "tlbr\n\t"
35 "nop\n\t"
36 ".set\treorder");
37 entryhi = read_c0_entryhi();
38 entrylo0 = read_c0_entrylo0();
39
40 /* Unused entries have a virtual address of KSEG0. */
41 if ((entryhi & 0xffffe000) != 0x80000000
42 && (entryhi & 0xfc0) == asid) {
43 /*
44 * Only print entries in use
45 */
46 printk("Index: %2d ", i);
47
48 printk("va=%08lx asid=%08lx"
49 " [pa=%06lx n=%d d=%d v=%d g=%d]",
50 (entryhi & 0xffffe000),
51 entryhi & 0xfc0,
52 entrylo0 & PAGE_MASK,
53 (entrylo0 & (1 << 11)) ? 1 : 0,
54 (entrylo0 & (1 << 10)) ? 1 : 0,
55 (entrylo0 & (1 << 9)) ? 1 : 0,
56 (entrylo0 & (1 << 8)) ? 1 : 0);
57 }
58 }
59 printk("\n");
60
61 write_c0_entryhi(asid);
62}
63
64void dump_tlb_all(void)
65{
66 dump_tlb(0, current_cpu_data.tlbsize - 1);
67}
68
69void dump_tlb_wired(void)
70{
71 int wired = r3k_have_wired_reg ? read_c0_wired() : 8;
72
73 printk("Wired: %d", wired);
74 dump_tlb(0, wired - 1);
75}
76
77void dump_tlb_addr(unsigned long addr)
78{
79 unsigned long flags, oldpid;
80 int index;
81
82 local_irq_save(flags);
83 oldpid = read_c0_entryhi() & 0xff;
84 write_c0_entryhi((addr & PAGE_MASK) | oldpid);
85 tlb_probe();
86 index = read_c0_index();
87 write_c0_entryhi(oldpid);
88 local_irq_restore(flags);
89
90 if (index < 0) {
91 printk("No entry for address 0x%08lx in TLB\n", addr);
92 return;
93 }
94
95 printk("Entry %d maps address 0x%08lx\n", index, addr);
96 dump_tlb(index, index);
97}
98
99void dump_tlb_nonwired(void)
100{
101 int wired = r3k_have_wired_reg ? read_c0_wired() : 8;
102 dump_tlb(wired, current_cpu_data.tlbsize - 1);
103}
104
105void dump_list_process(struct task_struct *t, void *address)
106{
107 pgd_t *page_dir, *pgd;
108 pmd_t *pmd;
109 pte_t *pte, page;
110 unsigned int addr;
111 unsigned long val;
112
113 addr = (unsigned int) address;
114
115 printk("Addr == %08x\n", addr);
116 printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd);
117
118 page_dir = pgd_offset(t->mm, 0);
119 printk("page_dir == %08x\n", (unsigned int) page_dir);
120
121 pgd = pgd_offset(t->mm, addr);
122 printk("pgd == %08x, ", (unsigned int) pgd);
123
124 pmd = pmd_offset(pgd, addr);
125 printk("pmd == %08x, ", (unsigned int) pmd);
126
127 pte = pte_offset(pmd, addr);
128 printk("pte == %08x, ", (unsigned int) pte);
129
130 page = *pte;
131 printk("page == %08x\n", (unsigned int) pte_val(page));
132
133 val = pte_val(page);
134 if (val & _PAGE_PRESENT) printk("present ");
135 if (val & _PAGE_READ) printk("read ");
136 if (val & _PAGE_WRITE) printk("write ");
137 if (val & _PAGE_ACCESSED) printk("accessed ");
138 if (val & _PAGE_MODIFIED) printk("modified ");
139 if (val & _PAGE_GLOBAL) printk("global ");
140 if (val & _PAGE_VALID) printk("valid ");
141 printk("\n");
142}
143
144void dump_list_current(void *address)
145{
146 dump_list_process(current, address);
147}
148
149unsigned int vtop(void *address)
150{
151 pgd_t *pgd;
152 pmd_t *pmd;
153 pte_t *pte;
154 unsigned int addr, paddr;
155
156 addr = (unsigned long) address;
157 pgd = pgd_offset(current->mm, addr);
158 pmd = pmd_offset(pgd, addr);
159 pte = pte_offset(pmd, addr);
160 paddr = (KSEG1 | (unsigned int) pte_val(*pte)) & PAGE_MASK;
161 paddr |= (addr & ~PAGE_MASK);
162
163 return paddr;
164}
165
166void dump16(unsigned long *p)
167{
168 int i;
169
170 for (i = 0; i < 8; i++) {
171 printk("*%08lx == %08lx, ", (unsigned long)p, *p);
172 p++;
173 printk("*%08lx == %08lx\n", (unsigned long)p, *p);
174 p++;
175 }
176}
diff --git a/arch/mips/lib-32/watch.S b/arch/mips/lib-32/watch.S
new file mode 100644
index 000000000000..808b3af1a605
--- /dev/null
+++ b/arch/mips/lib-32/watch.S
@@ -0,0 +1,60 @@
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 * Kernel debug stuff to use the Watch registers.
7 * Useful to find stack overflows, dangling pointers etc.
8 *
9 * Copyright (C) 1995, 1996, 1999 by Ralf Baechle
10 */
11#include <asm/asm.h>
12#include <asm/mipsregs.h>
13#include <asm/regdef.h>
14
15 .set noreorder
16/*
17 * Parameter: a0 - logic address to watch
18 * Currently only KSEG0 addresses are allowed!
19 * a1 - set bit #1 to trap on load references
20 * bit #0 to trap on store references
21 * Results : none
22 */
23 LEAF(__watch_set)
24 li t0, 0x80000000
25 subu a0, t0
26 ori a0, 7
27 xori a0, 7
28 or a0, a1
29 mtc0 a0, CP0_WATCHLO
30 sw a0, watch_savelo
31
32 jr ra
33 mtc0 zero, CP0_WATCHHI
34 END(__watch_set)
35
36/*
37 * Parameter: none
38 * Results : none
39 */
40 LEAF(__watch_clear)
41 jr ra
42 mtc0 zero, CP0_WATCHLO
43 END(__watch_clear)
44
45/*
46 * Parameter: none
47 * Results : none
48 */
49 LEAF(__watch_reenable)
50 lw t0, watch_savelo
51 jr ra
52 mtc0 t0, CP0_WATCHLO
53 END(__watch_reenable)
54
55/*
56 * Saved value of the c0_watchlo register for watch_reenable()
57 */
58 .data
59watch_savelo: .word 0
60 .text
diff --git a/arch/mips/lib-64/Makefile b/arch/mips/lib-64/Makefile
new file mode 100644
index 000000000000..fd6a2bafdfcf
--- /dev/null
+++ b/arch/mips/lib-64/Makefile
@@ -0,0 +1,25 @@
1#
2# Makefile for MIPS-specific library files..
3#
4
5lib-y += csum_partial.o memset.o watch.o
6
7obj-$(CONFIG_CPU_MIPS32) += dump_tlb.o
8obj-$(CONFIG_CPU_MIPS64) += dump_tlb.o
9obj-$(CONFIG_CPU_NEVADA) += dump_tlb.o
10obj-$(CONFIG_CPU_R10000) += dump_tlb.o
11obj-$(CONFIG_CPU_R3000) += r3k_dump_tlb.o
12obj-$(CONFIG_CPU_R4300) += dump_tlb.o
13obj-$(CONFIG_CPU_R4X00) += dump_tlb.o
14obj-$(CONFIG_CPU_R5000) += dump_tlb.o
15obj-$(CONFIG_CPU_R5432) += dump_tlb.o
16obj-$(CONFIG_CPU_R6000) +=
17obj-$(CONFIG_CPU_R8000) +=
18obj-$(CONFIG_CPU_RM7000) += dump_tlb.o
19obj-$(CONFIG_CPU_RM9000) += dump_tlb.o
20obj-$(CONFIG_CPU_SB1) += dump_tlb.o
21obj-$(CONFIG_CPU_TX39XX) += r3k_dump_tlb.o
22obj-$(CONFIG_CPU_TX49XX) += dump_tlb.o
23obj-$(CONFIG_CPU_VR41XX) += dump_tlb.o
24
25EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/lib-64/csum_partial.S b/arch/mips/lib-64/csum_partial.S
new file mode 100644
index 000000000000..25aba660cc9c
--- /dev/null
+++ b/arch/mips/lib-64/csum_partial.S
@@ -0,0 +1,242 @@
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 * Quick'n'dirty IP checksum ...
7 *
8 * Copyright (C) 1998, 1999 Ralf Baechle
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 */
11#include <asm/asm.h>
12#include <asm/regdef.h>
13
14#define ADDC(sum,reg) \
15 addu sum, reg; \
16 sltu v1, sum, reg; \
17 addu sum, v1
18
19#define CSUM_BIGCHUNK(src, offset, sum, t0, t1, t2, t3) \
20 lw t0, (offset + 0x00)(src); \
21 lw t1, (offset + 0x04)(src); \
22 lw t2, (offset + 0x08)(src); \
23 lw t3, (offset + 0x0c)(src); \
24 ADDC(sum, t0); \
25 ADDC(sum, t1); \
26 ADDC(sum, t2); \
27 ADDC(sum, t3); \
28 lw t0, (offset + 0x10)(src); \
29 lw t1, (offset + 0x14)(src); \
30 lw t2, (offset + 0x18)(src); \
31 lw t3, (offset + 0x1c)(src); \
32 ADDC(sum, t0); \
33 ADDC(sum, t1); \
34 ADDC(sum, t2); \
35 ADDC(sum, t3); \
36
37/*
38 * a0: source address
39 * a1: length of the area to checksum
40 * a2: partial checksum
41 */
42
43#define src a0
44#define sum v0
45
46 .text
47 .set noreorder
48
49/* unknown src alignment and < 8 bytes to go */
50small_csumcpy:
51 move a1, ta2
52
53 andi ta0, a1, 4
54 beqz ta0, 1f
55 andi ta0, a1, 2
56
57 /* Still a full word to go */
58 ulw ta1, (src)
59 daddiu src, 4
60 ADDC(sum, ta1)
61
621: move ta1, zero
63 beqz ta0, 1f
64 andi ta0, a1, 1
65
66 /* Still a halfword to go */
67 ulhu ta1, (src)
68 daddiu src, 2
69
701: beqz ta0, 1f
71 sll ta1, ta1, 16
72
73 lbu ta2, (src)
74 nop
75
76#ifdef __MIPSEB__
77 sll ta2, ta2, 8
78#endif
79 or ta1, ta2
80
811: ADDC(sum, ta1)
82
83 /* fold checksum */
84 sll v1, sum, 16
85 addu sum, v1
86 sltu v1, sum, v1
87 srl sum, sum, 16
88 addu sum, v1
89
90 /* odd buffer alignment? */
91 beqz t3, 1f
92 nop
93 sll v1, sum, 8
94 srl sum, sum, 8
95 or sum, v1
96 andi sum, 0xffff
971:
98 .set reorder
99 /* Add the passed partial csum. */
100 ADDC(sum, a2)
101 jr ra
102 .set noreorder
103
104/* ------------------------------------------------------------------------- */
105
106 .align 5
107LEAF(csum_partial)
108 move sum, zero
109 move t3, zero
110
111 sltiu t8, a1, 0x8
112 bnez t8, small_csumcpy /* < 8 bytes to copy */
113 move ta2, a1
114
115 beqz a1, out
116 andi t3, src, 0x1 /* odd buffer? */
117
118hword_align:
119 beqz t3, word_align
120 andi t8, src, 0x2
121
122 lbu ta0, (src)
123 dsubu a1, a1, 0x1
124#ifdef __MIPSEL__
125 sll ta0, ta0, 8
126#endif
127 ADDC(sum, ta0)
128 daddu src, src, 0x1
129 andi t8, src, 0x2
130
131word_align:
132 beqz t8, dword_align
133 sltiu t8, a1, 56
134
135 lhu ta0, (src)
136 dsubu a1, a1, 0x2
137 ADDC(sum, ta0)
138 sltiu t8, a1, 56
139 daddu src, src, 0x2
140
141dword_align:
142 bnez t8, do_end_words
143 move t8, a1
144
145 andi t8, src, 0x4
146 beqz t8, qword_align
147 andi t8, src, 0x8
148
149 lw ta0, 0x00(src)
150 dsubu a1, a1, 0x4
151 ADDC(sum, ta0)
152 daddu src, src, 0x4
153 andi t8, src, 0x8
154
155qword_align:
156 beqz t8, oword_align
157 andi t8, src, 0x10
158
159 lw ta0, 0x00(src)
160 lw ta1, 0x04(src)
161 dsubu a1, a1, 0x8
162 ADDC(sum, ta0)
163 ADDC(sum, ta1)
164 daddu src, src, 0x8
165 andi t8, src, 0x10
166
167oword_align:
168 beqz t8, begin_movement
169 dsrl t8, a1, 0x7
170
171 lw ta3, 0x08(src)
172 lw t0, 0x0c(src)
173 lw ta0, 0x00(src)
174 lw ta1, 0x04(src)
175 ADDC(sum, ta3)
176 ADDC(sum, t0)
177 ADDC(sum, ta0)
178 ADDC(sum, ta1)
179 dsubu a1, a1, 0x10
180 daddu src, src, 0x10
181 dsrl t8, a1, 0x7
182
183begin_movement:
184 beqz t8, 1f
185 andi ta2, a1, 0x40
186
187move_128bytes:
188 CSUM_BIGCHUNK(src, 0x00, sum, ta0, ta1, ta3, t0)
189 CSUM_BIGCHUNK(src, 0x20, sum, ta0, ta1, ta3, t0)
190 CSUM_BIGCHUNK(src, 0x40, sum, ta0, ta1, ta3, t0)
191 CSUM_BIGCHUNK(src, 0x60, sum, ta0, ta1, ta3, t0)
192 dsubu t8, t8, 0x01
193 bnez t8, move_128bytes
194 daddu src, src, 0x80
195
1961:
197 beqz ta2, 1f
198 andi ta2, a1, 0x20
199
200move_64bytes:
201 CSUM_BIGCHUNK(src, 0x00, sum, ta0, ta1, ta3, t0)
202 CSUM_BIGCHUNK(src, 0x20, sum, ta0, ta1, ta3, t0)
203 daddu src, src, 0x40
204
2051:
206 beqz ta2, do_end_words
207 andi t8, a1, 0x1c
208
209move_32bytes:
210 CSUM_BIGCHUNK(src, 0x00, sum, ta0, ta1, ta3, t0)
211 andi t8, a1, 0x1c
212 daddu src, src, 0x20
213
214do_end_words:
215 beqz t8, maybe_end_cruft
216 dsrl t8, t8, 0x2
217
218end_words:
219 lw ta0, (src)
220 dsubu t8, t8, 0x1
221 ADDC(sum, ta0)
222 bnez t8, end_words
223 daddu src, src, 0x4
224
225maybe_end_cruft:
226 andi ta2, a1, 0x3
227
228small_memcpy:
229 j small_csumcpy; move a1, ta2 /* XXX ??? */
230 beqz t2, out
231 move a1, ta2
232
233end_bytes:
234 lb ta0, (src)
235 dsubu a1, a1, 0x1
236 bnez a2, end_bytes
237 daddu src, src, 0x1
238
239out:
240 jr ra
241 move v0, sum
242 END(csum_partial)
diff --git a/arch/mips/lib-64/dump_tlb.c b/arch/mips/lib-64/dump_tlb.c
new file mode 100644
index 000000000000..42f88e055b4c
--- /dev/null
+++ b/arch/mips/lib-64/dump_tlb.c
@@ -0,0 +1,211 @@
1/*
2 * Dump R4x00 TLB for debugging purposes.
3 *
4 * Copyright (C) 1994, 1995 by Waldorf Electronics, written by Ralf Baechle.
5 * Copyright (C) 1999 by Silicon Graphics, Inc.
6 */
7#include <linux/config.h>
8#include <linux/kernel.h>
9#include <linux/mm.h>
10#include <linux/sched.h>
11#include <linux/string.h>
12
13#include <asm/bootinfo.h>
14#include <asm/cachectl.h>
15#include <asm/cpu.h>
16#include <asm/mipsregs.h>
17#include <asm/page.h>
18#include <asm/pgtable.h>
19
20static inline const char *msk2str(unsigned int mask)
21{
22 switch (mask) {
23 case PM_4K: return "4kb";
24 case PM_16K: return "16kb";
25 case PM_64K: return "64kb";
26 case PM_256K: return "256kb";
27#ifndef CONFIG_CPU_VR41XX
28 case PM_1M: return "1Mb";
29 case PM_4M: return "4Mb";
30 case PM_16M: return "16Mb";
31 case PM_64M: return "64Mb";
32 case PM_256M: return "256Mb";
33#endif
34 }
35
36 return "unknown";
37}
38
39#define BARRIER() \
40 __asm__ __volatile__( \
41 ".set\tnoreorder\n\t" \
42 "nop;nop;nop;nop;nop;nop;nop\n\t" \
43 ".set\treorder");
44
45void dump_tlb(int first, int last)
46{
47 unsigned long s_entryhi, entryhi, entrylo0, entrylo1, asid;
48 unsigned int s_index, pagemask, c0, c1, i;
49
50 s_entryhi = read_c0_entryhi();
51 s_index = read_c0_index();
52 asid = s_entryhi & 0xff;
53
54 for (i = first; i <= last; i++) {
55 write_c0_index(i);
56 BARRIER();
57 tlb_read();
58 BARRIER();
59 pagemask = read_c0_pagemask();
60 entryhi = read_c0_entryhi();
61 entrylo0 = read_c0_entrylo0();
62 entrylo1 = read_c0_entrylo1();
63
64 /* Unused entries have a virtual address of CKSEG0. */
65 if ((entryhi & ~0x1ffffUL) != CKSEG0
66 && (entryhi & 0xff) == asid) {
67 /*
68 * Only print entries in use
69 */
70 printk("Index: %2d pgmask=%s ", i, msk2str(pagemask));
71
72 c0 = (entrylo0 >> 3) & 7;
73 c1 = (entrylo1 >> 3) & 7;
74
75 printk("va=%011lx asid=%02lx\n",
76 (entryhi & ~0x1fffUL),
77 entryhi & 0xff);
78 printk("\t[pa=%011lx c=%d d=%d v=%d g=%ld] ",
79 (entrylo0 << 6) & PAGE_MASK, c0,
80 (entrylo0 & 4) ? 1 : 0,
81 (entrylo0 & 2) ? 1 : 0,
82 (entrylo0 & 1));
83 printk("[pa=%011lx c=%d d=%d v=%d g=%ld]\n",
84 (entrylo1 << 6) & PAGE_MASK, c1,
85 (entrylo1 & 4) ? 1 : 0,
86 (entrylo1 & 2) ? 1 : 0,
87 (entrylo1 & 1));
88 }
89 }
90 printk("\n");
91
92 write_c0_entryhi(s_entryhi);
93 write_c0_index(s_index);
94}
95
96void dump_tlb_all(void)
97{
98 dump_tlb(0, current_cpu_data.tlbsize - 1);
99}
100
101void dump_tlb_wired(void)
102{
103 int wired;
104
105 wired = read_c0_wired();
106 printk("Wired: %d", wired);
107 dump_tlb(0, read_c0_wired());
108}
109
110void dump_tlb_addr(unsigned long addr)
111{
112 unsigned int flags, oldpid;
113 int index;
114
115 local_irq_save(flags);
116 oldpid = read_c0_entryhi() & 0xff;
117 BARRIER();
118 write_c0_entryhi((addr & PAGE_MASK) | oldpid);
119 BARRIER();
120 tlb_probe();
121 BARRIER();
122 index = read_c0_index();
123 write_c0_entryhi(oldpid);
124 local_irq_restore(flags);
125
126 if (index < 0) {
127 printk("No entry for address 0x%08lx in TLB\n", addr);
128 return;
129 }
130
131 printk("Entry %d maps address 0x%08lx\n", index, addr);
132 dump_tlb(index, index);
133}
134
135void dump_tlb_nonwired(void)
136{
137 dump_tlb(read_c0_wired(), current_cpu_data.tlbsize - 1);
138}
139
140void dump_list_process(struct task_struct *t, void *address)
141{
142 pgd_t *page_dir, *pgd;
143 pmd_t *pmd;
144 pte_t *pte, page;
145 unsigned long addr, val;
146
147 addr = (unsigned long) address;
148
149 printk("Addr == %08lx\n", addr);
150 printk("tasks->mm.pgd == %08lx\n", (unsigned long) t->mm->pgd);
151
152 page_dir = pgd_offset(t->mm, 0);
153 printk("page_dir == %016lx\n", (unsigned long) page_dir);
154
155 pgd = pgd_offset(t->mm, addr);
156 printk("pgd == %016lx\n", (unsigned long) pgd);
157
158 pmd = pmd_offset(pgd, addr);
159 printk("pmd == %016lx\n", (unsigned long) pmd);
160
161 pte = pte_offset(pmd, addr);
162 printk("pte == %016lx\n", (unsigned long) pte);
163
164 page = *pte;
165 printk("page == %08lx\n", pte_val(page));
166
167 val = pte_val(page);
168 if (val & _PAGE_PRESENT) printk("present ");
169 if (val & _PAGE_READ) printk("read ");
170 if (val & _PAGE_WRITE) printk("write ");
171 if (val & _PAGE_ACCESSED) printk("accessed ");
172 if (val & _PAGE_MODIFIED) printk("modified ");
173 if (val & _PAGE_R4KBUG) printk("r4kbug ");
174 if (val & _PAGE_GLOBAL) printk("global ");
175 if (val & _PAGE_VALID) printk("valid ");
176 printk("\n");
177}
178
179void dump_list_current(void *address)
180{
181 dump_list_process(current, address);
182}
183
184unsigned int vtop(void *address)
185{
186 pgd_t *pgd;
187 pmd_t *pmd;
188 pte_t *pte;
189 unsigned int addr, paddr;
190
191 addr = (unsigned long) address;
192 pgd = pgd_offset(current->mm, addr);
193 pmd = pmd_offset(pgd, addr);
194 pte = pte_offset(pmd, addr);
195 paddr = (CKSEG1 | (unsigned int) pte_val(*pte)) & PAGE_MASK;
196 paddr |= (addr & ~PAGE_MASK);
197
198 return paddr;
199}
200
201void dump16(unsigned long *p)
202{
203 int i;
204
205 for (i = 0; i < 8; i++) {
206 printk("*%08lx == %08lx, ", (unsigned long)p, *p);
207 p++;
208 printk("*%08lx == %08lx\n", (unsigned long)p, *p);
209 p++;
210 }
211}
diff --git a/arch/mips/lib-64/memset.S b/arch/mips/lib-64/memset.S
new file mode 100644
index 000000000000..242f1976cfaf
--- /dev/null
+++ b/arch/mips/lib-64/memset.S
@@ -0,0 +1,142 @@
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) 1998, 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#include <asm/asm.h>
10#include <asm/offset.h>
11#include <asm/regdef.h>
12
13#define EX(insn,reg,addr,handler) \
149: insn reg, addr; \
15 .section __ex_table,"a"; \
16 PTR 9b, handler; \
17 .previous
18
19 .macro f_fill64 dst, offset, val, fixup
20 EX(LONG_S, \val, (\offset + 0 * LONGSIZE)(\dst), \fixup)
21 EX(LONG_S, \val, (\offset + 1 * LONGSIZE)(\dst), \fixup)
22 EX(LONG_S, \val, (\offset + 2 * LONGSIZE)(\dst), \fixup)
23 EX(LONG_S, \val, (\offset + 3 * LONGSIZE)(\dst), \fixup)
24 EX(LONG_S, \val, (\offset + 4 * LONGSIZE)(\dst), \fixup)
25 EX(LONG_S, \val, (\offset + 5 * LONGSIZE)(\dst), \fixup)
26 EX(LONG_S, \val, (\offset + 6 * LONGSIZE)(\dst), \fixup)
27 EX(LONG_S, \val, (\offset + 7 * LONGSIZE)(\dst), \fixup)
28 .endm
29
30/*
31 * memset(void *s, int c, size_t n)
32 *
33 * a0: start of area to clear
34 * a1: char to fill with
35 * a2: size of area to clear
36 */
37 .set noreorder
38 .align 5
39LEAF(memset)
40 beqz a1, 1f
41 move v0, a0 /* result */
42
43 andi a1, 0xff /* spread fillword */
44 dsll t1, a1, 8
45 or a1, t1
46 dsll t1, a1, 16
47 or a1, t1
48 dsll t1, a1, 32
49 or a1, t1
501:
51
52FEXPORT(__bzero)
53 sltiu t0, a2, LONGSIZE /* very small region? */
54 bnez t0, small_memset
55 andi t0, a0, LONGMASK /* aligned? */
56
57 beqz t0, 1f
58 PTR_SUBU t0, LONGSIZE /* alignment in bytes */
59
60#ifdef __MIPSEB__
61 EX(sdl, a1, (a0), first_fixup) /* make dword aligned */
62#endif
63#ifdef __MIPSEL__
64 EX(sdr, a1, (a0), first_fixup) /* make dword aligned */
65#endif
66 PTR_SUBU a0, t0 /* long align ptr */
67 PTR_ADDU a2, t0 /* correct size */
68
691: ori t1, a2, 0x3f /* # of full blocks */
70 xori t1, 0x3f
71 beqz t1, memset_partial /* no block to fill */
72 andi t0, a2, 0x38
73
74 PTR_ADDU t1, a0 /* end address */
75 .set reorder
761: PTR_ADDIU a0, 64
77 f_fill64 a0, -64, a1, fwd_fixup
78 bne t1, a0, 1b
79 .set noreorder
80
81memset_partial:
82 PTR_LA t1, 2f /* where to start */
83 .set noat
84 dsrl AT, t0, 1
85 PTR_SUBU t1, AT
86 .set noat
87 jr t1
88 PTR_ADDU a0, t0 /* dest ptr */
89
90 .set push
91 .set noreorder
92 .set nomacro
93 f_fill64 a0, -64, a1, partial_fixup /* ... but first do longs ... */
942: .set pop
95 andi a2, LONGMASK /* At most one long to go */
96
97 beqz a2, 1f
98 PTR_ADDU a0, a2 /* What's left */
99#ifdef __MIPSEB__
100 EX(sdr, a1, -1(a0), last_fixup)
101#endif
102#ifdef __MIPSEL__
103 EX(sdl, a1, -1(a0), last_fixup)
104#endif
1051: jr ra
106 move a2, zero
107
108small_memset:
109 beqz a2, 2f
110 PTR_ADDU t1, a0, a2
111
1121: PTR_ADDIU a0, 1 /* fill bytewise */
113 bne t1, a0, 1b
114 sb a1, -1(a0)
115
1162: jr ra /* done */
117 move a2, zero
118 END(memset)
119
120first_fixup:
121 jr ra
122 nop
123
124fwd_fixup:
125 PTR_L t0, TI_TASK($28)
126 LONG_L t0, THREAD_BUADDR(t0)
127 andi a2, 0x3f
128 LONG_ADDU a2, t1
129 jr ra
130 LONG_SUBU a2, t0
131
132partial_fixup:
133 PTR_L t0, TI_TASK($28)
134 LONG_L t0, THREAD_BUADDR(t0)
135 andi a2, LONGMASK
136 LONG_ADDU a2, t1
137 jr ra
138 LONG_SUBU a2, t0
139
140last_fixup:
141 jr ra
142 andi v1, a2, LONGMASK
diff --git a/arch/mips/lib-64/watch.S b/arch/mips/lib-64/watch.S
new file mode 100644
index 000000000000..f91434013695
--- /dev/null
+++ b/arch/mips/lib-64/watch.S
@@ -0,0 +1,57 @@
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 * Kernel debug stuff to use the Watch registers.
7 * Useful to find stack overflows, dangling pointers etc.
8 *
9 * Copyright (C) 1995, 1996, 1999, 2001 by Ralf Baechle
10 */
11#include <asm/asm.h>
12#include <asm/mipsregs.h>
13#include <asm/regdef.h>
14
15 .set noreorder
16/*
17 * Parameter: a0 - physical address to watch
18 * a1 - set bit #1 to trap on load references
19 * bit #0 to trap on store references
20 * Results : none
21 */
22 LEAF(__watch_set)
23 ori a0, 7
24 xori a0, 7
25 or a0, a1
26 mtc0 a0, CP0_WATCHLO
27 sd a0, watch_savelo
28 dsrl32 a0, a0, 0
29
30 jr ra
31 mtc0 zero, CP0_WATCHHI
32 END(__watch_set)
33
34/*
35 * Parameter: none
36 * Results : none
37 */
38 LEAF(__watch_clear)
39 jr ra
40 mtc0 zero, CP0_WATCHLO
41 END(__watch_clear)
42
43/*
44 * Parameter: none
45 * Results : none
46 */
47 LEAF(__watch_reenable)
48 ld t0, watch_savelo
49 jr ra
50 mtc0 t0, CP0_WATCHLO
51 END(__watch_reenable)
52
53/*
54 * Saved value of the c0_watchlo register for watch_reenable()
55 */
56 .local watch_savelo
57 .comm watch_savelo, 8, 8
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
new file mode 100644
index 000000000000..21b92b9dd013
--- /dev/null
+++ b/arch/mips/lib/Makefile
@@ -0,0 +1,10 @@
1#
2# Makefile for MIPS-specific library files..
3#
4
5lib-y += csum_partial_copy.o dec_and_lock.o memcpy.o promlib.o \
6 strlen_user.o strncpy_user.o strnlen_user.o
7
8obj-y += iomap.o
9
10EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/lib/csum_partial_copy.c b/arch/mips/lib/csum_partial_copy.c
new file mode 100644
index 000000000000..ffed0a6a1c16
--- /dev/null
+++ b/arch/mips/lib/csum_partial_copy.c
@@ -0,0 +1,49 @@
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) 1994, 1995 Waldorf Electronics GmbH
7 * Copyright (C) 1998, 1999 Ralf Baechle
8 */
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <asm/byteorder.h>
12#include <asm/string.h>
13#include <asm/uaccess.h>
14#include <net/checksum.h>
15
16/*
17 * copy while checksumming, otherwise like csum_partial
18 */
19unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst,
20 int len, unsigned int sum)
21{
22 /*
23 * It's 2:30 am and I don't feel like doing it real ...
24 * This is lots slower than the real thing (tm)
25 */
26 sum = csum_partial(src, len, sum);
27 memcpy(dst, src, len);
28
29 return sum;
30}
31
32/*
33 * Copy from userspace and compute checksum. If we catch an exception
34 * then zero the rest of the buffer.
35 */
36unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst,
37 int len, unsigned int sum, int *err_ptr)
38{
39 int missing;
40
41 might_sleep();
42 missing = copy_from_user(dst, src, len);
43 if (missing) {
44 memset(dst + len - missing, 0, missing);
45 *err_ptr = -EFAULT;
46 }
47
48 return csum_partial(dst, len, sum);
49}
diff --git a/arch/mips/lib/dec_and_lock.c b/arch/mips/lib/dec_and_lock.c
new file mode 100644
index 000000000000..e44e9579bd36
--- /dev/null
+++ b/arch/mips/lib/dec_and_lock.c
@@ -0,0 +1,55 @@
1/*
2 * MIPS version of atomic_dec_and_lock() using cmpxchg
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#include <linux/module.h>
11#include <linux/spinlock.h>
12#include <asm/atomic.h>
13#include <asm/system.h>
14
15/*
16 * This is an implementation of the notion of "decrement a
17 * reference count, and return locked if it decremented to zero".
18 *
19 * This implementation can be used on any architecture that
20 * has a cmpxchg, and where atomic->value is an int holding
21 * the value of the atomic (i.e. the high bits aren't used
22 * for a lock or anything like that).
23 *
24 * N.B. ATOMIC_DEC_AND_LOCK gets defined in include/linux/spinlock.h
25 * if spinlocks are empty and thus atomic_dec_and_lock is defined
26 * to be atomic_dec_and_test - in that case we don't need it
27 * defined here as well.
28 */
29
30#ifndef ATOMIC_DEC_AND_LOCK
31int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
32{
33 int counter;
34 int newcount;
35
36 for (;;) {
37 counter = atomic_read(atomic);
38 newcount = counter - 1;
39 if (!newcount)
40 break; /* do it the slow way */
41
42 newcount = cmpxchg(&atomic->counter, counter, newcount);
43 if (newcount == counter)
44 return 0;
45 }
46
47 spin_lock(lock);
48 if (atomic_dec_and_test(atomic))
49 return 1;
50 spin_unlock(lock);
51 return 0;
52}
53
54EXPORT_SYMBOL(_atomic_dec_and_lock);
55#endif /* ATOMIC_DEC_AND_LOCK */
diff --git a/arch/mips/lib/iomap.c b/arch/mips/lib/iomap.c
new file mode 100644
index 000000000000..b5d5fa833762
--- /dev/null
+++ b/arch/mips/lib/iomap.c
@@ -0,0 +1,78 @@
1/*
2 * iomap.c, Memory Mapped I/O routines for MIPS architecture.
3 *
4 * This code is based on lib/iomap.c, by Linus Torvalds.
5 *
6 * Copyright (C) 2004-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#include <linux/ioport.h>
23#include <linux/module.h>
24#include <linux/pci.h>
25
26#include <asm/io.h>
27
28void __iomem *ioport_map(unsigned long port, unsigned int nr)
29{
30 unsigned long end;
31
32 end = port + nr - 1UL;
33 if (ioport_resource.start > port ||
34 ioport_resource.end < end || port > end)
35 return NULL;
36
37 return (void __iomem *)(mips_io_port_base + port);
38}
39
40void ioport_unmap(void __iomem *addr)
41{
42}
43EXPORT_SYMBOL(ioport_map);
44EXPORT_SYMBOL(ioport_unmap);
45
46void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
47{
48 unsigned long start, len, flags;
49
50 if (dev == NULL)
51 return NULL;
52
53 start = pci_resource_start(dev, bar);
54 len = pci_resource_len(dev, bar);
55 if (!start || !len)
56 return NULL;
57
58 if (maxlen != 0 && len > maxlen)
59 len = maxlen;
60
61 flags = pci_resource_flags(dev, bar);
62 if (flags & IORESOURCE_IO)
63 return ioport_map(start, len);
64 if (flags & IORESOURCE_MEM) {
65 if (flags & IORESOURCE_CACHEABLE)
66 return ioremap_cacheable_cow(start, len);
67 return ioremap_nocache(start, len);
68 }
69
70 return NULL;
71}
72
73void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
74{
75 iounmap(addr);
76}
77EXPORT_SYMBOL(pci_iomap);
78EXPORT_SYMBOL(pci_iounmap);
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S
new file mode 100644
index 000000000000..afa8eae18ff6
--- /dev/null
+++ b/arch/mips/lib/memcpy.S
@@ -0,0 +1,508 @@
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 * Unified implementation of memcpy, memmove and the __copy_user backend.
7 *
8 * Copyright (C) 1998, 99, 2000, 01, 2002 Ralf Baechle (ralf@gnu.org)
9 * Copyright (C) 1999, 2000, 01, 2002 Silicon Graphics, Inc.
10 * Copyright (C) 2002 Broadcom, Inc.
11 * memcpy/copy_user author: Mark Vandevoorde
12 *
13 * Mnemonic names for arguments to memcpy/__copy_user
14 */
15#include <linux/config.h>
16#include <asm/asm.h>
17#include <asm/offset.h>
18#include <asm/regdef.h>
19
20#define dst a0
21#define src a1
22#define len a2
23
24/*
25 * Spec
26 *
27 * memcpy copies len bytes from src to dst and sets v0 to dst.
28 * It assumes that
29 * - src and dst don't overlap
30 * - src is readable
31 * - dst is writable
32 * memcpy uses the standard calling convention
33 *
34 * __copy_user copies up to len bytes from src to dst and sets a2 (len) to
35 * the number of uncopied bytes due to an exception caused by a read or write.
36 * __copy_user assumes that src and dst don't overlap, and that the call is
37 * implementing one of the following:
38 * copy_to_user
39 * - src is readable (no exceptions when reading src)
40 * copy_from_user
41 * - dst is writable (no exceptions when writing dst)
42 * __copy_user uses a non-standard calling convention; see
43 * include/asm-mips/uaccess.h
44 *
45 * When an exception happens on a load, the handler must
46 # ensure that all of the destination buffer is overwritten to prevent
47 * leaking information to user mode programs.
48 */
49
50/*
51 * Implementation
52 */
53
54/*
55 * The exception handler for loads requires that:
56 * 1- AT contain the address of the byte just past the end of the source
57 * of the copy,
58 * 2- src_entry <= src < AT, and
59 * 3- (dst - src) == (dst_entry - src_entry),
60 * The _entry suffix denotes values when __copy_user was called.
61 *
62 * (1) is set up up by uaccess.h and maintained by not writing AT in copy_user
63 * (2) is met by incrementing src by the number of bytes copied
64 * (3) is met by not doing loads between a pair of increments of dst and src
65 *
66 * The exception handlers for stores adjust len (if necessary) and return.
67 * These handlers do not need to overwrite any data.
68 *
69 * For __rmemcpy and memmove an exception is always a kernel bug, therefore
70 * they're not protected.
71 */
72
73#define EXC(inst_reg,addr,handler) \
749: inst_reg, addr; \
75 .section __ex_table,"a"; \
76 PTR 9b, handler; \
77 .previous
78
79/*
80 * Only on the 64-bit kernel we can made use of 64-bit registers.
81 */
82#ifdef CONFIG_MIPS64
83#define USE_DOUBLE
84#endif
85
86#ifdef USE_DOUBLE
87
88#define LOAD ld
89#define LOADL ldl
90#define LOADR ldr
91#define STOREL sdl
92#define STORER sdr
93#define STORE sd
94#define ADD daddu
95#define SUB dsubu
96#define SRL dsrl
97#define SRA dsra
98#define SLL dsll
99#define SLLV dsllv
100#define SRLV dsrlv
101#define NBYTES 8
102#define LOG_NBYTES 3
103
104/*
105 * As we are sharing code base with the mips32 tree (which use the o32 ABI
106 * register definitions). We need to redefine the register definitions from
107 * the n64 ABI register naming to the o32 ABI register naming.
108 */
109#undef t0
110#undef t1
111#undef t2
112#undef t3
113#define t0 $8
114#define t1 $9
115#define t2 $10
116#define t3 $11
117#define t4 $12
118#define t5 $13
119#define t6 $14
120#define t7 $15
121
122#else
123
124#define LOAD lw
125#define LOADL lwl
126#define LOADR lwr
127#define STOREL swl
128#define STORER swr
129#define STORE sw
130#define ADD addu
131#define SUB subu
132#define SRL srl
133#define SLL sll
134#define SRA sra
135#define SLLV sllv
136#define SRLV srlv
137#define NBYTES 4
138#define LOG_NBYTES 2
139
140#endif /* USE_DOUBLE */
141
142#ifdef CONFIG_CPU_LITTLE_ENDIAN
143#define LDFIRST LOADR
144#define LDREST LOADL
145#define STFIRST STORER
146#define STREST STOREL
147#define SHIFT_DISCARD SLLV
148#else
149#define LDFIRST LOADL
150#define LDREST LOADR
151#define STFIRST STOREL
152#define STREST STORER
153#define SHIFT_DISCARD SRLV
154#endif
155
156#define FIRST(unit) ((unit)*NBYTES)
157#define REST(unit) (FIRST(unit)+NBYTES-1)
158#define UNIT(unit) FIRST(unit)
159
160#define ADDRMASK (NBYTES-1)
161
162 .text
163 .set noreorder
164 .set noat
165
166/*
167 * A combined memcpy/__copy_user
168 * __copy_user sets len to 0 for success; else to an upper bound of
169 * the number of uncopied bytes.
170 * memcpy sets v0 to dst.
171 */
172 .align 5
173LEAF(memcpy) /* a0=dst a1=src a2=len */
174 move v0, dst /* return value */
175__memcpy:
176FEXPORT(__copy_user)
177 /*
178 * Note: dst & src may be unaligned, len may be 0
179 * Temps
180 */
181#define rem t8
182
183 /*
184 * The "issue break"s below are very approximate.
185 * Issue delays for dcache fills will perturb the schedule, as will
186 * load queue full replay traps, etc.
187 *
188 * If len < NBYTES use byte operations.
189 */
190 PREF( 0, 0(src) )
191 PREF( 1, 0(dst) )
192 sltu t2, len, NBYTES
193 and t1, dst, ADDRMASK
194 PREF( 0, 1*32(src) )
195 PREF( 1, 1*32(dst) )
196 bnez t2, copy_bytes_checklen
197 and t0, src, ADDRMASK
198 PREF( 0, 2*32(src) )
199 PREF( 1, 2*32(dst) )
200 bnez t1, dst_unaligned
201 nop
202 bnez t0, src_unaligned_dst_aligned
203 /*
204 * use delay slot for fall-through
205 * src and dst are aligned; need to compute rem
206 */
207both_aligned:
208 SRL t0, len, LOG_NBYTES+3 # +3 for 8 units/iter
209 beqz t0, cleanup_both_aligned # len < 8*NBYTES
210 and rem, len, (8*NBYTES-1) # rem = len % (8*NBYTES)
211 PREF( 0, 3*32(src) )
212 PREF( 1, 3*32(dst) )
213 .align 4
2141:
215EXC( LOAD t0, UNIT(0)(src), l_exc)
216EXC( LOAD t1, UNIT(1)(src), l_exc_copy)
217EXC( LOAD t2, UNIT(2)(src), l_exc_copy)
218EXC( LOAD t3, UNIT(3)(src), l_exc_copy)
219 SUB len, len, 8*NBYTES
220EXC( LOAD t4, UNIT(4)(src), l_exc_copy)
221EXC( LOAD t7, UNIT(5)(src), l_exc_copy)
222EXC( STORE t0, UNIT(0)(dst), s_exc_p8u)
223EXC( STORE t1, UNIT(1)(dst), s_exc_p7u)
224EXC( LOAD t0, UNIT(6)(src), l_exc_copy)
225EXC( LOAD t1, UNIT(7)(src), l_exc_copy)
226 ADD src, src, 8*NBYTES
227 ADD dst, dst, 8*NBYTES
228EXC( STORE t2, UNIT(-6)(dst), s_exc_p6u)
229EXC( STORE t3, UNIT(-5)(dst), s_exc_p5u)
230EXC( STORE t4, UNIT(-4)(dst), s_exc_p4u)
231EXC( STORE t7, UNIT(-3)(dst), s_exc_p3u)
232EXC( STORE t0, UNIT(-2)(dst), s_exc_p2u)
233EXC( STORE t1, UNIT(-1)(dst), s_exc_p1u)
234 PREF( 0, 8*32(src) )
235 PREF( 1, 8*32(dst) )
236 bne len, rem, 1b
237 nop
238
239 /*
240 * len == rem == the number of bytes left to copy < 8*NBYTES
241 */
242cleanup_both_aligned:
243 beqz len, done
244 sltu t0, len, 4*NBYTES
245 bnez t0, less_than_4units
246 and rem, len, (NBYTES-1) # rem = len % NBYTES
247 /*
248 * len >= 4*NBYTES
249 */
250EXC( LOAD t0, UNIT(0)(src), l_exc)
251EXC( LOAD t1, UNIT(1)(src), l_exc_copy)
252EXC( LOAD t2, UNIT(2)(src), l_exc_copy)
253EXC( LOAD t3, UNIT(3)(src), l_exc_copy)
254 SUB len, len, 4*NBYTES
255 ADD src, src, 4*NBYTES
256EXC( STORE t0, UNIT(0)(dst), s_exc_p4u)
257EXC( STORE t1, UNIT(1)(dst), s_exc_p3u)
258EXC( STORE t2, UNIT(2)(dst), s_exc_p2u)
259EXC( STORE t3, UNIT(3)(dst), s_exc_p1u)
260 beqz len, done
261 ADD dst, dst, 4*NBYTES
262less_than_4units:
263 /*
264 * rem = len % NBYTES
265 */
266 beq rem, len, copy_bytes
267 nop
2681:
269EXC( LOAD t0, 0(src), l_exc)
270 ADD src, src, NBYTES
271 SUB len, len, NBYTES
272EXC( STORE t0, 0(dst), s_exc_p1u)
273 bne rem, len, 1b
274 ADD dst, dst, NBYTES
275
276 /*
277 * src and dst are aligned, need to copy rem bytes (rem < NBYTES)
278 * A loop would do only a byte at a time with possible branch
279 * mispredicts. Can't do an explicit LOAD dst,mask,or,STORE
280 * because can't assume read-access to dst. Instead, use
281 * STREST dst, which doesn't require read access to dst.
282 *
283 * This code should perform better than a simple loop on modern,
284 * wide-issue mips processors because the code has fewer branches and
285 * more instruction-level parallelism.
286 */
287#define bits t2
288 beqz len, done
289 ADD t1, dst, len # t1 is just past last byte of dst
290 li bits, 8*NBYTES
291 SLL rem, len, 3 # rem = number of bits to keep
292EXC( LOAD t0, 0(src), l_exc)
293 SUB bits, bits, rem # bits = number of bits to discard
294 SHIFT_DISCARD t0, t0, bits
295EXC( STREST t0, -1(t1), s_exc)
296 jr ra
297 move len, zero
298dst_unaligned:
299 /*
300 * dst is unaligned
301 * t0 = src & ADDRMASK
302 * t1 = dst & ADDRMASK; T1 > 0
303 * len >= NBYTES
304 *
305 * Copy enough bytes to align dst
306 * Set match = (src and dst have same alignment)
307 */
308#define match rem
309EXC( LDFIRST t3, FIRST(0)(src), l_exc)
310 ADD t2, zero, NBYTES
311EXC( LDREST t3, REST(0)(src), l_exc_copy)
312 SUB t2, t2, t1 # t2 = number of bytes copied
313 xor match, t0, t1
314EXC( STFIRST t3, FIRST(0)(dst), s_exc)
315 beq len, t2, done
316 SUB len, len, t2
317 ADD dst, dst, t2
318 beqz match, both_aligned
319 ADD src, src, t2
320
321src_unaligned_dst_aligned:
322 SRL t0, len, LOG_NBYTES+2 # +2 for 4 units/iter
323 PREF( 0, 3*32(src) )
324 beqz t0, cleanup_src_unaligned
325 and rem, len, (4*NBYTES-1) # rem = len % 4*NBYTES
326 PREF( 1, 3*32(dst) )
3271:
328/*
329 * Avoid consecutive LD*'s to the same register since some mips
330 * implementations can't issue them in the same cycle.
331 * It's OK to load FIRST(N+1) before REST(N) because the two addresses
332 * are to the same unit (unless src is aligned, but it's not).
333 */
334EXC( LDFIRST t0, FIRST(0)(src), l_exc)
335EXC( LDFIRST t1, FIRST(1)(src), l_exc_copy)
336 SUB len, len, 4*NBYTES
337EXC( LDREST t0, REST(0)(src), l_exc_copy)
338EXC( LDREST t1, REST(1)(src), l_exc_copy)
339EXC( LDFIRST t2, FIRST(2)(src), l_exc_copy)
340EXC( LDFIRST t3, FIRST(3)(src), l_exc_copy)
341EXC( LDREST t2, REST(2)(src), l_exc_copy)
342EXC( LDREST t3, REST(3)(src), l_exc_copy)
343 PREF( 0, 9*32(src) ) # 0 is PREF_LOAD (not streamed)
344 ADD src, src, 4*NBYTES
345#ifdef CONFIG_CPU_SB1
346 nop # improves slotting
347#endif
348EXC( STORE t0, UNIT(0)(dst), s_exc_p4u)
349EXC( STORE t1, UNIT(1)(dst), s_exc_p3u)
350EXC( STORE t2, UNIT(2)(dst), s_exc_p2u)
351EXC( STORE t3, UNIT(3)(dst), s_exc_p1u)
352 PREF( 1, 9*32(dst) ) # 1 is PREF_STORE (not streamed)
353 bne len, rem, 1b
354 ADD dst, dst, 4*NBYTES
355
356cleanup_src_unaligned:
357 beqz len, done
358 and rem, len, NBYTES-1 # rem = len % NBYTES
359 beq rem, len, copy_bytes
360 nop
3611:
362EXC( LDFIRST t0, FIRST(0)(src), l_exc)
363EXC( LDREST t0, REST(0)(src), l_exc_copy)
364 ADD src, src, NBYTES
365 SUB len, len, NBYTES
366EXC( STORE t0, 0(dst), s_exc_p1u)
367 bne len, rem, 1b
368 ADD dst, dst, NBYTES
369
370copy_bytes_checklen:
371 beqz len, done
372 nop
373copy_bytes:
374 /* 0 < len < NBYTES */
375#define COPY_BYTE(N) \
376EXC( lb t0, N(src), l_exc); \
377 SUB len, len, 1; \
378 beqz len, done; \
379EXC( sb t0, N(dst), s_exc_p1)
380
381 COPY_BYTE(0)
382 COPY_BYTE(1)
383#ifdef USE_DOUBLE
384 COPY_BYTE(2)
385 COPY_BYTE(3)
386 COPY_BYTE(4)
387 COPY_BYTE(5)
388#endif
389EXC( lb t0, NBYTES-2(src), l_exc)
390 SUB len, len, 1
391 jr ra
392EXC( sb t0, NBYTES-2(dst), s_exc_p1)
393done:
394 jr ra
395 nop
396 END(memcpy)
397
398l_exc_copy:
399 /*
400 * Copy bytes from src until faulting load address (or until a
401 * lb faults)
402 *
403 * When reached by a faulting LDFIRST/LDREST, THREAD_BUADDR($28)
404 * may be more than a byte beyond the last address.
405 * Hence, the lb below may get an exception.
406 *
407 * Assumes src < THREAD_BUADDR($28)
408 */
409 LOAD t0, TI_TASK($28)
410 nop
411 LOAD t0, THREAD_BUADDR(t0)
4121:
413EXC( lb t1, 0(src), l_exc)
414 ADD src, src, 1
415 sb t1, 0(dst) # can't fault -- we're copy_from_user
416 bne src, t0, 1b
417 ADD dst, dst, 1
418l_exc:
419 LOAD t0, TI_TASK($28)
420 nop
421 LOAD t0, THREAD_BUADDR(t0) # t0 is just past last good address
422 nop
423 SUB len, AT, t0 # len number of uncopied bytes
424 /*
425 * Here's where we rely on src and dst being incremented in tandem,
426 * See (3) above.
427 * dst += (fault addr - src) to put dst at first byte to clear
428 */
429 ADD dst, t0 # compute start address in a1
430 SUB dst, src
431 /*
432 * Clear len bytes starting at dst. Can't call __bzero because it
433 * might modify len. An inefficient loop for these rare times...
434 */
435 beqz len, done
436 SUB src, len, 1
4371: sb zero, 0(dst)
438 ADD dst, dst, 1
439 bnez src, 1b
440 SUB src, src, 1
441 jr ra
442 nop
443
444
445#define SEXC(n) \
446s_exc_p ## n ## u: \
447 jr ra; \
448 ADD len, len, n*NBYTES
449
450SEXC(8)
451SEXC(7)
452SEXC(6)
453SEXC(5)
454SEXC(4)
455SEXC(3)
456SEXC(2)
457SEXC(1)
458
459s_exc_p1:
460 jr ra
461 ADD len, len, 1
462s_exc:
463 jr ra
464 nop
465
466 .align 5
467LEAF(memmove)
468 ADD t0, a0, a2
469 ADD t1, a1, a2
470 sltu t0, a1, t0 # dst + len <= src -> memcpy
471 sltu t1, a0, t1 # dst >= src + len -> memcpy
472 and t0, t1
473 beqz t0, __memcpy
474 move v0, a0 /* return value */
475 beqz a2, r_out
476 END(memmove)
477
478 /* fall through to __rmemcpy */
479LEAF(__rmemcpy) /* a0=dst a1=src a2=len */
480 sltu t0, a1, a0
481 beqz t0, r_end_bytes_up # src >= dst
482 nop
483 ADD a0, a2 # dst = dst + len
484 ADD a1, a2 # src = src + len
485
486r_end_bytes:
487 lb t0, -1(a1)
488 SUB a2, a2, 0x1
489 sb t0, -1(a0)
490 SUB a1, a1, 0x1
491 bnez a2, r_end_bytes
492 SUB a0, a0, 0x1
493
494r_out:
495 jr ra
496 move a2, zero
497
498r_end_bytes_up:
499 lb t0, (a1)
500 SUB a2, a2, 0x1
501 sb t0, (a0)
502 ADD a1, a1, 0x1
503 bnez a2, r_end_bytes_up
504 ADD a0, a0, 0x1
505
506 jr ra
507 move a2, zero
508 END(__rmemcpy)
diff --git a/arch/mips/lib/promlib.c b/arch/mips/lib/promlib.c
new file mode 100644
index 000000000000..dddfe98b4ded
--- /dev/null
+++ b/arch/mips/lib/promlib.c
@@ -0,0 +1,24 @@
1#include <stdarg.h>
2#include <linux/kernel.h>
3
4extern void prom_putchar(char);
5
6void prom_printf(char *fmt, ...)
7{
8 va_list args;
9 char ppbuf[1024];
10 char *bptr;
11
12 va_start(args, fmt);
13 vsprintf(ppbuf, fmt, args);
14
15 bptr = ppbuf;
16
17 while (*bptr != 0) {
18 if (*bptr == '\n')
19 prom_putchar('\r');
20
21 prom_putchar(*bptr++);
22 }
23 va_end(args);
24}
diff --git a/arch/mips/lib/strlen_user.S b/arch/mips/lib/strlen_user.S
new file mode 100644
index 000000000000..07660e86c99d
--- /dev/null
+++ b/arch/mips/lib/strlen_user.S
@@ -0,0 +1,39 @@
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) 1996, 1998, 1999, 2004 by Ralf Baechle
7 * Copyright (c) 1999 Silicon Graphics, Inc.
8 */
9#include <asm/asm.h>
10#include <asm/offset.h>
11#include <asm/regdef.h>
12
13#define EX(insn,reg,addr,handler) \
149: insn reg, addr; \
15 .section __ex_table,"a"; \
16 PTR 9b, handler; \
17 .previous
18
19/*
20 * Return the size of a string (including the ending 0)
21 *
22 * Return 0 for error
23 */
24LEAF(__strlen_user_asm)
25 LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok?
26 and v0, a0
27 bnez v0, fault
28
29FEXPORT(__strlen_user_nocheck_asm)
30 move v0, a0
311: EX(lb, t0, (v0), fault)
32 PTR_ADDIU v0, 1
33 bnez t0, 1b
34 PTR_SUBU v0, a0
35 jr ra
36 END(__strlen_user_asm)
37
38fault: move v0, zero
39 jr ra
diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S
new file mode 100644
index 000000000000..14bed17c1648
--- /dev/null
+++ b/arch/mips/lib/strncpy_user.S
@@ -0,0 +1,58 @@
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) 1996, 1999 by Ralf Baechle
7 */
8#include <linux/errno.h>
9#include <asm/asm.h>
10#include <asm/offset.h>
11#include <asm/regdef.h>
12
13#define EX(insn,reg,addr,handler) \
149: insn reg, addr; \
15 .section __ex_table,"a"; \
16 PTR 9b, handler; \
17 .previous
18
19/*
20 * Returns: -EFAULT if exception before terminator, N if the entire
21 * buffer filled, else strlen.
22 */
23
24/*
25 * Ugly special case have to check: we might get passed a user space
26 * pointer which wraps into the kernel space. We don't deal with that. If
27 * it happens at most some bytes of the exceptions handlers will be copied.
28 */
29
30LEAF(__strncpy_from_user_asm)
31 LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok?
32 and v0, a1
33 bnez v0, fault
34
35FEXPORT(__strncpy_from_user_nocheck_asm)
36 move v0, zero
37 move v1, a1
38 .set noreorder
391: EX(lbu, t0, (v1), fault)
40 PTR_ADDIU v1, 1
41 beqz t0, 2f
42 sb t0, (a0)
43 PTR_ADDIU v0, 1
44 bne v0, a2, 1b
45 PTR_ADDIU a0, 1
46 .set reorder
472: PTR_ADDU t0, a1, v0
48 xor t0, a1
49 bltz t0, fault
50 jr ra # return n
51 END(__strncpy_from_user_asm)
52
53fault: li v0, -EFAULT
54 jr ra
55
56 .section __ex_table,"a"
57 PTR 1b, fault
58 .previous
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S
new file mode 100644
index 000000000000..6e7a8eed4de8
--- /dev/null
+++ b/arch/mips/lib/strnlen_user.S
@@ -0,0 +1,45 @@
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) 1996, 1998, 1999, 2004 by Ralf Baechle
7 * Copyright (c) 1999 Silicon Graphics, Inc.
8 */
9#include <asm/asm.h>
10#include <asm/offset.h>
11#include <asm/regdef.h>
12
13#define EX(insn,reg,addr,handler) \
149: insn reg, addr; \
15 .section __ex_table,"a"; \
16 PTR 9b, handler; \
17 .previous
18
19/*
20 * Return the size of a string including the ending NUL character upto a
21 * maximum of a1 or 0 in case of error.
22 *
23 * Note: for performance reasons we deliberately accept that a user may
24 * make strlen_user and strnlen_user access the first few KSEG0
25 * bytes. There's nothing secret there. On 64-bit accessing beyond
26 * the maximum is a tad hairier ...
27 */
28LEAF(__strnlen_user_asm)
29 LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok?
30 and v0, a0
31 bnez v0, fault
32
33FEXPORT(__strnlen_user_nocheck_asm)
34 move v0, a0
35 PTR_ADDU a1, a0 # stop pointer
361: beq v0, a1, 1f # limit reached?
37 EX(lb, t0, (v0), fault)
38 PTR_ADDU v0, 1
39 bnez t0, 1b
401: PTR_SUBU v0, a0
41 jr ra
42 END(__strnlen_user_asm)
43
44fault: move v0, zero
45 jr ra
diff --git a/arch/mips/math-emu/Makefile b/arch/mips/math-emu/Makefile
new file mode 100644
index 000000000000..121a848a3594
--- /dev/null
+++ b/arch/mips/math-emu/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the Linux/MIPS kernel FPU emulation.
3#
4
5obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
6 ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \
7 dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \
8 dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.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 \
11 dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
new file mode 100644
index 000000000000..20a552be02ee
--- /dev/null
+++ b/arch/mips/math-emu/cp1emu.c
@@ -0,0 +1,1322 @@
1/*
2 * cp1emu.c: a MIPS coprocessor 1 (fpu) instruction emulator
3 *
4 * MIPS floating point support
5 * Copyright (C) 1994-2000 Algorithmics Ltd.
6 * http://www.algor.co.uk
7 *
8 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
9 * Copyright (C) 2000 MIPS Technologies, Inc.
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * A complete emulator for MIPS coprocessor 1 instructions. This is
25 * required for #float(switch) or #float(trap), where it catches all
26 * COP1 instructions via the "CoProcessor Unusable" exception.
27 *
28 * More surprisingly it is also required for #float(ieee), to help out
29 * the hardware fpu at the boundaries of the IEEE-754 representation
30 * (denormalised values, infinities, underflow, etc). It is made
31 * quite nasty because emulation of some non-COP1 instructions is
32 * required, e.g. in branch delay slots.
33 *
34 * Note if you know that you won't have an fpu, then you'll get much
35 * better performance by compiling with -msoft-float!
36 */
37#include <linux/sched.h>
38
39#include <asm/inst.h>
40#include <asm/bootinfo.h>
41#include <asm/cpu.h>
42#include <asm/cpu-features.h>
43#include <asm/processor.h>
44#include <asm/ptrace.h>
45#include <asm/signal.h>
46#include <asm/mipsregs.h>
47#include <asm/fpu_emulator.h>
48#include <asm/uaccess.h>
49#include <asm/branch.h>
50
51#include "ieee754.h"
52#include "dsemul.h"
53
54/* Strap kernel emulator for full MIPS IV emulation */
55
56#ifdef __mips
57#undef __mips
58#endif
59#define __mips 4
60
61/* Function which emulates a floating point instruction. */
62
63static int fpu_emu(struct pt_regs *, struct mips_fpu_soft_struct *,
64 mips_instruction);
65
66#if __mips >= 4 && __mips != 32
67static int fpux_emu(struct pt_regs *,
68 struct mips_fpu_soft_struct *, mips_instruction);
69#endif
70
71/* Further private data for which no space exists in mips_fpu_soft_struct */
72
73struct mips_fpu_emulator_private fpuemuprivate;
74
75/* Control registers */
76
77#define FPCREG_RID 0 /* $0 = revision id */
78#define FPCREG_CSR 31 /* $31 = csr */
79
80/* Convert Mips rounding mode (0..3) to IEEE library modes. */
81static const unsigned char ieee_rm[4] = {
82 IEEE754_RN, IEEE754_RZ, IEEE754_RU, IEEE754_RD
83};
84
85#if __mips >= 4
86/* convert condition code register number to csr bit */
87static const unsigned int fpucondbit[8] = {
88 FPU_CSR_COND0,
89 FPU_CSR_COND1,
90 FPU_CSR_COND2,
91 FPU_CSR_COND3,
92 FPU_CSR_COND4,
93 FPU_CSR_COND5,
94 FPU_CSR_COND6,
95 FPU_CSR_COND7
96};
97#endif
98
99
100/*
101 * Redundant with logic already in kernel/branch.c,
102 * embedded in compute_return_epc. At some point,
103 * a single subroutine should be used across both
104 * modules.
105 */
106static int isBranchInstr(mips_instruction * i)
107{
108 switch (MIPSInst_OPCODE(*i)) {
109 case spec_op:
110 switch (MIPSInst_FUNC(*i)) {
111 case jalr_op:
112 case jr_op:
113 return 1;
114 }
115 break;
116
117 case bcond_op:
118 switch (MIPSInst_RT(*i)) {
119 case bltz_op:
120 case bgez_op:
121 case bltzl_op:
122 case bgezl_op:
123 case bltzal_op:
124 case bgezal_op:
125 case bltzall_op:
126 case bgezall_op:
127 return 1;
128 }
129 break;
130
131 case j_op:
132 case jal_op:
133 case jalx_op:
134 case beq_op:
135 case bne_op:
136 case blez_op:
137 case bgtz_op:
138 case beql_op:
139 case bnel_op:
140 case blezl_op:
141 case bgtzl_op:
142 return 1;
143
144 case cop0_op:
145 case cop1_op:
146 case cop2_op:
147 case cop1x_op:
148 if (MIPSInst_RS(*i) == bc_op)
149 return 1;
150 break;
151 }
152
153 return 0;
154}
155
156/*
157 * In the Linux kernel, we support selection of FPR format on the
158 * basis of the Status.FR bit. This does imply that, if a full 32
159 * FPRs are desired, there needs to be a flip-flop that can be written
160 * to one at that bit position. In any case, O32 MIPS ABI uses
161 * only the even FPRs (Status.FR = 0).
162 */
163
164#define CP0_STATUS_FR_SUPPORT
165
166#ifdef CP0_STATUS_FR_SUPPORT
167#define FR_BIT ST0_FR
168#else
169#define FR_BIT 0
170#endif
171
172#define SIFROMREG(si,x) ((si) = \
173 (xcp->cp0_status & FR_BIT) || !(x & 1) ? \
174 (int)ctx->fpr[x] : \
175 (int)(ctx->fpr[x & ~1] >> 32 ))
176#define SITOREG(si,x) (ctx->fpr[x & ~((xcp->cp0_status & FR_BIT) == 0)] = \
177 (xcp->cp0_status & FR_BIT) || !(x & 1) ? \
178 ctx->fpr[x & ~1] >> 32 << 32 | (u32)(si) : \
179 ctx->fpr[x & ~1] << 32 >> 32 | (u64)(si) << 32)
180
181#define DIFROMREG(di,x) ((di) = \
182 ctx->fpr[x & ~((xcp->cp0_status & FR_BIT) == 0)])
183#define DITOREG(di,x) (ctx->fpr[x & ~((xcp->cp0_status & FR_BIT) == 0)] \
184 = (di))
185
186#define SPFROMREG(sp,x) SIFROMREG((sp).bits,x)
187#define SPTOREG(sp,x) SITOREG((sp).bits,x)
188#define DPFROMREG(dp,x) DIFROMREG((dp).bits,x)
189#define DPTOREG(dp,x) DITOREG((dp).bits,x)
190
191/*
192 * Emulate the single floating point instruction pointed at by EPC.
193 * Two instructions if the instruction is in a branch delay slot.
194 */
195
196static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx)
197{
198 mips_instruction ir;
199 vaddr_t emulpc, contpc;
200 unsigned int cond;
201
202 if (get_user(ir, (mips_instruction *) xcp->cp0_epc)) {
203 fpuemuprivate.stats.errors++;
204 return SIGBUS;
205 }
206
207 /* XXX NEC Vr54xx bug workaround */
208 if ((xcp->cp0_cause & CAUSEF_BD) && !isBranchInstr(&ir))
209 xcp->cp0_cause &= ~CAUSEF_BD;
210
211 if (xcp->cp0_cause & CAUSEF_BD) {
212 /*
213 * The instruction to be emulated is in a branch delay slot
214 * which means that we have to emulate the branch instruction
215 * BEFORE we do the cop1 instruction.
216 *
217 * This branch could be a COP1 branch, but in that case we
218 * would have had a trap for that instruction, and would not
219 * come through this route.
220 *
221 * Linux MIPS branch emulator operates on context, updating the
222 * cp0_epc.
223 */
224 emulpc = REG_TO_VA(xcp->cp0_epc + 4); /* Snapshot emulation target */
225
226 if (__compute_return_epc(xcp)) {
227#ifdef CP1DBG
228 printk("failed to emulate branch at %p\n",
229 REG_TO_VA(xcp->cp0_epc));
230#endif
231 return SIGILL;
232 }
233 if (get_user(ir, (mips_instruction *) emulpc)) {
234 fpuemuprivate.stats.errors++;
235 return SIGBUS;
236 }
237 /* __compute_return_epc() will have updated cp0_epc */
238 contpc = REG_TO_VA xcp->cp0_epc;
239 /* In order not to confuse ptrace() et al, tweak context */
240 xcp->cp0_epc = VA_TO_REG emulpc - 4;
241 }
242 else {
243 emulpc = REG_TO_VA xcp->cp0_epc;
244 contpc = REG_TO_VA(xcp->cp0_epc + 4);
245 }
246
247 emul:
248 fpuemuprivate.stats.emulated++;
249 switch (MIPSInst_OPCODE(ir)) {
250#ifndef SINGLE_ONLY_FPU
251 case ldc1_op:{
252 u64 *va = REG_TO_VA(xcp->regs[MIPSInst_RS(ir)] +
253 MIPSInst_SIMM(ir));
254 u64 val;
255
256 fpuemuprivate.stats.loads++;
257 if (get_user(val, va)) {
258 fpuemuprivate.stats.errors++;
259 return SIGBUS;
260 }
261 DITOREG(val, MIPSInst_RT(ir));
262 break;
263 }
264
265 case sdc1_op:{
266 u64 *va = REG_TO_VA(xcp->regs[MIPSInst_RS(ir)] +
267 MIPSInst_SIMM(ir));
268 u64 val;
269
270 fpuemuprivate.stats.stores++;
271 DIFROMREG(val, MIPSInst_RT(ir));
272 if (put_user(val, va)) {
273 fpuemuprivate.stats.errors++;
274 return SIGBUS;
275 }
276 break;
277 }
278#endif
279
280 case lwc1_op:{
281 u32 *va = REG_TO_VA(xcp->regs[MIPSInst_RS(ir)] +
282 MIPSInst_SIMM(ir));
283 u32 val;
284
285 fpuemuprivate.stats.loads++;
286 if (get_user(val, va)) {
287 fpuemuprivate.stats.errors++;
288 return SIGBUS;
289 }
290#ifdef SINGLE_ONLY_FPU
291 if (MIPSInst_RT(ir) & 1) {
292 /* illegal register in single-float mode */
293 return SIGILL;
294 }
295#endif
296 SITOREG(val, MIPSInst_RT(ir));
297 break;
298 }
299
300 case swc1_op:{
301 u32 *va = REG_TO_VA(xcp->regs[MIPSInst_RS(ir)] +
302 MIPSInst_SIMM(ir));
303 u32 val;
304
305 fpuemuprivate.stats.stores++;
306#ifdef SINGLE_ONLY_FPU
307 if (MIPSInst_RT(ir) & 1) {
308 /* illegal register in single-float mode */
309 return SIGILL;
310 }
311#endif
312 SIFROMREG(val, MIPSInst_RT(ir));
313 if (put_user(val, va)) {
314 fpuemuprivate.stats.errors++;
315 return SIGBUS;
316 }
317 break;
318 }
319
320 case cop1_op:
321 switch (MIPSInst_RS(ir)) {
322
323#if __mips64 && !defined(SINGLE_ONLY_FPU)
324 case dmfc_op:
325 /* copregister fs -> gpr[rt] */
326 if (MIPSInst_RT(ir) != 0) {
327 DIFROMREG(xcp->regs[MIPSInst_RT(ir)],
328 MIPSInst_RD(ir));
329 }
330 break;
331
332 case dmtc_op:
333 /* copregister fs <- rt */
334 DITOREG(xcp->regs[MIPSInst_RT(ir)], MIPSInst_RD(ir));
335 break;
336#endif
337
338 case mfc_op:
339 /* copregister rd -> gpr[rt] */
340#ifdef SINGLE_ONLY_FPU
341 if (MIPSInst_RD(ir) & 1) {
342 /* illegal register in single-float mode */
343 return SIGILL;
344 }
345#endif
346 if (MIPSInst_RT(ir) != 0) {
347 SIFROMREG(xcp->regs[MIPSInst_RT(ir)],
348 MIPSInst_RD(ir));
349 }
350 break;
351
352 case mtc_op:
353 /* copregister rd <- rt */
354#ifdef SINGLE_ONLY_FPU
355 if (MIPSInst_RD(ir) & 1) {
356 /* illegal register in single-float mode */
357 return SIGILL;
358 }
359#endif
360 SITOREG(xcp->regs[MIPSInst_RT(ir)], MIPSInst_RD(ir));
361 break;
362
363 case cfc_op:{
364 /* cop control register rd -> gpr[rt] */
365 u32 value;
366
367 if (ir == CP1UNDEF) {
368 return do_dsemulret(xcp);
369 }
370 if (MIPSInst_RD(ir) == FPCREG_CSR) {
371 value = ctx->fcr31;
372#ifdef CSRTRACE
373 printk("%p gpr[%d]<-csr=%08x\n",
374 REG_TO_VA(xcp->cp0_epc),
375 MIPSInst_RT(ir), value);
376#endif
377 }
378 else if (MIPSInst_RD(ir) == FPCREG_RID)
379 value = 0;
380 else
381 value = 0;
382 if (MIPSInst_RT(ir))
383 xcp->regs[MIPSInst_RT(ir)] = value;
384 break;
385 }
386
387 case ctc_op:{
388 /* copregister rd <- rt */
389 u32 value;
390
391 if (MIPSInst_RT(ir) == 0)
392 value = 0;
393 else
394 value = xcp->regs[MIPSInst_RT(ir)];
395
396 /* we only have one writable control reg
397 */
398 if (MIPSInst_RD(ir) == FPCREG_CSR) {
399#ifdef CSRTRACE
400 printk("%p gpr[%d]->csr=%08x\n",
401 REG_TO_VA(xcp->cp0_epc),
402 MIPSInst_RT(ir), value);
403#endif
404 ctx->fcr31 = value;
405 /* copy new rounding mode and
406 flush bit to ieee library state! */
407 ieee754_csr.nod = (ctx->fcr31 & 0x1000000) != 0;
408 ieee754_csr.rm = ieee_rm[value & 0x3];
409 }
410 if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) {
411 return SIGFPE;
412 }
413 break;
414 }
415
416 case bc_op:{
417 int likely = 0;
418
419 if (xcp->cp0_cause & CAUSEF_BD)
420 return SIGILL;
421
422#if __mips >= 4
423 cond = ctx->fcr31 & fpucondbit[MIPSInst_RT(ir) >> 2];
424#else
425 cond = ctx->fcr31 & FPU_CSR_COND;
426#endif
427 switch (MIPSInst_RT(ir) & 3) {
428 case bcfl_op:
429 likely = 1;
430 case bcf_op:
431 cond = !cond;
432 break;
433 case bctl_op:
434 likely = 1;
435 case bct_op:
436 break;
437 default:
438 /* thats an illegal instruction */
439 return SIGILL;
440 }
441
442 xcp->cp0_cause |= CAUSEF_BD;
443 if (cond) {
444 /* branch taken: emulate dslot
445 * instruction
446 */
447 xcp->cp0_epc += 4;
448 contpc = REG_TO_VA
449 (xcp->cp0_epc +
450 (MIPSInst_SIMM(ir) << 2));
451
452 if (get_user(ir, (mips_instruction *)
453 REG_TO_VA xcp->cp0_epc)) {
454 fpuemuprivate.stats.errors++;
455 return SIGBUS;
456 }
457
458 switch (MIPSInst_OPCODE(ir)) {
459 case lwc1_op:
460 case swc1_op:
461#if (__mips >= 2 || __mips64) && !defined(SINGLE_ONLY_FPU)
462 case ldc1_op:
463 case sdc1_op:
464#endif
465 case cop1_op:
466#if __mips >= 4 && __mips != 32
467 case cop1x_op:
468#endif
469 /* its one of ours */
470 goto emul;
471#if __mips >= 4
472 case spec_op:
473 if (MIPSInst_FUNC(ir) == movc_op)
474 goto emul;
475 break;
476#endif
477 }
478
479 /*
480 * Single step the non-cp1
481 * instruction in the dslot
482 */
483 return mips_dsemul(xcp, ir, VA_TO_REG contpc);
484 }
485 else {
486 /* branch not taken */
487 if (likely) {
488 /*
489 * branch likely nullifies
490 * dslot if not taken
491 */
492 xcp->cp0_epc += 4;
493 contpc += 4;
494 /*
495 * else continue & execute
496 * dslot as normal insn
497 */
498 }
499 }
500 break;
501 }
502
503 default:
504 if (!(MIPSInst_RS(ir) & 0x10))
505 return SIGILL;
506 {
507 int sig;
508
509 /* a real fpu computation instruction */
510 if ((sig = fpu_emu(xcp, ctx, ir)))
511 return sig;
512 }
513 }
514 break;
515
516#if __mips >= 4 && __mips != 32
517 case cop1x_op:{
518 int sig;
519
520 if ((sig = fpux_emu(xcp, ctx, ir)))
521 return sig;
522 break;
523 }
524#endif
525
526#if __mips >= 4
527 case spec_op:
528 if (MIPSInst_FUNC(ir) != movc_op)
529 return SIGILL;
530 cond = fpucondbit[MIPSInst_RT(ir) >> 2];
531 if (((ctx->fcr31 & cond) != 0) == ((MIPSInst_RT(ir) & 1) != 0))
532 xcp->regs[MIPSInst_RD(ir)] =
533 xcp->regs[MIPSInst_RS(ir)];
534 break;
535#endif
536
537 default:
538 return SIGILL;
539 }
540
541 /* we did it !! */
542 xcp->cp0_epc = VA_TO_REG(contpc);
543 xcp->cp0_cause &= ~CAUSEF_BD;
544 return 0;
545}
546
547/*
548 * Conversion table from MIPS compare ops 48-63
549 * cond = ieee754dp_cmp(x,y,IEEE754_UN,sig);
550 */
551static const unsigned char cmptab[8] = {
552 0, /* cmp_0 (sig) cmp_sf */
553 IEEE754_CUN, /* cmp_un (sig) cmp_ngle */
554 IEEE754_CEQ, /* cmp_eq (sig) cmp_seq */
555 IEEE754_CEQ | IEEE754_CUN, /* cmp_ueq (sig) cmp_ngl */
556 IEEE754_CLT, /* cmp_olt (sig) cmp_lt */
557 IEEE754_CLT | IEEE754_CUN, /* cmp_ult (sig) cmp_nge */
558 IEEE754_CLT | IEEE754_CEQ, /* cmp_ole (sig) cmp_le */
559 IEEE754_CLT | IEEE754_CEQ | IEEE754_CUN, /* cmp_ule (sig) cmp_ngt */
560};
561
562
563#if __mips >= 4 && __mips != 32
564
565/*
566 * Additional MIPS4 instructions
567 */
568
569#define DEF3OP(name, p, f1, f2, f3) \
570static ieee754##p fpemu_##p##_##name (ieee754##p r, ieee754##p s, \
571 ieee754##p t) \
572{ \
573 struct ieee754_csr ieee754_csr_save; \
574 s = f1 (s, t); \
575 ieee754_csr_save = ieee754_csr; \
576 s = f2 (s, r); \
577 ieee754_csr_save.cx |= ieee754_csr.cx; \
578 ieee754_csr_save.sx |= ieee754_csr.sx; \
579 s = f3 (s); \
580 ieee754_csr.cx |= ieee754_csr_save.cx; \
581 ieee754_csr.sx |= ieee754_csr_save.sx; \
582 return s; \
583}
584
585static ieee754dp fpemu_dp_recip(ieee754dp d)
586{
587 return ieee754dp_div(ieee754dp_one(0), d);
588}
589
590static ieee754dp fpemu_dp_rsqrt(ieee754dp d)
591{
592 return ieee754dp_div(ieee754dp_one(0), ieee754dp_sqrt(d));
593}
594
595static ieee754sp fpemu_sp_recip(ieee754sp s)
596{
597 return ieee754sp_div(ieee754sp_one(0), s);
598}
599
600static ieee754sp fpemu_sp_rsqrt(ieee754sp s)
601{
602 return ieee754sp_div(ieee754sp_one(0), ieee754sp_sqrt(s));
603}
604
605DEF3OP(madd, sp, ieee754sp_mul, ieee754sp_add,);
606DEF3OP(msub, sp, ieee754sp_mul, ieee754sp_sub,);
607DEF3OP(nmadd, sp, ieee754sp_mul, ieee754sp_add, ieee754sp_neg);
608DEF3OP(nmsub, sp, ieee754sp_mul, ieee754sp_sub, ieee754sp_neg);
609DEF3OP(madd, dp, ieee754dp_mul, ieee754dp_add,);
610DEF3OP(msub, dp, ieee754dp_mul, ieee754dp_sub,);
611DEF3OP(nmadd, dp, ieee754dp_mul, ieee754dp_add, ieee754dp_neg);
612DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg);
613
614static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
615 mips_instruction ir)
616{
617 unsigned rcsr = 0; /* resulting csr */
618
619 fpuemuprivate.stats.cp1xops++;
620
621 switch (MIPSInst_FMA_FFMT(ir)) {
622 case s_fmt:{ /* 0 */
623
624 ieee754sp(*handler) (ieee754sp, ieee754sp, ieee754sp);
625 ieee754sp fd, fr, fs, ft;
626 u32 *va;
627 u32 val;
628
629 switch (MIPSInst_FUNC(ir)) {
630 case lwxc1_op:
631 va = REG_TO_VA(xcp->regs[MIPSInst_FR(ir)] +
632 xcp->regs[MIPSInst_FT(ir)]);
633
634 fpuemuprivate.stats.loads++;
635 if (get_user(val, va)) {
636 fpuemuprivate.stats.errors++;
637 return SIGBUS;
638 }
639#ifdef SINGLE_ONLY_FPU
640 if (MIPSInst_FD(ir) & 1) {
641 /* illegal register in single-float
642 * mode
643 */
644 return SIGILL;
645 }
646#endif
647 SITOREG(val, MIPSInst_FD(ir));
648 break;
649
650 case swxc1_op:
651 va = REG_TO_VA(xcp->regs[MIPSInst_FR(ir)] +
652 xcp->regs[MIPSInst_FT(ir)]);
653
654 fpuemuprivate.stats.stores++;
655#ifdef SINGLE_ONLY_FPU
656 if (MIPSInst_FS(ir) & 1) {
657 /* illegal register in single-float
658 * mode
659 */
660 return SIGILL;
661 }
662#endif
663
664 SIFROMREG(val, MIPSInst_FS(ir));
665 if (put_user(val, va)) {
666 fpuemuprivate.stats.errors++;
667 return SIGBUS;
668 }
669 break;
670
671 case madd_s_op:
672 handler = fpemu_sp_madd;
673 goto scoptop;
674 case msub_s_op:
675 handler = fpemu_sp_msub;
676 goto scoptop;
677 case nmadd_s_op:
678 handler = fpemu_sp_nmadd;
679 goto scoptop;
680 case nmsub_s_op:
681 handler = fpemu_sp_nmsub;
682 goto scoptop;
683
684 scoptop:
685 SPFROMREG(fr, MIPSInst_FR(ir));
686 SPFROMREG(fs, MIPSInst_FS(ir));
687 SPFROMREG(ft, MIPSInst_FT(ir));
688 fd = (*handler) (fr, fs, ft);
689 SPTOREG(fd, MIPSInst_FD(ir));
690
691 copcsr:
692 if (ieee754_cxtest(IEEE754_INEXACT))
693 rcsr |= FPU_CSR_INE_X | FPU_CSR_INE_S;
694 if (ieee754_cxtest(IEEE754_UNDERFLOW))
695 rcsr |= FPU_CSR_UDF_X | FPU_CSR_UDF_S;
696 if (ieee754_cxtest(IEEE754_OVERFLOW))
697 rcsr |= FPU_CSR_OVF_X | FPU_CSR_OVF_S;
698 if (ieee754_cxtest(IEEE754_INVALID_OPERATION))
699 rcsr |= FPU_CSR_INV_X | FPU_CSR_INV_S;
700
701 ctx->fcr31 = (ctx->fcr31 & ~FPU_CSR_ALL_X) | rcsr;
702 if (ieee754_csr.nod)
703 ctx->fcr31 |= 0x1000000;
704 if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) {
705 /*printk ("SIGFPE: fpu csr = %08x\n",
706 ctx->fcr31); */
707 return SIGFPE;
708 }
709
710 break;
711
712 default:
713 return SIGILL;
714 }
715 break;
716 }
717
718#ifndef SINGLE_ONLY_FPU
719 case d_fmt:{ /* 1 */
720 ieee754dp(*handler) (ieee754dp, ieee754dp, ieee754dp);
721 ieee754dp fd, fr, fs, ft;
722 u64 *va;
723 u64 val;
724
725 switch (MIPSInst_FUNC(ir)) {
726 case ldxc1_op:
727 va = REG_TO_VA(xcp->regs[MIPSInst_FR(ir)] +
728 xcp->regs[MIPSInst_FT(ir)]);
729
730 fpuemuprivate.stats.loads++;
731 if (get_user(val, va)) {
732 fpuemuprivate.stats.errors++;
733 return SIGBUS;
734 }
735 DITOREG(val, MIPSInst_FD(ir));
736 break;
737
738 case sdxc1_op:
739 va = REG_TO_VA(xcp->regs[MIPSInst_FR(ir)] +
740 xcp->regs[MIPSInst_FT(ir)]);
741
742 fpuemuprivate.stats.stores++;
743 DIFROMREG(val, MIPSInst_FS(ir));
744 if (put_user(val, va)) {
745 fpuemuprivate.stats.errors++;
746 return SIGBUS;
747 }
748 break;
749
750 case madd_d_op:
751 handler = fpemu_dp_madd;
752 goto dcoptop;
753 case msub_d_op:
754 handler = fpemu_dp_msub;
755 goto dcoptop;
756 case nmadd_d_op:
757 handler = fpemu_dp_nmadd;
758 goto dcoptop;
759 case nmsub_d_op:
760 handler = fpemu_dp_nmsub;
761 goto dcoptop;
762
763 dcoptop:
764 DPFROMREG(fr, MIPSInst_FR(ir));
765 DPFROMREG(fs, MIPSInst_FS(ir));
766 DPFROMREG(ft, MIPSInst_FT(ir));
767 fd = (*handler) (fr, fs, ft);
768 DPTOREG(fd, MIPSInst_FD(ir));
769 goto copcsr;
770
771 default:
772 return SIGILL;
773 }
774 break;
775 }
776#endif
777
778 case 0x7: /* 7 */
779 if (MIPSInst_FUNC(ir) != pfetch_op) {
780 return SIGILL;
781 }
782 /* ignore prefx operation */
783 break;
784
785 default:
786 return SIGILL;
787 }
788
789 return 0;
790}
791#endif
792
793
794
795/*
796 * Emulate a single COP1 arithmetic instruction.
797 */
798static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx,
799 mips_instruction ir)
800{
801 int rfmt; /* resulting format */
802 unsigned rcsr = 0; /* resulting csr */
803 unsigned cond;
804 union {
805 ieee754dp d;
806 ieee754sp s;
807 int w;
808#if __mips64
809 s64 l;
810#endif
811 } rv; /* resulting value */
812
813 fpuemuprivate.stats.cp1ops++;
814 switch (rfmt = (MIPSInst_FFMT(ir) & 0xf)) {
815 case s_fmt:{ /* 0 */
816 union {
817 ieee754sp(*b) (ieee754sp, ieee754sp);
818 ieee754sp(*u) (ieee754sp);
819 } handler;
820
821 switch (MIPSInst_FUNC(ir)) {
822 /* binary ops */
823 case fadd_op:
824 handler.b = ieee754sp_add;
825 goto scopbop;
826 case fsub_op:
827 handler.b = ieee754sp_sub;
828 goto scopbop;
829 case fmul_op:
830 handler.b = ieee754sp_mul;
831 goto scopbop;
832 case fdiv_op:
833 handler.b = ieee754sp_div;
834 goto scopbop;
835
836 /* unary ops */
837#if __mips >= 2 || __mips64
838 case fsqrt_op:
839 handler.u = ieee754sp_sqrt;
840 goto scopuop;
841#endif
842#if __mips >= 4 && __mips != 32
843 case frsqrt_op:
844 handler.u = fpemu_sp_rsqrt;
845 goto scopuop;
846 case frecip_op:
847 handler.u = fpemu_sp_recip;
848 goto scopuop;
849#endif
850#if __mips >= 4
851 case fmovc_op:
852 cond = fpucondbit[MIPSInst_FT(ir) >> 2];
853 if (((ctx->fcr31 & cond) != 0) !=
854 ((MIPSInst_FT(ir) & 1) != 0))
855 return 0;
856 SPFROMREG(rv.s, MIPSInst_FS(ir));
857 break;
858 case fmovz_op:
859 if (xcp->regs[MIPSInst_FT(ir)] != 0)
860 return 0;
861 SPFROMREG(rv.s, MIPSInst_FS(ir));
862 break;
863 case fmovn_op:
864 if (xcp->regs[MIPSInst_FT(ir)] == 0)
865 return 0;
866 SPFROMREG(rv.s, MIPSInst_FS(ir));
867 break;
868#endif
869 case fabs_op:
870 handler.u = ieee754sp_abs;
871 goto scopuop;
872 case fneg_op:
873 handler.u = ieee754sp_neg;
874 goto scopuop;
875 case fmov_op:
876 /* an easy one */
877 SPFROMREG(rv.s, MIPSInst_FS(ir));
878 goto copcsr;
879
880 /* binary op on handler */
881 scopbop:
882 {
883 ieee754sp fs, ft;
884
885 SPFROMREG(fs, MIPSInst_FS(ir));
886 SPFROMREG(ft, MIPSInst_FT(ir));
887
888 rv.s = (*handler.b) (fs, ft);
889 goto copcsr;
890 }
891 scopuop:
892 {
893 ieee754sp fs;
894
895 SPFROMREG(fs, MIPSInst_FS(ir));
896 rv.s = (*handler.u) (fs);
897 goto copcsr;
898 }
899 copcsr:
900 if (ieee754_cxtest(IEEE754_INEXACT))
901 rcsr |= FPU_CSR_INE_X | FPU_CSR_INE_S;
902 if (ieee754_cxtest(IEEE754_UNDERFLOW))
903 rcsr |= FPU_CSR_UDF_X | FPU_CSR_UDF_S;
904 if (ieee754_cxtest(IEEE754_OVERFLOW))
905 rcsr |= FPU_CSR_OVF_X | FPU_CSR_OVF_S;
906 if (ieee754_cxtest(IEEE754_ZERO_DIVIDE))
907 rcsr |= FPU_CSR_DIV_X | FPU_CSR_DIV_S;
908 if (ieee754_cxtest(IEEE754_INVALID_OPERATION))
909 rcsr |= FPU_CSR_INV_X | FPU_CSR_INV_S;
910 break;
911
912 /* unary conv ops */
913 case fcvts_op:
914 return SIGILL; /* not defined */
915 case fcvtd_op:{
916#ifdef SINGLE_ONLY_FPU
917 return SIGILL; /* not defined */
918#else
919 ieee754sp fs;
920
921 SPFROMREG(fs, MIPSInst_FS(ir));
922 rv.d = ieee754dp_fsp(fs);
923 rfmt = d_fmt;
924 goto copcsr;
925 }
926#endif
927 case fcvtw_op:{
928 ieee754sp fs;
929
930 SPFROMREG(fs, MIPSInst_FS(ir));
931 rv.w = ieee754sp_tint(fs);
932 rfmt = w_fmt;
933 goto copcsr;
934 }
935
936#if __mips >= 2 || __mips64
937 case fround_op:
938 case ftrunc_op:
939 case fceil_op:
940 case ffloor_op:{
941 unsigned int oldrm = ieee754_csr.rm;
942 ieee754sp fs;
943
944 SPFROMREG(fs, MIPSInst_FS(ir));
945 ieee754_csr.rm = ieee_rm[MIPSInst_FUNC(ir) & 0x3];
946 rv.w = ieee754sp_tint(fs);
947 ieee754_csr.rm = oldrm;
948 rfmt = w_fmt;
949 goto copcsr;
950 }
951#endif /* __mips >= 2 */
952
953#if __mips64 && !defined(SINGLE_ONLY_FPU)
954 case fcvtl_op:{
955 ieee754sp fs;
956
957 SPFROMREG(fs, MIPSInst_FS(ir));
958 rv.l = ieee754sp_tlong(fs);
959 rfmt = l_fmt;
960 goto copcsr;
961 }
962
963 case froundl_op:
964 case ftruncl_op:
965 case fceill_op:
966 case ffloorl_op:{
967 unsigned int oldrm = ieee754_csr.rm;
968 ieee754sp fs;
969
970 SPFROMREG(fs, MIPSInst_FS(ir));
971 ieee754_csr.rm = ieee_rm[MIPSInst_FUNC(ir) & 0x3];
972 rv.l = ieee754sp_tlong(fs);
973 ieee754_csr.rm = oldrm;
974 rfmt = l_fmt;
975 goto copcsr;
976 }
977#endif /* __mips64 && !fpu(single) */
978
979 default:
980 if (MIPSInst_FUNC(ir) >= fcmp_op) {
981 unsigned cmpop = MIPSInst_FUNC(ir) - fcmp_op;
982 ieee754sp fs, ft;
983
984 SPFROMREG(fs, MIPSInst_FS(ir));
985 SPFROMREG(ft, MIPSInst_FT(ir));
986 rv.w = ieee754sp_cmp(fs, ft,
987 cmptab[cmpop & 0x7], cmpop & 0x8);
988 rfmt = -1;
989 if ((cmpop & 0x8) && ieee754_cxtest
990 (IEEE754_INVALID_OPERATION))
991 rcsr = FPU_CSR_INV_X | FPU_CSR_INV_S;
992 else
993 goto copcsr;
994
995 }
996 else {
997 return SIGILL;
998 }
999 break;
1000 }
1001 break;
1002 }
1003
1004#ifndef SINGLE_ONLY_FPU
1005 case d_fmt:{
1006 union {
1007 ieee754dp(*b) (ieee754dp, ieee754dp);
1008 ieee754dp(*u) (ieee754dp);
1009 } handler;
1010
1011 switch (MIPSInst_FUNC(ir)) {
1012 /* binary ops */
1013 case fadd_op:
1014 handler.b = ieee754dp_add;
1015 goto dcopbop;
1016 case fsub_op:
1017 handler.b = ieee754dp_sub;
1018 goto dcopbop;
1019 case fmul_op:
1020 handler.b = ieee754dp_mul;
1021 goto dcopbop;
1022 case fdiv_op:
1023 handler.b = ieee754dp_div;
1024 goto dcopbop;
1025
1026 /* unary ops */
1027#if __mips >= 2 || __mips64
1028 case fsqrt_op:
1029 handler.u = ieee754dp_sqrt;
1030 goto dcopuop;
1031#endif
1032#if __mips >= 4 && __mips != 32
1033 case frsqrt_op:
1034 handler.u = fpemu_dp_rsqrt;
1035 goto dcopuop;
1036 case frecip_op:
1037 handler.u = fpemu_dp_recip;
1038 goto dcopuop;
1039#endif
1040#if __mips >= 4
1041 case fmovc_op:
1042 cond = fpucondbit[MIPSInst_FT(ir) >> 2];
1043 if (((ctx->fcr31 & cond) != 0) !=
1044 ((MIPSInst_FT(ir) & 1) != 0))
1045 return 0;
1046 DPFROMREG(rv.d, MIPSInst_FS(ir));
1047 break;
1048 case fmovz_op:
1049 if (xcp->regs[MIPSInst_FT(ir)] != 0)
1050 return 0;
1051 DPFROMREG(rv.d, MIPSInst_FS(ir));
1052 break;
1053 case fmovn_op:
1054 if (xcp->regs[MIPSInst_FT(ir)] == 0)
1055 return 0;
1056 DPFROMREG(rv.d, MIPSInst_FS(ir));
1057 break;
1058#endif
1059 case fabs_op:
1060 handler.u = ieee754dp_abs;
1061 goto dcopuop;
1062
1063 case fneg_op:
1064 handler.u = ieee754dp_neg;
1065 goto dcopuop;
1066
1067 case fmov_op:
1068 /* an easy one */
1069 DPFROMREG(rv.d, MIPSInst_FS(ir));
1070 goto copcsr;
1071
1072 /* binary op on handler */
1073 dcopbop:{
1074 ieee754dp fs, ft;
1075
1076 DPFROMREG(fs, MIPSInst_FS(ir));
1077 DPFROMREG(ft, MIPSInst_FT(ir));
1078
1079 rv.d = (*handler.b) (fs, ft);
1080 goto copcsr;
1081 }
1082 dcopuop:{
1083 ieee754dp fs;
1084
1085 DPFROMREG(fs, MIPSInst_FS(ir));
1086 rv.d = (*handler.u) (fs);
1087 goto copcsr;
1088 }
1089
1090 /* unary conv ops */
1091 case fcvts_op:{
1092 ieee754dp fs;
1093
1094 DPFROMREG(fs, MIPSInst_FS(ir));
1095 rv.s = ieee754sp_fdp(fs);
1096 rfmt = s_fmt;
1097 goto copcsr;
1098 }
1099 case fcvtd_op:
1100 return SIGILL; /* not defined */
1101
1102 case fcvtw_op:{
1103 ieee754dp fs;
1104
1105 DPFROMREG(fs, MIPSInst_FS(ir));
1106 rv.w = ieee754dp_tint(fs); /* wrong */
1107 rfmt = w_fmt;
1108 goto copcsr;
1109 }
1110
1111#if __mips >= 2 || __mips64
1112 case fround_op:
1113 case ftrunc_op:
1114 case fceil_op:
1115 case ffloor_op:{
1116 unsigned int oldrm = ieee754_csr.rm;
1117 ieee754dp fs;
1118
1119 DPFROMREG(fs, MIPSInst_FS(ir));
1120 ieee754_csr.rm = ieee_rm[MIPSInst_FUNC(ir) & 0x3];
1121 rv.w = ieee754dp_tint(fs);
1122 ieee754_csr.rm = oldrm;
1123 rfmt = w_fmt;
1124 goto copcsr;
1125 }
1126#endif
1127
1128#if __mips64 && !defined(SINGLE_ONLY_FPU)
1129 case fcvtl_op:{
1130 ieee754dp fs;
1131
1132 DPFROMREG(fs, MIPSInst_FS(ir));
1133 rv.l = ieee754dp_tlong(fs);
1134 rfmt = l_fmt;
1135 goto copcsr;
1136 }
1137
1138 case froundl_op:
1139 case ftruncl_op:
1140 case fceill_op:
1141 case ffloorl_op:{
1142 unsigned int oldrm = ieee754_csr.rm;
1143 ieee754dp fs;
1144
1145 DPFROMREG(fs, MIPSInst_FS(ir));
1146 ieee754_csr.rm = ieee_rm[MIPSInst_FUNC(ir) & 0x3];
1147 rv.l = ieee754dp_tlong(fs);
1148 ieee754_csr.rm = oldrm;
1149 rfmt = l_fmt;
1150 goto copcsr;
1151 }
1152#endif /* __mips >= 3 && !fpu(single) */
1153
1154 default:
1155 if (MIPSInst_FUNC(ir) >= fcmp_op) {
1156 unsigned cmpop = MIPSInst_FUNC(ir) - fcmp_op;
1157 ieee754dp fs, ft;
1158
1159 DPFROMREG(fs, MIPSInst_FS(ir));
1160 DPFROMREG(ft, MIPSInst_FT(ir));
1161 rv.w = ieee754dp_cmp(fs, ft,
1162 cmptab[cmpop & 0x7], cmpop & 0x8);
1163 rfmt = -1;
1164 if ((cmpop & 0x8)
1165 &&
1166 ieee754_cxtest
1167 (IEEE754_INVALID_OPERATION))
1168 rcsr = FPU_CSR_INV_X | FPU_CSR_INV_S;
1169 else
1170 goto copcsr;
1171
1172 }
1173 else {
1174 return SIGILL;
1175 }
1176 break;
1177 }
1178 break;
1179 }
1180#endif /* ifndef SINGLE_ONLY_FPU */
1181
1182 case w_fmt:{
1183 ieee754sp fs;
1184
1185 switch (MIPSInst_FUNC(ir)) {
1186 case fcvts_op:
1187 /* convert word to single precision real */
1188 SPFROMREG(fs, MIPSInst_FS(ir));
1189 rv.s = ieee754sp_fint(fs.bits);
1190 rfmt = s_fmt;
1191 goto copcsr;
1192#ifndef SINGLE_ONLY_FPU
1193 case fcvtd_op:
1194 /* convert word to double precision real */
1195 SPFROMREG(fs, MIPSInst_FS(ir));
1196 rv.d = ieee754dp_fint(fs.bits);
1197 rfmt = d_fmt;
1198 goto copcsr;
1199#endif
1200 default:
1201 return SIGILL;
1202 }
1203 break;
1204 }
1205
1206#if __mips64 && !defined(SINGLE_ONLY_FPU)
1207 case l_fmt:{
1208 switch (MIPSInst_FUNC(ir)) {
1209 case fcvts_op:
1210 /* convert long to single precision real */
1211 rv.s = ieee754sp_flong(ctx->fpr[MIPSInst_FS(ir)]);
1212 rfmt = s_fmt;
1213 goto copcsr;
1214 case fcvtd_op:
1215 /* convert long to double precision real */
1216 rv.d = ieee754dp_flong(ctx->fpr[MIPSInst_FS(ir)]);
1217 rfmt = d_fmt;
1218 goto copcsr;
1219 default:
1220 return SIGILL;
1221 }
1222 break;
1223 }
1224#endif
1225
1226 default:
1227 return SIGILL;
1228 }
1229
1230 /*
1231 * Update the fpu CSR register for this operation.
1232 * If an exception is required, generate a tidy SIGFPE exception,
1233 * without updating the result register.
1234 * Note: cause exception bits do not accumulate, they are rewritten
1235 * for each op; only the flag/sticky bits accumulate.
1236 */
1237 ctx->fcr31 = (ctx->fcr31 & ~FPU_CSR_ALL_X) | rcsr;
1238 if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) {
1239 /*printk ("SIGFPE: fpu csr = %08x\n",ctx->fcr31); */
1240 return SIGFPE;
1241 }
1242
1243 /*
1244 * Now we can safely write the result back to the register file.
1245 */
1246 switch (rfmt) {
1247 case -1:{
1248#if __mips >= 4
1249 cond = fpucondbit[MIPSInst_FD(ir) >> 2];
1250#else
1251 cond = FPU_CSR_COND;
1252#endif
1253 if (rv.w)
1254 ctx->fcr31 |= cond;
1255 else
1256 ctx->fcr31 &= ~cond;
1257 break;
1258 }
1259#ifndef SINGLE_ONLY_FPU
1260 case d_fmt:
1261 DPTOREG(rv.d, MIPSInst_FD(ir));
1262 break;
1263#endif
1264 case s_fmt:
1265 SPTOREG(rv.s, MIPSInst_FD(ir));
1266 break;
1267 case w_fmt:
1268 SITOREG(rv.w, MIPSInst_FD(ir));
1269 break;
1270#if __mips64 && !defined(SINGLE_ONLY_FPU)
1271 case l_fmt:
1272 DITOREG(rv.l, MIPSInst_FD(ir));
1273 break;
1274#endif
1275 default:
1276 return SIGILL;
1277 }
1278
1279 return 0;
1280}
1281
1282int fpu_emulator_cop1Handler(int xcptno, struct pt_regs *xcp,
1283 struct mips_fpu_soft_struct *ctx)
1284{
1285 gpreg_t oldepc, prevepc;
1286 mips_instruction insn;
1287 int sig = 0;
1288
1289 oldepc = xcp->cp0_epc;
1290 do {
1291 prevepc = xcp->cp0_epc;
1292
1293 if (get_user(insn, (mips_instruction *) xcp->cp0_epc)) {
1294 fpuemuprivate.stats.errors++;
1295 return SIGBUS;
1296 }
1297 if (insn == 0)
1298 xcp->cp0_epc += 4; /* skip nops */
1299 else {
1300 /* Update ieee754_csr. Only relevant if we have a
1301 h/w FPU */
1302 ieee754_csr.nod = (ctx->fcr31 & 0x1000000) != 0;
1303 ieee754_csr.rm = ieee_rm[ctx->fcr31 & 0x3];
1304 ieee754_csr.cx = (ctx->fcr31 >> 12) & 0x1f;
1305 sig = cop1Emulate(xcp, ctx);
1306 }
1307
1308 if (cpu_has_fpu)
1309 break;
1310 if (sig)
1311 break;
1312
1313 cond_resched();
1314 } while (xcp->cp0_epc > prevepc);
1315
1316 /* SIGILL indicates a non-fpu instruction */
1317 if (sig == SIGILL && xcp->cp0_epc != oldepc)
1318 /* but if epc has advanced, then ignore it */
1319 sig = 0;
1320
1321 return sig;
1322}
diff --git a/arch/mips/math-emu/dp_add.c b/arch/mips/math-emu/dp_add.c
new file mode 100644
index 000000000000..bcf73bb5c33a
--- /dev/null
+++ b/arch/mips/math-emu/dp_add.c
@@ -0,0 +1,183 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 *
26 */
27
28
29#include "ieee754dp.h"
30
31ieee754dp ieee754dp_add(ieee754dp x, ieee754dp y)
32{
33 COMPXDP;
34 COMPYDP;
35
36 EXPLODEXDP;
37 EXPLODEYDP;
38
39 CLEARCX;
40
41 FLUSHXDP;
42 FLUSHYDP;
43
44 switch (CLPAIR(xc, yc)) {
45 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN):
46 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN):
47 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN):
48 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN):
49 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN):
50 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN):
51 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN):
52 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO):
53 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
54 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
55 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
56 SETCX(IEEE754_INVALID_OPERATION);
57 return ieee754dp_nanxcpt(ieee754dp_indef(), "add", x, y);
58
59 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
60 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
61 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN):
62 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
63 return y;
64
65 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
66 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
67 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
68 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
69 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF):
70 return x;
71
72
73 /* Infinity handling
74 */
75
76 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
77 if (xs == ys)
78 return x;
79 SETCX(IEEE754_INVALID_OPERATION);
80 return ieee754dp_xcpt(ieee754dp_indef(), "add", x, y);
81
82 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
83 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
84 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
85 return y;
86
87 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
88 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
89 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
90 return x;
91
92 /* Zero handling
93 */
94
95 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
96 if (xs == ys)
97 return x;
98 else
99 return ieee754dp_zero(ieee754_csr.rm ==
100 IEEE754_RD);
101
102 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
103 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
104 return x;
105
106 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
107 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM):
108 return y;
109
110 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
111 DPDNORMX;
112
113 /* FALL THROUGH */
114
115 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
116 DPDNORMY;
117 break;
118
119 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM):
120 DPDNORMX;
121 break;
122
123 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
124 break;
125 }
126 assert(xm & DP_HIDDEN_BIT);
127 assert(ym & DP_HIDDEN_BIT);
128
129 /* provide guard,round and stick bit space */
130 xm <<= 3;
131 ym <<= 3;
132
133 if (xe > ye) {
134 /* have to shift y fraction right to align
135 */
136 int s = xe - ye;
137 ym = XDPSRS(ym, s);
138 ye += s;
139 } else if (ye > xe) {
140 /* have to shift x fraction right to align
141 */
142 int s = ye - xe;
143 xm = XDPSRS(xm, s);
144 xe += s;
145 }
146 assert(xe == ye);
147 assert(xe <= DP_EMAX);
148
149 if (xs == ys) {
150 /* generate 28 bit result of adding two 27 bit numbers
151 * leaving result in xm,xs,xe
152 */
153 xm = xm + ym;
154 xe = xe;
155 xs = xs;
156
157 if (xm >> (DP_MBITS + 1 + 3)) { /* carry out */
158 xm = XDPSRS1(xm);
159 xe++;
160 }
161 } else {
162 if (xm >= ym) {
163 xm = xm - ym;
164 xe = xe;
165 xs = xs;
166 } else {
167 xm = ym - xm;
168 xe = xe;
169 xs = ys;
170 }
171 if (xm == 0)
172 return ieee754dp_zero(ieee754_csr.rm ==
173 IEEE754_RD);
174
175 /* normalize to rounding precision */
176 while ((xm >> (DP_MBITS + 3)) == 0) {
177 xm <<= 1;
178 xe--;
179 }
180
181 }
182 DPNORMRET2(xs, xe, xm, "add", x, y);
183}
diff --git a/arch/mips/math-emu/dp_cmp.c b/arch/mips/math-emu/dp_cmp.c
new file mode 100644
index 000000000000..8ab4f320a478
--- /dev/null
+++ b/arch/mips/math-emu/dp_cmp.c
@@ -0,0 +1,67 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30int ieee754dp_cmp(ieee754dp x, ieee754dp y, int cmp, int sig)
31{
32 COMPXDP;
33 COMPYDP;
34
35 EXPLODEXDP;
36 EXPLODEYDP;
37 FLUSHXDP;
38 FLUSHYDP;
39 CLEARCX; /* Even clear inexact flag here */
40
41 if (ieee754dp_isnan(x) || ieee754dp_isnan(y)) {
42 if (sig || xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN)
43 SETCX(IEEE754_INVALID_OPERATION);
44 if (cmp & IEEE754_CUN)
45 return 1;
46 if (cmp & (IEEE754_CLT | IEEE754_CGT)) {
47 if (sig && SETANDTESTCX(IEEE754_INVALID_OPERATION))
48 return ieee754si_xcpt(0, "fcmpf", x);
49 }
50 return 0;
51 } else {
52 s64 vx = x.bits;
53 s64 vy = y.bits;
54
55 if (vx < 0)
56 vx = -vx ^ DP_SIGN_BIT;
57 if (vy < 0)
58 vy = -vy ^ DP_SIGN_BIT;
59
60 if (vx < vy)
61 return (cmp & IEEE754_CLT) != 0;
62 else if (vx == vy)
63 return (cmp & IEEE754_CEQ) != 0;
64 else
65 return (cmp & IEEE754_CGT) != 0;
66 }
67}
diff --git a/arch/mips/math-emu/dp_div.c b/arch/mips/math-emu/dp_div.c
new file mode 100644
index 000000000000..6acedce3b32d
--- /dev/null
+++ b/arch/mips/math-emu/dp_div.c
@@ -0,0 +1,157 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30ieee754dp ieee754dp_div(ieee754dp x, ieee754dp y)
31{
32 COMPXDP;
33 COMPYDP;
34
35 EXPLODEXDP;
36 EXPLODEYDP;
37
38 CLEARCX;
39
40 FLUSHXDP;
41 FLUSHYDP;
42
43 switch (CLPAIR(xc, yc)) {
44 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN):
45 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN):
46 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN):
47 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN):
48 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN):
49 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN):
50 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN):
51 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO):
52 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
53 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
54 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
55 SETCX(IEEE754_INVALID_OPERATION);
56 return ieee754dp_nanxcpt(ieee754dp_indef(), "div", x, y);
57
58 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
59 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
60 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN):
61 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
62 return y;
63
64 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
65 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
66 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
67 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
68 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF):
69 return x;
70
71
72 /* Infinity handling
73 */
74
75 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
76 SETCX(IEEE754_INVALID_OPERATION);
77 return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y);
78
79 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
80 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
81 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
82 return ieee754dp_zero(xs ^ ys);
83
84 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
85 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
86 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
87 return ieee754dp_inf(xs ^ ys);
88
89 /* Zero handling
90 */
91
92 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
93 SETCX(IEEE754_INVALID_OPERATION);
94 return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y);
95
96 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
97 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
98 SETCX(IEEE754_ZERO_DIVIDE);
99 return ieee754dp_xcpt(ieee754dp_inf(xs ^ ys), "div", x, y);
100
101 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
102 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM):
103 return ieee754dp_zero(xs == ys ? 0 : 1);
104
105 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
106 DPDNORMX;
107
108 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
109 DPDNORMY;
110 break;
111
112 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM):
113 DPDNORMX;
114 break;
115
116 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
117 break;
118 }
119 assert(xm & DP_HIDDEN_BIT);
120 assert(ym & DP_HIDDEN_BIT);
121
122 /* provide rounding space */
123 xm <<= 3;
124 ym <<= 3;
125
126 {
127 /* now the dirty work */
128
129 u64 rm = 0;
130 int re = xe - ye;
131 u64 bm;
132
133 for (bm = DP_MBIT(DP_MBITS + 2); bm; bm >>= 1) {
134 if (xm >= ym) {
135 xm -= ym;
136 rm |= bm;
137 if (xm == 0)
138 break;
139 }
140 xm <<= 1;
141 }
142 rm <<= 1;
143 if (xm)
144 rm |= 1; /* have remainder, set sticky */
145
146 assert(rm);
147
148 /* normalise rm to rounding precision ?
149 */
150 while ((rm >> (DP_MBITS + 3)) == 0) {
151 rm <<= 1;
152 re--;
153 }
154
155 DPNORMRET2(xs == ys ? 0 : 1, re, rm, "div", x, y);
156 }
157}
diff --git a/arch/mips/math-emu/dp_fint.c b/arch/mips/math-emu/dp_fint.c
new file mode 100644
index 000000000000..0065deaee24b
--- /dev/null
+++ b/arch/mips/math-emu/dp_fint.c
@@ -0,0 +1,80 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30ieee754dp ieee754dp_fint(int x)
31{
32 COMPXDP;
33
34 CLEARCX;
35
36 xc = ( 0 ? xc : xc );
37
38 if (x == 0)
39 return ieee754dp_zero(0);
40 if (x == 1 || x == -1)
41 return ieee754dp_one(x < 0);
42 if (x == 10 || x == -10)
43 return ieee754dp_ten(x < 0);
44
45 xs = (x < 0);
46 if (xs) {
47 if (x == (1 << 31))
48 xm = ((unsigned) 1 << 31); /* max neg can't be safely negated */
49 else
50 xm = -x;
51 } else {
52 xm = x;
53 }
54
55#if 1
56 /* normalize - result can never be inexact or overflow */
57 xe = DP_MBITS;
58 while ((xm >> DP_MBITS) == 0) {
59 xm <<= 1;
60 xe--;
61 }
62 return builddp(xs, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
63#else
64 /* normalize */
65 xe = DP_MBITS + 3;
66 while ((xm >> (DP_MBITS + 3)) == 0) {
67 xm <<= 1;
68 xe--;
69 }
70 DPNORMRET1(xs, xe, xm, "fint", x);
71#endif
72}
73
74ieee754dp ieee754dp_funs(unsigned int u)
75{
76 if ((int) u < 0)
77 return ieee754dp_add(ieee754dp_1e31(),
78 ieee754dp_fint(u & ~(1 << 31)));
79 return ieee754dp_fint(u);
80}
diff --git a/arch/mips/math-emu/dp_flong.c b/arch/mips/math-emu/dp_flong.c
new file mode 100644
index 000000000000..cb105b1dd860
--- /dev/null
+++ b/arch/mips/math-emu/dp_flong.c
@@ -0,0 +1,78 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30ieee754dp ieee754dp_flong(s64 x)
31{
32 COMPXDP;
33
34 CLEARCX;
35
36 xc = ( 0 ? xc : xc );
37
38 if (x == 0)
39 return ieee754dp_zero(0);
40 if (x == 1 || x == -1)
41 return ieee754dp_one(x < 0);
42 if (x == 10 || x == -10)
43 return ieee754dp_ten(x < 0);
44
45 xs = (x < 0);
46 if (xs) {
47 if (x == (1ULL << 63))
48 xm = (1ULL << 63); /* max neg can't be safely negated */
49 else
50 xm = -x;
51 } else {
52 xm = x;
53 }
54
55 /* normalize */
56 xe = DP_MBITS + 3;
57 if (xm >> (DP_MBITS + 1 + 3)) {
58 /* shunt out overflow bits */
59 while (xm >> (DP_MBITS + 1 + 3)) {
60 XDPSRSX1();
61 }
62 } else {
63 /* normalize in grs extended double precision */
64 while ((xm >> (DP_MBITS + 3)) == 0) {
65 xm <<= 1;
66 xe--;
67 }
68 }
69 DPNORMRET1(xs, xe, xm, "dp_flong", x);
70}
71
72ieee754dp ieee754dp_fulong(u64 u)
73{
74 if ((s64) u < 0)
75 return ieee754dp_add(ieee754dp_1e63(),
76 ieee754dp_flong(u & ~(1ULL << 63)));
77 return ieee754dp_flong(u);
78}
diff --git a/arch/mips/math-emu/dp_frexp.c b/arch/mips/math-emu/dp_frexp.c
new file mode 100644
index 000000000000..e650cb10c947
--- /dev/null
+++ b/arch/mips/math-emu/dp_frexp.c
@@ -0,0 +1,53 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30/* close to ieeep754dp_logb
31*/
32ieee754dp ieee754dp_frexp(ieee754dp x, int *eptr)
33{
34 COMPXDP;
35 CLEARCX;
36 EXPLODEXDP;
37
38 switch (xc) {
39 case IEEE754_CLASS_SNAN:
40 case IEEE754_CLASS_QNAN:
41 case IEEE754_CLASS_INF:
42 case IEEE754_CLASS_ZERO:
43 *eptr = 0;
44 return x;
45 case IEEE754_CLASS_DNORM:
46 DPDNORMX;
47 break;
48 case IEEE754_CLASS_NORM:
49 break;
50 }
51 *eptr = xe + 1;
52 return builddp(xs, -1 + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
53}
diff --git a/arch/mips/math-emu/dp_fsp.c b/arch/mips/math-emu/dp_fsp.c
new file mode 100644
index 000000000000..494d19ac7049
--- /dev/null
+++ b/arch/mips/math-emu/dp_fsp.c
@@ -0,0 +1,74 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30ieee754dp ieee754dp_fsp(ieee754sp x)
31{
32 COMPXSP;
33
34 EXPLODEXSP;
35
36 CLEARCX;
37
38 FLUSHXSP;
39
40 switch (xc) {
41 case IEEE754_CLASS_SNAN:
42 SETCX(IEEE754_INVALID_OPERATION);
43 return ieee754dp_nanxcpt(ieee754dp_indef(), "fsp");
44 case IEEE754_CLASS_QNAN:
45 return ieee754dp_nanxcpt(builddp(xs,
46 DP_EMAX + 1 + DP_EBIAS,
47 ((u64) xm
48 << (DP_MBITS -
49 SP_MBITS))), "fsp",
50 x);
51 case IEEE754_CLASS_INF:
52 return ieee754dp_inf(xs);
53 case IEEE754_CLASS_ZERO:
54 return ieee754dp_zero(xs);
55 case IEEE754_CLASS_DNORM:
56 /* normalize */
57 while ((xm >> SP_MBITS) == 0) {
58 xm <<= 1;
59 xe--;
60 }
61 break;
62 case IEEE754_CLASS_NORM:
63 break;
64 }
65
66 /* CANT possibly overflow,underflow, or need rounding
67 */
68
69 /* drop the hidden bit */
70 xm &= ~SP_HIDDEN_BIT;
71
72 return builddp(xs, xe + DP_EBIAS,
73 (u64) xm << (DP_MBITS - SP_MBITS));
74}
diff --git a/arch/mips/math-emu/dp_logb.c b/arch/mips/math-emu/dp_logb.c
new file mode 100644
index 000000000000..603388621ca5
--- /dev/null
+++ b/arch/mips/math-emu/dp_logb.c
@@ -0,0 +1,54 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30ieee754dp ieee754dp_logb(ieee754dp x)
31{
32 COMPXDP;
33
34 CLEARCX;
35
36 EXPLODEXDP;
37
38 switch (xc) {
39 case IEEE754_CLASS_SNAN:
40 return ieee754dp_nanxcpt(x, "logb", x);
41 case IEEE754_CLASS_QNAN:
42 return x;
43 case IEEE754_CLASS_INF:
44 return ieee754dp_inf(0);
45 case IEEE754_CLASS_ZERO:
46 return ieee754dp_inf(1);
47 case IEEE754_CLASS_DNORM:
48 DPDNORMX;
49 break;
50 case IEEE754_CLASS_NORM:
51 break;
52 }
53 return ieee754dp_fint(xe);
54}
diff --git a/arch/mips/math-emu/dp_modf.c b/arch/mips/math-emu/dp_modf.c
new file mode 100644
index 000000000000..25861a42c36f
--- /dev/null
+++ b/arch/mips/math-emu/dp_modf.c
@@ -0,0 +1,80 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30/* modf function is always exact for a finite number
31*/
32ieee754dp ieee754dp_modf(ieee754dp x, ieee754dp * ip)
33{
34 COMPXDP;
35
36 CLEARCX;
37
38 EXPLODEXDP;
39
40 switch (xc) {
41 case IEEE754_CLASS_SNAN:
42 case IEEE754_CLASS_QNAN:
43 case IEEE754_CLASS_INF:
44 case IEEE754_CLASS_ZERO:
45 *ip = x;
46 return x;
47 case IEEE754_CLASS_DNORM:
48 /* far to small */
49 *ip = ieee754dp_zero(xs);
50 return x;
51 case IEEE754_CLASS_NORM:
52 break;
53 }
54 if (xe < 0) {
55 *ip = ieee754dp_zero(xs);
56 return x;
57 }
58 if (xe >= DP_MBITS) {
59 *ip = x;
60 return ieee754dp_zero(xs);
61 }
62 /* generate ipart mantissa by clearing bottom bits
63 */
64 *ip = builddp(xs, xe + DP_EBIAS,
65 ((xm >> (DP_MBITS - xe)) << (DP_MBITS - xe)) &
66 ~DP_HIDDEN_BIT);
67
68 /* generate fpart mantissa by clearing top bits
69 * and normalizing (must be able to normalize)
70 */
71 xm = (xm << (64 - (DP_MBITS - xe))) >> (64 - (DP_MBITS - xe));
72 if (xm == 0)
73 return ieee754dp_zero(xs);
74
75 while ((xm >> DP_MBITS) == 0) {
76 xm <<= 1;
77 xe--;
78 }
79 return builddp(xs, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
80}
diff --git a/arch/mips/math-emu/dp_mul.c b/arch/mips/math-emu/dp_mul.c
new file mode 100644
index 000000000000..f2373902f524
--- /dev/null
+++ b/arch/mips/math-emu/dp_mul.c
@@ -0,0 +1,177 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30ieee754dp ieee754dp_mul(ieee754dp x, ieee754dp y)
31{
32 COMPXDP;
33 COMPYDP;
34
35 EXPLODEXDP;
36 EXPLODEYDP;
37
38 CLEARCX;
39
40 FLUSHXDP;
41 FLUSHYDP;
42
43 switch (CLPAIR(xc, yc)) {
44 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN):
45 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN):
46 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN):
47 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN):
48 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN):
49 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN):
50 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN):
51 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO):
52 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
53 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
54 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
55 SETCX(IEEE754_INVALID_OPERATION);
56 return ieee754dp_nanxcpt(ieee754dp_indef(), "mul", x, y);
57
58 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
59 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
60 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN):
61 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
62 return y;
63
64 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
65 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
66 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
67 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
68 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF):
69 return x;
70
71
72 /* Infinity handling */
73
74 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
75 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
76 SETCX(IEEE754_INVALID_OPERATION);
77 return ieee754dp_xcpt(ieee754dp_indef(), "mul", x, y);
78
79 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
80 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
81 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
82 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
83 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
84 return ieee754dp_inf(xs ^ ys);
85
86 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
87 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
88 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM):
89 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
90 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
91 return ieee754dp_zero(xs ^ ys);
92
93
94 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
95 DPDNORMX;
96
97 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
98 DPDNORMY;
99 break;
100
101 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM):
102 DPDNORMX;
103 break;
104
105 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
106 break;
107 }
108 /* rm = xm * ym, re = xe+ye basicly */
109 assert(xm & DP_HIDDEN_BIT);
110 assert(ym & DP_HIDDEN_BIT);
111 {
112 int re = xe + ye;
113 int rs = xs ^ ys;
114 u64 rm;
115
116 /* shunt to top of word */
117 xm <<= 64 - (DP_MBITS + 1);
118 ym <<= 64 - (DP_MBITS + 1);
119
120 /* multiply 32bits xm,ym to give high 32bits rm with stickness
121 */
122
123 /* 32 * 32 => 64 */
124#define DPXMULT(x,y) ((u64)(x) * (u64)y)
125
126 {
127 unsigned lxm = xm;
128 unsigned hxm = xm >> 32;
129 unsigned lym = ym;
130 unsigned hym = ym >> 32;
131 u64 lrm;
132 u64 hrm;
133
134 lrm = DPXMULT(lxm, lym);
135 hrm = DPXMULT(hxm, hym);
136
137 {
138 u64 t = DPXMULT(lxm, hym);
139 {
140 u64 at =
141 lrm + (t << 32);
142 hrm += at < lrm;
143 lrm = at;
144 }
145 hrm = hrm + (t >> 32);
146 }
147
148 {
149 u64 t = DPXMULT(hxm, lym);
150 {
151 u64 at =
152 lrm + (t << 32);
153 hrm += at < lrm;
154 lrm = at;
155 }
156 hrm = hrm + (t >> 32);
157 }
158 rm = hrm | (lrm != 0);
159 }
160
161 /*
162 * sticky shift down to normal rounding precision
163 */
164 if ((s64) rm < 0) {
165 rm =
166 (rm >> (64 - (DP_MBITS + 1 + 3))) |
167 ((rm << (DP_MBITS + 1 + 3)) != 0);
168 re++;
169 } else {
170 rm =
171 (rm >> (64 - (DP_MBITS + 1 + 3 + 1))) |
172 ((rm << (DP_MBITS + 1 + 3 + 1)) != 0);
173 }
174 assert(rm & (DP_HIDDEN_BIT << 3));
175 DPNORMRET2(rs, re, rm, "mul", x, y);
176 }
177}
diff --git a/arch/mips/math-emu/dp_scalb.c b/arch/mips/math-emu/dp_scalb.c
new file mode 100644
index 000000000000..b84e6338330e
--- /dev/null
+++ b/arch/mips/math-emu/dp_scalb.c
@@ -0,0 +1,58 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30ieee754dp ieee754dp_scalb(ieee754dp x, int n)
31{
32 COMPXDP;
33
34 CLEARCX;
35
36 EXPLODEXDP;
37
38 switch (xc) {
39 case IEEE754_CLASS_SNAN:
40 return ieee754dp_nanxcpt(x, "scalb", x, n);
41 case IEEE754_CLASS_QNAN:
42 case IEEE754_CLASS_INF:
43 case IEEE754_CLASS_ZERO:
44 return x;
45 case IEEE754_CLASS_DNORM:
46 DPDNORMX;
47 break;
48 case IEEE754_CLASS_NORM:
49 break;
50 }
51 DPNORMRET2(xs, xe + n, xm << 3, "scalb", x, n);
52}
53
54
55ieee754dp ieee754dp_ldexp(ieee754dp x, int n)
56{
57 return ieee754dp_scalb(x, n);
58}
diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c
new file mode 100644
index 000000000000..495c1ac94298
--- /dev/null
+++ b/arch/mips/math-emu/dp_simple.c
@@ -0,0 +1,84 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30int ieee754dp_finite(ieee754dp x)
31{
32 return DPBEXP(x) != DP_EMAX + 1 + DP_EBIAS;
33}
34
35ieee754dp ieee754dp_copysign(ieee754dp x, ieee754dp y)
36{
37 CLEARCX;
38 DPSIGN(x) = DPSIGN(y);
39 return x;
40}
41
42
43ieee754dp ieee754dp_neg(ieee754dp x)
44{
45 COMPXDP;
46
47 EXPLODEXDP;
48 CLEARCX;
49 FLUSHXDP;
50
51 if (xc == IEEE754_CLASS_SNAN) {
52 SETCX(IEEE754_INVALID_OPERATION);
53 return ieee754dp_nanxcpt(ieee754dp_indef(), "neg");
54 }
55
56 if (ieee754dp_isnan(x)) /* but not infinity */
57 return ieee754dp_nanxcpt(x, "neg", x);
58
59 /* quick fix up */
60 DPSIGN(x) ^= 1;
61 return x;
62}
63
64
65ieee754dp ieee754dp_abs(ieee754dp x)
66{
67 COMPXDP;
68
69 EXPLODEXDP;
70 CLEARCX;
71 FLUSHXDP;
72
73 if (xc == IEEE754_CLASS_SNAN) {
74 SETCX(IEEE754_INVALID_OPERATION);
75 return ieee754dp_nanxcpt(ieee754dp_indef(), "neg");
76 }
77
78 if (ieee754dp_isnan(x)) /* but not infinity */
79 return ieee754dp_nanxcpt(x, "abs", x);
80
81 /* quick fix up */
82 DPSIGN(x) = 0;
83 return x;
84}
diff --git a/arch/mips/math-emu/dp_sqrt.c b/arch/mips/math-emu/dp_sqrt.c
new file mode 100644
index 000000000000..c35e871ae975
--- /dev/null
+++ b/arch/mips/math-emu/dp_sqrt.c
@@ -0,0 +1,165 @@
1/* IEEE754 floating point arithmetic
2 * double precision square root
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30static const unsigned table[] = {
31 0, 1204, 3062, 5746, 9193, 13348, 18162, 23592,
32 29598, 36145, 43202, 50740, 58733, 67158, 75992,
33 85215, 83599, 71378, 60428, 50647, 41945, 34246,
34 27478, 21581, 16499, 12183, 8588, 5674, 3403,
35 1742, 661, 130
36};
37
38ieee754dp ieee754dp_sqrt(ieee754dp x)
39{
40 struct ieee754_csr oldcsr;
41 ieee754dp y, z, t;
42 unsigned scalx, yh;
43 COMPXDP;
44
45 EXPLODEXDP;
46 CLEARCX;
47 FLUSHXDP;
48
49 /* x == INF or NAN? */
50 switch (xc) {
51 case IEEE754_CLASS_QNAN:
52 /* sqrt(Nan) = Nan */
53 return ieee754dp_nanxcpt(x, "sqrt");
54 case IEEE754_CLASS_SNAN:
55 SETCX(IEEE754_INVALID_OPERATION);
56 return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt");
57 case IEEE754_CLASS_ZERO:
58 /* sqrt(0) = 0 */
59 return x;
60 case IEEE754_CLASS_INF:
61 if (xs) {
62 /* sqrt(-Inf) = Nan */
63 SETCX(IEEE754_INVALID_OPERATION);
64 return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt");
65 }
66 /* sqrt(+Inf) = Inf */
67 return x;
68 case IEEE754_CLASS_DNORM:
69 DPDNORMX;
70 /* fall through */
71 case IEEE754_CLASS_NORM:
72 if (xs) {
73 /* sqrt(-x) = Nan */
74 SETCX(IEEE754_INVALID_OPERATION);
75 return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt");
76 }
77 break;
78 }
79
80 /* save old csr; switch off INX enable & flag; set RN rounding */
81 oldcsr = ieee754_csr;
82 ieee754_csr.mx &= ~IEEE754_INEXACT;
83 ieee754_csr.sx &= ~IEEE754_INEXACT;
84 ieee754_csr.rm = IEEE754_RN;
85
86 /* adjust exponent to prevent overflow */
87 scalx = 0;
88 if (xe > 512) { /* x > 2**-512? */
89 xe -= 512; /* x = x / 2**512 */
90 scalx += 256;
91 } else if (xe < -512) { /* x < 2**-512? */
92 xe += 512; /* x = x * 2**512 */
93 scalx -= 256;
94 }
95
96 y = x = builddp(0, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
97
98 /* magic initial approximation to almost 8 sig. bits */
99 yh = y.bits >> 32;
100 yh = (yh >> 1) + 0x1ff80000;
101 yh = yh - table[(yh >> 15) & 31];
102 y.bits = ((u64) yh << 32) | (y.bits & 0xffffffff);
103
104 /* Heron's rule once with correction to improve to ~18 sig. bits */
105 /* t=x/y; y=y+t; py[n0]=py[n0]-0x00100006; py[n1]=0; */
106 t = ieee754dp_div(x, y);
107 y = ieee754dp_add(y, t);
108 y.bits -= 0x0010000600000000LL;
109 y.bits &= 0xffffffff00000000LL;
110
111 /* triple to almost 56 sig. bits: y ~= sqrt(x) to within 1 ulp */
112 /* t=y*y; z=t; pt[n0]+=0x00100000; t+=z; z=(x-z)*y; */
113 z = t = ieee754dp_mul(y, y);
114 t.parts.bexp += 0x001;
115 t = ieee754dp_add(t, z);
116 z = ieee754dp_mul(ieee754dp_sub(x, z), y);
117
118 /* t=z/(t+x) ; pt[n0]+=0x00100000; y+=t; */
119 t = ieee754dp_div(z, ieee754dp_add(t, x));
120 t.parts.bexp += 0x001;
121 y = ieee754dp_add(y, t);
122
123 /* twiddle last bit to force y correctly rounded */
124
125 /* set RZ, clear INEX flag */
126 ieee754_csr.rm = IEEE754_RZ;
127 ieee754_csr.sx &= ~IEEE754_INEXACT;
128
129 /* t=x/y; ...chopped quotient, possibly inexact */
130 t = ieee754dp_div(x, y);
131
132 if (ieee754_csr.sx & IEEE754_INEXACT || t.bits != y.bits) {
133
134 if (!(ieee754_csr.sx & IEEE754_INEXACT))
135 /* t = t-ulp */
136 t.bits -= 1;
137
138 /* add inexact to result status */
139 oldcsr.cx |= IEEE754_INEXACT;
140 oldcsr.sx |= IEEE754_INEXACT;
141
142 switch (oldcsr.rm) {
143 case IEEE754_RP:
144 y.bits += 1;
145 /* drop through */
146 case IEEE754_RN:
147 t.bits += 1;
148 break;
149 }
150
151 /* y=y+t; ...chopped sum */
152 y = ieee754dp_add(y, t);
153
154 /* adjust scalx for correctly rounded sqrt(x) */
155 scalx -= 1;
156 }
157
158 /* py[n0]=py[n0]+scalx; ...scale back y */
159 y.parts.bexp += scalx;
160
161 /* restore rounding mode, possibly set inexact */
162 ieee754_csr = oldcsr;
163
164 return y;
165}
diff --git a/arch/mips/math-emu/dp_sub.c b/arch/mips/math-emu/dp_sub.c
new file mode 100644
index 000000000000..b30c5b1f1a2c
--- /dev/null
+++ b/arch/mips/math-emu/dp_sub.c
@@ -0,0 +1,191 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30ieee754dp ieee754dp_sub(ieee754dp x, ieee754dp y)
31{
32 COMPXDP;
33 COMPYDP;
34
35 EXPLODEXDP;
36 EXPLODEYDP;
37
38 CLEARCX;
39
40 FLUSHXDP;
41 FLUSHYDP;
42
43 switch (CLPAIR(xc, yc)) {
44 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN):
45 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN):
46 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN):
47 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN):
48 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN):
49 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN):
50 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN):
51 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO):
52 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
53 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
54 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
55 SETCX(IEEE754_INVALID_OPERATION);
56 return ieee754dp_nanxcpt(ieee754dp_indef(), "sub", x, y);
57
58 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
59 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
60 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN):
61 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
62 return y;
63
64 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
65 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
66 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
67 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
68 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF):
69 return x;
70
71
72 /* Infinity handling
73 */
74
75 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
76 if (xs != ys)
77 return x;
78 SETCX(IEEE754_INVALID_OPERATION);
79 return ieee754dp_xcpt(ieee754dp_indef(), "sub", x, y);
80
81 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
82 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
83 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
84 return ieee754dp_inf(ys ^ 1);
85
86 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
87 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
88 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
89 return x;
90
91 /* Zero handling
92 */
93
94 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
95 if (xs != ys)
96 return x;
97 else
98 return ieee754dp_zero(ieee754_csr.rm ==
99 IEEE754_RD);
100
101 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
102 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
103 return x;
104
105 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
106 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM):
107 /* quick fix up */
108 DPSIGN(y) ^= 1;
109 return y;
110
111 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
112 DPDNORMX;
113 /* FAAL THOROUGH */
114
115 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
116 /* normalize ym,ye */
117 DPDNORMY;
118 break;
119
120 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM):
121 /* normalize xm,xe */
122 DPDNORMX;
123 break;
124
125 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
126 break;
127 }
128 /* flip sign of y and handle as add */
129 ys ^= 1;
130
131 assert(xm & DP_HIDDEN_BIT);
132 assert(ym & DP_HIDDEN_BIT);
133
134
135 /* provide guard,round and stick bit dpace */
136 xm <<= 3;
137 ym <<= 3;
138
139 if (xe > ye) {
140 /* have to shift y fraction right to align
141 */
142 int s = xe - ye;
143 ym = XDPSRS(ym, s);
144 ye += s;
145 } else if (ye > xe) {
146 /* have to shift x fraction right to align
147 */
148 int s = ye - xe;
149 xm = XDPSRS(xm, s);
150 xe += s;
151 }
152 assert(xe == ye);
153 assert(xe <= DP_EMAX);
154
155 if (xs == ys) {
156 /* generate 28 bit result of adding two 27 bit numbers
157 */
158 xm = xm + ym;
159 xe = xe;
160 xs = xs;
161
162 if (xm >> (DP_MBITS + 1 + 3)) { /* carry out */
163 xm = XDPSRS1(xm); /* shift preserving sticky */
164 xe++;
165 }
166 } else {
167 if (xm >= ym) {
168 xm = xm - ym;
169 xe = xe;
170 xs = xs;
171 } else {
172 xm = ym - xm;
173 xe = xe;
174 xs = ys;
175 }
176 if (xm == 0) {
177 if (ieee754_csr.rm == IEEE754_RD)
178 return ieee754dp_zero(1); /* round negative inf. => sign = -1 */
179 else
180 return ieee754dp_zero(0); /* other round modes => sign = 1 */
181 }
182
183 /* normalize to rounding precision
184 */
185 while ((xm >> (DP_MBITS + 3)) == 0) {
186 xm <<= 1;
187 xe--;
188 }
189 }
190 DPNORMRET2(xs, xe, xm, "sub", x, y);
191}
diff --git a/arch/mips/math-emu/dp_tint.c b/arch/mips/math-emu/dp_tint.c
new file mode 100644
index 000000000000..77b2b7ccf28a
--- /dev/null
+++ b/arch/mips/math-emu/dp_tint.c
@@ -0,0 +1,124 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include <linux/kernel.h>
29#include "ieee754dp.h"
30
31int ieee754dp_tint(ieee754dp x)
32{
33 COMPXDP;
34
35 CLEARCX;
36
37 EXPLODEXDP;
38 FLUSHXDP;
39
40 switch (xc) {
41 case IEEE754_CLASS_SNAN:
42 case IEEE754_CLASS_QNAN:
43 case IEEE754_CLASS_INF:
44 SETCX(IEEE754_INVALID_OPERATION);
45 return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x);
46 case IEEE754_CLASS_ZERO:
47 return 0;
48 case IEEE754_CLASS_DNORM:
49 case IEEE754_CLASS_NORM:
50 break;
51 }
52 if (xe > 31) {
53 /* Set invalid. We will only use overflow for floating
54 point overflow */
55 SETCX(IEEE754_INVALID_OPERATION);
56 return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x);
57 }
58 /* oh gawd */
59 if (xe > DP_MBITS) {
60 xm <<= xe - DP_MBITS;
61 } else if (xe < DP_MBITS) {
62 u64 residue;
63 int round;
64 int sticky;
65 int odd;
66
67 if (xe < -1) {
68 residue = xm;
69 round = 0;
70 sticky = residue != 0;
71 xm = 0;
72 }
73 else {
74 residue = xm << (64 - DP_MBITS + xe);
75 round = (residue >> 63) != 0;
76 sticky = (residue << 1) != 0;
77 xm >>= DP_MBITS - xe;
78 }
79 /* Note: At this point upper 32 bits of xm are guaranteed
80 to be zero */
81 odd = (xm & 0x1) != 0x0;
82 switch (ieee754_csr.rm) {
83 case IEEE754_RN:
84 if (round && (sticky || odd))
85 xm++;
86 break;
87 case IEEE754_RZ:
88 break;
89 case IEEE754_RU: /* toward +Infinity */
90 if ((round || sticky) && !xs)
91 xm++;
92 break;
93 case IEEE754_RD: /* toward -Infinity */
94 if ((round || sticky) && xs)
95 xm++;
96 break;
97 }
98 /* look for valid corner case 0x80000000 */
99 if ((xm >> 31) != 0 && (xs == 0 || xm != 0x80000000)) {
100 /* This can happen after rounding */
101 SETCX(IEEE754_INVALID_OPERATION);
102 return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x);
103 }
104 if (round || sticky)
105 SETCX(IEEE754_INEXACT);
106 }
107 if (xs)
108 return -xm;
109 else
110 return xm;
111}
112
113
114unsigned int ieee754dp_tuns(ieee754dp x)
115{
116 ieee754dp hb = ieee754dp_1e31();
117
118 /* what if x < 0 ?? */
119 if (ieee754dp_lt(x, hb))
120 return (unsigned) ieee754dp_tint(x);
121
122 return (unsigned) ieee754dp_tint(ieee754dp_sub(x, hb)) |
123 ((unsigned) 1 << 31);
124}
diff --git a/arch/mips/math-emu/dp_tlong.c b/arch/mips/math-emu/dp_tlong.c
new file mode 100644
index 000000000000..d71113e07164
--- /dev/null
+++ b/arch/mips/math-emu/dp_tlong.c
@@ -0,0 +1,127 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30s64 ieee754dp_tlong(ieee754dp x)
31{
32 COMPXDP;
33
34 CLEARCX;
35
36 EXPLODEXDP;
37 FLUSHXDP;
38
39 switch (xc) {
40 case IEEE754_CLASS_SNAN:
41 case IEEE754_CLASS_QNAN:
42 case IEEE754_CLASS_INF:
43 SETCX(IEEE754_INVALID_OPERATION);
44 return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x);
45 case IEEE754_CLASS_ZERO:
46 return 0;
47 case IEEE754_CLASS_DNORM:
48 case IEEE754_CLASS_NORM:
49 break;
50 }
51 if (xe >= 63) {
52 /* look for valid corner case */
53 if (xe == 63 && xs && xm == DP_HIDDEN_BIT)
54 return -0x8000000000000000LL;
55 /* Set invalid. We will only use overflow for floating
56 point overflow */
57 SETCX(IEEE754_INVALID_OPERATION);
58 return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x);
59 }
60 /* oh gawd */
61 if (xe > DP_MBITS) {
62 xm <<= xe - DP_MBITS;
63 } else if (xe < DP_MBITS) {
64 u64 residue;
65 int round;
66 int sticky;
67 int odd;
68
69 if (xe < -1) {
70 residue = xm;
71 round = 0;
72 sticky = residue != 0;
73 xm = 0;
74 }
75 else {
76 /* Shifting a u64 64 times does not work,
77 * so we do it in two steps. Be aware that xe
78 * may be -1 */
79 residue = xm << (xe + 1);
80 residue <<= 63 - DP_MBITS;
81 round = (residue >> 63) != 0;
82 sticky = (residue << 1) != 0;
83 xm >>= DP_MBITS - xe;
84 }
85 odd = (xm & 0x1) != 0x0;
86 switch (ieee754_csr.rm) {
87 case IEEE754_RN:
88 if (round && (sticky || odd))
89 xm++;
90 break;
91 case IEEE754_RZ:
92 break;
93 case IEEE754_RU: /* toward +Infinity */
94 if ((round || sticky) && !xs)
95 xm++;
96 break;
97 case IEEE754_RD: /* toward -Infinity */
98 if ((round || sticky) && xs)
99 xm++;
100 break;
101 }
102 if ((xm >> 63) != 0) {
103 /* This can happen after rounding */
104 SETCX(IEEE754_INVALID_OPERATION);
105 return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x);
106 }
107 if (round || sticky)
108 SETCX(IEEE754_INEXACT);
109 }
110 if (xs)
111 return -xm;
112 else
113 return xm;
114}
115
116
117u64 ieee754dp_tulong(ieee754dp x)
118{
119 ieee754dp hb = ieee754dp_1e63();
120
121 /* what if x < 0 ?? */
122 if (ieee754dp_lt(x, hb))
123 return (u64) ieee754dp_tlong(x);
124
125 return (u64) ieee754dp_tlong(ieee754dp_sub(x, hb)) |
126 (1ULL << 63);
127}
diff --git a/arch/mips/math-emu/dsemul.c b/arch/mips/math-emu/dsemul.c
new file mode 100644
index 000000000000..aa989c2246da
--- /dev/null
+++ b/arch/mips/math-emu/dsemul.c
@@ -0,0 +1,172 @@
1#include <linux/compiler.h>
2#include <linux/mm.h>
3#include <linux/signal.h>
4#include <linux/smp.h>
5#include <linux/smp_lock.h>
6
7#include <asm/asm.h>
8#include <asm/bootinfo.h>
9#include <asm/byteorder.h>
10#include <asm/cpu.h>
11#include <asm/inst.h>
12#include <asm/processor.h>
13#include <asm/uaccess.h>
14#include <asm/branch.h>
15#include <asm/mipsregs.h>
16#include <asm/system.h>
17#include <asm/cacheflush.h>
18
19#include <asm/fpu_emulator.h>
20
21#include "ieee754.h"
22#include "dsemul.h"
23
24/* Strap kernel emulator for full MIPS IV emulation */
25
26#ifdef __mips
27#undef __mips
28#endif
29#define __mips 4
30
31extern struct mips_fpu_emulator_private fpuemuprivate;
32
33
34/*
35 * Emulate the arbritrary instruction ir at xcp->cp0_epc. Required when
36 * we have to emulate the instruction in a COP1 branch delay slot. Do
37 * not change cp0_epc due to the instruction
38 *
39 * According to the spec:
40 * 1) it shouldnt be a branch :-)
41 * 2) it can be a COP instruction :-(
42 * 3) if we are tring to run a protected memory space we must take
43 * special care on memory access instructions :-(
44 */
45
46/*
47 * "Trampoline" return routine to catch exception following
48 * execution of delay-slot instruction execution.
49 */
50
51struct emuframe {
52 mips_instruction emul;
53 mips_instruction badinst;
54 mips_instruction cookie;
55 gpreg_t epc;
56};
57
58int mips_dsemul(struct pt_regs *regs, mips_instruction ir, gpreg_t cpc)
59{
60 extern asmlinkage void handle_dsemulret(void);
61 mips_instruction *dsemul_insns;
62 struct emuframe *fr;
63 int err;
64
65 if (ir == 0) { /* a nop is easy */
66 regs->cp0_epc = cpc;
67 regs->cp0_cause &= ~CAUSEF_BD;
68 return 0;
69 }
70#ifdef DSEMUL_TRACE
71 printk("dsemul %lx %lx\n", regs->cp0_epc, cpc);
72
73#endif
74
75 /*
76 * The strategy is to push the instruction onto the user stack
77 * and put a trap after it which we can catch and jump to
78 * the required address any alternative apart from full
79 * instruction emulation!!.
80 *
81 * Algorithmics used a system call instruction, and
82 * borrowed that vector. MIPS/Linux version is a bit
83 * more heavyweight in the interests of portability and
84 * multiprocessor support. For Linux we generate a
85 * an unaligned access and force an address error exception.
86 *
87 * For embedded systems (stand-alone) we prefer to use a
88 * non-existing CP1 instruction. This prevents us from emulating
89 * branches, but gives us a cleaner interface to the exception
90 * handler (single entry point).
91 */
92
93 /* Ensure that the two instructions are in the same cache line */
94 dsemul_insns = (mips_instruction *) REG_TO_VA ((regs->regs[29] - sizeof(struct emuframe)) & ~0x7);
95 fr = (struct emuframe *) dsemul_insns;
96
97 /* Verify that the stack pointer is not competely insane */
98 if (unlikely(!access_ok(VERIFY_WRITE, fr, sizeof(struct emuframe))))
99 return SIGBUS;
100
101 err = __put_user(ir, &fr->emul);
102 err |= __put_user((mips_instruction)BADINST, &fr->badinst);
103 err |= __put_user((mips_instruction)BD_COOKIE, &fr->cookie);
104 err |= __put_user(cpc, &fr->epc);
105
106 if (unlikely(err)) {
107 fpuemuprivate.stats.errors++;
108 return SIGBUS;
109 }
110
111 regs->cp0_epc = VA_TO_REG & fr->emul;
112
113 flush_cache_sigtramp((unsigned long)&fr->badinst);
114
115 return SIGILL; /* force out of emulation loop */
116}
117
118int do_dsemulret(struct pt_regs *xcp)
119{
120 struct emuframe *fr;
121 gpreg_t epc;
122 u32 insn, cookie;
123 int err = 0;
124
125 fr = (struct emuframe *) (xcp->cp0_epc - sizeof(mips_instruction));
126
127 /*
128 * If we can't even access the area, something is very wrong, but we'll
129 * leave that to the default handling
130 */
131 if (!access_ok(VERIFY_READ, fr, sizeof(struct emuframe)))
132 return 0;
133
134 /*
135 * Do some sanity checking on the stackframe:
136 *
137 * - Is the instruction pointed to by the EPC an BADINST?
138 * - Is the following memory word the BD_COOKIE?
139 */
140 err = __get_user(insn, &fr->badinst);
141 err |= __get_user(cookie, &fr->cookie);
142
143 if (unlikely(err || (insn != BADINST) || (cookie != BD_COOKIE))) {
144 fpuemuprivate.stats.errors++;
145 return 0;
146 }
147
148 /*
149 * At this point, we are satisfied that it's a BD emulation trap. Yes,
150 * a user might have deliberately put two malformed and useless
151 * instructions in a row in his program, in which case he's in for a
152 * nasty surprise - the next instruction will be treated as a
153 * continuation address! Alas, this seems to be the only way that we
154 * can handle signals, recursion, and longjmps() in the context of
155 * emulating the branch delay instruction.
156 */
157
158#ifdef DSEMUL_TRACE
159 printk("dsemulret\n");
160#endif
161 if (__get_user(epc, &fr->epc)) { /* Saved EPC */
162 /* This is not a good situation to be in */
163 force_sig(SIGBUS, current);
164
165 return 0;
166 }
167
168 /* Set EPC to return to post-branch instruction */
169 xcp->cp0_epc = epc;
170
171 return 1;
172}
diff --git a/arch/mips/math-emu/dsemul.h b/arch/mips/math-emu/dsemul.h
new file mode 100644
index 000000000000..dbd85f95268d
--- /dev/null
+++ b/arch/mips/math-emu/dsemul.h
@@ -0,0 +1,23 @@
1typedef long gpreg_t;
2typedef void *vaddr_t;
3
4#define REG_TO_VA (vaddr_t)
5#define VA_TO_REG (gpreg_t)
6
7int mips_dsemul(struct pt_regs *regs, mips_instruction ir, gpreg_t cpc);
8int do_dsemulret(struct pt_regs *xcp);
9
10/* Instruction which will always cause an address error */
11#define AdELOAD 0x8c000001 /* lw $0,1($0) */
12/* Instruction which will plainly cause a CP1 exception when FPU is disabled */
13#define CP1UNDEF 0x44400001 /* cfc1 $0,$0 undef */
14
15/* Instruction inserted following the badinst to further tag the sequence */
16#define BD_COOKIE 0x0000bd36 /* tne $0,$0 with baggage */
17
18/* Setup which instruction to use for trampoline */
19#ifdef STANDALONE_EMULATOR
20#define BADINST CP1UNDEF
21#else
22#define BADINST AdELOAD
23#endif
diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c
new file mode 100644
index 000000000000..f0a364adbf34
--- /dev/null
+++ b/arch/mips/math-emu/ieee754.c
@@ -0,0 +1,138 @@
1/* ieee754 floating point arithmetic
2 * single and double precision
3 *
4 * BUGS
5 * not much dp done
6 * doesn't generate IEEE754_INEXACT
7 *
8 */
9/*
10 * MIPS floating point support
11 * Copyright (C) 1994-2000 Algorithmics Ltd.
12 * http://www.algor.co.uk
13 *
14 * ########################################################################
15 *
16 * This program is free software; you can distribute it and/or modify it
17 * under the terms of the GNU General Public License (Version 2) as
18 * published by the Free Software Foundation.
19 *
20 * This program is distributed in the hope it will be useful, but WITHOUT
21 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * for more details.
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 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
28 *
29 * ########################################################################
30 */
31
32
33#include "ieee754int.h"
34
35#define DP_EBIAS 1023
36#define DP_EMIN (-1022)
37#define DP_EMAX 1023
38
39#define SP_EBIAS 127
40#define SP_EMIN (-126)
41#define SP_EMAX 127
42
43/* indexed by class */
44const char *const ieee754_cname[] = {
45 "Normal",
46 "Zero",
47 "Denormal",
48 "Infinity",
49 "QNaN",
50 "SNaN",
51};
52
53/* the control status register
54*/
55struct ieee754_csr ieee754_csr;
56
57/* special constants
58*/
59
60
61#if (defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN) || defined(__MIPSEL__)
62#define SPSTR(s,b,m) {m,b,s}
63#define DPSTR(s,b,mh,ml) {ml,mh,b,s}
64#endif
65
66#ifdef __MIPSEB__
67#define SPSTR(s,b,m) {s,b,m}
68#define DPSTR(s,b,mh,ml) {s,b,mh,ml}
69#endif
70
71const struct ieee754dp_konst __ieee754dp_spcvals[] = {
72 DPSTR(0, DP_EMIN - 1 + DP_EBIAS, 0, 0), /* + zero */
73 DPSTR(1, DP_EMIN - 1 + DP_EBIAS, 0, 0), /* - zero */
74 DPSTR(0, DP_EBIAS, 0, 0), /* + 1.0 */
75 DPSTR(1, DP_EBIAS, 0, 0), /* - 1.0 */
76 DPSTR(0, 3 + DP_EBIAS, 0x40000, 0), /* + 10.0 */
77 DPSTR(1, 3 + DP_EBIAS, 0x40000, 0), /* - 10.0 */
78 DPSTR(0, DP_EMAX + 1 + DP_EBIAS, 0, 0), /* + infinity */
79 DPSTR(1, DP_EMAX + 1 + DP_EBIAS, 0, 0), /* - infinity */
80 DPSTR(0,DP_EMAX+1+DP_EBIAS,0x7FFFF,0xFFFFFFFF), /* + indef quiet Nan */
81 DPSTR(0, DP_EMAX + DP_EBIAS, 0xFFFFF, 0xFFFFFFFF), /* + max */
82 DPSTR(1, DP_EMAX + DP_EBIAS, 0xFFFFF, 0xFFFFFFFF), /* - max */
83 DPSTR(0, DP_EMIN + DP_EBIAS, 0, 0), /* + min normal */
84 DPSTR(1, DP_EMIN + DP_EBIAS, 0, 0), /* - min normal */
85 DPSTR(0, DP_EMIN - 1 + DP_EBIAS, 0, 1), /* + min denormal */
86 DPSTR(1, DP_EMIN - 1 + DP_EBIAS, 0, 1), /* - min denormal */
87 DPSTR(0, 31 + DP_EBIAS, 0, 0), /* + 1.0e31 */
88 DPSTR(0, 63 + DP_EBIAS, 0, 0), /* + 1.0e63 */
89};
90
91const struct ieee754sp_konst __ieee754sp_spcvals[] = {
92 SPSTR(0, SP_EMIN - 1 + SP_EBIAS, 0), /* + zero */
93 SPSTR(1, SP_EMIN - 1 + SP_EBIAS, 0), /* - zero */
94 SPSTR(0, SP_EBIAS, 0), /* + 1.0 */
95 SPSTR(1, SP_EBIAS, 0), /* - 1.0 */
96 SPSTR(0, 3 + SP_EBIAS, 0x200000), /* + 10.0 */
97 SPSTR(1, 3 + SP_EBIAS, 0x200000), /* - 10.0 */
98 SPSTR(0, SP_EMAX + 1 + SP_EBIAS, 0), /* + infinity */
99 SPSTR(1, SP_EMAX + 1 + SP_EBIAS, 0), /* - infinity */
100 SPSTR(0,SP_EMAX+1+SP_EBIAS,0x3FFFFF), /* + indef quiet Nan */
101 SPSTR(0, SP_EMAX + SP_EBIAS, 0x7FFFFF), /* + max normal */
102 SPSTR(1, SP_EMAX + SP_EBIAS, 0x7FFFFF), /* - max normal */
103 SPSTR(0, SP_EMIN + SP_EBIAS, 0), /* + min normal */
104 SPSTR(1, SP_EMIN + SP_EBIAS, 0), /* - min normal */
105 SPSTR(0, SP_EMIN - 1 + SP_EBIAS, 1), /* + min denormal */
106 SPSTR(1, SP_EMIN - 1 + SP_EBIAS, 1), /* - min denormal */
107 SPSTR(0, 31 + SP_EBIAS, 0), /* + 1.0e31 */
108 SPSTR(0, 63 + SP_EBIAS, 0), /* + 1.0e63 */
109};
110
111
112int ieee754si_xcpt(int r, const char *op, ...)
113{
114 struct ieee754xctx ax;
115
116 if (!TSTX())
117 return r;
118 ax.op = op;
119 ax.rt = IEEE754_RT_SI;
120 ax.rv.si = r;
121 va_start(ax.ap, op);
122 ieee754_xcpt(&ax);
123 return ax.rv.si;
124}
125
126s64 ieee754di_xcpt(s64 r, const char *op, ...)
127{
128 struct ieee754xctx ax;
129
130 if (!TSTX())
131 return r;
132 ax.op = op;
133 ax.rt = IEEE754_RT_DI;
134 ax.rv.di = r;
135 va_start(ax.ap, op);
136 ieee754_xcpt(&ax);
137 return ax.rv.di;
138}
diff --git a/arch/mips/math-emu/ieee754.h b/arch/mips/math-emu/ieee754.h
new file mode 100644
index 000000000000..b8772f46972d
--- /dev/null
+++ b/arch/mips/math-emu/ieee754.h
@@ -0,0 +1,489 @@
1/* single and double precision fp ops
2 * missing extended precision.
3*/
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27/**************************************************************************
28 * Nov 7, 2000
29 * Modification to allow integration with Linux kernel
30 *
31 * Kevin D. Kissell, kevink@mips.com and Carsten Langgard, carstenl@mips.com
32 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
33 *************************************************************************/
34
35#ifdef __KERNEL__
36/* Going from Algorithmics to Linux native environment, add this */
37#include <linux/types.h>
38
39/*
40 * Not very pretty, but the Linux kernel's normal va_list definition
41 * does not allow it to be used as a structure element, as it is here.
42 */
43#ifndef _STDARG_H
44#include <stdarg.h>
45#endif
46
47#else
48
49/* Note that __KERNEL__ is taken to mean Linux kernel */
50
51#if #system(OpenBSD)
52#include <machine/types.h>
53#endif
54#include <machine/endian.h>
55
56#endif /* __KERNEL__ */
57
58#if (defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN) || defined(__MIPSEL__)
59struct ieee754dp_konst {
60 unsigned mantlo:32;
61 unsigned manthi:20;
62 unsigned bexp:11;
63 unsigned sign:1;
64};
65struct ieee754sp_konst {
66 unsigned mant:23;
67 unsigned bexp:8;
68 unsigned sign:1;
69};
70
71typedef union _ieee754dp {
72 struct ieee754dp_konst oparts;
73 struct {
74 u64 mant:52;
75 unsigned int bexp:11;
76 unsigned int sign:1;
77 } parts;
78 u64 bits;
79 double d;
80} ieee754dp;
81
82typedef union _ieee754sp {
83 struct ieee754sp_konst parts;
84 float f;
85 u32 bits;
86} ieee754sp;
87#endif
88
89#if (defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN) || defined(__MIPSEB__)
90struct ieee754dp_konst {
91 unsigned sign:1;
92 unsigned bexp:11;
93 unsigned manthi:20;
94 unsigned mantlo:32;
95};
96typedef union _ieee754dp {
97 struct ieee754dp_konst oparts;
98 struct {
99 unsigned int sign:1;
100 unsigned int bexp:11;
101 u64 mant:52;
102 } parts;
103 double d;
104 u64 bits;
105} ieee754dp;
106
107struct ieee754sp_konst {
108 unsigned sign:1;
109 unsigned bexp:8;
110 unsigned mant:23;
111};
112
113typedef union _ieee754sp {
114 struct ieee754sp_konst parts;
115 float f;
116 u32 bits;
117} ieee754sp;
118#endif
119
120/*
121 * single precision (often aka float)
122*/
123int ieee754sp_finite(ieee754sp x);
124int ieee754sp_class(ieee754sp x);
125
126ieee754sp ieee754sp_abs(ieee754sp x);
127ieee754sp ieee754sp_neg(ieee754sp x);
128ieee754sp ieee754sp_scalb(ieee754sp x, int);
129ieee754sp ieee754sp_logb(ieee754sp x);
130
131/* x with sign of y */
132ieee754sp ieee754sp_copysign(ieee754sp x, ieee754sp y);
133
134ieee754sp ieee754sp_add(ieee754sp x, ieee754sp y);
135ieee754sp ieee754sp_sub(ieee754sp x, ieee754sp y);
136ieee754sp ieee754sp_mul(ieee754sp x, ieee754sp y);
137ieee754sp ieee754sp_div(ieee754sp x, ieee754sp y);
138
139ieee754sp ieee754sp_fint(int x);
140ieee754sp ieee754sp_funs(unsigned x);
141ieee754sp ieee754sp_flong(s64 x);
142ieee754sp ieee754sp_fulong(u64 x);
143ieee754sp ieee754sp_fdp(ieee754dp x);
144
145int ieee754sp_tint(ieee754sp x);
146unsigned int ieee754sp_tuns(ieee754sp x);
147s64 ieee754sp_tlong(ieee754sp x);
148u64 ieee754sp_tulong(ieee754sp x);
149
150int ieee754sp_cmp(ieee754sp x, ieee754sp y, int cop, int sig);
151/*
152 * basic sp math
153 */
154ieee754sp ieee754sp_modf(ieee754sp x, ieee754sp * ip);
155ieee754sp ieee754sp_frexp(ieee754sp x, int *exp);
156ieee754sp ieee754sp_ldexp(ieee754sp x, int exp);
157
158ieee754sp ieee754sp_ceil(ieee754sp x);
159ieee754sp ieee754sp_floor(ieee754sp x);
160ieee754sp ieee754sp_trunc(ieee754sp x);
161
162ieee754sp ieee754sp_sqrt(ieee754sp x);
163
164/*
165 * double precision (often aka double)
166*/
167int ieee754dp_finite(ieee754dp x);
168int ieee754dp_class(ieee754dp x);
169
170/* x with sign of y */
171ieee754dp ieee754dp_copysign(ieee754dp x, ieee754dp y);
172
173ieee754dp ieee754dp_add(ieee754dp x, ieee754dp y);
174ieee754dp ieee754dp_sub(ieee754dp x, ieee754dp y);
175ieee754dp ieee754dp_mul(ieee754dp x, ieee754dp y);
176ieee754dp ieee754dp_div(ieee754dp x, ieee754dp y);
177
178ieee754dp ieee754dp_abs(ieee754dp x);
179ieee754dp ieee754dp_neg(ieee754dp x);
180ieee754dp ieee754dp_scalb(ieee754dp x, int);
181
182/* return exponent as integer in floating point format
183 */
184ieee754dp ieee754dp_logb(ieee754dp x);
185
186ieee754dp ieee754dp_fint(int x);
187ieee754dp ieee754dp_funs(unsigned x);
188ieee754dp ieee754dp_flong(s64 x);
189ieee754dp ieee754dp_fulong(u64 x);
190ieee754dp ieee754dp_fsp(ieee754sp x);
191
192ieee754dp ieee754dp_ceil(ieee754dp x);
193ieee754dp ieee754dp_floor(ieee754dp x);
194ieee754dp ieee754dp_trunc(ieee754dp x);
195
196int ieee754dp_tint(ieee754dp x);
197unsigned int ieee754dp_tuns(ieee754dp x);
198s64 ieee754dp_tlong(ieee754dp x);
199u64 ieee754dp_tulong(ieee754dp x);
200
201int ieee754dp_cmp(ieee754dp x, ieee754dp y, int cop, int sig);
202/*
203 * basic sp math
204 */
205ieee754dp ieee754dp_modf(ieee754dp x, ieee754dp * ip);
206ieee754dp ieee754dp_frexp(ieee754dp x, int *exp);
207ieee754dp ieee754dp_ldexp(ieee754dp x, int exp);
208
209ieee754dp ieee754dp_ceil(ieee754dp x);
210ieee754dp ieee754dp_floor(ieee754dp x);
211ieee754dp ieee754dp_trunc(ieee754dp x);
212
213ieee754dp ieee754dp_sqrt(ieee754dp x);
214
215
216
217/* 5 types of floating point number
218*/
219#define IEEE754_CLASS_NORM 0x00
220#define IEEE754_CLASS_ZERO 0x01
221#define IEEE754_CLASS_DNORM 0x02
222#define IEEE754_CLASS_INF 0x03
223#define IEEE754_CLASS_SNAN 0x04
224#define IEEE754_CLASS_QNAN 0x05
225extern const char *const ieee754_cname[];
226
227/* exception numbers */
228#define IEEE754_INEXACT 0x01
229#define IEEE754_UNDERFLOW 0x02
230#define IEEE754_OVERFLOW 0x04
231#define IEEE754_ZERO_DIVIDE 0x08
232#define IEEE754_INVALID_OPERATION 0x10
233
234/* cmp operators
235*/
236#define IEEE754_CLT 0x01
237#define IEEE754_CEQ 0x02
238#define IEEE754_CGT 0x04
239#define IEEE754_CUN 0x08
240
241/* rounding mode
242*/
243#define IEEE754_RN 0 /* round to nearest */
244#define IEEE754_RZ 1 /* round toward zero */
245#define IEEE754_RD 2 /* round toward -Infinity */
246#define IEEE754_RU 3 /* round toward +Infinity */
247
248/* other naming */
249#define IEEE754_RM IEEE754_RD
250#define IEEE754_RP IEEE754_RU
251
252/* "normal" comparisons
253*/
254static __inline int ieee754sp_eq(ieee754sp x, ieee754sp y)
255{
256 return ieee754sp_cmp(x, y, IEEE754_CEQ, 0);
257}
258
259static __inline int ieee754sp_ne(ieee754sp x, ieee754sp y)
260{
261 return ieee754sp_cmp(x, y,
262 IEEE754_CLT | IEEE754_CGT | IEEE754_CUN, 0);
263}
264
265static __inline int ieee754sp_lt(ieee754sp x, ieee754sp y)
266{
267 return ieee754sp_cmp(x, y, IEEE754_CLT, 0);
268}
269
270static __inline int ieee754sp_le(ieee754sp x, ieee754sp y)
271{
272 return ieee754sp_cmp(x, y, IEEE754_CLT | IEEE754_CEQ, 0);
273}
274
275static __inline int ieee754sp_gt(ieee754sp x, ieee754sp y)
276{
277 return ieee754sp_cmp(x, y, IEEE754_CGT, 0);
278}
279
280
281static __inline int ieee754sp_ge(ieee754sp x, ieee754sp y)
282{
283 return ieee754sp_cmp(x, y, IEEE754_CGT | IEEE754_CEQ, 0);
284}
285
286static __inline int ieee754dp_eq(ieee754dp x, ieee754dp y)
287{
288 return ieee754dp_cmp(x, y, IEEE754_CEQ, 0);
289}
290
291static __inline int ieee754dp_ne(ieee754dp x, ieee754dp y)
292{
293 return ieee754dp_cmp(x, y,
294 IEEE754_CLT | IEEE754_CGT | IEEE754_CUN, 0);
295}
296
297static __inline int ieee754dp_lt(ieee754dp x, ieee754dp y)
298{
299 return ieee754dp_cmp(x, y, IEEE754_CLT, 0);
300}
301
302static __inline int ieee754dp_le(ieee754dp x, ieee754dp y)
303{
304 return ieee754dp_cmp(x, y, IEEE754_CLT | IEEE754_CEQ, 0);
305}
306
307static __inline int ieee754dp_gt(ieee754dp x, ieee754dp y)
308{
309 return ieee754dp_cmp(x, y, IEEE754_CGT, 0);
310}
311
312static __inline int ieee754dp_ge(ieee754dp x, ieee754dp y)
313{
314 return ieee754dp_cmp(x, y, IEEE754_CGT | IEEE754_CEQ, 0);
315}
316
317
318/* like strtod
319*/
320ieee754dp ieee754dp_fstr(const char *s, char **endp);
321char *ieee754dp_tstr(ieee754dp x, int prec, int fmt, int af);
322
323
324/* the control status register
325*/
326struct ieee754_csr {
327 unsigned pad:13;
328 unsigned nod:1; /* set 1 for no denormalised numbers */
329 unsigned cx:5; /* exceptions this operation */
330 unsigned mx:5; /* exception enable mask */
331 unsigned sx:5; /* exceptions total */
332 unsigned rm:2; /* current rounding mode */
333};
334extern struct ieee754_csr ieee754_csr;
335
336static __inline unsigned ieee754_getrm(void)
337{
338 return (ieee754_csr.rm);
339}
340static __inline unsigned ieee754_setrm(unsigned rm)
341{
342 return (ieee754_csr.rm = rm);
343}
344
345/*
346 * get current exceptions
347 */
348static __inline unsigned ieee754_getcx(void)
349{
350 return (ieee754_csr.cx);
351}
352
353/* test for current exception condition
354 */
355static __inline int ieee754_cxtest(unsigned n)
356{
357 return (ieee754_csr.cx & n);
358}
359
360/*
361 * get sticky exceptions
362 */
363static __inline unsigned ieee754_getsx(void)
364{
365 return (ieee754_csr.sx);
366}
367
368/* clear sticky conditions
369*/
370static __inline unsigned ieee754_clrsx(void)
371{
372 return (ieee754_csr.sx = 0);
373}
374
375/* test for sticky exception condition
376 */
377static __inline int ieee754_sxtest(unsigned n)
378{
379 return (ieee754_csr.sx & n);
380}
381
382/* debugging */
383ieee754sp ieee754sp_dump(char *s, ieee754sp x);
384ieee754dp ieee754dp_dump(char *s, ieee754dp x);
385
386#define IEEE754_SPCVAL_PZERO 0
387#define IEEE754_SPCVAL_NZERO 1
388#define IEEE754_SPCVAL_PONE 2
389#define IEEE754_SPCVAL_NONE 3
390#define IEEE754_SPCVAL_PTEN 4
391#define IEEE754_SPCVAL_NTEN 5
392#define IEEE754_SPCVAL_PINFINITY 6
393#define IEEE754_SPCVAL_NINFINITY 7
394#define IEEE754_SPCVAL_INDEF 8
395#define IEEE754_SPCVAL_PMAX 9 /* +max norm */
396#define IEEE754_SPCVAL_NMAX 10 /* -max norm */
397#define IEEE754_SPCVAL_PMIN 11 /* +min norm */
398#define IEEE754_SPCVAL_NMIN 12 /* +min norm */
399#define IEEE754_SPCVAL_PMIND 13 /* +min denorm */
400#define IEEE754_SPCVAL_NMIND 14 /* +min denorm */
401#define IEEE754_SPCVAL_P1E31 15 /* + 1.0e31 */
402#define IEEE754_SPCVAL_P1E63 16 /* + 1.0e63 */
403
404extern const struct ieee754dp_konst __ieee754dp_spcvals[];
405extern const struct ieee754sp_konst __ieee754sp_spcvals[];
406#define ieee754dp_spcvals ((const ieee754dp *)__ieee754dp_spcvals)
407#define ieee754sp_spcvals ((const ieee754sp *)__ieee754sp_spcvals)
408
409/* return infinity with given sign
410*/
411#define ieee754dp_inf(sn) \
412 (ieee754dp_spcvals[IEEE754_SPCVAL_PINFINITY+(sn)])
413#define ieee754dp_zero(sn) \
414 (ieee754dp_spcvals[IEEE754_SPCVAL_PZERO+(sn)])
415#define ieee754dp_one(sn) \
416 (ieee754dp_spcvals[IEEE754_SPCVAL_PONE+(sn)])
417#define ieee754dp_ten(sn) \
418 (ieee754dp_spcvals[IEEE754_SPCVAL_PTEN+(sn)])
419#define ieee754dp_indef() \
420 (ieee754dp_spcvals[IEEE754_SPCVAL_INDEF])
421#define ieee754dp_max(sn) \
422 (ieee754dp_spcvals[IEEE754_SPCVAL_PMAX+(sn)])
423#define ieee754dp_min(sn) \
424 (ieee754dp_spcvals[IEEE754_SPCVAL_PMIN+(sn)])
425#define ieee754dp_mind(sn) \
426 (ieee754dp_spcvals[IEEE754_SPCVAL_PMIND+(sn)])
427#define ieee754dp_1e31() \
428 (ieee754dp_spcvals[IEEE754_SPCVAL_P1E31])
429#define ieee754dp_1e63() \
430 (ieee754dp_spcvals[IEEE754_SPCVAL_P1E63])
431
432#define ieee754sp_inf(sn) \
433 (ieee754sp_spcvals[IEEE754_SPCVAL_PINFINITY+(sn)])
434#define ieee754sp_zero(sn) \
435 (ieee754sp_spcvals[IEEE754_SPCVAL_PZERO+(sn)])
436#define ieee754sp_one(sn) \
437 (ieee754sp_spcvals[IEEE754_SPCVAL_PONE+(sn)])
438#define ieee754sp_ten(sn) \
439 (ieee754sp_spcvals[IEEE754_SPCVAL_PTEN+(sn)])
440#define ieee754sp_indef() \
441 (ieee754sp_spcvals[IEEE754_SPCVAL_INDEF])
442#define ieee754sp_max(sn) \
443 (ieee754sp_spcvals[IEEE754_SPCVAL_PMAX+(sn)])
444#define ieee754sp_min(sn) \
445 (ieee754sp_spcvals[IEEE754_SPCVAL_PMIN+(sn)])
446#define ieee754sp_mind(sn) \
447 (ieee754sp_spcvals[IEEE754_SPCVAL_PMIND+(sn)])
448#define ieee754sp_1e31() \
449 (ieee754sp_spcvals[IEEE754_SPCVAL_P1E31])
450#define ieee754sp_1e63() \
451 (ieee754sp_spcvals[IEEE754_SPCVAL_P1E63])
452
453/* indefinite integer value
454*/
455#define ieee754si_indef() INT_MAX
456#ifdef LONG_LONG_MAX
457#define ieee754di_indef() LONG_LONG_MAX
458#else
459#define ieee754di_indef() ((s64)(~0ULL>>1))
460#endif
461
462/* IEEE exception context, passed to handler */
463struct ieee754xctx {
464 const char *op; /* operation name */
465 int rt; /* result type */
466 union {
467 ieee754sp sp; /* single precision */
468 ieee754dp dp; /* double precision */
469#ifdef IEEE854_XP
470 ieee754xp xp; /* extended precision */
471#endif
472 int si; /* standard signed integer (32bits) */
473 s64 di; /* extended signed integer (64bits) */
474 } rv; /* default result format implied by op */
475 va_list ap;
476};
477
478/* result types for xctx.rt */
479#define IEEE754_RT_SP 0
480#define IEEE754_RT_DP 1
481#define IEEE754_RT_XP 2
482#define IEEE754_RT_SI 3
483#define IEEE754_RT_DI 4
484
485extern void ieee754_xcpt(struct ieee754xctx *xcp);
486
487/* compat */
488#define ieee754dp_fix(x) ieee754dp_tint(x)
489#define ieee754sp_fix(x) ieee754sp_tint(x)
diff --git a/arch/mips/math-emu/ieee754d.c b/arch/mips/math-emu/ieee754d.c
new file mode 100644
index 000000000000..7e900f30987e
--- /dev/null
+++ b/arch/mips/math-emu/ieee754d.c
@@ -0,0 +1,138 @@
1/*
2 * Some debug functions
3 *
4 * MIPS floating point support
5 *
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * This program is free software; you can distribute it and/or modify it
10 * under the terms of the GNU General Public License (Version 2) as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *
22 * Nov 7, 2000
23 * Modified to build and operate in Linux kernel environment.
24 *
25 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
26 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
27 */
28
29#include <linux/kernel.h>
30#include "ieee754.h"
31
32#define DP_EBIAS 1023
33#define DP_EMIN (-1022)
34#define DP_EMAX 1023
35#define DP_FBITS 52
36
37#define SP_EBIAS 127
38#define SP_EMIN (-126)
39#define SP_EMAX 127
40#define SP_FBITS 23
41
42#define DP_MBIT(x) ((u64)1 << (x))
43#define DP_HIDDEN_BIT DP_MBIT(DP_FBITS)
44#define DP_SIGN_BIT DP_MBIT(63)
45
46
47#define SP_MBIT(x) ((u32)1 << (x))
48#define SP_HIDDEN_BIT SP_MBIT(SP_FBITS)
49#define SP_SIGN_BIT SP_MBIT(31)
50
51
52#define SPSIGN(sp) (sp.parts.sign)
53#define SPBEXP(sp) (sp.parts.bexp)
54#define SPMANT(sp) (sp.parts.mant)
55
56#define DPSIGN(dp) (dp.parts.sign)
57#define DPBEXP(dp) (dp.parts.bexp)
58#define DPMANT(dp) (dp.parts.mant)
59
60ieee754dp ieee754dp_dump(char *m, ieee754dp x)
61{
62 int i;
63
64 printk("%s", m);
65 printk("<%08x,%08x>\n", (unsigned) (x.bits >> 32),
66 (unsigned) x.bits);
67 printk("\t=");
68 switch (ieee754dp_class(x)) {
69 case IEEE754_CLASS_QNAN:
70 case IEEE754_CLASS_SNAN:
71 printk("Nan %c", DPSIGN(x) ? '-' : '+');
72 for (i = DP_FBITS - 1; i >= 0; i--)
73 printk("%c", DPMANT(x) & DP_MBIT(i) ? '1' : '0');
74 break;
75 case IEEE754_CLASS_INF:
76 printk("%cInfinity", DPSIGN(x) ? '-' : '+');
77 break;
78 case IEEE754_CLASS_ZERO:
79 printk("%cZero", DPSIGN(x) ? '-' : '+');
80 break;
81 case IEEE754_CLASS_DNORM:
82 printk("%c0.", DPSIGN(x) ? '-' : '+');
83 for (i = DP_FBITS - 1; i >= 0; i--)
84 printk("%c", DPMANT(x) & DP_MBIT(i) ? '1' : '0');
85 printk("e%d", DPBEXP(x) - DP_EBIAS);
86 break;
87 case IEEE754_CLASS_NORM:
88 printk("%c1.", DPSIGN(x) ? '-' : '+');
89 for (i = DP_FBITS - 1; i >= 0; i--)
90 printk("%c", DPMANT(x) & DP_MBIT(i) ? '1' : '0');
91 printk("e%d", DPBEXP(x) - DP_EBIAS);
92 break;
93 default:
94 printk("Illegal/Unknown IEEE754 value class");
95 }
96 printk("\n");
97 return x;
98}
99
100ieee754sp ieee754sp_dump(char *m, ieee754sp x)
101{
102 int i;
103
104 printk("%s=", m);
105 printk("<%08x>\n", (unsigned) x.bits);
106 printk("\t=");
107 switch (ieee754sp_class(x)) {
108 case IEEE754_CLASS_QNAN:
109 case IEEE754_CLASS_SNAN:
110 printk("Nan %c", SPSIGN(x) ? '-' : '+');
111 for (i = SP_FBITS - 1; i >= 0; i--)
112 printk("%c", SPMANT(x) & SP_MBIT(i) ? '1' : '0');
113 break;
114 case IEEE754_CLASS_INF:
115 printk("%cInfinity", SPSIGN(x) ? '-' : '+');
116 break;
117 case IEEE754_CLASS_ZERO:
118 printk("%cZero", SPSIGN(x) ? '-' : '+');
119 break;
120 case IEEE754_CLASS_DNORM:
121 printk("%c0.", SPSIGN(x) ? '-' : '+');
122 for (i = SP_FBITS - 1; i >= 0; i--)
123 printk("%c", SPMANT(x) & SP_MBIT(i) ? '1' : '0');
124 printk("e%d", SPBEXP(x) - SP_EBIAS);
125 break;
126 case IEEE754_CLASS_NORM:
127 printk("%c1.", SPSIGN(x) ? '-' : '+');
128 for (i = SP_FBITS - 1; i >= 0; i--)
129 printk("%c", SPMANT(x) & SP_MBIT(i) ? '1' : '0');
130 printk("e%d", SPBEXP(x) - SP_EBIAS);
131 break;
132 default:
133 printk("Illegal/Unknown IEEE754 value class");
134 }
135 printk("\n");
136 return x;
137}
138
diff --git a/arch/mips/math-emu/ieee754dp.c b/arch/mips/math-emu/ieee754dp.c
new file mode 100644
index 000000000000..3e214aac4b12
--- /dev/null
+++ b/arch/mips/math-emu/ieee754dp.c
@@ -0,0 +1,243 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754dp.h"
29
30int ieee754dp_class(ieee754dp x)
31{
32 COMPXDP;
33 EXPLODEXDP;
34 return xc;
35}
36
37int ieee754dp_isnan(ieee754dp x)
38{
39 return ieee754dp_class(x) >= IEEE754_CLASS_SNAN;
40}
41
42int ieee754dp_issnan(ieee754dp x)
43{
44 assert(ieee754dp_isnan(x));
45 return ((DPMANT(x) & DP_MBIT(DP_MBITS-1)) == DP_MBIT(DP_MBITS-1));
46}
47
48
49ieee754dp ieee754dp_xcpt(ieee754dp r, const char *op, ...)
50{
51 struct ieee754xctx ax;
52 if (!TSTX())
53 return r;
54
55 ax.op = op;
56 ax.rt = IEEE754_RT_DP;
57 ax.rv.dp = r;
58 va_start(ax.ap, op);
59 ieee754_xcpt(&ax);
60 return ax.rv.dp;
61}
62
63ieee754dp ieee754dp_nanxcpt(ieee754dp r, const char *op, ...)
64{
65 struct ieee754xctx ax;
66
67 assert(ieee754dp_isnan(r));
68
69 if (!ieee754dp_issnan(r)) /* QNAN does not cause invalid op !! */
70 return r;
71
72 if (!SETANDTESTCX(IEEE754_INVALID_OPERATION)) {
73 /* not enabled convert to a quiet NaN */
74 DPMANT(r) &= (~DP_MBIT(DP_MBITS-1));
75 if (ieee754dp_isnan(r))
76 return r;
77 else
78 return ieee754dp_indef();
79 }
80
81 ax.op = op;
82 ax.rt = 0;
83 ax.rv.dp = r;
84 va_start(ax.ap, op);
85 ieee754_xcpt(&ax);
86 return ax.rv.dp;
87}
88
89ieee754dp ieee754dp_bestnan(ieee754dp x, ieee754dp y)
90{
91 assert(ieee754dp_isnan(x));
92 assert(ieee754dp_isnan(y));
93
94 if (DPMANT(x) > DPMANT(y))
95 return x;
96 else
97 return y;
98}
99
100
101static u64 get_rounding(int sn, u64 xm)
102{
103 /* inexact must round of 3 bits
104 */
105 if (xm & (DP_MBIT(3) - 1)) {
106 switch (ieee754_csr.rm) {
107 case IEEE754_RZ:
108 break;
109 case IEEE754_RN:
110 xm += 0x3 + ((xm >> 3) & 1);
111 /* xm += (xm&0x8)?0x4:0x3 */
112 break;
113 case IEEE754_RU: /* toward +Infinity */
114 if (!sn) /* ?? */
115 xm += 0x8;
116 break;
117 case IEEE754_RD: /* toward -Infinity */
118 if (sn) /* ?? */
119 xm += 0x8;
120 break;
121 }
122 }
123 return xm;
124}
125
126
127/* generate a normal/denormal number with over,under handling
128 * sn is sign
129 * xe is an unbiased exponent
130 * xm is 3bit extended precision value.
131 */
132ieee754dp ieee754dp_format(int sn, int xe, u64 xm)
133{
134 assert(xm); /* we don't gen exact zeros (probably should) */
135
136 assert((xm >> (DP_MBITS + 1 + 3)) == 0); /* no execess */
137 assert(xm & (DP_HIDDEN_BIT << 3));
138
139 if (xe < DP_EMIN) {
140 /* strip lower bits */
141 int es = DP_EMIN - xe;
142
143 if (ieee754_csr.nod) {
144 SETCX(IEEE754_UNDERFLOW);
145 SETCX(IEEE754_INEXACT);
146
147 switch(ieee754_csr.rm) {
148 case IEEE754_RN:
149 return ieee754dp_zero(sn);
150 case IEEE754_RZ:
151 return ieee754dp_zero(sn);
152 case IEEE754_RU: /* toward +Infinity */
153 if(sn == 0)
154 return ieee754dp_min(0);
155 else
156 return ieee754dp_zero(1);
157 case IEEE754_RD: /* toward -Infinity */
158 if(sn == 0)
159 return ieee754dp_zero(0);
160 else
161 return ieee754dp_min(1);
162 }
163 }
164
165 if (xe == DP_EMIN - 1
166 && get_rounding(sn, xm) >> (DP_MBITS + 1 + 3))
167 {
168 /* Not tiny after rounding */
169 SETCX(IEEE754_INEXACT);
170 xm = get_rounding(sn, xm);
171 xm >>= 1;
172 /* Clear grs bits */
173 xm &= ~(DP_MBIT(3) - 1);
174 xe++;
175 }
176 else {
177 /* sticky right shift es bits
178 */
179 xm = XDPSRS(xm, es);
180 xe += es;
181 assert((xm & (DP_HIDDEN_BIT << 3)) == 0);
182 assert(xe == DP_EMIN);
183 }
184 }
185 if (xm & (DP_MBIT(3) - 1)) {
186 SETCX(IEEE754_INEXACT);
187 if ((xm & (DP_HIDDEN_BIT << 3)) == 0) {
188 SETCX(IEEE754_UNDERFLOW);
189 }
190
191 /* inexact must round of 3 bits
192 */
193 xm = get_rounding(sn, xm);
194 /* adjust exponent for rounding add overflowing
195 */
196 if (xm >> (DP_MBITS + 3 + 1)) {
197 /* add causes mantissa overflow */
198 xm >>= 1;
199 xe++;
200 }
201 }
202 /* strip grs bits */
203 xm >>= 3;
204
205 assert((xm >> (DP_MBITS + 1)) == 0); /* no execess */
206 assert(xe >= DP_EMIN);
207
208 if (xe > DP_EMAX) {
209 SETCX(IEEE754_OVERFLOW);
210 SETCX(IEEE754_INEXACT);
211 /* -O can be table indexed by (rm,sn) */
212 switch (ieee754_csr.rm) {
213 case IEEE754_RN:
214 return ieee754dp_inf(sn);
215 case IEEE754_RZ:
216 return ieee754dp_max(sn);
217 case IEEE754_RU: /* toward +Infinity */
218 if (sn == 0)
219 return ieee754dp_inf(0);
220 else
221 return ieee754dp_max(1);
222 case IEEE754_RD: /* toward -Infinity */
223 if (sn == 0)
224 return ieee754dp_max(0);
225 else
226 return ieee754dp_inf(1);
227 }
228 }
229 /* gen norm/denorm/zero */
230
231 if ((xm & DP_HIDDEN_BIT) == 0) {
232 /* we underflow (tiny/zero) */
233 assert(xe == DP_EMIN);
234 if (ieee754_csr.mx & IEEE754_UNDERFLOW)
235 SETCX(IEEE754_UNDERFLOW);
236 return builddp(sn, DP_EMIN - 1 + DP_EBIAS, xm);
237 } else {
238 assert((xm >> (DP_MBITS + 1)) == 0); /* no execess */
239 assert(xm & DP_HIDDEN_BIT);
240
241 return builddp(sn, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
242 }
243}
diff --git a/arch/mips/math-emu/ieee754dp.h b/arch/mips/math-emu/ieee754dp.h
new file mode 100644
index 000000000000..a37370dae232
--- /dev/null
+++ b/arch/mips/math-emu/ieee754dp.h
@@ -0,0 +1,83 @@
1/*
2 * IEEE754 floating point
3 * double precision internal header file
4 */
5/*
6 * MIPS floating point support
7 * Copyright (C) 1994-2000 Algorithmics Ltd.
8 * http://www.algor.co.uk
9 *
10 * ########################################################################
11 *
12 * This program is free software; you can distribute it and/or modify it
13 * under the terms of the GNU General Public License (Version 2) as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * for more details.
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 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 *
25 * ########################################################################
26 */
27
28
29#include "ieee754int.h"
30
31#define assert(expr) ((void)0)
32
33/* 3bit extended double precision sticky right shift */
34#define XDPSRS(v,rs) \
35 ((rs > (DP_MBITS+3))?1:((v) >> (rs)) | ((v) << (64-(rs)) != 0))
36
37#define XDPSRSX1() \
38 (xe++, (xm = (xm >> 1) | (xm & 1)))
39
40#define XDPSRS1(v) \
41 (((v) >> 1) | ((v) & 1))
42
43/* convert denormal to normalized with extended exponent */
44#define DPDNORMx(m,e) \
45 while( (m >> DP_MBITS) == 0) { m <<= 1; e--; }
46#define DPDNORMX DPDNORMx(xm,xe)
47#define DPDNORMY DPDNORMx(ym,ye)
48
49static __inline ieee754dp builddp(int s, int bx, u64 m)
50{
51 ieee754dp r;
52
53 assert((s) == 0 || (s) == 1);
54 assert((bx) >= DP_EMIN - 1 + DP_EBIAS
55 && (bx) <= DP_EMAX + 1 + DP_EBIAS);
56 assert(((m) >> DP_MBITS) == 0);
57
58 r.parts.sign = s;
59 r.parts.bexp = bx;
60 r.parts.mant = m;
61 return r;
62}
63
64extern int ieee754dp_isnan(ieee754dp);
65extern int ieee754dp_issnan(ieee754dp);
66extern int ieee754si_xcpt(int, const char *, ...);
67extern s64 ieee754di_xcpt(s64, const char *, ...);
68extern ieee754dp ieee754dp_xcpt(ieee754dp, const char *, ...);
69extern ieee754dp ieee754dp_nanxcpt(ieee754dp, const char *, ...);
70extern ieee754dp ieee754dp_bestnan(ieee754dp, ieee754dp);
71extern ieee754dp ieee754dp_format(int, int, u64);
72
73
74#define DPNORMRET2(s,e,m,name,a0,a1) \
75{ \
76 ieee754dp V = ieee754dp_format(s,e,m); \
77 if(TSTX()) \
78 return ieee754dp_xcpt(V,name,a0,a1); \
79 else \
80 return V; \
81}
82
83#define DPNORMRET1(s,e,m,name,a0) DPNORMRET2(s,e,m,name,a0,a0)
diff --git a/arch/mips/math-emu/ieee754int.h b/arch/mips/math-emu/ieee754int.h
new file mode 100644
index 000000000000..4a5a81d6b893
--- /dev/null
+++ b/arch/mips/math-emu/ieee754int.h
@@ -0,0 +1,165 @@
1/*
2 * IEEE754 floating point
3 * common internal header file
4 */
5/*
6 * MIPS floating point support
7 * Copyright (C) 1994-2000 Algorithmics Ltd.
8 * http://www.algor.co.uk
9 *
10 * ########################################################################
11 *
12 * This program is free software; you can distribute it and/or modify it
13 * under the terms of the GNU General Public License (Version 2) as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * for more details.
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 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 *
25 * ########################################################################
26 */
27
28
29#include "ieee754.h"
30
31#define DP_EBIAS 1023
32#define DP_EMIN (-1022)
33#define DP_EMAX 1023
34#define DP_MBITS 52
35
36#define SP_EBIAS 127
37#define SP_EMIN (-126)
38#define SP_EMAX 127
39#define SP_MBITS 23
40
41#define DP_MBIT(x) ((u64)1 << (x))
42#define DP_HIDDEN_BIT DP_MBIT(DP_MBITS)
43#define DP_SIGN_BIT DP_MBIT(63)
44
45#define SP_MBIT(x) ((u32)1 << (x))
46#define SP_HIDDEN_BIT SP_MBIT(SP_MBITS)
47#define SP_SIGN_BIT SP_MBIT(31)
48
49
50#define SPSIGN(sp) (sp.parts.sign)
51#define SPBEXP(sp) (sp.parts.bexp)
52#define SPMANT(sp) (sp.parts.mant)
53
54#define DPSIGN(dp) (dp.parts.sign)
55#define DPBEXP(dp) (dp.parts.bexp)
56#define DPMANT(dp) (dp.parts.mant)
57
58#define CLPAIR(x,y) ((x)*6+(y))
59
60#define CLEARCX \
61 (ieee754_csr.cx = 0)
62
63#define SETCX(x) \
64 (ieee754_csr.cx |= (x),ieee754_csr.sx |= (x))
65
66#define SETANDTESTCX(x) \
67 (SETCX(x),ieee754_csr.mx & (x))
68
69#define TSTX() \
70 (ieee754_csr.cx & ieee754_csr.mx)
71
72
73#define COMPXSP \
74 unsigned xm; int xe; int xs; int xc
75
76#define COMPYSP \
77 unsigned ym; int ye; int ys; int yc
78
79#define EXPLODESP(v,vc,vs,ve,vm) \
80{\
81 vs = SPSIGN(v);\
82 ve = SPBEXP(v);\
83 vm = SPMANT(v);\
84 if(ve == SP_EMAX+1+SP_EBIAS){\
85 if(vm == 0)\
86 vc = IEEE754_CLASS_INF;\
87 else if(vm & SP_MBIT(SP_MBITS-1)) \
88 vc = IEEE754_CLASS_SNAN;\
89 else \
90 vc = IEEE754_CLASS_QNAN;\
91 } else if(ve == SP_EMIN-1+SP_EBIAS) {\
92 if(vm) {\
93 ve = SP_EMIN;\
94 vc = IEEE754_CLASS_DNORM;\
95 } else\
96 vc = IEEE754_CLASS_ZERO;\
97 } else {\
98 ve -= SP_EBIAS;\
99 vm |= SP_HIDDEN_BIT;\
100 vc = IEEE754_CLASS_NORM;\
101 }\
102}
103#define EXPLODEXSP EXPLODESP(x,xc,xs,xe,xm)
104#define EXPLODEYSP EXPLODESP(y,yc,ys,ye,ym)
105
106
107#define COMPXDP \
108u64 xm; int xe; int xs; int xc
109
110#define COMPYDP \
111u64 ym; int ye; int ys; int yc
112
113#define EXPLODEDP(v,vc,vs,ve,vm) \
114{\
115 vm = DPMANT(v);\
116 vs = DPSIGN(v);\
117 ve = DPBEXP(v);\
118 if(ve == DP_EMAX+1+DP_EBIAS){\
119 if(vm == 0)\
120 vc = IEEE754_CLASS_INF;\
121 else if(vm & DP_MBIT(DP_MBITS-1)) \
122 vc = IEEE754_CLASS_SNAN;\
123 else \
124 vc = IEEE754_CLASS_QNAN;\
125 } else if(ve == DP_EMIN-1+DP_EBIAS) {\
126 if(vm) {\
127 ve = DP_EMIN;\
128 vc = IEEE754_CLASS_DNORM;\
129 } else\
130 vc = IEEE754_CLASS_ZERO;\
131 } else {\
132 ve -= DP_EBIAS;\
133 vm |= DP_HIDDEN_BIT;\
134 vc = IEEE754_CLASS_NORM;\
135 }\
136}
137#define EXPLODEXDP EXPLODEDP(x,xc,xs,xe,xm)
138#define EXPLODEYDP EXPLODEDP(y,yc,ys,ye,ym)
139
140#define FLUSHDP(v,vc,vs,ve,vm) \
141 if(vc==IEEE754_CLASS_DNORM) {\
142 if(ieee754_csr.nod) {\
143 SETCX(IEEE754_INEXACT);\
144 vc = IEEE754_CLASS_ZERO;\
145 ve = DP_EMIN-1+DP_EBIAS;\
146 vm = 0;\
147 v = ieee754dp_zero(vs);\
148 }\
149 }
150
151#define FLUSHSP(v,vc,vs,ve,vm) \
152 if(vc==IEEE754_CLASS_DNORM) {\
153 if(ieee754_csr.nod) {\
154 SETCX(IEEE754_INEXACT);\
155 vc = IEEE754_CLASS_ZERO;\
156 ve = SP_EMIN-1+SP_EBIAS;\
157 vm = 0;\
158 v = ieee754sp_zero(vs);\
159 }\
160 }
161
162#define FLUSHXDP FLUSHDP(x,xc,xs,xe,xm)
163#define FLUSHYDP FLUSHDP(y,yc,ys,ye,ym)
164#define FLUSHXSP FLUSHSP(x,xc,xs,xe,xm)
165#define FLUSHYSP FLUSHSP(y,yc,ys,ye,ym)
diff --git a/arch/mips/math-emu/ieee754m.c b/arch/mips/math-emu/ieee754m.c
new file mode 100644
index 000000000000..d66896cd8f21
--- /dev/null
+++ b/arch/mips/math-emu/ieee754m.c
@@ -0,0 +1,56 @@
1/*
2 * floor, trunc, ceil
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754.h"
29
30ieee754dp ieee754dp_floor(ieee754dp x)
31{
32 ieee754dp i;
33
34 if (ieee754dp_lt(ieee754dp_modf(x, &i), ieee754dp_zero(0)))
35 return ieee754dp_sub(i, ieee754dp_one(0));
36 else
37 return i;
38}
39
40ieee754dp ieee754dp_ceil(ieee754dp x)
41{
42 ieee754dp i;
43
44 if (ieee754dp_gt(ieee754dp_modf(x, &i), ieee754dp_zero(0)))
45 return ieee754dp_add(i, ieee754dp_one(0));
46 else
47 return i;
48}
49
50ieee754dp ieee754dp_trunc(ieee754dp x)
51{
52 ieee754dp i;
53
54 (void) ieee754dp_modf(x, &i);
55 return i;
56}
diff --git a/arch/mips/math-emu/ieee754sp.c b/arch/mips/math-emu/ieee754sp.c
new file mode 100644
index 000000000000..adda851cd04f
--- /dev/null
+++ b/arch/mips/math-emu/ieee754sp.c
@@ -0,0 +1,243 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30int ieee754sp_class(ieee754sp x)
31{
32 COMPXSP;
33 EXPLODEXSP;
34 return xc;
35}
36
37int ieee754sp_isnan(ieee754sp x)
38{
39 return ieee754sp_class(x) >= IEEE754_CLASS_SNAN;
40}
41
42int ieee754sp_issnan(ieee754sp x)
43{
44 assert(ieee754sp_isnan(x));
45 return (SPMANT(x) & SP_MBIT(SP_MBITS-1));
46}
47
48
49ieee754sp ieee754sp_xcpt(ieee754sp r, const char *op, ...)
50{
51 struct ieee754xctx ax;
52
53 if (!TSTX())
54 return r;
55
56 ax.op = op;
57 ax.rt = IEEE754_RT_SP;
58 ax.rv.sp = r;
59 va_start(ax.ap, op);
60 ieee754_xcpt(&ax);
61 return ax.rv.sp;
62}
63
64ieee754sp ieee754sp_nanxcpt(ieee754sp r, const char *op, ...)
65{
66 struct ieee754xctx ax;
67
68 assert(ieee754sp_isnan(r));
69
70 if (!ieee754sp_issnan(r)) /* QNAN does not cause invalid op !! */
71 return r;
72
73 if (!SETANDTESTCX(IEEE754_INVALID_OPERATION)) {
74 /* not enabled convert to a quiet NaN */
75 SPMANT(r) &= (~SP_MBIT(SP_MBITS-1));
76 if (ieee754sp_isnan(r))
77 return r;
78 else
79 return ieee754sp_indef();
80 }
81
82 ax.op = op;
83 ax.rt = 0;
84 ax.rv.sp = r;
85 va_start(ax.ap, op);
86 ieee754_xcpt(&ax);
87 return ax.rv.sp;
88}
89
90ieee754sp ieee754sp_bestnan(ieee754sp x, ieee754sp y)
91{
92 assert(ieee754sp_isnan(x));
93 assert(ieee754sp_isnan(y));
94
95 if (SPMANT(x) > SPMANT(y))
96 return x;
97 else
98 return y;
99}
100
101
102static unsigned get_rounding(int sn, unsigned xm)
103{
104 /* inexact must round of 3 bits
105 */
106 if (xm & (SP_MBIT(3) - 1)) {
107 switch (ieee754_csr.rm) {
108 case IEEE754_RZ:
109 break;
110 case IEEE754_RN:
111 xm += 0x3 + ((xm >> 3) & 1);
112 /* xm += (xm&0x8)?0x4:0x3 */
113 break;
114 case IEEE754_RU: /* toward +Infinity */
115 if (!sn) /* ?? */
116 xm += 0x8;
117 break;
118 case IEEE754_RD: /* toward -Infinity */
119 if (sn) /* ?? */
120 xm += 0x8;
121 break;
122 }
123 }
124 return xm;
125}
126
127
128/* generate a normal/denormal number with over,under handling
129 * sn is sign
130 * xe is an unbiased exponent
131 * xm is 3bit extended precision value.
132 */
133ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
134{
135 assert(xm); /* we don't gen exact zeros (probably should) */
136
137 assert((xm >> (SP_MBITS + 1 + 3)) == 0); /* no execess */
138 assert(xm & (SP_HIDDEN_BIT << 3));
139
140 if (xe < SP_EMIN) {
141 /* strip lower bits */
142 int es = SP_EMIN - xe;
143
144 if (ieee754_csr.nod) {
145 SETCX(IEEE754_UNDERFLOW);
146 SETCX(IEEE754_INEXACT);
147
148 switch(ieee754_csr.rm) {
149 case IEEE754_RN:
150 return ieee754sp_zero(sn);
151 case IEEE754_RZ:
152 return ieee754sp_zero(sn);
153 case IEEE754_RU: /* toward +Infinity */
154 if(sn == 0)
155 return ieee754sp_min(0);
156 else
157 return ieee754sp_zero(1);
158 case IEEE754_RD: /* toward -Infinity */
159 if(sn == 0)
160 return ieee754sp_zero(0);
161 else
162 return ieee754sp_min(1);
163 }
164 }
165
166 if (xe == SP_EMIN - 1
167 && get_rounding(sn, xm) >> (SP_MBITS + 1 + 3))
168 {
169 /* Not tiny after rounding */
170 SETCX(IEEE754_INEXACT);
171 xm = get_rounding(sn, xm);
172 xm >>= 1;
173 /* Clear grs bits */
174 xm &= ~(SP_MBIT(3) - 1);
175 xe++;
176 }
177 else {
178 /* sticky right shift es bits
179 */
180 SPXSRSXn(es);
181 assert((xm & (SP_HIDDEN_BIT << 3)) == 0);
182 assert(xe == SP_EMIN);
183 }
184 }
185 if (xm & (SP_MBIT(3) - 1)) {
186 SETCX(IEEE754_INEXACT);
187 if ((xm & (SP_HIDDEN_BIT << 3)) == 0) {
188 SETCX(IEEE754_UNDERFLOW);
189 }
190
191 /* inexact must round of 3 bits
192 */
193 xm = get_rounding(sn, xm);
194 /* adjust exponent for rounding add overflowing
195 */
196 if (xm >> (SP_MBITS + 1 + 3)) {
197 /* add causes mantissa overflow */
198 xm >>= 1;
199 xe++;
200 }
201 }
202 /* strip grs bits */
203 xm >>= 3;
204
205 assert((xm >> (SP_MBITS + 1)) == 0); /* no execess */
206 assert(xe >= SP_EMIN);
207
208 if (xe > SP_EMAX) {
209 SETCX(IEEE754_OVERFLOW);
210 SETCX(IEEE754_INEXACT);
211 /* -O can be table indexed by (rm,sn) */
212 switch (ieee754_csr.rm) {
213 case IEEE754_RN:
214 return ieee754sp_inf(sn);
215 case IEEE754_RZ:
216 return ieee754sp_max(sn);
217 case IEEE754_RU: /* toward +Infinity */
218 if (sn == 0)
219 return ieee754sp_inf(0);
220 else
221 return ieee754sp_max(1);
222 case IEEE754_RD: /* toward -Infinity */
223 if (sn == 0)
224 return ieee754sp_max(0);
225 else
226 return ieee754sp_inf(1);
227 }
228 }
229 /* gen norm/denorm/zero */
230
231 if ((xm & SP_HIDDEN_BIT) == 0) {
232 /* we underflow (tiny/zero) */
233 assert(xe == SP_EMIN);
234 if (ieee754_csr.mx & IEEE754_UNDERFLOW)
235 SETCX(IEEE754_UNDERFLOW);
236 return buildsp(sn, SP_EMIN - 1 + SP_EBIAS, xm);
237 } else {
238 assert((xm >> (SP_MBITS + 1)) == 0); /* no execess */
239 assert(xm & SP_HIDDEN_BIT);
240
241 return buildsp(sn, xe + SP_EBIAS, xm & ~SP_HIDDEN_BIT);
242 }
243}
diff --git a/arch/mips/math-emu/ieee754sp.h b/arch/mips/math-emu/ieee754sp.h
new file mode 100644
index 000000000000..ae82f51297e5
--- /dev/null
+++ b/arch/mips/math-emu/ieee754sp.h
@@ -0,0 +1,89 @@
1/*
2 * IEEE754 floating point
3 * double precision internal header file
4 */
5/*
6 * MIPS floating point support
7 * Copyright (C) 1994-2000 Algorithmics Ltd.
8 * http://www.algor.co.uk
9 *
10 * ########################################################################
11 *
12 * This program is free software; you can distribute it and/or modify it
13 * under the terms of the GNU General Public License (Version 2) as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * for more details.
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 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 *
25 * ########################################################################
26 */
27
28
29#include "ieee754int.h"
30
31#define assert(expr) ((void)0)
32
33/* 3bit extended single precision sticky right shift */
34#define SPXSRSXn(rs) \
35 (xe += rs, \
36 xm = (rs > (SP_MBITS+3))?1:((xm) >> (rs)) | ((xm) << (32-(rs)) != 0))
37
38#define SPXSRSX1() \
39 (xe++, (xm = (xm >> 1) | (xm & 1)))
40
41#define SPXSRSYn(rs) \
42 (ye+=rs, \
43 ym = (rs > (SP_MBITS+3))?1:((ym) >> (rs)) | ((ym) << (32-(rs)) != 0))
44
45#define SPXSRSY1() \
46 (ye++, (ym = (ym >> 1) | (ym & 1)))
47
48/* convert denormal to normalized with extended exponent */
49#define SPDNORMx(m,e) \
50 while( (m >> SP_MBITS) == 0) { m <<= 1; e--; }
51#define SPDNORMX SPDNORMx(xm,xe)
52#define SPDNORMY SPDNORMx(ym,ye)
53
54static __inline ieee754sp buildsp(int s, int bx, unsigned m)
55{
56 ieee754sp r;
57
58 assert((s) == 0 || (s) == 1);
59 assert((bx) >= SP_EMIN - 1 + SP_EBIAS
60 && (bx) <= SP_EMAX + 1 + SP_EBIAS);
61 assert(((m) >> SP_MBITS) == 0);
62
63 r.parts.sign = s;
64 r.parts.bexp = bx;
65 r.parts.mant = m;
66
67 return r;
68}
69
70extern int ieee754sp_isnan(ieee754sp);
71extern int ieee754sp_issnan(ieee754sp);
72extern int ieee754si_xcpt(int, const char *, ...);
73extern s64 ieee754di_xcpt(s64, const char *, ...);
74extern ieee754sp ieee754sp_xcpt(ieee754sp, const char *, ...);
75extern ieee754sp ieee754sp_nanxcpt(ieee754sp, const char *, ...);
76extern ieee754sp ieee754sp_bestnan(ieee754sp, ieee754sp);
77extern ieee754sp ieee754sp_format(int, int, unsigned);
78
79
80#define SPNORMRET2(s,e,m,name,a0,a1) \
81{ \
82 ieee754sp V = ieee754sp_format(s,e,m); \
83 if(TSTX()) \
84 return ieee754sp_xcpt(V,name,a0,a1); \
85 else \
86 return V; \
87}
88
89#define SPNORMRET1(s,e,m,name,a0) SPNORMRET2(s,e,m,name,a0,a0)
diff --git a/arch/mips/math-emu/ieee754xcpt.c b/arch/mips/math-emu/ieee754xcpt.c
new file mode 100644
index 000000000000..7d8ef8965067
--- /dev/null
+++ b/arch/mips/math-emu/ieee754xcpt.c
@@ -0,0 +1,49 @@
1/*
2 * MIPS floating point support
3 * Copyright (C) 1994-2000 Algorithmics Ltd.
4 * http://www.algor.co.uk
5 *
6 * ########################################################################
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 *
21 * ########################################################################
22 */
23
24/**************************************************************************
25 * Nov 7, 2000
26 * Added preprocessor hacks to map to Linux kernel diagnostics.
27 *
28 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
29 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
30 *************************************************************************/
31
32#include <linux/kernel.h>
33#include "ieee754.h"
34
35/*
36 * Very naff exception handler (you can plug in your own and
37 * override this).
38 */
39
40static const char *const rtnames[] = {
41 "sp", "dp", "xp", "si", "di"
42};
43
44void ieee754_xcpt(struct ieee754xctx *xcp)
45{
46 printk(KERN_DEBUG "floating point exception in \"%s\", type=%s\n",
47 xcp->op, rtnames[xcp->rt]);
48}
49
diff --git a/arch/mips/math-emu/kernel_linkage.c b/arch/mips/math-emu/kernel_linkage.c
new file mode 100644
index 000000000000..04397fec30fc
--- /dev/null
+++ b/arch/mips/math-emu/kernel_linkage.c
@@ -0,0 +1,125 @@
1/*
2 * Kevin D. Kissell, kevink@mips and Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Routines corresponding to Linux kernel FP context
19 * manipulation primitives for the Algorithmics MIPS
20 * FPU Emulator
21 */
22#include <linux/config.h>
23#include <linux/sched.h>
24#include <asm/processor.h>
25#include <asm/signal.h>
26#include <asm/uaccess.h>
27
28#include <asm/fpu_emulator.h>
29
30extern struct mips_fpu_emulator_private fpuemuprivate;
31
32#define SIGNALLING_NAN 0x7ff800007ff80000LL
33
34void fpu_emulator_init_fpu(void)
35{
36 static int first = 1;
37 int i;
38
39 if (first) {
40 first = 0;
41 printk("Algorithmics/MIPS FPU Emulator v1.5\n");
42 }
43
44 current->thread.fpu.soft.fcr31 = 0;
45 for (i = 0; i < 32; i++) {
46 current->thread.fpu.soft.fpr[i] = SIGNALLING_NAN;
47 }
48}
49
50
51/*
52 * Emulator context save/restore to/from a signal context
53 * presumed to be on the user stack, and therefore accessed
54 * with appropriate macros from uaccess.h
55 */
56
57int fpu_emulator_save_context(struct sigcontext *sc)
58{
59 int i;
60 int err = 0;
61
62 for (i = 0; i < 32; i++) {
63 err |=
64 __put_user(current->thread.fpu.soft.fpr[i],
65 &sc->sc_fpregs[i]);
66 }
67 err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
68 err |= __put_user(fpuemuprivate.eir, &sc->sc_fpc_eir);
69
70 return err;
71}
72
73int fpu_emulator_restore_context(struct sigcontext *sc)
74{
75 int i;
76 int err = 0;
77
78 for (i = 0; i < 32; i++) {
79 err |=
80 __get_user(current->thread.fpu.soft.fpr[i],
81 &sc->sc_fpregs[i]);
82 }
83 err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
84 err |= __get_user(fpuemuprivate.eir, &sc->sc_fpc_eir);
85
86 return err;
87}
88
89#ifdef CONFIG_MIPS64
90/*
91 * This is the o32 version
92 */
93
94int fpu_emulator_save_context32(struct sigcontext32 *sc)
95{
96 int i;
97 int err = 0;
98
99 for (i = 0; i < 32; i+=2) {
100 err |=
101 __put_user(current->thread.fpu.soft.fpr[i],
102 &sc->sc_fpregs[i]);
103 }
104 err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
105 err |= __put_user(fpuemuprivate.eir, &sc->sc_fpc_eir);
106
107 return err;
108}
109
110int fpu_emulator_restore_context32(struct sigcontext32 *sc)
111{
112 int i;
113 int err = 0;
114
115 for (i = 0; i < 32; i+=2) {
116 err |=
117 __get_user(current->thread.fpu.soft.fpr[i],
118 &sc->sc_fpregs[i]);
119 }
120 err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr);
121 err |= __get_user(fpuemuprivate.eir, &sc->sc_fpc_eir);
122
123 return err;
124}
125#endif
diff --git a/arch/mips/math-emu/sp_add.c b/arch/mips/math-emu/sp_add.c
new file mode 100644
index 000000000000..d8c4211bcfbe
--- /dev/null
+++ b/arch/mips/math-emu/sp_add.c
@@ -0,0 +1,177 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_add(ieee754sp x, ieee754sp y)
31{
32 COMPXSP;
33 COMPYSP;
34
35 EXPLODEXSP;
36 EXPLODEYSP;
37
38 CLEARCX;
39
40 FLUSHXSP;
41 FLUSHYSP;
42
43 switch (CLPAIR(xc, yc)) {
44 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN):
45 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN):
46 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN):
47 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN):
48 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN):
49 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN):
50 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN):
51 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO):
52 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
53 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
54 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
55 SETCX(IEEE754_INVALID_OPERATION);
56 return ieee754sp_nanxcpt(ieee754sp_indef(), "add", x, y);
57
58 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
59 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
60 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN):
61 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
62 return y;
63
64 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
65 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
66 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
67 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
68 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF):
69 return x;
70
71
72 /* Infinity handling
73 */
74
75 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
76 if (xs == ys)
77 return x;
78 SETCX(IEEE754_INVALID_OPERATION);
79 return ieee754sp_xcpt(ieee754sp_indef(), "add", x, y);
80
81 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
82 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
83 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
84 return y;
85
86 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
87 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
88 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
89 return x;
90
91 /* Zero handling
92 */
93
94 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
95 if (xs == ys)
96 return x;
97 else
98 return ieee754sp_zero(ieee754_csr.rm ==
99 IEEE754_RD);
100
101 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
102 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
103 return x;
104
105 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
106 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM):
107 return y;
108
109 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
110 SPDNORMX;
111
112 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
113 SPDNORMY;
114 break;
115
116 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM):
117 SPDNORMX;
118 break;
119
120 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
121 break;
122 }
123 assert(xm & SP_HIDDEN_BIT);
124 assert(ym & SP_HIDDEN_BIT);
125
126 /* provide guard,round and stick bit space */
127 xm <<= 3;
128 ym <<= 3;
129
130 if (xe > ye) {
131 /* have to shift y fraction right to align
132 */
133 int s = xe - ye;
134 SPXSRSYn(s);
135 } else if (ye > xe) {
136 /* have to shift x fraction right to align
137 */
138 int s = ye - xe;
139 SPXSRSXn(s);
140 }
141 assert(xe == ye);
142 assert(xe <= SP_EMAX);
143
144 if (xs == ys) {
145 /* generate 28 bit result of adding two 27 bit numbers
146 * leaving result in xm,xs,xe
147 */
148 xm = xm + ym;
149 xe = xe;
150 xs = xs;
151
152 if (xm >> (SP_MBITS + 1 + 3)) { /* carry out */
153 SPXSRSX1();
154 }
155 } else {
156 if (xm >= ym) {
157 xm = xm - ym;
158 xe = xe;
159 xs = xs;
160 } else {
161 xm = ym - xm;
162 xe = xe;
163 xs = ys;
164 }
165 if (xm == 0)
166 return ieee754sp_zero(ieee754_csr.rm ==
167 IEEE754_RD);
168
169 /* normalize in extended single precision */
170 while ((xm >> (SP_MBITS + 3)) == 0) {
171 xm <<= 1;
172 xe--;
173 }
174
175 }
176 SPNORMRET2(xs, xe, xm, "add", x, y);
177}
diff --git a/arch/mips/math-emu/sp_cmp.c b/arch/mips/math-emu/sp_cmp.c
new file mode 100644
index 000000000000..d3eff6b04b5a
--- /dev/null
+++ b/arch/mips/math-emu/sp_cmp.c
@@ -0,0 +1,67 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30int ieee754sp_cmp(ieee754sp x, ieee754sp y, int cmp, int sig)
31{
32 COMPXSP;
33 COMPYSP;
34
35 EXPLODEXSP;
36 EXPLODEYSP;
37 FLUSHXSP;
38 FLUSHYSP;
39 CLEARCX; /* Even clear inexact flag here */
40
41 if (ieee754sp_isnan(x) || ieee754sp_isnan(y)) {
42 if (sig || xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN)
43 SETCX(IEEE754_INVALID_OPERATION);
44 if (cmp & IEEE754_CUN)
45 return 1;
46 if (cmp & (IEEE754_CLT | IEEE754_CGT)) {
47 if (sig && SETANDTESTCX(IEEE754_INVALID_OPERATION))
48 return ieee754si_xcpt(0, "fcmpf", x);
49 }
50 return 0;
51 } else {
52 int vx = x.bits;
53 int vy = y.bits;
54
55 if (vx < 0)
56 vx = -vx ^ SP_SIGN_BIT;
57 if (vy < 0)
58 vy = -vy ^ SP_SIGN_BIT;
59
60 if (vx < vy)
61 return (cmp & IEEE754_CLT) != 0;
62 else if (vx == vy)
63 return (cmp & IEEE754_CEQ) != 0;
64 else
65 return (cmp & IEEE754_CGT) != 0;
66 }
67}
diff --git a/arch/mips/math-emu/sp_div.c b/arch/mips/math-emu/sp_div.c
new file mode 100644
index 000000000000..2b437fcfdad9
--- /dev/null
+++ b/arch/mips/math-emu/sp_div.c
@@ -0,0 +1,157 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_div(ieee754sp x, ieee754sp y)
31{
32 COMPXSP;
33 COMPYSP;
34
35 EXPLODEXSP;
36 EXPLODEYSP;
37
38 CLEARCX;
39
40 FLUSHXSP;
41 FLUSHYSP;
42
43 switch (CLPAIR(xc, yc)) {
44 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN):
45 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN):
46 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN):
47 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN):
48 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN):
49 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN):
50 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN):
51 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO):
52 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
53 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
54 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
55 SETCX(IEEE754_INVALID_OPERATION);
56 return ieee754sp_nanxcpt(ieee754sp_indef(), "div", x, y);
57
58 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
59 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
60 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN):
61 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
62 return y;
63
64 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
65 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
66 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
67 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
68 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF):
69 return x;
70
71
72 /* Infinity handling
73 */
74
75 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
76 SETCX(IEEE754_INVALID_OPERATION);
77 return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y);
78
79 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
80 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
81 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
82 return ieee754sp_zero(xs ^ ys);
83
84 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
85 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
86 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
87 return ieee754sp_inf(xs ^ ys);
88
89 /* Zero handling
90 */
91
92 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
93 SETCX(IEEE754_INVALID_OPERATION);
94 return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y);
95
96 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
97 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
98 SETCX(IEEE754_ZERO_DIVIDE);
99 return ieee754sp_xcpt(ieee754sp_inf(xs ^ ys), "div", x, y);
100
101 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
102 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM):
103 return ieee754sp_zero(xs == ys ? 0 : 1);
104
105 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
106 SPDNORMX;
107
108 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
109 SPDNORMY;
110 break;
111
112 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM):
113 SPDNORMX;
114 break;
115
116 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
117 break;
118 }
119 assert(xm & SP_HIDDEN_BIT);
120 assert(ym & SP_HIDDEN_BIT);
121
122 /* provide rounding space */
123 xm <<= 3;
124 ym <<= 3;
125
126 {
127 /* now the dirty work */
128
129 unsigned rm = 0;
130 int re = xe - ye;
131 unsigned bm;
132
133 for (bm = SP_MBIT(SP_MBITS + 2); bm; bm >>= 1) {
134 if (xm >= ym) {
135 xm -= ym;
136 rm |= bm;
137 if (xm == 0)
138 break;
139 }
140 xm <<= 1;
141 }
142 rm <<= 1;
143 if (xm)
144 rm |= 1; /* have remainder, set sticky */
145
146 assert(rm);
147
148 /* normalise rm to rounding precision ?
149 */
150 while ((rm >> (SP_MBITS + 3)) == 0) {
151 rm <<= 1;
152 re--;
153 }
154
155 SPNORMRET2(xs == ys ? 0 : 1, re, rm, "div", x, y);
156 }
157}
diff --git a/arch/mips/math-emu/sp_fdp.c b/arch/mips/math-emu/sp_fdp.c
new file mode 100644
index 000000000000..4093723d1aa5
--- /dev/null
+++ b/arch/mips/math-emu/sp_fdp.c
@@ -0,0 +1,77 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_fdp(ieee754dp x)
31{
32 COMPXDP;
33 ieee754sp nan;
34
35 EXPLODEXDP;
36
37 CLEARCX;
38
39 FLUSHXDP;
40
41 switch (xc) {
42 case IEEE754_CLASS_SNAN:
43 SETCX(IEEE754_INVALID_OPERATION);
44 return ieee754sp_nanxcpt(ieee754sp_indef(), "fdp");
45 case IEEE754_CLASS_QNAN:
46 nan = buildsp(xs, SP_EMAX + 1 + SP_EBIAS, (u32)
47 (xm >> (DP_MBITS - SP_MBITS)));
48 if (!ieee754sp_isnan(nan))
49 nan = ieee754sp_indef();
50 return ieee754sp_nanxcpt(nan, "fdp", x);
51 case IEEE754_CLASS_INF:
52 return ieee754sp_inf(xs);
53 case IEEE754_CLASS_ZERO:
54 return ieee754sp_zero(xs);
55 case IEEE754_CLASS_DNORM:
56 /* can't possibly be sp representable */
57 SETCX(IEEE754_UNDERFLOW);
58 SETCX(IEEE754_INEXACT);
59 if ((ieee754_csr.rm == IEEE754_RU && !xs) ||
60 (ieee754_csr.rm == IEEE754_RD && xs))
61 return ieee754sp_xcpt(ieee754sp_mind(xs), "fdp", x);
62 return ieee754sp_xcpt(ieee754sp_zero(xs), "fdp", x);
63 case IEEE754_CLASS_NORM:
64 break;
65 }
66
67 {
68 u32 rm;
69
70 /* convert from DP_MBITS to SP_MBITS+3 with sticky right shift
71 */
72 rm = (xm >> (DP_MBITS - (SP_MBITS + 3))) |
73 ((xm << (64 - (DP_MBITS - (SP_MBITS + 3)))) != 0);
74
75 SPNORMRET1(xs, xe, rm, "fdp", x);
76 }
77}
diff --git a/arch/mips/math-emu/sp_fint.c b/arch/mips/math-emu/sp_fint.c
new file mode 100644
index 000000000000..42d9ed4b9a94
--- /dev/null
+++ b/arch/mips/math-emu/sp_fint.c
@@ -0,0 +1,80 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_fint(int x)
31{
32 COMPXSP;
33
34 CLEARCX;
35
36 xc = ( 0 ? xc : xc );
37
38 if (x == 0)
39 return ieee754sp_zero(0);
40 if (x == 1 || x == -1)
41 return ieee754sp_one(x < 0);
42 if (x == 10 || x == -10)
43 return ieee754sp_ten(x < 0);
44
45 xs = (x < 0);
46 if (xs) {
47 if (x == (1 << 31))
48 xm = ((unsigned) 1 << 31); /* max neg can't be safely negated */
49 else
50 xm = -x;
51 } else {
52 xm = x;
53 }
54 xe = SP_MBITS + 3;
55
56 if (xm >> (SP_MBITS + 1 + 3)) {
57 /* shunt out overflow bits
58 */
59 while (xm >> (SP_MBITS + 1 + 3)) {
60 SPXSRSX1();
61 }
62 } else {
63 /* normalize in grs extended single precision
64 */
65 while ((xm >> (SP_MBITS + 3)) == 0) {
66 xm <<= 1;
67 xe--;
68 }
69 }
70 SPNORMRET1(xs, xe, xm, "fint", x);
71}
72
73
74ieee754sp ieee754sp_funs(unsigned int u)
75{
76 if ((int) u < 0)
77 return ieee754sp_add(ieee754sp_1e31(),
78 ieee754sp_fint(u & ~(1 << 31)));
79 return ieee754sp_fint(u);
80}
diff --git a/arch/mips/math-emu/sp_flong.c b/arch/mips/math-emu/sp_flong.c
new file mode 100644
index 000000000000..1e26795ccecb
--- /dev/null
+++ b/arch/mips/math-emu/sp_flong.c
@@ -0,0 +1,79 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_flong(s64 x)
31{
32 COMPXDP; /* <--- need 64-bit mantissa temp */
33
34 CLEARCX;
35
36 xc = ( 0 ? xc : xc );
37
38 if (x == 0)
39 return ieee754sp_zero(0);
40 if (x == 1 || x == -1)
41 return ieee754sp_one(x < 0);
42 if (x == 10 || x == -10)
43 return ieee754sp_ten(x < 0);
44
45 xs = (x < 0);
46 if (xs) {
47 if (x == (1ULL << 63))
48 xm = (1ULL << 63); /* max neg can't be safely negated */
49 else
50 xm = -x;
51 } else {
52 xm = x;
53 }
54 xe = SP_MBITS + 3;
55
56 if (xm >> (SP_MBITS + 1 + 3)) {
57 /* shunt out overflow bits
58 */
59 while (xm >> (SP_MBITS + 1 + 3)) {
60 SPXSRSX1();
61 }
62 } else {
63 /* normalize in grs extended single precision */
64 while ((xm >> (SP_MBITS + 3)) == 0) {
65 xm <<= 1;
66 xe--;
67 }
68 }
69 SPNORMRET1(xs, xe, xm, "sp_flong", x);
70}
71
72
73ieee754sp ieee754sp_fulong(u64 u)
74{
75 if ((s64) u < 0)
76 return ieee754sp_add(ieee754sp_1e63(),
77 ieee754sp_flong(u & ~(1ULL << 63)));
78 return ieee754sp_flong(u);
79}
diff --git a/arch/mips/math-emu/sp_frexp.c b/arch/mips/math-emu/sp_frexp.c
new file mode 100644
index 000000000000..359c6483dbfa
--- /dev/null
+++ b/arch/mips/math-emu/sp_frexp.c
@@ -0,0 +1,53 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30/* close to ieeep754sp_logb
31*/
32ieee754sp ieee754sp_frexp(ieee754sp x, int *eptr)
33{
34 COMPXSP;
35 CLEARCX;
36 EXPLODEXSP;
37
38 switch (xc) {
39 case IEEE754_CLASS_SNAN:
40 case IEEE754_CLASS_QNAN:
41 case IEEE754_CLASS_INF:
42 case IEEE754_CLASS_ZERO:
43 *eptr = 0;
44 return x;
45 case IEEE754_CLASS_DNORM:
46 SPDNORMX;
47 break;
48 case IEEE754_CLASS_NORM:
49 break;
50 }
51 *eptr = xe + 1;
52 return buildsp(xs, -1 + SP_EBIAS, xm & ~SP_HIDDEN_BIT);
53}
diff --git a/arch/mips/math-emu/sp_logb.c b/arch/mips/math-emu/sp_logb.c
new file mode 100644
index 000000000000..3c337219ca32
--- /dev/null
+++ b/arch/mips/math-emu/sp_logb.c
@@ -0,0 +1,54 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_logb(ieee754sp x)
31{
32 COMPXSP;
33
34 CLEARCX;
35
36 EXPLODEXSP;
37
38 switch (xc) {
39 case IEEE754_CLASS_SNAN:
40 return ieee754sp_nanxcpt(x, "logb", x);
41 case IEEE754_CLASS_QNAN:
42 return x;
43 case IEEE754_CLASS_INF:
44 return ieee754sp_inf(0);
45 case IEEE754_CLASS_ZERO:
46 return ieee754sp_inf(1);
47 case IEEE754_CLASS_DNORM:
48 SPDNORMX;
49 break;
50 case IEEE754_CLASS_NORM:
51 break;
52 }
53 return ieee754sp_fint(xe);
54}
diff --git a/arch/mips/math-emu/sp_modf.c b/arch/mips/math-emu/sp_modf.c
new file mode 100644
index 000000000000..4b1dbac796f8
--- /dev/null
+++ b/arch/mips/math-emu/sp_modf.c
@@ -0,0 +1,80 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30/* modf function is always exact for a finite number
31*/
32ieee754sp ieee754sp_modf(ieee754sp x, ieee754sp * ip)
33{
34 COMPXSP;
35
36 CLEARCX;
37
38 EXPLODEXSP;
39
40 switch (xc) {
41 case IEEE754_CLASS_SNAN:
42 case IEEE754_CLASS_QNAN:
43 case IEEE754_CLASS_INF:
44 case IEEE754_CLASS_ZERO:
45 *ip = x;
46 return x;
47 case IEEE754_CLASS_DNORM:
48 /* far to small */
49 *ip = ieee754sp_zero(xs);
50 return x;
51 case IEEE754_CLASS_NORM:
52 break;
53 }
54 if (xe < 0) {
55 *ip = ieee754sp_zero(xs);
56 return x;
57 }
58 if (xe >= SP_MBITS) {
59 *ip = x;
60 return ieee754sp_zero(xs);
61 }
62 /* generate ipart mantissa by clearing bottom bits
63 */
64 *ip = buildsp(xs, xe + SP_EBIAS,
65 ((xm >> (SP_MBITS - xe)) << (SP_MBITS - xe)) &
66 ~SP_HIDDEN_BIT);
67
68 /* generate fpart mantissa by clearing top bits
69 * and normalizing (must be able to normalize)
70 */
71 xm = (xm << (32 - (SP_MBITS - xe))) >> (32 - (SP_MBITS - xe));
72 if (xm == 0)
73 return ieee754sp_zero(xs);
74
75 while ((xm >> SP_MBITS) == 0) {
76 xm <<= 1;
77 xe--;
78 }
79 return buildsp(xs, xe + SP_EBIAS, xm & ~SP_HIDDEN_BIT);
80}
diff --git a/arch/mips/math-emu/sp_mul.c b/arch/mips/math-emu/sp_mul.c
new file mode 100644
index 000000000000..3f070f82212f
--- /dev/null
+++ b/arch/mips/math-emu/sp_mul.c
@@ -0,0 +1,171 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_mul(ieee754sp x, ieee754sp y)
31{
32 COMPXSP;
33 COMPYSP;
34
35 EXPLODEXSP;
36 EXPLODEYSP;
37
38 CLEARCX;
39
40 FLUSHXSP;
41 FLUSHYSP;
42
43 switch (CLPAIR(xc, yc)) {
44 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN):
45 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN):
46 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN):
47 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN):
48 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN):
49 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN):
50 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN):
51 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO):
52 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
53 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
54 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
55 SETCX(IEEE754_INVALID_OPERATION);
56 return ieee754sp_nanxcpt(ieee754sp_indef(), "mul", x, y);
57
58 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
59 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
60 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN):
61 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
62 return y;
63
64 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
65 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
66 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
67 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
68 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF):
69 return x;
70
71
72 /* Infinity handling */
73
74 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
75 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
76 SETCX(IEEE754_INVALID_OPERATION);
77 return ieee754sp_xcpt(ieee754sp_indef(), "mul", x, y);
78
79 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
80 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
81 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
82 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
83 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
84 return ieee754sp_inf(xs ^ ys);
85
86 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
87 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
88 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM):
89 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
90 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
91 return ieee754sp_zero(xs ^ ys);
92
93
94 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
95 SPDNORMX;
96
97 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
98 SPDNORMY;
99 break;
100
101 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM):
102 SPDNORMX;
103 break;
104
105 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
106 break;
107 }
108 /* rm = xm * ym, re = xe+ye basicly */
109 assert(xm & SP_HIDDEN_BIT);
110 assert(ym & SP_HIDDEN_BIT);
111
112 {
113 int re = xe + ye;
114 int rs = xs ^ ys;
115 unsigned rm;
116
117 /* shunt to top of word */
118 xm <<= 32 - (SP_MBITS + 1);
119 ym <<= 32 - (SP_MBITS + 1);
120
121 /* multiply 32bits xm,ym to give high 32bits rm with stickness
122 */
123 {
124 unsigned short lxm = xm & 0xffff;
125 unsigned short hxm = xm >> 16;
126 unsigned short lym = ym & 0xffff;
127 unsigned short hym = ym >> 16;
128 unsigned lrm;
129 unsigned hrm;
130
131 lrm = lxm * lym; /* 16 * 16 => 32 */
132 hrm = hxm * hym; /* 16 * 16 => 32 */
133
134 {
135 unsigned t = lxm * hym; /* 16 * 16 => 32 */
136 {
137 unsigned at = lrm + (t << 16);
138 hrm += at < lrm;
139 lrm = at;
140 }
141 hrm = hrm + (t >> 16);
142 }
143
144 {
145 unsigned t = hxm * lym; /* 16 * 16 => 32 */
146 {
147 unsigned at = lrm + (t << 16);
148 hrm += at < lrm;
149 lrm = at;
150 }
151 hrm = hrm + (t >> 16);
152 }
153 rm = hrm | (lrm != 0);
154 }
155
156 /*
157 * sticky shift down to normal rounding precision
158 */
159 if ((int) rm < 0) {
160 rm = (rm >> (32 - (SP_MBITS + 1 + 3))) |
161 ((rm << (SP_MBITS + 1 + 3)) != 0);
162 re++;
163 } else {
164 rm = (rm >> (32 - (SP_MBITS + 1 + 3 + 1))) |
165 ((rm << (SP_MBITS + 1 + 3 + 1)) != 0);
166 }
167 assert(rm & (SP_HIDDEN_BIT << 3));
168
169 SPNORMRET2(rs, re, rm, "mul", x, y);
170 }
171}
diff --git a/arch/mips/math-emu/sp_scalb.c b/arch/mips/math-emu/sp_scalb.c
new file mode 100644
index 000000000000..44ceb87ea944
--- /dev/null
+++ b/arch/mips/math-emu/sp_scalb.c
@@ -0,0 +1,58 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_scalb(ieee754sp x, int n)
31{
32 COMPXSP;
33
34 CLEARCX;
35
36 EXPLODEXSP;
37
38 switch (xc) {
39 case IEEE754_CLASS_SNAN:
40 return ieee754sp_nanxcpt(x, "scalb", x, n);
41 case IEEE754_CLASS_QNAN:
42 case IEEE754_CLASS_INF:
43 case IEEE754_CLASS_ZERO:
44 return x;
45 case IEEE754_CLASS_DNORM:
46 SPDNORMX;
47 break;
48 case IEEE754_CLASS_NORM:
49 break;
50 }
51 SPNORMRET2(xs, xe + n, xm << 3, "scalb", x, n);
52}
53
54
55ieee754sp ieee754sp_ldexp(ieee754sp x, int n)
56{
57 return ieee754sp_scalb(x, n);
58}
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c
new file mode 100644
index 000000000000..c809830dffb4
--- /dev/null
+++ b/arch/mips/math-emu/sp_simple.c
@@ -0,0 +1,84 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30int ieee754sp_finite(ieee754sp x)
31{
32 return SPBEXP(x) != SP_EMAX + 1 + SP_EBIAS;
33}
34
35ieee754sp ieee754sp_copysign(ieee754sp x, ieee754sp y)
36{
37 CLEARCX;
38 SPSIGN(x) = SPSIGN(y);
39 return x;
40}
41
42
43ieee754sp ieee754sp_neg(ieee754sp x)
44{
45 COMPXSP;
46
47 EXPLODEXSP;
48 CLEARCX;
49 FLUSHXSP;
50
51 if (xc == IEEE754_CLASS_SNAN) {
52 SETCX(IEEE754_INVALID_OPERATION);
53 return ieee754sp_nanxcpt(ieee754sp_indef(), "neg");
54 }
55
56 if (ieee754sp_isnan(x)) /* but not infinity */
57 return ieee754sp_nanxcpt(x, "neg", x);
58
59 /* quick fix up */
60 SPSIGN(x) ^= 1;
61 return x;
62}
63
64
65ieee754sp ieee754sp_abs(ieee754sp x)
66{
67 COMPXSP;
68
69 EXPLODEXSP;
70 CLEARCX;
71 FLUSHXSP;
72
73 if (xc == IEEE754_CLASS_SNAN) {
74 SETCX(IEEE754_INVALID_OPERATION);
75 return ieee754sp_nanxcpt(ieee754sp_indef(), "abs");
76 }
77
78 if (ieee754sp_isnan(x)) /* but not infinity */
79 return ieee754sp_nanxcpt(x, "abs", x);
80
81 /* quick fix up */
82 SPSIGN(x) = 0;
83 return x;
84}
diff --git a/arch/mips/math-emu/sp_sqrt.c b/arch/mips/math-emu/sp_sqrt.c
new file mode 100644
index 000000000000..8a934b9f7eb8
--- /dev/null
+++ b/arch/mips/math-emu/sp_sqrt.c
@@ -0,0 +1,117 @@
1/* IEEE754 floating point arithmetic
2 * single precision square root
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_sqrt(ieee754sp x)
31{
32 int ix, s, q, m, t, i;
33 unsigned int r;
34 COMPXSP;
35
36 /* take care of Inf and NaN */
37
38 EXPLODEXSP;
39 CLEARCX;
40 FLUSHXSP;
41
42 /* x == INF or NAN? */
43 switch (xc) {
44 case IEEE754_CLASS_QNAN:
45 /* sqrt(Nan) = Nan */
46 return ieee754sp_nanxcpt(x, "sqrt");
47 case IEEE754_CLASS_SNAN:
48 SETCX(IEEE754_INVALID_OPERATION);
49 return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt");
50 case IEEE754_CLASS_ZERO:
51 /* sqrt(0) = 0 */
52 return x;
53 case IEEE754_CLASS_INF:
54 if (xs) {
55 /* sqrt(-Inf) = Nan */
56 SETCX(IEEE754_INVALID_OPERATION);
57 return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt");
58 }
59 /* sqrt(+Inf) = Inf */
60 return x;
61 case IEEE754_CLASS_DNORM:
62 case IEEE754_CLASS_NORM:
63 if (xs) {
64 /* sqrt(-x) = Nan */
65 SETCX(IEEE754_INVALID_OPERATION);
66 return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt");
67 }
68 break;
69 }
70
71 ix = x.bits;
72
73 /* normalize x */
74 m = (ix >> 23);
75 if (m == 0) { /* subnormal x */
76 for (i = 0; (ix & 0x00800000) == 0; i++)
77 ix <<= 1;
78 m -= i - 1;
79 }
80 m -= 127; /* unbias exponent */
81 ix = (ix & 0x007fffff) | 0x00800000;
82 if (m & 1) /* odd m, double x to make it even */
83 ix += ix;
84 m >>= 1; /* m = [m/2] */
85
86 /* generate sqrt(x) bit by bit */
87 ix += ix;
88 q = s = 0; /* q = sqrt(x) */
89 r = 0x01000000; /* r = moving bit from right to left */
90
91 while (r != 0) {
92 t = s + r;
93 if (t <= ix) {
94 s = t + r;
95 ix -= t;
96 q += r;
97 }
98 ix += ix;
99 r >>= 1;
100 }
101
102 if (ix != 0) {
103 SETCX(IEEE754_INEXACT);
104 switch (ieee754_csr.rm) {
105 case IEEE754_RP:
106 q += 2;
107 break;
108 case IEEE754_RN:
109 q += (q & 1);
110 break;
111 }
112 }
113 ix = (q >> 1) + 0x3f000000;
114 ix += (m << 23);
115 x.bits = ix;
116 return x;
117}
diff --git a/arch/mips/math-emu/sp_sub.c b/arch/mips/math-emu/sp_sub.c
new file mode 100644
index 000000000000..dbb802c1a086
--- /dev/null
+++ b/arch/mips/math-emu/sp_sub.c
@@ -0,0 +1,184 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30ieee754sp ieee754sp_sub(ieee754sp x, ieee754sp y)
31{
32 COMPXSP;
33 COMPYSP;
34
35 EXPLODEXSP;
36 EXPLODEYSP;
37
38 CLEARCX;
39
40 FLUSHXSP;
41 FLUSHYSP;
42
43 switch (CLPAIR(xc, yc)) {
44 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_QNAN):
45 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_SNAN):
46 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_SNAN):
47 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_SNAN):
48 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_SNAN):
49 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_SNAN):
50 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_SNAN):
51 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_ZERO):
52 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM):
53 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM):
54 case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
55 SETCX(IEEE754_INVALID_OPERATION);
56 return ieee754sp_nanxcpt(ieee754sp_indef(), "sub", x, y);
57
58 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
59 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
60 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_QNAN):
61 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
62 return y;
63
64 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
65 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
66 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
67 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
68 case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_INF):
69 return x;
70
71
72 /* Infinity handling
73 */
74
75 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
76 if (xs != ys)
77 return x;
78 SETCX(IEEE754_INVALID_OPERATION);
79 return ieee754sp_xcpt(ieee754sp_indef(), "sub", x, y);
80
81 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
82 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
83 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
84 return ieee754sp_inf(ys ^ 1);
85
86 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
87 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
88 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
89 return x;
90
91 /* Zero handling
92 */
93
94 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
95 if (xs != ys)
96 return x;
97 else
98 return ieee754sp_zero(ieee754_csr.rm ==
99 IEEE754_RD);
100
101 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
102 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
103 return x;
104
105 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM):
106 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM):
107 /* quick fix up */
108 DPSIGN(y) ^= 1;
109 return y;
110
111 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_DNORM):
112 SPDNORMX;
113
114 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_DNORM):
115 SPDNORMY;
116 break;
117
118 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_NORM):
119 SPDNORMX;
120 break;
121
122 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_NORM):
123 break;
124 }
125 /* flip sign of y and handle as add */
126 ys ^= 1;
127
128 assert(xm & SP_HIDDEN_BIT);
129 assert(ym & SP_HIDDEN_BIT);
130
131
132 /* provide guard,round and stick bit space */
133 xm <<= 3;
134 ym <<= 3;
135
136 if (xe > ye) {
137 /* have to shift y fraction right to align
138 */
139 int s = xe - ye;
140 SPXSRSYn(s);
141 } else if (ye > xe) {
142 /* have to shift x fraction right to align
143 */
144 int s = ye - xe;
145 SPXSRSXn(s);
146 }
147 assert(xe == ye);
148 assert(xe <= SP_EMAX);
149
150 if (xs == ys) {
151 /* generate 28 bit result of adding two 27 bit numbers
152 */
153 xm = xm + ym;
154 xe = xe;
155 xs = xs;
156
157 if (xm >> (SP_MBITS + 1 + 3)) { /* carry out */
158 SPXSRSX1(); /* shift preserving sticky */
159 }
160 } else {
161 if (xm >= ym) {
162 xm = xm - ym;
163 xe = xe;
164 xs = xs;
165 } else {
166 xm = ym - xm;
167 xe = xe;
168 xs = ys;
169 }
170 if (xm == 0) {
171 if (ieee754_csr.rm == IEEE754_RD)
172 return ieee754sp_zero(1); /* round negative inf. => sign = -1 */
173 else
174 return ieee754sp_zero(0); /* other round modes => sign = 1 */
175 }
176 /* normalize to rounding precision
177 */
178 while ((xm >> (SP_MBITS + 3)) == 0) {
179 xm <<= 1;
180 xe--;
181 }
182 }
183 SPNORMRET2(xs, xe, xm, "sub", x, y);
184}
diff --git a/arch/mips/math-emu/sp_tint.c b/arch/mips/math-emu/sp_tint.c
new file mode 100644
index 000000000000..1d73d2abe0b5
--- /dev/null
+++ b/arch/mips/math-emu/sp_tint.c
@@ -0,0 +1,128 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include <linux/kernel.h>
29#include "ieee754sp.h"
30
31int ieee754sp_tint(ieee754sp x)
32{
33 COMPXSP;
34
35 CLEARCX;
36
37 EXPLODEXSP;
38 FLUSHXSP;
39
40 switch (xc) {
41 case IEEE754_CLASS_SNAN:
42 case IEEE754_CLASS_QNAN:
43 case IEEE754_CLASS_INF:
44 SETCX(IEEE754_INVALID_OPERATION);
45 return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x);
46 case IEEE754_CLASS_ZERO:
47 return 0;
48 case IEEE754_CLASS_DNORM:
49 case IEEE754_CLASS_NORM:
50 break;
51 }
52 if (xe >= 31) {
53 /* look for valid corner case */
54 if (xe == 31 && xs && xm == SP_HIDDEN_BIT)
55 return -0x80000000;
56 /* Set invalid. We will only use overflow for floating
57 point overflow */
58 SETCX(IEEE754_INVALID_OPERATION);
59 return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x);
60 }
61 /* oh gawd */
62 if (xe > SP_MBITS) {
63 xm <<= xe - SP_MBITS;
64 } else {
65 u32 residue;
66 int round;
67 int sticky;
68 int odd;
69
70 if (xe < -1) {
71 residue = xm;
72 round = 0;
73 sticky = residue != 0;
74 xm = 0;
75 }
76 else {
77 /* Shifting a u32 32 times does not work,
78 * so we do it in two steps. Be aware that xe
79 * may be -1 */
80 residue = xm << (xe + 1);
81 residue <<= 31 - SP_MBITS;
82 round = (residue >> 31) != 0;
83 sticky = (residue << 1) != 0;
84 xm >>= SP_MBITS - xe;
85 }
86 odd = (xm & 0x1) != 0x0;
87 switch (ieee754_csr.rm) {
88 case IEEE754_RN:
89 if (round && (sticky || odd))
90 xm++;
91 break;
92 case IEEE754_RZ:
93 break;
94 case IEEE754_RU: /* toward +Infinity */
95 if ((round || sticky) && !xs)
96 xm++;
97 break;
98 case IEEE754_RD: /* toward -Infinity */
99 if ((round || sticky) && xs)
100 xm++;
101 break;
102 }
103 if ((xm >> 31) != 0) {
104 /* This can happen after rounding */
105 SETCX(IEEE754_INVALID_OPERATION);
106 return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x);
107 }
108 if (round || sticky)
109 SETCX(IEEE754_INEXACT);
110 }
111 if (xs)
112 return -xm;
113 else
114 return xm;
115}
116
117
118unsigned int ieee754sp_tuns(ieee754sp x)
119{
120 ieee754sp hb = ieee754sp_1e31();
121
122 /* what if x < 0 ?? */
123 if (ieee754sp_lt(x, hb))
124 return (unsigned) ieee754sp_tint(x);
125
126 return (unsigned) ieee754sp_tint(ieee754sp_sub(x, hb)) |
127 ((unsigned) 1 << 31);
128}
diff --git a/arch/mips/math-emu/sp_tlong.c b/arch/mips/math-emu/sp_tlong.c
new file mode 100644
index 000000000000..4be21aa81fbf
--- /dev/null
+++ b/arch/mips/math-emu/sp_tlong.c
@@ -0,0 +1,123 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * http://www.algor.co.uk
8 *
9 * ########################################################################
10 *
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 *
24 * ########################################################################
25 */
26
27
28#include "ieee754sp.h"
29
30s64 ieee754sp_tlong(ieee754sp x)
31{
32 COMPXDP; /* <-- need 64-bit mantissa tmp */
33
34 CLEARCX;
35
36 EXPLODEXSP;
37 FLUSHXSP;
38
39 switch (xc) {
40 case IEEE754_CLASS_SNAN:
41 case IEEE754_CLASS_QNAN:
42 case IEEE754_CLASS_INF:
43 SETCX(IEEE754_INVALID_OPERATION);
44 return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x);
45 case IEEE754_CLASS_ZERO:
46 return 0;
47 case IEEE754_CLASS_DNORM:
48 case IEEE754_CLASS_NORM:
49 break;
50 }
51 if (xe >= 63) {
52 /* look for valid corner case */
53 if (xe == 63 && xs && xm == SP_HIDDEN_BIT)
54 return -0x8000000000000000LL;
55 /* Set invalid. We will only use overflow for floating
56 point overflow */
57 SETCX(IEEE754_INVALID_OPERATION);
58 return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x);
59 }
60 /* oh gawd */
61 if (xe > SP_MBITS) {
62 xm <<= xe - SP_MBITS;
63 } else if (xe < SP_MBITS) {
64 u32 residue;
65 int round;
66 int sticky;
67 int odd;
68
69 if (xe < -1) {
70 residue = xm;
71 round = 0;
72 sticky = residue != 0;
73 xm = 0;
74 }
75 else {
76 residue = xm << (32 - SP_MBITS + xe);
77 round = (residue >> 31) != 0;
78 sticky = (residue << 1) != 0;
79 xm >>= SP_MBITS - xe;
80 }
81 odd = (xm & 0x1) != 0x0;
82 switch (ieee754_csr.rm) {
83 case IEEE754_RN:
84 if (round && (sticky || odd))
85 xm++;
86 break;
87 case IEEE754_RZ:
88 break;
89 case IEEE754_RU: /* toward +Infinity */
90 if ((round || sticky) && !xs)
91 xm++;
92 break;
93 case IEEE754_RD: /* toward -Infinity */
94 if ((round || sticky) && xs)
95 xm++;
96 break;
97 }
98 if ((xm >> 63) != 0) {
99 /* This can happen after rounding */
100 SETCX(IEEE754_INVALID_OPERATION);
101 return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x);
102 }
103 if (round || sticky)
104 SETCX(IEEE754_INEXACT);
105 }
106 if (xs)
107 return -xm;
108 else
109 return xm;
110}
111
112
113u64 ieee754sp_tulong(ieee754sp x)
114{
115 ieee754sp hb = ieee754sp_1e63();
116
117 /* what if x < 0 ?? */
118 if (ieee754sp_lt(x, hb))
119 return (u64) ieee754sp_tlong(x);
120
121 return (u64) ieee754sp_tlong(ieee754sp_sub(x, hb)) |
122 (1ULL << 63);
123}
diff --git a/arch/mips/mips-boards/atlas/Makefile b/arch/mips/mips-boards/atlas/Makefile
new file mode 100644
index 000000000000..d8dab75906bf
--- /dev/null
+++ b/arch/mips/mips-boards/atlas/Makefile
@@ -0,0 +1,20 @@
1#
2# Carsten Langgaard, carstenl@mips.com
3# Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4#
5# This program is free software; you can distribute it and/or modify it
6# under the terms of the GNU General Public License (Version 2) as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12# for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc.,
16# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17#
18
19obj-y := atlas_int.o atlas_setup.o
20obj-$(CONFIG_KGDB) += atlas_gdb.o
diff --git a/arch/mips/mips-boards/atlas/atlas_gdb.c b/arch/mips/mips-boards/atlas/atlas_gdb.c
new file mode 100644
index 000000000000..fb65280f1780
--- /dev/null
+++ b/arch/mips/mips-boards/atlas/atlas_gdb.c
@@ -0,0 +1,97 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * This is the interface to the remote debugger stub.
19 */
20#include <asm/io.h>
21#include <asm/mips-boards/atlas.h>
22#include <asm/mips-boards/saa9730_uart.h>
23
24#define INB(a) inb((unsigned long)a)
25#define OUTB(x,a) outb(x,(unsigned long)a)
26
27/*
28 * This is the interface to the remote debugger stub
29 * if the Philips part is used for the debug port,
30 * called from the platform setup code.
31 */
32void *saa9730_base = (void *)ATLAS_SAA9730_REG;
33
34static int saa9730_kgdb_active = 0;
35
36#define SAA9730_BAUDCLOCK(baud) (((ATLAS_SAA9730_BAUDCLOCK/(baud))/16)-1)
37
38int saa9730_kgdb_hook(int speed)
39{
40 int baudclock;
41 t_uart_saa9730_regmap *kgdb_uart = (t_uart_saa9730_regmap *)(saa9730_base + SAA9730_UART_REGS_ADDR);
42
43 /*
44 * Clear all interrupts
45 */
46 (void) INB(&kgdb_uart->Lsr);
47 (void) INB(&kgdb_uart->Msr);
48 (void) INB(&kgdb_uart->Thr_Rbr);
49 (void) INB(&kgdb_uart->Iir_Fcr);
50
51 /*
52 * Now, initialize the UART
53 */
54 /* 8 data bits, one stop bit, no parity */
55 OUTB(SAA9730_LCR_DATA8, &kgdb_uart->Lcr);
56
57 baudclock = SAA9730_BAUDCLOCK(speed);
58
59 OUTB((baudclock >> 16) & 0xff, &kgdb_uart->BaudDivMsb);
60 OUTB( baudclock & 0xff, &kgdb_uart->BaudDivLsb);
61
62 /* Set RTS/DTR active */
63 OUTB(SAA9730_MCR_DTR | SAA9730_MCR_RTS, &kgdb_uart->Mcr);
64 saa9730_kgdb_active = 1;
65
66 return speed;
67}
68
69int saa9730_putDebugChar(char c)
70{
71 t_uart_saa9730_regmap *kgdb_uart = (t_uart_saa9730_regmap *)(saa9730_base + SAA9730_UART_REGS_ADDR);
72
73 if (!saa9730_kgdb_active) { /* need to init device first */
74 return 0;
75 }
76
77 while (!(INB(&kgdb_uart->Lsr) & SAA9730_LSR_THRE))
78 ;
79 OUTB(c, &kgdb_uart->Thr_Rbr);
80
81 return 1;
82}
83
84char saa9730_getDebugChar(void)
85{
86 t_uart_saa9730_regmap *kgdb_uart = (t_uart_saa9730_regmap *)(saa9730_base + SAA9730_UART_REGS_ADDR);
87 char c;
88
89 if (!saa9730_kgdb_active) { /* need to init device first */
90 return 0;
91 }
92 while (!(INB(&kgdb_uart->Lsr) & SAA9730_LSR_DR))
93 ;
94
95 c = INB(&kgdb_uart->Thr_Rbr);
96 return(c);
97}
diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c
new file mode 100644
index 000000000000..8f1d875217a2
--- /dev/null
+++ b/arch/mips/mips-boards/atlas/atlas_int.c
@@ -0,0 +1,142 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Routines for generic manipulation of the interrupts found on the MIPS
23 * Atlas board.
24 *
25 */
26#include <linux/compiler.h>
27#include <linux/init.h>
28#include <linux/sched.h>
29#include <linux/slab.h>
30#include <linux/interrupt.h>
31#include <linux/kernel_stat.h>
32
33#include <asm/irq.h>
34#include <asm/io.h>
35#include <asm/mips-boards/atlas.h>
36#include <asm/mips-boards/atlasint.h>
37#include <asm/gdb-stub.h>
38
39
40static struct atlas_ictrl_regs *atlas_hw0_icregs;
41
42extern asmlinkage void mipsIRQ(void);
43
44#if 0
45#define DEBUG_INT(x...) printk(x)
46#else
47#define DEBUG_INT(x...)
48#endif
49
50void disable_atlas_irq(unsigned int irq_nr)
51{
52 atlas_hw0_icregs->intrsten = (1 << (irq_nr-ATLASINT_BASE));
53 iob();
54}
55
56void enable_atlas_irq(unsigned int irq_nr)
57{
58 atlas_hw0_icregs->intseten = (1 << (irq_nr-ATLASINT_BASE));
59 iob();
60}
61
62static unsigned int startup_atlas_irq(unsigned int irq)
63{
64 enable_atlas_irq(irq);
65 return 0; /* never anything pending */
66}
67
68#define shutdown_atlas_irq disable_atlas_irq
69
70#define mask_and_ack_atlas_irq disable_atlas_irq
71
72static void end_atlas_irq(unsigned int irq)
73{
74 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
75 enable_atlas_irq(irq);
76}
77
78static struct hw_interrupt_type atlas_irq_type = {
79 "Atlas",
80 startup_atlas_irq,
81 shutdown_atlas_irq,
82 enable_atlas_irq,
83 disable_atlas_irq,
84 mask_and_ack_atlas_irq,
85 end_atlas_irq,
86 NULL
87};
88
89static inline int ls1bit32(unsigned int x)
90{
91 int b = 31, s;
92
93 s = 16; if (x << 16 == 0) s = 0; b -= s; x <<= s;
94 s = 8; if (x << 8 == 0) s = 0; b -= s; x <<= s;
95 s = 4; if (x << 4 == 0) s = 0; b -= s; x <<= s;
96 s = 2; if (x << 2 == 0) s = 0; b -= s; x <<= s;
97 s = 1; if (x << 1 == 0) s = 0; b -= s;
98
99 return b;
100}
101
102void atlas_hw0_irqdispatch(struct pt_regs *regs)
103{
104 unsigned long int_status;
105 int irq;
106
107 int_status = atlas_hw0_icregs->intstatus;
108
109 /* if int_status == 0, then the interrupt has already been cleared */
110 if (unlikely(int_status == 0))
111 return;
112
113 irq = ATLASINT_BASE + ls1bit32(int_status);
114
115 DEBUG_INT("atlas_hw0_irqdispatch: irq=%d\n", irq);
116
117 do_IRQ(irq, regs);
118}
119
120void __init arch_init_irq(void)
121{
122 int i;
123
124 atlas_hw0_icregs = (struct atlas_ictrl_regs *)ioremap (ATLAS_ICTRL_REGS_BASE, sizeof(struct atlas_ictrl_regs *));
125
126 /*
127 * Mask out all interrupt by writing "1" to all bit position in
128 * the interrupt reset reg.
129 */
130 atlas_hw0_icregs->intrsten = 0xffffffff;
131
132 /* Now safe to set the exception vector. */
133 set_except_vector(0, mipsIRQ);
134
135 for (i = ATLASINT_BASE; i <= ATLASINT_END; i++) {
136 irq_desc[i].status = IRQ_DISABLED;
137 irq_desc[i].action = 0;
138 irq_desc[i].depth = 1;
139 irq_desc[i].handler = &atlas_irq_type;
140 spin_lock_init(&irq_desc[i].lock);
141 }
142}
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
new file mode 100644
index 000000000000..0a1dd9bbc02e
--- /dev/null
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -0,0 +1,95 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 */
18#include <linux/config.h>
19#include <linux/init.h>
20#include <linux/interrupt.h>
21#include <linux/sched.h>
22#include <linux/ioport.h>
23#include <linux/tty.h>
24#include <linux/serial.h>
25#include <linux/serial_core.h>
26
27#include <asm/cpu.h>
28#include <asm/bootinfo.h>
29#include <asm/irq.h>
30#include <asm/mips-boards/generic.h>
31#include <asm/mips-boards/prom.h>
32#include <asm/mips-boards/atlas.h>
33#include <asm/mips-boards/atlasint.h>
34#include <asm/time.h>
35#include <asm/traps.h>
36
37extern void mips_reboot_setup(void);
38extern void mips_time_init(void);
39extern void mips_timer_setup(struct irqaction *irq);
40extern unsigned long mips_rtc_get_time(void);
41
42#ifdef CONFIG_KGDB
43extern void kgdb_config(void);
44#endif
45
46static void __init serial_init(void);
47
48const char *get_system_type(void)
49{
50 return "MIPS Atlas";
51}
52
53static int __init atlas_setup(void)
54{
55 ioport_resource.end = 0x7fffffff;
56
57 serial_init ();
58
59#ifdef CONFIG_KGDB
60 kgdb_config();
61#endif
62 mips_reboot_setup();
63
64 board_time_init = mips_time_init;
65 board_timer_setup = mips_timer_setup;
66 rtc_get_time = mips_rtc_get_time;
67
68 return 0;
69}
70
71early_initcall(atlas_setup);
72
73static void __init serial_init(void)
74{
75#ifdef CONFIG_SERIAL_8250
76 struct uart_port s;
77
78 memset(&s, 0, sizeof(s));
79
80#ifdef CONFIG_CPU_LITTLE_ENDIAN
81 s.iobase = ATLAS_UART_REGS_BASE;
82#else
83 s.iobase = ATLAS_UART_REGS_BASE+3;
84#endif
85 s.irq = ATLASINT_UART;
86 s.uartclk = ATLAS_BASE_BAUD * 16;
87 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
88 s.iotype = SERIAL_IO_PORT;
89 s.regshift = 3;
90
91 if (early_serial_setup(&s) != 0) {
92 printk(KERN_ERR "Serial setup failed!\n");
93 }
94#endif
95}
diff --git a/arch/mips/mips-boards/generic/Makefile b/arch/mips/mips-boards/generic/Makefile
new file mode 100644
index 000000000000..b21bc6887fa8
--- /dev/null
+++ b/arch/mips/mips-boards/generic/Makefile
@@ -0,0 +1,26 @@
1#
2# Carsten Langgaard, carstenl@mips.com
3# Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4#
5# This program is free software; you can distribute it and/or modify it
6# under the terms of the GNU General Public License (Version 2) as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12# for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc.,
16# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17#
18# Makefile for the MIPS boards generic routines under Linux.
19#
20
21obj-y := mipsIRQ.o reset.o display.o init.o memory.o \
22 printf.o cmdline.o time.o
23obj-$(CONFIG_PCI) += pci.o
24obj-$(CONFIG_KGDB) += gdb_hook.o
25
26EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/mips-boards/generic/cmdline.c b/arch/mips/mips-boards/generic/cmdline.c
new file mode 100644
index 000000000000..1871c30ed2eb
--- /dev/null
+++ b/arch/mips/mips-boards/generic/cmdline.c
@@ -0,0 +1,59 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Kernel command line creation using the prom monitor (YAMON) argc/argv.
19 */
20#include <linux/init.h>
21#include <linux/string.h>
22
23#include <asm/bootinfo.h>
24
25extern int prom_argc;
26extern int *_prom_argv;
27
28/*
29 * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
30 * This macro take care of sign extension.
31 */
32#define prom_argv(index) ((char *)(long)_prom_argv[(index)])
33
34char * __init prom_getcmdline(void)
35{
36 return &(arcs_cmdline[0]);
37}
38
39
40void __init prom_init_cmdline(void)
41{
42 char *cp;
43 int actr;
44
45 actr = 1; /* Always ignore argv[0] */
46
47 cp = &(arcs_cmdline[0]);
48 while(actr < prom_argc) {
49 strcpy(cp, prom_argv(actr));
50 cp += strlen(prom_argv(actr));
51 *cp++ = ' ';
52 actr++;
53 }
54 if (cp != &(arcs_cmdline[0])) {
55 /* get rid of trailing space */
56 --cp;
57 *cp = '\0';
58 }
59}
diff --git a/arch/mips/mips-boards/generic/display.c b/arch/mips/mips-boards/generic/display.c
new file mode 100644
index 000000000000..f653946afc23
--- /dev/null
+++ b/arch/mips/mips-boards/generic/display.c
@@ -0,0 +1,39 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Display routines for display messages in MIPS boards ascii display.
19 */
20
21#include <linux/compiler.h>
22#include <asm/io.h>
23#include <asm/mips-boards/generic.h>
24
25void mips_display_message(const char *str)
26{
27 static volatile unsigned int *display = NULL;
28 int i;
29
30 if (unlikely(display == NULL))
31 display = (volatile unsigned int *)ioremap(ASCII_DISPLAY_POS_BASE, 16*sizeof(int));
32
33 for (i = 0; i <= 14; i=i+2) {
34 if (*str)
35 display[i] = *str++;
36 else
37 display[i] = ' ';
38 }
39}
diff --git a/arch/mips/mips-boards/generic/gdb_hook.c b/arch/mips/mips-boards/generic/gdb_hook.c
new file mode 100644
index 000000000000..91a2ccbe3730
--- /dev/null
+++ b/arch/mips/mips-boards/generic/gdb_hook.c
@@ -0,0 +1,133 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * This is the interface to the remote debugger stub.
19 */
20#include <linux/types.h>
21#include <linux/serial.h>
22#include <linux/serialP.h>
23#include <linux/serial_reg.h>
24
25#include <asm/serial.h>
26#include <asm/io.h>
27
28static struct serial_state rs_table[RS_TABLE_SIZE] = {
29 SERIAL_PORT_DFNS /* Defined in serial.h */
30};
31
32static struct async_struct kdb_port_info = {0};
33
34int (*generic_putDebugChar)(char);
35char (*generic_getDebugChar)(void);
36
37static __inline__ unsigned int serial_in(struct async_struct *info, int offset)
38{
39 return inb(info->port + offset);
40}
41
42static __inline__ void serial_out(struct async_struct *info, int offset,
43 int value)
44{
45 outb(value, info->port+offset);
46}
47
48int rs_kgdb_hook(int tty_no, int speed) {
49 int t;
50 struct serial_state *ser = &rs_table[tty_no];
51
52 kdb_port_info.state = ser;
53 kdb_port_info.magic = SERIAL_MAGIC;
54 kdb_port_info.port = ser->port;
55 kdb_port_info.flags = ser->flags;
56
57 /*
58 * Clear all interrupts
59 */
60 serial_in(&kdb_port_info, UART_LSR);
61 serial_in(&kdb_port_info, UART_RX);
62 serial_in(&kdb_port_info, UART_IIR);
63 serial_in(&kdb_port_info, UART_MSR);
64
65 /*
66 * Now, initialize the UART
67 */
68 serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8); /* reset DLAB */
69 if (kdb_port_info.flags & ASYNC_FOURPORT) {
70 kdb_port_info.MCR = UART_MCR_DTR | UART_MCR_RTS;
71 t = UART_MCR_DTR | UART_MCR_OUT1;
72 } else {
73 kdb_port_info.MCR
74 = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2;
75 t = UART_MCR_DTR | UART_MCR_RTS;
76 }
77
78 kdb_port_info.MCR = t; /* no interrupts, please */
79 serial_out(&kdb_port_info, UART_MCR, kdb_port_info.MCR);
80
81 /*
82 * and set the speed of the serial port
83 */
84 if (speed == 0)
85 speed = 9600;
86
87 t = kdb_port_info.state->baud_base / speed;
88 /* set DLAB */
89 serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8 | UART_LCR_DLAB);
90 serial_out(&kdb_port_info, UART_DLL, t & 0xff);/* LS of divisor */
91 serial_out(&kdb_port_info, UART_DLM, t >> 8); /* MS of divisor */
92 /* reset DLAB */
93 serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8);
94
95 return speed;
96}
97
98int putDebugChar(char c)
99{
100 return generic_putDebugChar(c);
101}
102
103char getDebugChar(void)
104{
105 return generic_getDebugChar();
106}
107
108int rs_putDebugChar(char c)
109{
110
111 if (!kdb_port_info.state) { /* need to init device first */
112 return 0;
113 }
114
115 while ((serial_in(&kdb_port_info, UART_LSR) & UART_LSR_THRE) == 0)
116 ;
117
118 serial_out(&kdb_port_info, UART_TX, c);
119
120 return 1;
121}
122
123char rs_getDebugChar(void)
124{
125 if (!kdb_port_info.state) { /* need to init device first */
126 return 0;
127 }
128
129 while (!(serial_in(&kdb_port_info, UART_LSR) & 1))
130 ;
131
132 return serial_in(&kdb_port_info, UART_RX);
133}
diff --git a/arch/mips/mips-boards/generic/init.c b/arch/mips/mips-boards/generic/init.c
new file mode 100644
index 000000000000..31caf0603a3f
--- /dev/null
+++ b/arch/mips/mips-boards/generic/init.c
@@ -0,0 +1,343 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * PROM library initialisation code.
19 */
20#include <linux/config.h>
21#include <linux/init.h>
22#include <linux/string.h>
23#include <linux/kernel.h>
24
25#include <asm/io.h>
26#include <asm/bootinfo.h>
27#include <asm/mips-boards/prom.h>
28#include <asm/mips-boards/generic.h>
29#ifdef CONFIG_MIPS_GT64120
30#include <asm/gt64120.h>
31#endif
32#include <asm/mips-boards/msc01_pci.h>
33#include <asm/mips-boards/bonito64.h>
34#ifdef CONFIG_MIPS_MALTA
35#include <asm/mips-boards/malta.h>
36#endif
37
38#ifdef CONFIG_KGDB
39extern int rs_kgdb_hook(int, int);
40extern int rs_putDebugChar(char);
41extern char rs_getDebugChar(void);
42extern int saa9730_kgdb_hook(int);
43extern int saa9730_putDebugChar(char);
44extern char saa9730_getDebugChar(void);
45#endif
46
47int prom_argc;
48int *_prom_argv, *_prom_envp;
49
50/*
51 * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
52 * This macro take care of sign extension, if running in 64-bit mode.
53 */
54#define prom_envp(index) ((char *)(long)_prom_envp[(index)])
55
56int init_debug = 0;
57
58unsigned int mips_revision_corid;
59
60/* Bonito64 system controller register base. */
61unsigned long _pcictrl_bonito;
62unsigned long _pcictrl_bonito_pcicfg;
63
64/* GT64120 system controller register base */
65unsigned long _pcictrl_gt64120;
66
67/* MIPS System controller register base */
68unsigned long _pcictrl_msc;
69
70char *prom_getenv(char *envname)
71{
72 /*
73 * Return a pointer to the given environment variable.
74 * In 64-bit mode: we're using 64-bit pointers, but all pointers
75 * in the PROM structures are only 32-bit, so we need some
76 * workarounds, if we are running in 64-bit mode.
77 */
78 int i, index=0;
79
80 i = strlen(envname);
81
82 while (prom_envp(index)) {
83 if(strncmp(envname, prom_envp(index), i) == 0) {
84 return(prom_envp(index+1));
85 }
86 index += 2;
87 }
88
89 return NULL;
90}
91
92static inline unsigned char str2hexnum(unsigned char c)
93{
94 if (c >= '0' && c <= '9')
95 return c - '0';
96 if (c >= 'a' && c <= 'f')
97 return c - 'a' + 10;
98 return 0; /* foo */
99}
100
101static inline void str2eaddr(unsigned char *ea, unsigned char *str)
102{
103 int i;
104
105 for (i = 0; i < 6; i++) {
106 unsigned char num;
107
108 if((*str == '.') || (*str == ':'))
109 str++;
110 num = str2hexnum(*str++) << 4;
111 num |= (str2hexnum(*str++));
112 ea[i] = num;
113 }
114}
115
116int get_ethernet_addr(char *ethernet_addr)
117{
118 char *ethaddr_str;
119
120 ethaddr_str = prom_getenv("ethaddr");
121 if (!ethaddr_str) {
122 printk("ethaddr not set in boot prom\n");
123 return -1;
124 }
125 str2eaddr(ethernet_addr, ethaddr_str);
126
127 if (init_debug > 1) {
128 int i;
129 printk("get_ethernet_addr: ");
130 for (i=0; i<5; i++)
131 printk("%02x:", (unsigned char)*(ethernet_addr+i));
132 printk("%02x\n", *(ethernet_addr+i));
133 }
134
135 return 0;
136}
137
138#ifdef CONFIG_SERIAL_8250_CONSOLE
139static void __init console_config(void)
140{
141 char console_string[40];
142 int baud = 0;
143 char parity = '\0', bits = '\0', flow = '\0';
144 char *s;
145
146 if ((strstr(prom_getcmdline(), "console=ttyS")) == NULL) {
147 s = prom_getenv("modetty0");
148 if (s) {
149 while (*s >= '0' && *s <= '9')
150 baud = baud*10 + *s++ - '0';
151 if (*s == ',') s++;
152 if (*s) parity = *s++;
153 if (*s == ',') s++;
154 if (*s) bits = *s++;
155 if (*s == ',') s++;
156 if (*s == 'h') flow = 'r';
157 }
158 if (baud == 0)
159 baud = 38400;
160 if (parity != 'n' && parity != 'o' && parity != 'e')
161 parity = 'n';
162 if (bits != '7' && bits != '8')
163 bits = '8';
164 if (flow == '\0')
165 flow = 'r';
166 sprintf (console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow);
167 strcat (prom_getcmdline(), console_string);
168 prom_printf("Config serial console:%s\n", console_string);
169 }
170}
171#endif
172
173#ifdef CONFIG_KGDB
174void __init kgdb_config (void)
175{
176 extern int (*generic_putDebugChar)(char);
177 extern char (*generic_getDebugChar)(void);
178 char *argptr;
179 int line, speed;
180
181 argptr = prom_getcmdline();
182 if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
183 argptr += strlen("kgdb=ttyS");
184 if (*argptr != '0' && *argptr != '1')
185 printk("KGDB: Unknown serial line /dev/ttyS%c, "
186 "falling back to /dev/ttyS1\n", *argptr);
187 line = *argptr == '0' ? 0 : 1;
188 printk("KGDB: Using serial line /dev/ttyS%d for session\n", line);
189
190 speed = 0;
191 if (*++argptr == ',')
192 {
193 int c;
194 while ((c = *++argptr) && ('0' <= c && c <= '9'))
195 speed = speed * 10 + c - '0';
196 }
197#ifdef CONFIG_MIPS_ATLAS
198 if (line == 1) {
199 speed = saa9730_kgdb_hook(speed);
200 generic_putDebugChar = saa9730_putDebugChar;
201 generic_getDebugChar = saa9730_getDebugChar;
202 }
203 else
204#endif
205 {
206 speed = rs_kgdb_hook(line, speed);
207 generic_putDebugChar = rs_putDebugChar;
208 generic_getDebugChar = rs_getDebugChar;
209 }
210
211 prom_printf("KGDB: Using serial line /dev/ttyS%d at %d for session, "
212 "please connect your debugger\n", line ? 1 : 0, speed);
213
214 {
215 char *s;
216 for (s = "Please connect GDB to this port\r\n"; *s; )
217 generic_putDebugChar (*s++);
218 }
219
220 kgdb_enabled = 1;
221 /* Breakpoint is invoked after interrupts are initialised */
222 }
223}
224#endif
225
226void __init prom_init(void)
227{
228 prom_argc = fw_arg0;
229 _prom_argv = (int *) fw_arg1;
230 _prom_envp = (int *) fw_arg2;
231
232 mips_display_message("LINUX");
233
234#ifdef CONFIG_MIPS_SEAD
235 set_io_port_base(KSEG1);
236#else
237 /*
238 * early setup of _pcictrl_bonito so that we can determine
239 * the system controller on a CORE_EMUL board
240 */
241 _pcictrl_bonito = (unsigned long)ioremap(BONITO_REG_BASE, BONITO_REG_SIZE);
242
243 mips_revision_corid = MIPS_REVISION_CORID;
244
245 if (mips_revision_corid == MIPS_REVISION_CORID_CORE_EMUL) {
246 if (BONITO_PCIDID == 0x0001df53 ||
247 BONITO_PCIDID == 0x0003df53)
248 mips_revision_corid = MIPS_REVISION_CORID_CORE_EMUL_BON;
249 else
250 mips_revision_corid = MIPS_REVISION_CORID_CORE_EMUL_MSC;
251 }
252 switch(mips_revision_corid) {
253 case MIPS_REVISION_CORID_QED_RM5261:
254 case MIPS_REVISION_CORID_CORE_LV:
255 case MIPS_REVISION_CORID_CORE_FPGA:
256 case MIPS_REVISION_CORID_CORE_FPGAR2:
257 /*
258 * Setup the North bridge to do Master byte-lane swapping
259 * when running in bigendian.
260 */
261 _pcictrl_gt64120 = (unsigned long)ioremap(MIPS_GT_BASE, 0x2000);
262
263#ifdef CONFIG_CPU_LITTLE_ENDIAN
264 GT_WRITE(GT_PCI0_CMD_OFS, GT_PCI0_CMD_MBYTESWAP_BIT |
265 GT_PCI0_CMD_SBYTESWAP_BIT);
266#else
267 GT_WRITE(GT_PCI0_CMD_OFS, 0);
268#endif
269
270#ifdef CONFIG_MIPS_MALTA
271 set_io_port_base(MALTA_GT_PORT_BASE);
272#else
273 set_io_port_base((unsigned long)ioremap(0, 0x20000000));
274#endif
275 break;
276
277 case MIPS_REVISION_CORID_CORE_EMUL_BON:
278 case MIPS_REVISION_CORID_BONITO64:
279 case MIPS_REVISION_CORID_CORE_20K:
280 _pcictrl_bonito_pcicfg = (unsigned long)ioremap(BONITO_PCICFG_BASE, BONITO_PCICFG_SIZE);
281
282 /*
283 * Disable Bonito IOBC.
284 */
285 BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
286 ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
287 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
288
289 /*
290 * Setup the North bridge to do Master byte-lane swapping
291 * when running in bigendian.
292 */
293#ifdef CONFIG_CPU_LITTLE_ENDIAN
294 BONITO_BONGENCFG = BONITO_BONGENCFG &
295 ~(BONITO_BONGENCFG_MSTRBYTESWAP |
296 BONITO_BONGENCFG_BYTESWAP);
297#else
298 BONITO_BONGENCFG = BONITO_BONGENCFG |
299 BONITO_BONGENCFG_MSTRBYTESWAP |
300 BONITO_BONGENCFG_BYTESWAP;
301#endif
302
303#ifdef CONFIG_MIPS_MALTA
304 set_io_port_base(MALTA_BONITO_PORT_BASE);
305#else
306 set_io_port_base((unsigned long)ioremap(0, 0x20000000));
307#endif
308 break;
309
310 case MIPS_REVISION_CORID_CORE_MSC:
311 case MIPS_REVISION_CORID_CORE_FPGA2:
312 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
313 _pcictrl_msc = (unsigned long)ioremap(MIPS_MSC01_PCI_REG_BASE, 0x2000);
314
315#ifdef CONFIG_CPU_LITTLE_ENDIAN
316 MSC_WRITE(MSC01_PCI_SWAP, MSC01_PCI_SWAP_NOSWAP);
317#else
318 MSC_WRITE(MSC01_PCI_SWAP,
319 MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_IO_SHF |
320 MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_MEM_SHF |
321 MSC01_PCI_SWAP_BYTESWAP << MSC01_PCI_SWAP_BAR0_SHF);
322#endif
323
324#ifdef CONFIG_MIPS_MALTA
325 set_io_port_base(MALTA_MSC_PORT_BASE);
326#else
327 set_io_port_base((unsigned long)ioremap(0, 0x20000000));
328#endif
329 break;
330
331 default:
332 /* Unknown Core card */
333 mips_display_message("CC Error");
334 while(1); /* We die here... */
335 }
336#endif
337 prom_printf("\nLINUX started...\n");
338 prom_init_cmdline();
339 prom_meminit();
340#ifdef CONFIG_SERIAL_8250_CONSOLE
341 console_config();
342#endif
343}
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
new file mode 100644
index 000000000000..5ae2b43e4c2e
--- /dev/null
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -0,0 +1,173 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * PROM library functions for acquiring/using memory descriptors given to
19 * us from the YAMON.
20 */
21#include <linux/config.h>
22#include <linux/init.h>
23#include <linux/mm.h>
24#include <linux/bootmem.h>
25
26#include <asm/bootinfo.h>
27#include <asm/page.h>
28
29#include <asm/mips-boards/prom.h>
30
31/*#define DEBUG*/
32
33enum yamon_memtypes {
34 yamon_dontuse,
35 yamon_prom,
36 yamon_free,
37};
38struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];
39
40#ifdef DEBUG
41static char *mtypes[3] = {
42 "Dont use memory",
43 "YAMON PROM memory",
44 "Free memmory",
45};
46#endif
47
48/* References to section boundaries */
49extern char _end;
50
51#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
52
53
54struct prom_pmemblock * __init prom_getmdesc(void)
55{
56 char *memsize_str;
57 unsigned int memsize;
58
59 memsize_str = prom_getenv("memsize");
60 if (!memsize_str) {
61 prom_printf("memsize not set in boot prom, set to default (32Mb)\n");
62 memsize = 0x02000000;
63 } else {
64#ifdef DEBUG
65 prom_printf("prom_memsize = %s\n", memsize_str);
66#endif
67 memsize = simple_strtol(memsize_str, NULL, 0);
68 }
69
70 memset(mdesc, 0, sizeof(mdesc));
71
72 mdesc[0].type = yamon_dontuse;
73 mdesc[0].base = 0x00000000;
74 mdesc[0].size = 0x00001000;
75
76 mdesc[1].type = yamon_prom;
77 mdesc[1].base = 0x00001000;
78 mdesc[1].size = 0x000ef000;
79
80#ifdef CONFIG_MIPS_MALTA
81 /*
82 * The area 0x000f0000-0x000fffff is allocated for BIOS memory by the
83 * south bridge and PCI access always forwarded to the ISA Bus and
84 * BIOSCS# is always generated.
85 * This mean that this area can't be used as DMA memory for PCI
86 * devices.
87 */
88 mdesc[2].type = yamon_dontuse;
89 mdesc[2].base = 0x000f0000;
90 mdesc[2].size = 0x00010000;
91#else
92 mdesc[2].type = yamon_prom;
93 mdesc[2].base = 0x000f0000;
94 mdesc[2].size = 0x00010000;
95#endif
96
97 mdesc[3].type = yamon_dontuse;
98 mdesc[3].base = 0x00100000;
99 mdesc[3].size = CPHYSADDR(PFN_ALIGN(&_end)) - mdesc[3].base;
100
101 mdesc[4].type = yamon_free;
102 mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end));
103 mdesc[4].size = memsize - mdesc[4].base;
104
105 return &mdesc[0];
106}
107
108static int __init prom_memtype_classify (unsigned int type)
109{
110 switch (type) {
111 case yamon_free:
112 return BOOT_MEM_RAM;
113 case yamon_prom:
114 return BOOT_MEM_ROM_DATA;
115 default:
116 return BOOT_MEM_RESERVED;
117 }
118}
119
120void __init prom_meminit(void)
121{
122 struct prom_pmemblock *p;
123
124#ifdef DEBUG
125 prom_printf("YAMON MEMORY DESCRIPTOR dump:\n");
126 p = prom_getmdesc();
127 while (p->size) {
128 int i = 0;
129 prom_printf("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n",
130 i, p, p->base, p->size, mtypes[p->type]);
131 p++;
132 i++;
133 }
134#endif
135 p = prom_getmdesc();
136
137 while (p->size) {
138 long type;
139 unsigned long base, size;
140
141 type = prom_memtype_classify (p->type);
142 base = p->base;
143 size = p->size;
144
145 add_memory_region(base, size, type);
146 p++;
147 }
148}
149
150unsigned long __init prom_free_prom_memory(void)
151{
152 unsigned long freed = 0;
153 unsigned long addr;
154 int i;
155
156 for (i = 0; i < boot_mem_map.nr_map; i++) {
157 if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
158 continue;
159
160 addr = boot_mem_map.map[i].addr;
161 while (addr < boot_mem_map.map[i].addr
162 + boot_mem_map.map[i].size) {
163 ClearPageReserved(virt_to_page(__va(addr)));
164 set_page_count(virt_to_page(__va(addr)), 1);
165 free_page((unsigned long)__va(addr));
166 addr += PAGE_SIZE;
167 freed += PAGE_SIZE;
168 }
169 }
170 printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
171
172 return freed;
173}
diff --git a/arch/mips/mips-boards/generic/mipsIRQ.S b/arch/mips/mips-boards/generic/mipsIRQ.S
new file mode 100644
index 000000000000..131f49bccb20
--- /dev/null
+++ b/arch/mips/mips-boards/generic/mipsIRQ.S
@@ -0,0 +1,153 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Interrupt exception dispatch code.
23 *
24 */
25#include <linux/config.h>
26
27#include <asm/asm.h>
28#include <asm/mipsregs.h>
29#include <asm/regdef.h>
30#include <asm/stackframe.h>
31
32/* A lot of complication here is taken away because:
33 *
34 * 1) We handle one interrupt and return, sitting in a loop and moving across
35 * all the pending IRQ bits in the cause register is _NOT_ the answer, the
36 * common case is one pending IRQ so optimize in that direction.
37 *
38 * 2) We need not check against bits in the status register IRQ mask, that
39 * would make this routine slow as hell.
40 *
41 * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
42 * between like BSD spl() brain-damage.
43 *
44 * Furthermore, the IRQs on the MIPS board look basically (barring software
45 * IRQs which we don't use at all and all external interrupt sources are
46 * combined together on hardware interrupt 0 (MIPS IRQ 2)) like:
47 *
48 * MIPS IRQ Source
49 * -------- ------
50 * 0 Software (ignored)
51 * 1 Software (ignored)
52 * 2 Combined hardware interrupt (hw0)
53 * 3 Hardware (ignored)
54 * 4 Hardware (ignored)
55 * 5 Hardware (ignored)
56 * 6 Hardware (ignored)
57 * 7 R4k timer (what we use)
58 *
59 * Note: On the SEAD board thing are a little bit different.
60 * Here IRQ 2 (hw0) is wired to the UART0 and IRQ 3 (hw1) is wired
61 * wired to UART1.
62 *
63 * We handle the IRQ according to _our_ priority which is:
64 *
65 * Highest ---- R4k Timer
66 * Lowest ---- Combined hardware interrupt
67 *
68 * then we just return, if multiple IRQs are pending then we will just take
69 * another exception, big deal.
70 */
71
72 .text
73 .set noreorder
74 .set noat
75 .align 5
76 NESTED(mipsIRQ, PT_SIZE, sp)
77 SAVE_ALL
78 CLI
79 .set at
80
81 mfc0 s0, CP0_CAUSE # get irq bits
82 mfc0 s1, CP0_STATUS # get irq mask
83 and s0, s1
84
85 /* First we check for r4k counter/timer IRQ. */
86 andi a0, s0, CAUSEF_IP7
87 beq a0, zero, 1f
88 andi a0, s0, CAUSEF_IP2 # delay slot, check hw0 interrupt
89
90 /* Wheee, a timer interrupt. */
91 move a0, sp
92 jal mips_timer_interrupt
93 nop
94
95 j ret_from_irq
96 nop
97
981:
99#if defined(CONFIG_MIPS_SEAD)
100 beq a0, zero, 1f
101 andi a0, s0, CAUSEF_IP3 # delay slot, check hw1 interrupt
102#else
103 beq a0, zero, 1f # delay slot, check hw3 interrupt
104 andi a0, s0, CAUSEF_IP5
105#endif
106
107 /* Wheee, combined hardware level zero interrupt. */
108#if defined(CONFIG_MIPS_ATLAS)
109 jal atlas_hw0_irqdispatch
110#elif defined(CONFIG_MIPS_MALTA)
111 jal malta_hw0_irqdispatch
112#elif defined(CONFIG_MIPS_SEAD)
113 jal sead_hw0_irqdispatch
114#else
115#error "MIPS board not supported\n"
116#endif
117 move a0, sp # delay slot
118
119 j ret_from_irq
120 nop # delay slot
121
1221:
123#if defined(CONFIG_MIPS_SEAD)
124 beq a0, zero, 1f
125 andi a0, s0, CAUSEF_IP5 # delay slot, check hw3 interrupt
126 jal sead_hw1_irqdispatch
127 move a0, sp # delay slot
128 j ret_from_irq
129 nop # delay slot
1301:
131#endif
132#if defined(CONFIG_MIPS_MALTA)
133 beq a0, zero, 1f # check hw3 (coreHI) interrupt
134 nop
135 jal corehi_irqdispatch
136 move a0, sp
137 j ret_from_irq
138 nop
1391:
140#endif
141 /*
142 * Here by mistake? This is possible, what can happen is that by the
143 * time we take the exception the IRQ pin goes low, so just leave if
144 * this is the case.
145 */
146 move a1,s0
147 PRINT("Got interrupt: c0_cause = %08x\n")
148 mfc0 a1, CP0_EPC
149 PRINT("c0_epc = %08x\n")
150
151 j ret_from_irq
152 nop
153 END(mipsIRQ)
diff --git a/arch/mips/mips-boards/generic/pci.c b/arch/mips/mips-boards/generic/pci.c
new file mode 100644
index 000000000000..92c34bda02ae
--- /dev/null
+++ b/arch/mips/mips-boards/generic/pci.c
@@ -0,0 +1,163 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * MIPS boards specific PCI support.
21 */
22#include <linux/config.h>
23#include <linux/types.h>
24#include <linux/pci.h>
25#include <linux/kernel.h>
26#include <linux/init.h>
27
28#include <asm/mips-boards/generic.h>
29#include <asm/gt64120.h>
30#include <asm/mips-boards/bonito64.h>
31#include <asm/mips-boards/msc01_pci.h>
32#ifdef CONFIG_MIPS_MALTA
33#include <asm/mips-boards/malta.h>
34#endif
35
36static struct resource bonito64_mem_resource = {
37 .name = "Bonito PCI MEM",
38 .start = 0x10000000UL,
39 .end = 0x1bffffffUL,
40 .flags = IORESOURCE_MEM,
41};
42
43static struct resource bonito64_io_resource = {
44 .name = "Bonito IO MEM",
45 .start = 0x00002000UL, /* avoid conflicts with YAMON allocated I/O addresses */
46 .end = 0x000fffffUL,
47 .flags = IORESOURCE_IO,
48};
49
50static struct resource gt64120_mem_resource = {
51 .name = "GT64120 PCI MEM",
52 .start = 0x10000000UL,
53 .end = 0x1bdfffffUL,
54 .flags = IORESOURCE_MEM,
55};
56
57static struct resource gt64120_io_resource = {
58 .name = "GT64120 IO MEM",
59#ifdef CONFIG_MIPS_ATLAS
60 .start = 0x18000000UL,
61 .end = 0x181fffffUL,
62#endif
63#ifdef CONFIG_MIPS_MALTA
64 .start = 0x00002000UL,
65 .end = 0x001fffffUL,
66#endif
67 .flags = IORESOURCE_IO,
68};
69
70static struct resource msc_mem_resource = {
71 .name = "MSC PCI MEM",
72 .start = 0x10000000UL,
73 .end = 0x1fffffffUL,
74 .flags = IORESOURCE_MEM,
75};
76
77static struct resource msc_io_resource = {
78 .name = "MSC IO MEM",
79 .start = 0x00002000UL,
80 .end = 0x007fffffUL,
81 .flags = IORESOURCE_IO,
82};
83
84extern struct pci_ops bonito64_pci_ops;
85extern struct pci_ops gt64120_pci_ops;
86extern struct pci_ops msc_pci_ops;
87
88static struct pci_controller bonito64_controller = {
89 .pci_ops = &bonito64_pci_ops,
90 .io_resource = &bonito64_io_resource,
91 .mem_resource = &bonito64_mem_resource,
92 .mem_offset = 0x10000000UL,
93 .io_offset = 0x00000000UL,
94};
95
96static struct pci_controller gt64120_controller = {
97 .pci_ops = &gt64120_pci_ops,
98 .io_resource = &gt64120_io_resource,
99 .mem_resource = &gt64120_mem_resource,
100 .mem_offset = 0x00000000UL,
101 .io_offset = 0x00000000UL,
102};
103
104static struct pci_controller msc_controller = {
105 .pci_ops = &msc_pci_ops,
106 .io_resource = &msc_io_resource,
107 .mem_resource = &msc_mem_resource,
108 .mem_offset = 0x10000000UL,
109 .io_offset = 0x00000000UL,
110};
111
112static int __init pcibios_init(void)
113{
114 struct pci_controller *controller;
115
116 switch (mips_revision_corid) {
117 case MIPS_REVISION_CORID_QED_RM5261:
118 case MIPS_REVISION_CORID_CORE_LV:
119 case MIPS_REVISION_CORID_CORE_FPGA:
120 case MIPS_REVISION_CORID_CORE_FPGAR2:
121 /*
122 * Due to a bug in the Galileo system controller, we need
123 * to setup the PCI BAR for the Galileo internal registers.
124 * This should be done in the bios/bootprom and will be
125 * fixed in a later revision of YAMON (the MIPS boards
126 * boot prom).
127 */
128 GT_WRITE(GT_PCI0_CFGADDR_OFS,
129 (0 << GT_PCI0_CFGADDR_BUSNUM_SHF) | /* Local bus */
130 (0 << GT_PCI0_CFGADDR_DEVNUM_SHF) | /* GT64120 dev */
131 (0 << GT_PCI0_CFGADDR_FUNCTNUM_SHF) | /* Function 0*/
132 ((0x20/4) << GT_PCI0_CFGADDR_REGNUM_SHF) | /* BAR 4*/
133 GT_PCI0_CFGADDR_CONFIGEN_BIT );
134
135 /* Perform the write */
136 GT_WRITE(GT_PCI0_CFGDATA_OFS, CPHYSADDR(MIPS_GT_BASE));
137
138 controller = &gt64120_controller;
139 break;
140
141 case MIPS_REVISION_CORID_BONITO64:
142 case MIPS_REVISION_CORID_CORE_20K:
143 case MIPS_REVISION_CORID_CORE_EMUL_BON:
144 controller = &bonito64_controller;
145 break;
146
147 case MIPS_REVISION_CORID_CORE_MSC:
148 case MIPS_REVISION_CORID_CORE_FPGA2:
149 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
150 controller = &msc_controller;
151 break;
152 default:
153 return 1;
154 }
155
156 ioport_resource.end = controller->io_resource->end;
157
158 register_pci_controller (controller);
159
160 return 0;
161}
162
163early_initcall(pcibios_init);
diff --git a/arch/mips/mips-boards/generic/printf.c b/arch/mips/mips-boards/generic/printf.c
new file mode 100644
index 000000000000..2c1ab1f19fdc
--- /dev/null
+++ b/arch/mips/mips-boards/generic/printf.c
@@ -0,0 +1,79 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Putting things on the screen/serial line using YAMONs facilities.
19 */
20#include <linux/config.h>
21#include <linux/init.h>
22#include <linux/kernel.h>
23#include <linux/serial_reg.h>
24#include <linux/spinlock.h>
25#include <asm/io.h>
26
27#ifdef CONFIG_MIPS_ATLAS
28#include <asm/mips-boards/atlas.h>
29
30#ifdef CONFIG_CPU_LITTLE_ENDIAN
31#define PORT(offset) (ATLAS_UART_REGS_BASE + ((offset)<<3))
32#else
33#define PORT(offset) (ATLAS_UART_REGS_BASE + 3 + ((offset)<<3))
34#endif
35
36#elif defined(CONFIG_MIPS_SEAD)
37
38#include <asm/mips-boards/sead.h>
39
40#ifdef CONFIG_CPU_LITTLE_ENDIAN
41#define PORT(offset) (SEAD_UART0_REGS_BASE + ((offset)<<3))
42#else
43#define PORT(offset) (SEAD_UART0_REGS_BASE + 3 + ((offset)<<3))
44#endif
45
46#else
47
48#define PORT(offset) (0x3f8 + (offset))
49
50#endif
51
52static inline unsigned int serial_in(int offset)
53{
54 return inb(PORT(offset));
55}
56
57static inline void serial_out(int offset, int value)
58{
59 outb(value, PORT(offset));
60}
61
62int prom_putchar(char c)
63{
64 while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
65 ;
66
67 serial_out(UART_TX, c);
68
69 return 1;
70}
71
72char prom_getchar(void)
73{
74 while (!(serial_in(UART_LSR) & UART_LSR_DR))
75 ;
76
77 return serial_in(UART_RX);
78}
79
diff --git a/arch/mips/mips-boards/generic/reset.c b/arch/mips/mips-boards/generic/reset.c
new file mode 100644
index 000000000000..9fdec743bd95
--- /dev/null
+++ b/arch/mips/mips-boards/generic/reset.c
@@ -0,0 +1,73 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Reset the MIPS boards.
23 *
24 */
25#include <linux/config.h>
26
27#include <asm/io.h>
28#include <asm/reboot.h>
29#include <asm/mips-boards/generic.h>
30#if defined(CONFIG_MIPS_ATLAS)
31#include <asm/mips-boards/atlas.h>
32#endif
33
34static void mips_machine_restart(char *command);
35static void mips_machine_halt(void);
36#if defined(CONFIG_MIPS_ATLAS)
37static void atlas_machine_power_off(void);
38#endif
39
40static void mips_machine_restart(char *command)
41{
42 volatile unsigned int *softres_reg = (unsigned int *)ioremap (SOFTRES_REG, sizeof(unsigned int));
43
44 *softres_reg = GORESET;
45}
46
47static void mips_machine_halt(void)
48{
49 volatile unsigned int *softres_reg = (unsigned int *)ioremap (SOFTRES_REG, sizeof(unsigned int));
50
51 *softres_reg = GORESET;
52}
53
54#if defined(CONFIG_MIPS_ATLAS)
55static void atlas_machine_power_off(void)
56{
57 volatile unsigned int *psustby_reg = (unsigned int *)ioremap(ATLAS_PSUSTBY_REG, sizeof(unsigned int));
58
59 *psustby_reg = ATLAS_GOSTBY;
60}
61#endif
62
63void mips_reboot_setup(void)
64{
65 _machine_restart = mips_machine_restart;
66 _machine_halt = mips_machine_halt;
67#if defined(CONFIG_MIPS_ATLAS)
68 _machine_power_off = atlas_machine_power_off;
69#endif
70#if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_SEAD)
71 _machine_power_off = mips_machine_halt;
72#endif
73}
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
new file mode 100644
index 000000000000..fe7fc17305a6
--- /dev/null
+++ b/arch/mips/mips-boards/generic/time.c
@@ -0,0 +1,167 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Setting up the clock on the MIPS boards.
19 */
20
21#include <linux/types.h>
22#include <linux/config.h>
23#include <linux/init.h>
24#include <linux/kernel_stat.h>
25#include <linux/sched.h>
26#include <linux/spinlock.h>
27#include <linux/interrupt.h>
28#include <linux/time.h>
29#include <linux/timex.h>
30#include <linux/mc146818rtc.h>
31
32#include <asm/mipsregs.h>
33#include <asm/ptrace.h>
34#include <asm/div64.h>
35#include <asm/cpu.h>
36#include <asm/time.h>
37#include <asm/mc146818-time.h>
38
39#include <asm/mips-boards/generic.h>
40#include <asm/mips-boards/prom.h>
41
42unsigned long cpu_khz;
43
44#if defined(CONFIG_MIPS_SEAD)
45#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ5)
46#else
47#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
48#endif
49
50#if defined(CONFIG_MIPS_ATLAS)
51static char display_string[] = " LINUX ON ATLAS ";
52#endif
53#if defined(CONFIG_MIPS_MALTA)
54static char display_string[] = " LINUX ON MALTA ";
55#endif
56#if defined(CONFIG_MIPS_SEAD)
57static char display_string[] = " LINUX ON SEAD ";
58#endif
59static unsigned int display_count = 0;
60#define MAX_DISPLAY_COUNT (sizeof(display_string) - 8)
61
62#define MIPS_CPU_TIMER_IRQ (NR_IRQS-1)
63
64static unsigned int timer_tick_count=0;
65
66void mips_timer_interrupt(struct pt_regs *regs)
67{
68 if ((timer_tick_count++ % HZ) == 0) {
69 mips_display_message(&display_string[display_count++]);
70 if (display_count == MAX_DISPLAY_COUNT)
71 display_count = 0;
72
73 }
74
75 ll_timer_interrupt(MIPS_CPU_TIMER_IRQ, regs);
76}
77
78/*
79 * Estimate CPU frequency. Sets mips_counter_frequency as a side-effect
80 */
81static unsigned int __init estimate_cpu_frequency(void)
82{
83 unsigned int prid = read_c0_prid() & 0xffff00;
84 unsigned int count;
85
86#ifdef CONFIG_MIPS_SEAD
87 /*
88 * The SEAD board doesn't have a real time clock, so we can't
89 * really calculate the timer frequency
90 * For now we hardwire the SEAD board frequency to 12MHz.
91 */
92
93 if ((prid == (PRID_COMP_MIPS | PRID_IMP_20KC)) ||
94 (prid == (PRID_COMP_MIPS | PRID_IMP_25KF)))
95 count = 12000000;
96 else
97 count = 6000000;
98#endif
99#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_MALTA)
100 unsigned int flags;
101
102 local_irq_save(flags);
103
104 /* Start counter exactly on falling edge of update flag */
105 while (CMOS_READ(RTC_REG_A) & RTC_UIP);
106 while (!(CMOS_READ(RTC_REG_A) & RTC_UIP));
107
108 /* Start r4k counter. */
109 write_c0_count(0);
110
111 /* Read counter exactly on falling edge of update flag */
112 while (CMOS_READ(RTC_REG_A) & RTC_UIP);
113 while (!(CMOS_READ(RTC_REG_A) & RTC_UIP));
114
115 count = read_c0_count();
116
117 /* restore interrupts */
118 local_irq_restore(flags);
119#endif
120
121 mips_hpt_frequency = count;
122 if ((prid != (PRID_COMP_MIPS | PRID_IMP_20KC)) &&
123 (prid != (PRID_COMP_MIPS | PRID_IMP_25KF)))
124 count *= 2;
125
126 count += 5000; /* round */
127 count -= count%10000;
128
129 return count;
130}
131
132unsigned long __init mips_rtc_get_time(void)
133{
134 return mc146818_get_cmos_time();
135}
136
137void __init mips_time_init(void)
138{
139 unsigned int est_freq, flags;
140
141 local_irq_save(flags);
142
143#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_MALTA)
144 /* Set Data mode - binary. */
145 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL);
146#endif
147
148 est_freq = estimate_cpu_frequency ();
149
150 printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
151 (est_freq%1000000)*100/1000000);
152
153 cpu_khz = est_freq / 1000;
154
155 local_irq_restore(flags);
156}
157
158void __init mips_timer_setup(struct irqaction *irq)
159{
160 /* we are using the cpu counter for timer interrupts */
161 irq->handler = no_action; /* we use our own handler */
162 setup_irq(MIPS_CPU_TIMER_IRQ, irq);
163
164 /* to generate the first timer interrupt */
165 write_c0_compare (read_c0_count() + mips_hpt_frequency/HZ);
166 set_c0_status(ALLINTS);
167}
diff --git a/arch/mips/mips-boards/malta/Makefile b/arch/mips/mips-boards/malta/Makefile
new file mode 100644
index 000000000000..fd4c143c0e2f
--- /dev/null
+++ b/arch/mips/mips-boards/malta/Makefile
@@ -0,0 +1,22 @@
1#
2# Carsten Langgaard, carstenl@mips.com
3# Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4#
5# This program is free software; you can distribute it and/or modify it
6# under the terms of the GNU General Public License (Version 2) as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12# for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc.,
16# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17#
18# Makefile for the MIPS Malta specific kernel interface routines
19# under Linux.
20#
21
22obj-y := malta_int.o malta_setup.o
diff --git a/arch/mips/mips-boards/malta/malta_int.c b/arch/mips/mips-boards/malta/malta_int.c
new file mode 100644
index 000000000000..dd2db35966bc
--- /dev/null
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -0,0 +1,187 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc.
4 * Copyright (C) 2001 Ralf Baechle
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 *
19 * Routines for generic manipulation of the interrupts found on the MIPS
20 * Malta board.
21 * The interrupt controller is located in the South Bridge a PIIX4 device
22 * with two internal 82C95 interrupt controllers.
23 */
24#include <linux/init.h>
25#include <linux/irq.h>
26#include <linux/sched.h>
27#include <linux/slab.h>
28#include <linux/interrupt.h>
29#include <linux/kernel_stat.h>
30#include <linux/random.h>
31
32#include <asm/i8259.h>
33#include <asm/io.h>
34#include <asm/mips-boards/malta.h>
35#include <asm/mips-boards/maltaint.h>
36#include <asm/mips-boards/piix4.h>
37#include <asm/gt64120.h>
38#include <asm/mips-boards/generic.h>
39#include <asm/mips-boards/msc01_pci.h>
40
41extern asmlinkage void mipsIRQ(void);
42
43static DEFINE_SPINLOCK(mips_irq_lock);
44
45static inline int mips_pcibios_iack(void)
46{
47 int irq;
48 u32 dummy;
49
50 /*
51 * Determine highest priority pending interrupt by performing
52 * a PCI Interrupt Acknowledge cycle.
53 */
54 switch(mips_revision_corid) {
55 case MIPS_REVISION_CORID_CORE_MSC:
56 case MIPS_REVISION_CORID_CORE_FPGA2:
57 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
58 MSC_READ(MSC01_PCI_IACK, irq);
59 irq &= 0xff;
60 break;
61 case MIPS_REVISION_CORID_QED_RM5261:
62 case MIPS_REVISION_CORID_CORE_LV:
63 case MIPS_REVISION_CORID_CORE_FPGA:
64 case MIPS_REVISION_CORID_CORE_FPGAR2:
65 irq = GT_READ(GT_PCI0_IACK_OFS);
66 irq &= 0xff;
67 break;
68 case MIPS_REVISION_CORID_BONITO64:
69 case MIPS_REVISION_CORID_CORE_20K:
70 case MIPS_REVISION_CORID_CORE_EMUL_BON:
71 /* The following will generate a PCI IACK cycle on the
72 * Bonito controller. It's a little bit kludgy, but it
73 * was the easiest way to implement it in hardware at
74 * the given time.
75 */
76 BONITO_PCIMAP_CFG = 0x20000;
77
78 /* Flush Bonito register block */
79 dummy = BONITO_PCIMAP_CFG;
80 iob(); /* sync */
81
82 irq = *(volatile u32 *)(_pcictrl_bonito_pcicfg);
83 iob(); /* sync */
84 irq &= 0xff;
85 BONITO_PCIMAP_CFG = 0;
86 break;
87 default:
88 printk("Unknown Core card, don't know the system controller.\n");
89 return -1;
90 }
91 return irq;
92}
93
94static inline int get_int(int *irq)
95{
96 unsigned long flags;
97
98 spin_lock_irqsave(&mips_irq_lock, flags);
99
100 *irq = mips_pcibios_iack();
101
102 /*
103 * IRQ7 is used to detect spurious interrupts.
104 * The interrupt acknowledge cycle returns IRQ7, if no
105 * interrupts is requested.
106 * We can differentiate between this situation and a
107 * "Normal" IRQ7 by reading the ISR.
108 */
109 if (*irq == 7)
110 {
111 outb(PIIX4_OCW3_SEL | PIIX4_OCW3_ISR,
112 PIIX4_ICTLR1_OCW3);
113 if (!(inb(PIIX4_ICTLR1_OCW3) & (1 << 7))) {
114 spin_unlock_irqrestore(&mips_irq_lock, flags);
115 printk("We got a spurious interrupt from PIIX4.\n");
116 atomic_inc(&irq_err_count);
117 return -1; /* Spurious interrupt. */
118 }
119 }
120
121 spin_unlock_irqrestore(&mips_irq_lock, flags);
122
123 return 0;
124}
125
126void malta_hw0_irqdispatch(struct pt_regs *regs)
127{
128 int irq;
129
130 if (get_int(&irq))
131 return; /* interrupt has already been cleared */
132
133 do_IRQ(irq, regs);
134}
135
136void corehi_irqdispatch(struct pt_regs *regs)
137{
138 unsigned int data,datahi;
139
140 /* Mask out corehi interrupt. */
141 clear_c0_status(IE_IRQ3);
142
143 printk("CoreHI interrupt, shouldn't happen, so we die here!!!\n");
144 printk("epc : %08lx\nStatus: %08lx\nCause : %08lx\nbadVaddr : %08lx\n"
145, regs->cp0_epc, regs->cp0_status, regs->cp0_cause, regs->cp0_badvaddr);
146 switch(mips_revision_corid) {
147 case MIPS_REVISION_CORID_CORE_MSC:
148 case MIPS_REVISION_CORID_CORE_FPGA2:
149 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
150 break;
151 case MIPS_REVISION_CORID_QED_RM5261:
152 case MIPS_REVISION_CORID_CORE_LV:
153 case MIPS_REVISION_CORID_CORE_FPGA:
154 case MIPS_REVISION_CORID_CORE_FPGAR2:
155 data = GT_READ(GT_INTRCAUSE_OFS);
156 printk("GT_INTRCAUSE = %08x\n", data);
157 data = GT_READ(GT_CPUERR_ADDRLO_OFS);
158 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
159 printk("GT_CPUERR_ADDR = %02x%08x\n", datahi, data);
160 break;
161 case MIPS_REVISION_CORID_BONITO64:
162 case MIPS_REVISION_CORID_CORE_20K:
163 case MIPS_REVISION_CORID_CORE_EMUL_BON:
164 data = BONITO_INTISR;
165 printk("BONITO_INTISR = %08x\n", data);
166 data = BONITO_INTEN;
167 printk("BONITO_INTEN = %08x\n", data);
168 data = BONITO_INTPOL;
169 printk("BONITO_INTPOL = %08x\n", data);
170 data = BONITO_INTEDGE;
171 printk("BONITO_INTEDGE = %08x\n", data);
172 data = BONITO_INTSTEER;
173 printk("BONITO_INTSTEER = %08x\n", data);
174 data = BONITO_PCICMD;
175 printk("BONITO_PCICMD = %08x\n", data);
176 break;
177 }
178
179 /* We die here*/
180 die("CoreHi interrupt", regs);
181}
182
183void __init arch_init_irq(void)
184{
185 set_except_vector(0, mipsIRQ);
186 init_i8259_irqs();
187}
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
new file mode 100644
index 000000000000..3377e66de9eb
--- /dev/null
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -0,0 +1,231 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 */
18#include <linux/config.h>
19#include <linux/init.h>
20#include <linux/sched.h>
21#include <linux/ioport.h>
22#include <linux/pci.h>
23#include <linux/tty.h>
24
25#ifdef CONFIG_MTD
26#include <linux/mtd/partitions.h>
27#include <linux/mtd/physmap.h>
28#include <linux/mtd/mtd.h>
29#include <linux/mtd/map.h>
30#endif
31
32#include <asm/cpu.h>
33#include <asm/bootinfo.h>
34#include <asm/irq.h>
35#include <asm/mips-boards/generic.h>
36#include <asm/mips-boards/prom.h>
37#include <asm/mips-boards/malta.h>
38#include <asm/mips-boards/maltaint.h>
39#include <asm/dma.h>
40#include <asm/time.h>
41#include <asm/traps.h>
42#ifdef CONFIG_VT
43#include <linux/console.h>
44#endif
45
46extern void mips_reboot_setup(void);
47extern void mips_time_init(void);
48extern void mips_timer_setup(struct irqaction *irq);
49extern unsigned long mips_rtc_get_time(void);
50
51#ifdef CONFIG_KGDB
52extern void kgdb_config(void);
53#endif
54
55struct resource standard_io_resources[] = {
56 { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
57 { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
58 { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY },
59 { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
60 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
61};
62
63#ifdef CONFIG_MTD
64static struct mtd_partition malta_mtd_partitions[] = {
65 {
66 .name = "YAMON",
67 .offset = 0x0,
68 .size = 0x100000,
69 .mask_flags = MTD_WRITEABLE
70 },
71 {
72 .name = "User FS",
73 .offset = 0x100000,
74 .size = 0x2e0000
75 },
76 {
77 .name = "Board Config",
78 .offset = 0x3e0000,
79 .size = 0x020000,
80 .mask_flags = MTD_WRITEABLE
81 }
82};
83
84#define number_partitions (sizeof(malta_mtd_partitions)/sizeof(struct mtd_partition))
85#endif
86
87const char *get_system_type(void)
88{
89 return "MIPS Malta";
90}
91
92#ifdef CONFIG_BLK_DEV_FD
93void __init fd_activate(void)
94{
95 /*
96 * Activate Floppy Controller in the SMSC FDC37M817 Super I/O
97 * Controller.
98 * Done by YAMON 2.00 onwards
99 */
100 /* Entering config state. */
101 SMSC_WRITE(SMSC_CONFIG_ENTER, SMSC_CONFIG_REG);
102
103 /* Activate floppy controller. */
104 SMSC_WRITE(SMSC_CONFIG_DEVNUM, SMSC_CONFIG_REG);
105 SMSC_WRITE(SMSC_CONFIG_DEVNUM_FLOPPY, SMSC_DATA_REG);
106 SMSC_WRITE(SMSC_CONFIG_ACTIVATE, SMSC_CONFIG_REG);
107 SMSC_WRITE(SMSC_CONFIG_ACTIVATE_ENABLE, SMSC_DATA_REG);
108
109 /* Exit config state. */
110 SMSC_WRITE(SMSC_CONFIG_EXIT, SMSC_CONFIG_REG);
111}
112#endif
113
114static int __init malta_setup(void)
115{
116 unsigned int i;
117
118 /* Request I/O space for devices used on the Malta board. */
119 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
120 request_resource(&ioport_resource, standard_io_resources+i);
121
122 /*
123 * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.
124 */
125 enable_dma(4);
126
127#ifdef CONFIG_KGDB
128 kgdb_config ();
129#endif
130
131 if ((mips_revision_corid == MIPS_REVISION_CORID_BONITO64) ||
132 (mips_revision_corid == MIPS_REVISION_CORID_CORE_20K) ||
133 (mips_revision_corid == MIPS_REVISION_CORID_CORE_EMUL_BON)) {
134 char *argptr;
135
136 argptr = prom_getcmdline();
137 if (strstr(argptr, "debug")) {
138 BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
139 printk ("Enabled Bonito debug mode\n");
140 }
141 else
142 BONITO_BONGENCFG &= ~BONITO_BONGENCFG_DEBUGMODE;
143
144#ifdef CONFIG_DMA_COHERENT
145 if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
146 BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
147 printk("Enabled Bonito CPU coherency\n");
148
149 argptr = prom_getcmdline();
150 if (strstr(argptr, "iobcuncached")) {
151 BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN;
152 BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
153 ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
154 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
155 printk("Disabled Bonito IOBC coherency\n");
156 }
157 else {
158 BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_IOBCCOH_EN;
159 BONITO_PCIMEMBASECFG |=
160 (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
161 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
162 printk("Disabled Bonito IOBC coherency\n");
163 }
164 }
165 else
166 panic("Hardware DMA cache coherency not supported");
167
168#endif
169 }
170#ifdef CONFIG_DMA_COHERENT
171 else {
172 panic("Hardware DMA cache coherency not supported");
173 }
174#endif
175
176#ifdef CONFIG_BLK_DEV_IDE
177 /* Check PCI clock */
178 {
179 int jmpr = (*((volatile unsigned int *)ioremap(MALTA_JMPRS_REG, sizeof(unsigned int))) >> 2) & 0x07;
180 static const int pciclocks[] __initdata = {
181 33, 20, 25, 30, 12, 16, 37, 10
182 };
183 int pciclock = pciclocks[jmpr];
184 char *argptr = prom_getcmdline();
185
186 if (pciclock != 33 && !strstr (argptr, "idebus=")) {
187 printk("WARNING: PCI clock is %dMHz, setting idebus\n", pciclock);
188 argptr += strlen(argptr);
189 sprintf (argptr, " idebus=%d", pciclock);
190 if (pciclock < 20 || pciclock > 66)
191 printk ("WARNING: IDE timing calculations will be incorrect\n");
192 }
193 }
194#endif
195#ifdef CONFIG_BLK_DEV_FD
196 fd_activate ();
197#endif
198#ifdef CONFIG_VT
199#if defined(CONFIG_VGA_CONSOLE)
200 screen_info = (struct screen_info) {
201 0, 25, /* orig-x, orig-y */
202 0, /* unused */
203 0, /* orig-video-page */
204 0, /* orig-video-mode */
205 80, /* orig-video-cols */
206 0,0,0, /* ega_ax, ega_bx, ega_cx */
207 25, /* orig-video-lines */
208 VIDEO_TYPE_VGAC, /* orig-video-isVGA */
209 16 /* orig-video-points */
210 };
211#endif
212#endif
213
214#ifdef CONFIG_MTD
215 /*
216 * Support for MTD on Malta. Use the generic physmap driver
217 */
218 physmap_configure(0x1e000000, 0x400000, 4, NULL);
219 physmap_set_partitions(malta_mtd_partitions, number_partitions);
220#endif
221
222 mips_reboot_setup();
223
224 board_time_init = mips_time_init;
225 board_timer_setup = mips_timer_setup;
226 rtc_get_time = mips_rtc_get_time;
227
228 return 0;
229}
230
231early_initcall(malta_setup);
diff --git a/arch/mips/mips-boards/sead/Makefile b/arch/mips/mips-boards/sead/Makefile
new file mode 100644
index 000000000000..224bb848f16b
--- /dev/null
+++ b/arch/mips/mips-boards/sead/Makefile
@@ -0,0 +1,26 @@
1#
2# Carsten Langgaard, carstenl@mips.com
3# Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
4#
5# ########################################################################
6#
7# This program is free software; you can distribute it and/or modify it
8# under the terms of the GNU General Public License (Version 2) as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14# for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19#
20# #######################################################################
21#
22# Makefile for the MIPS SEAD specific kernel interface routines
23# under Linux.
24#
25
26obj-y := sead_int.o sead_setup.o
diff --git a/arch/mips/mips-boards/sead/sead_int.c b/arch/mips/mips-boards/sead/sead_int.c
new file mode 100644
index 000000000000..e5109657ed5a
--- /dev/null
+++ b/arch/mips/mips-boards/sead/sead_int.c
@@ -0,0 +1,51 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
4 * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org)
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 *
19 * Routines for generic manipulation of the interrupts found on the MIPS
20 * Sead board.
21 */
22#include <linux/init.h>
23#include <linux/irq.h>
24#include <linux/interrupt.h>
25
26#include <asm/mips-boards/seadint.h>
27
28extern asmlinkage void mipsIRQ(void);
29
30asmlinkage void sead_hw0_irqdispatch(struct pt_regs *regs)
31{
32 do_IRQ(SEADINT_UART0, regs);
33}
34
35asmlinkage void sead_hw1_irqdispatch(struct pt_regs *regs)
36{
37 do_IRQ(SEADINT_UART1, regs);
38}
39
40void __init arch_init_irq(void)
41{
42 /*
43 * Mask out all interrupt
44 */
45 clear_c0_status(0x0000ff00);
46
47 /* Now safe to set the exception vector. */
48 set_except_vector(0, mipsIRQ);
49
50 mips_cpu_irq_init(0);
51}
diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
new file mode 100644
index 000000000000..29892b88a4fc
--- /dev/null
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -0,0 +1,84 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * SEAD specific setup.
19 */
20#include <linux/config.h>
21#include <linux/init.h>
22#include <linux/sched.h>
23#include <linux/ioport.h>
24#include <linux/tty.h>
25#include <linux/serial.h>
26#include <linux/serial_core.h>
27
28#include <asm/cpu.h>
29#include <asm/bootinfo.h>
30#include <asm/irq.h>
31#include <asm/mips-boards/generic.h>
32#include <asm/mips-boards/prom.h>
33#include <asm/mips-boards/sead.h>
34#include <asm/mips-boards/seadint.h>
35#include <asm/time.h>
36
37extern void mips_reboot_setup(void);
38extern void mips_time_init(void);
39extern void mips_timer_setup(struct irqaction *irq);
40
41static void __init serial_init(void);
42
43const char *get_system_type(void)
44{
45 return "MIPS SEAD";
46}
47
48static void __init sead_setup(void)
49{
50 ioport_resource.end = 0x7fffffff;
51
52 serial_init ();
53
54 board_time_init = mips_time_init;
55 board_timer_setup = mips_timer_setup;
56
57 mips_reboot_setup();
58}
59
60early_initcall(sead_setup);
61
62static void __init serial_init(void)
63{
64#ifdef CONFIG_SERIAL_8250
65 struct uart_port s;
66
67 memset(&s, 0, sizeof(s));
68
69#ifdef CONFIG_CPU_LITTLE_ENDIAN
70 s.iobase = SEAD_UART0_REGS_BASE;
71#else
72 s.iobase = SEAD_UART0_REGS_BASE+3;
73#endif
74 s.irq = SEADINT_UART0;
75 s.uartclk = SEAD_BASE_BAUD * 16;
76 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
77 s.iotype = 0;
78 s.regshift = 3;
79
80 if (early_serial_setup(&s) != 0) {
81 printk(KERN_ERR "Serial setup failed!\n");
82 }
83#endif
84}
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
new file mode 100644
index 000000000000..f61e038b4440
--- /dev/null
+++ b/arch/mips/mm/Makefile
@@ -0,0 +1,44 @@
1#
2# Makefile for the Linux/MIPS-specific parts of the memory manager.
3#
4
5obj-y += cache.o extable.o fault.o init.o pgtable.o \
6 tlbex.o tlbex-fault.o
7
8obj-$(CONFIG_MIPS32) += ioremap.o pgtable-32.o
9obj-$(CONFIG_MIPS64) += pgtable-64.o
10obj-$(CONFIG_HIGHMEM) += highmem.o
11
12obj-$(CONFIG_CPU_MIPS32) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
13obj-$(CONFIG_CPU_MIPS64) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
14obj-$(CONFIG_CPU_NEVADA) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
15obj-$(CONFIG_CPU_R10000) += c-r4k.o cex-gen.o pg-r4k.o tlb-andes.o
16obj-$(CONFIG_CPU_R3000) += c-r3k.o tlb-r3k.o pg-r4k.o
17obj-$(CONFIG_CPU_R4300) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
18obj-$(CONFIG_CPU_R4X00) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
19obj-$(CONFIG_CPU_R5000) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
20obj-$(CONFIG_CPU_R5432) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
21obj-$(CONFIG_CPU_R8000) += c-r4k.o cex-gen.o pg-r4k.o tlb-r8k.o
22obj-$(CONFIG_CPU_RM7000) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
23obj-$(CONFIG_CPU_RM9000) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
24obj-$(CONFIG_CPU_SB1) += c-sb1.o cerr-sb1.o cex-sb1.o pg-sb1.o \
25 tlb-sb1.o
26obj-$(CONFIG_CPU_TX39XX) += c-tx39.o pg-r4k.o tlb-r3k.o
27obj-$(CONFIG_CPU_TX49XX) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
28obj-$(CONFIG_CPU_VR41XX) += c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
29
30obj-$(CONFIG_IP22_CPU_SCACHE) += sc-ip22.o
31obj-$(CONFIG_R5000_CPU_SCACHE) += sc-r5k.o
32obj-$(CONFIG_RM7000_CPU_SCACHE) += sc-rm7k.o
33
34#
35# Choose one DMA coherency model
36#
37ifndef CONFIG_OWN_DMA
38obj-$(CONFIG_DMA_COHERENT) += dma-coherent.o
39obj-$(CONFIG_DMA_NONCOHERENT) += dma-noncoherent.o
40endif
41obj-$(CONFIG_DMA_IP27) += dma-ip27.o
42obj-$(CONFIG_DMA_IP32) += dma-ip32.o
43
44EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
new file mode 100644
index 000000000000..c659f99eb39a
--- /dev/null
+++ b/arch/mips/mm/c-r3k.c
@@ -0,0 +1,349 @@
1/*
2 * r2300.c: R2000 and R3000 specific mmu/cache code.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 *
6 * with a lot of changes to make this thing work for R3000s
7 * Tx39XX R4k style caches added. HK
8 * Copyright (C) 1998, 1999, 2000 Harald Koerfgen
9 * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
10 * Copyright (C) 2001, 2004 Maciej W. Rozycki
11 */
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/mm.h>
16
17#include <asm/page.h>
18#include <asm/pgtable.h>
19#include <asm/mmu_context.h>
20#include <asm/system.h>
21#include <asm/isadep.h>
22#include <asm/io.h>
23#include <asm/bootinfo.h>
24#include <asm/cpu.h>
25
26static unsigned long icache_size, dcache_size; /* Size in bytes */
27static unsigned long icache_lsize, dcache_lsize; /* Size in bytes */
28
29#undef DEBUG_CACHE
30
31unsigned long __init r3k_cache_size(unsigned long ca_flags)
32{
33 unsigned long flags, status, dummy, size;
34 volatile unsigned long *p;
35
36 p = (volatile unsigned long *) KSEG0;
37
38 flags = read_c0_status();
39
40 /* isolate cache space */
41 write_c0_status((ca_flags|flags)&~ST0_IEC);
42
43 *p = 0xa5a55a5a;
44 dummy = *p;
45 status = read_c0_status();
46
47 if (dummy != 0xa5a55a5a || (status & ST0_CM)) {
48 size = 0;
49 } else {
50 for (size = 128; size <= 0x40000; size <<= 1)
51 *(p + size) = 0;
52 *p = -1;
53 for (size = 128;
54 (size <= 0x40000) && (*(p + size) == 0);
55 size <<= 1)
56 ;
57 if (size > 0x40000)
58 size = 0;
59 }
60
61 write_c0_status(flags);
62
63 return size * sizeof(*p);
64}
65
66unsigned long __init r3k_cache_lsize(unsigned long ca_flags)
67{
68 unsigned long flags, status, lsize, i;
69 volatile unsigned long *p;
70
71 p = (volatile unsigned long *) KSEG0;
72
73 flags = read_c0_status();
74
75 /* isolate cache space */
76 write_c0_status((ca_flags|flags)&~ST0_IEC);
77
78 for (i = 0; i < 128; i++)
79 *(p + i) = 0;
80 *(volatile unsigned char *)p = 0;
81 for (lsize = 1; lsize < 128; lsize <<= 1) {
82 *(p + lsize);
83 status = read_c0_status();
84 if (!(status & ST0_CM))
85 break;
86 }
87 for (i = 0; i < 128; i += lsize)
88 *(volatile unsigned char *)(p + i) = 0;
89
90 write_c0_status(flags);
91
92 return lsize * sizeof(*p);
93}
94
95static void __init r3k_probe_cache(void)
96{
97 dcache_size = r3k_cache_size(ST0_ISC);
98 if (dcache_size)
99 dcache_lsize = r3k_cache_lsize(ST0_ISC);
100
101 icache_size = r3k_cache_size(ST0_ISC|ST0_SWC);
102 if (icache_size)
103 icache_lsize = r3k_cache_lsize(ST0_ISC|ST0_SWC);
104}
105
106static void r3k_flush_icache_range(unsigned long start, unsigned long end)
107{
108 unsigned long size, i, flags;
109 volatile unsigned char *p;
110
111 size = end - start;
112 if (size > icache_size || KSEGX(start) != KSEG0) {
113 start = KSEG0;
114 size = icache_size;
115 }
116 p = (char *)start;
117
118 flags = read_c0_status();
119
120 /* isolate cache space */
121 write_c0_status((ST0_ISC|ST0_SWC|flags)&~ST0_IEC);
122
123 for (i = 0; i < size; i += 0x080) {
124 asm ( "sb\t$0, 0x000(%0)\n\t"
125 "sb\t$0, 0x004(%0)\n\t"
126 "sb\t$0, 0x008(%0)\n\t"
127 "sb\t$0, 0x00c(%0)\n\t"
128 "sb\t$0, 0x010(%0)\n\t"
129 "sb\t$0, 0x014(%0)\n\t"
130 "sb\t$0, 0x018(%0)\n\t"
131 "sb\t$0, 0x01c(%0)\n\t"
132 "sb\t$0, 0x020(%0)\n\t"
133 "sb\t$0, 0x024(%0)\n\t"
134 "sb\t$0, 0x028(%0)\n\t"
135 "sb\t$0, 0x02c(%0)\n\t"
136 "sb\t$0, 0x030(%0)\n\t"
137 "sb\t$0, 0x034(%0)\n\t"
138 "sb\t$0, 0x038(%0)\n\t"
139 "sb\t$0, 0x03c(%0)\n\t"
140 "sb\t$0, 0x040(%0)\n\t"
141 "sb\t$0, 0x044(%0)\n\t"
142 "sb\t$0, 0x048(%0)\n\t"
143 "sb\t$0, 0x04c(%0)\n\t"
144 "sb\t$0, 0x050(%0)\n\t"
145 "sb\t$0, 0x054(%0)\n\t"
146 "sb\t$0, 0x058(%0)\n\t"
147 "sb\t$0, 0x05c(%0)\n\t"
148 "sb\t$0, 0x060(%0)\n\t"
149 "sb\t$0, 0x064(%0)\n\t"
150 "sb\t$0, 0x068(%0)\n\t"
151 "sb\t$0, 0x06c(%0)\n\t"
152 "sb\t$0, 0x070(%0)\n\t"
153 "sb\t$0, 0x074(%0)\n\t"
154 "sb\t$0, 0x078(%0)\n\t"
155 "sb\t$0, 0x07c(%0)\n\t"
156 : : "r" (p) );
157 p += 0x080;
158 }
159
160 write_c0_status(flags);
161}
162
163static void r3k_flush_dcache_range(unsigned long start, unsigned long end)
164{
165 unsigned long size, i, flags;
166 volatile unsigned char *p;
167
168 size = end - start;
169 if (size > dcache_size || KSEGX(start) != KSEG0) {
170 start = KSEG0;
171 size = dcache_size;
172 }
173 p = (char *)start;
174
175 flags = read_c0_status();
176
177 /* isolate cache space */
178 write_c0_status((ST0_ISC|flags)&~ST0_IEC);
179
180 for (i = 0; i < size; i += 0x080) {
181 asm ( "sb\t$0, 0x000(%0)\n\t"
182 "sb\t$0, 0x004(%0)\n\t"
183 "sb\t$0, 0x008(%0)\n\t"
184 "sb\t$0, 0x00c(%0)\n\t"
185 "sb\t$0, 0x010(%0)\n\t"
186 "sb\t$0, 0x014(%0)\n\t"
187 "sb\t$0, 0x018(%0)\n\t"
188 "sb\t$0, 0x01c(%0)\n\t"
189 "sb\t$0, 0x020(%0)\n\t"
190 "sb\t$0, 0x024(%0)\n\t"
191 "sb\t$0, 0x028(%0)\n\t"
192 "sb\t$0, 0x02c(%0)\n\t"
193 "sb\t$0, 0x030(%0)\n\t"
194 "sb\t$0, 0x034(%0)\n\t"
195 "sb\t$0, 0x038(%0)\n\t"
196 "sb\t$0, 0x03c(%0)\n\t"
197 "sb\t$0, 0x040(%0)\n\t"
198 "sb\t$0, 0x044(%0)\n\t"
199 "sb\t$0, 0x048(%0)\n\t"
200 "sb\t$0, 0x04c(%0)\n\t"
201 "sb\t$0, 0x050(%0)\n\t"
202 "sb\t$0, 0x054(%0)\n\t"
203 "sb\t$0, 0x058(%0)\n\t"
204 "sb\t$0, 0x05c(%0)\n\t"
205 "sb\t$0, 0x060(%0)\n\t"
206 "sb\t$0, 0x064(%0)\n\t"
207 "sb\t$0, 0x068(%0)\n\t"
208 "sb\t$0, 0x06c(%0)\n\t"
209 "sb\t$0, 0x070(%0)\n\t"
210 "sb\t$0, 0x074(%0)\n\t"
211 "sb\t$0, 0x078(%0)\n\t"
212 "sb\t$0, 0x07c(%0)\n\t"
213 : : "r" (p) );
214 p += 0x080;
215 }
216
217 write_c0_status(flags);
218}
219
220static inline unsigned long get_phys_page (unsigned long addr,
221 struct mm_struct *mm)
222{
223 pgd_t *pgd;
224 pmd_t *pmd;
225 pte_t *pte;
226 unsigned long physpage;
227
228 pgd = pgd_offset(mm, addr);
229 pmd = pmd_offset(pgd, addr);
230 pte = pte_offset(pmd, addr);
231
232 if ((physpage = pte_val(*pte)) & _PAGE_VALID)
233 return KSEG0ADDR(physpage & PAGE_MASK);
234
235 return 0;
236}
237
238static inline void r3k_flush_cache_all(void)
239{
240}
241
242static inline void r3k___flush_cache_all(void)
243{
244 r3k_flush_dcache_range(KSEG0, KSEG0 + dcache_size);
245 r3k_flush_icache_range(KSEG0, KSEG0 + icache_size);
246}
247
248static void r3k_flush_cache_mm(struct mm_struct *mm)
249{
250}
251
252static void r3k_flush_cache_range(struct vm_area_struct *vma,
253 unsigned long start, unsigned long end)
254{
255}
256
257static void r3k_flush_cache_page(struct vm_area_struct *vma, unsigned long page, unsigned long pfn)
258{
259}
260
261static void r3k_flush_data_cache_page(unsigned long addr)
262{
263}
264
265static void r3k_flush_icache_page(struct vm_area_struct *vma, struct page *page)
266{
267 struct mm_struct *mm = vma->vm_mm;
268 unsigned long physpage;
269
270 if (cpu_context(smp_processor_id(), mm) == 0)
271 return;
272
273 if (!(vma->vm_flags & VM_EXEC))
274 return;
275
276#ifdef DEBUG_CACHE
277 printk("cpage[%d,%08lx]", cpu_context(smp_processor_id(), mm), page);
278#endif
279
280 physpage = (unsigned long) page_address(page);
281 if (physpage)
282 r3k_flush_icache_range(physpage, physpage + PAGE_SIZE);
283}
284
285static void r3k_flush_cache_sigtramp(unsigned long addr)
286{
287 unsigned long flags;
288
289#ifdef DEBUG_CACHE
290 printk("csigtramp[%08lx]", addr);
291#endif
292
293 flags = read_c0_status();
294
295 write_c0_status(flags&~ST0_IEC);
296
297 /* Fill the TLB to avoid an exception with caches isolated. */
298 asm ( "lw\t$0, 0x000(%0)\n\t"
299 "lw\t$0, 0x004(%0)\n\t"
300 : : "r" (addr) );
301
302 write_c0_status((ST0_ISC|ST0_SWC|flags)&~ST0_IEC);
303
304 asm ( "sb\t$0, 0x000(%0)\n\t"
305 "sb\t$0, 0x004(%0)\n\t"
306 : : "r" (addr) );
307
308 write_c0_status(flags);
309}
310
311static void r3k_dma_cache_wback_inv(unsigned long start, unsigned long size)
312{
313 /* Catch bad driver code */
314 BUG_ON(size == 0);
315
316 iob();
317 r3k_flush_dcache_range(start, start + size);
318}
319
320void __init ld_mmu_r23000(void)
321{
322 extern void build_clear_page(void);
323 extern void build_copy_page(void);
324
325 r3k_probe_cache();
326
327 flush_cache_all = r3k_flush_cache_all;
328 __flush_cache_all = r3k___flush_cache_all;
329 flush_cache_mm = r3k_flush_cache_mm;
330 flush_cache_range = r3k_flush_cache_range;
331 flush_cache_page = r3k_flush_cache_page;
332 flush_icache_page = r3k_flush_icache_page;
333 flush_icache_range = r3k_flush_icache_range;
334
335 flush_cache_sigtramp = r3k_flush_cache_sigtramp;
336 flush_data_cache_page = r3k_flush_data_cache_page;
337
338 _dma_cache_wback_inv = r3k_dma_cache_wback_inv;
339 _dma_cache_wback = r3k_dma_cache_wback_inv;
340 _dma_cache_inv = r3k_dma_cache_wback_inv;
341
342 printk("Primary instruction cache %ldkB, linesize %ld bytes.\n",
343 icache_size >> 10, icache_lsize);
344 printk("Primary data cache %ldkB, linesize %ld bytes.\n",
345 dcache_size >> 10, dcache_lsize);
346
347 build_clear_page();
348 build_copy_page();
349}
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
new file mode 100644
index 000000000000..a03ebb2cba67
--- /dev/null
+++ b/arch/mips/mm/c-r4k.c
@@ -0,0 +1,1260 @@
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) 1996 David S. Miller (dm@engr.sgi.com)
7 * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Ralf Baechle (ralf@gnu.org)
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */
10#include <linux/config.h>
11#include <linux/init.h>
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/mm.h>
15#include <linux/bitops.h>
16
17#include <asm/bcache.h>
18#include <asm/bootinfo.h>
19#include <asm/cacheops.h>
20#include <asm/cpu.h>
21#include <asm/cpu-features.h>
22#include <asm/io.h>
23#include <asm/page.h>
24#include <asm/pgtable.h>
25#include <asm/r4kcache.h>
26#include <asm/system.h>
27#include <asm/mmu_context.h>
28#include <asm/war.h>
29
30static unsigned long icache_size, dcache_size, scache_size;
31
32/*
33 * Dummy cache handling routines for machines without boardcaches
34 */
35static void no_sc_noop(void) {}
36
37static struct bcache_ops no_sc_ops = {
38 .bc_enable = (void *)no_sc_noop,
39 .bc_disable = (void *)no_sc_noop,
40 .bc_wback_inv = (void *)no_sc_noop,
41 .bc_inv = (void *)no_sc_noop
42};
43
44struct bcache_ops *bcops = &no_sc_ops;
45
46#define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x2010)
47#define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x2020)
48
49#define R4600_HIT_CACHEOP_WAR_IMPL \
50do { \
51 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) \
52 *(volatile unsigned long *)CKSEG1; \
53 if (R4600_V1_HIT_CACHEOP_WAR) \
54 __asm__ __volatile__("nop;nop;nop;nop"); \
55} while (0)
56
57static void (*r4k_blast_dcache_page)(unsigned long addr);
58
59static inline void r4k_blast_dcache_page_dc32(unsigned long addr)
60{
61 R4600_HIT_CACHEOP_WAR_IMPL;
62 blast_dcache32_page(addr);
63}
64
65static inline void r4k_blast_dcache_page_setup(void)
66{
67 unsigned long dc_lsize = cpu_dcache_line_size();
68
69 if (dc_lsize == 16)
70 r4k_blast_dcache_page = blast_dcache16_page;
71 else if (dc_lsize == 32)
72 r4k_blast_dcache_page = r4k_blast_dcache_page_dc32;
73}
74
75static void (* r4k_blast_dcache_page_indexed)(unsigned long addr);
76
77static inline void r4k_blast_dcache_page_indexed_setup(void)
78{
79 unsigned long dc_lsize = cpu_dcache_line_size();
80
81 if (dc_lsize == 16)
82 r4k_blast_dcache_page_indexed = blast_dcache16_page_indexed;
83 else if (dc_lsize == 32)
84 r4k_blast_dcache_page_indexed = blast_dcache32_page_indexed;
85}
86
87static void (* r4k_blast_dcache)(void);
88
89static inline void r4k_blast_dcache_setup(void)
90{
91 unsigned long dc_lsize = cpu_dcache_line_size();
92
93 if (dc_lsize == 16)
94 r4k_blast_dcache = blast_dcache16;
95 else if (dc_lsize == 32)
96 r4k_blast_dcache = blast_dcache32;
97}
98
99/* force code alignment (used for TX49XX_ICACHE_INDEX_INV_WAR) */
100#define JUMP_TO_ALIGN(order) \
101 __asm__ __volatile__( \
102 "b\t1f\n\t" \
103 ".align\t" #order "\n\t" \
104 "1:\n\t" \
105 )
106#define CACHE32_UNROLL32_ALIGN JUMP_TO_ALIGN(10) /* 32 * 32 = 1024 */
107#define CACHE32_UNROLL32_ALIGN2 JUMP_TO_ALIGN(11)
108
109static inline void blast_r4600_v1_icache32(void)
110{
111 unsigned long flags;
112
113 local_irq_save(flags);
114 blast_icache32();
115 local_irq_restore(flags);
116}
117
118static inline void tx49_blast_icache32(void)
119{
120 unsigned long start = INDEX_BASE;
121 unsigned long end = start + current_cpu_data.icache.waysize;
122 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
123 unsigned long ws_end = current_cpu_data.icache.ways <<
124 current_cpu_data.icache.waybit;
125 unsigned long ws, addr;
126
127 CACHE32_UNROLL32_ALIGN2;
128 /* I'm in even chunk. blast odd chunks */
129 for (ws = 0; ws < ws_end; ws += ws_inc)
130 for (addr = start + 0x400; addr < end; addr += 0x400 * 2)
131 cache32_unroll32(addr|ws,Index_Invalidate_I);
132 CACHE32_UNROLL32_ALIGN;
133 /* I'm in odd chunk. blast even chunks */
134 for (ws = 0; ws < ws_end; ws += ws_inc)
135 for (addr = start; addr < end; addr += 0x400 * 2)
136 cache32_unroll32(addr|ws,Index_Invalidate_I);
137}
138
139static inline void blast_icache32_r4600_v1_page_indexed(unsigned long page)
140{
141 unsigned long flags;
142
143 local_irq_save(flags);
144 blast_icache32_page_indexed(page);
145 local_irq_restore(flags);
146}
147
148static inline void tx49_blast_icache32_page_indexed(unsigned long page)
149{
150 unsigned long start = page;
151 unsigned long end = start + PAGE_SIZE;
152 unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
153 unsigned long ws_end = current_cpu_data.icache.ways <<
154 current_cpu_data.icache.waybit;
155 unsigned long ws, addr;
156
157 CACHE32_UNROLL32_ALIGN2;
158 /* I'm in even chunk. blast odd chunks */
159 for (ws = 0; ws < ws_end; ws += ws_inc)
160 for (addr = start + 0x400; addr < end; addr += 0x400 * 2)
161 cache32_unroll32(addr|ws,Index_Invalidate_I);
162 CACHE32_UNROLL32_ALIGN;
163 /* I'm in odd chunk. blast even chunks */
164 for (ws = 0; ws < ws_end; ws += ws_inc)
165 for (addr = start; addr < end; addr += 0x400 * 2)
166 cache32_unroll32(addr|ws,Index_Invalidate_I);
167}
168
169static void (* r4k_blast_icache_page)(unsigned long addr);
170
171static inline void r4k_blast_icache_page_setup(void)
172{
173 unsigned long ic_lsize = cpu_icache_line_size();
174
175 if (ic_lsize == 16)
176 r4k_blast_icache_page = blast_icache16_page;
177 else if (ic_lsize == 32)
178 r4k_blast_icache_page = blast_icache32_page;
179 else if (ic_lsize == 64)
180 r4k_blast_icache_page = blast_icache64_page;
181}
182
183
184static void (* r4k_blast_icache_page_indexed)(unsigned long addr);
185
186static inline void r4k_blast_icache_page_indexed_setup(void)
187{
188 unsigned long ic_lsize = cpu_icache_line_size();
189
190 if (ic_lsize == 16)
191 r4k_blast_icache_page_indexed = blast_icache16_page_indexed;
192 else if (ic_lsize == 32) {
193 if (TX49XX_ICACHE_INDEX_INV_WAR)
194 r4k_blast_icache_page_indexed =
195 tx49_blast_icache32_page_indexed;
196 else if (R4600_V1_INDEX_ICACHEOP_WAR && cpu_is_r4600_v1_x())
197 r4k_blast_icache_page_indexed =
198 blast_icache32_r4600_v1_page_indexed;
199 else
200 r4k_blast_icache_page_indexed =
201 blast_icache32_page_indexed;
202 } else if (ic_lsize == 64)
203 r4k_blast_icache_page_indexed = blast_icache64_page_indexed;
204}
205
206static void (* r4k_blast_icache)(void);
207
208static inline void r4k_blast_icache_setup(void)
209{
210 unsigned long ic_lsize = cpu_icache_line_size();
211
212 if (ic_lsize == 16)
213 r4k_blast_icache = blast_icache16;
214 else if (ic_lsize == 32) {
215 if (R4600_V1_INDEX_ICACHEOP_WAR && cpu_is_r4600_v1_x())
216 r4k_blast_icache = blast_r4600_v1_icache32;
217 else if (TX49XX_ICACHE_INDEX_INV_WAR)
218 r4k_blast_icache = tx49_blast_icache32;
219 else
220 r4k_blast_icache = blast_icache32;
221 } else if (ic_lsize == 64)
222 r4k_blast_icache = blast_icache64;
223}
224
225static void (* r4k_blast_scache_page)(unsigned long addr);
226
227static inline void r4k_blast_scache_page_setup(void)
228{
229 unsigned long sc_lsize = cpu_scache_line_size();
230
231 if (sc_lsize == 16)
232 r4k_blast_scache_page = blast_scache16_page;
233 else if (sc_lsize == 32)
234 r4k_blast_scache_page = blast_scache32_page;
235 else if (sc_lsize == 64)
236 r4k_blast_scache_page = blast_scache64_page;
237 else if (sc_lsize == 128)
238 r4k_blast_scache_page = blast_scache128_page;
239}
240
241static void (* r4k_blast_scache_page_indexed)(unsigned long addr);
242
243static inline void r4k_blast_scache_page_indexed_setup(void)
244{
245 unsigned long sc_lsize = cpu_scache_line_size();
246
247 if (sc_lsize == 16)
248 r4k_blast_scache_page_indexed = blast_scache16_page_indexed;
249 else if (sc_lsize == 32)
250 r4k_blast_scache_page_indexed = blast_scache32_page_indexed;
251 else if (sc_lsize == 64)
252 r4k_blast_scache_page_indexed = blast_scache64_page_indexed;
253 else if (sc_lsize == 128)
254 r4k_blast_scache_page_indexed = blast_scache128_page_indexed;
255}
256
257static void (* r4k_blast_scache)(void);
258
259static inline void r4k_blast_scache_setup(void)
260{
261 unsigned long sc_lsize = cpu_scache_line_size();
262
263 if (sc_lsize == 16)
264 r4k_blast_scache = blast_scache16;
265 else if (sc_lsize == 32)
266 r4k_blast_scache = blast_scache32;
267 else if (sc_lsize == 64)
268 r4k_blast_scache = blast_scache64;
269 else if (sc_lsize == 128)
270 r4k_blast_scache = blast_scache128;
271}
272
273/*
274 * This is former mm's flush_cache_all() which really should be
275 * flush_cache_vunmap these days ...
276 */
277static inline void local_r4k_flush_cache_all(void * args)
278{
279 r4k_blast_dcache();
280 r4k_blast_icache();
281}
282
283static void r4k_flush_cache_all(void)
284{
285 if (!cpu_has_dc_aliases)
286 return;
287
288 on_each_cpu(local_r4k_flush_cache_all, NULL, 1, 1);
289}
290
291static inline void local_r4k___flush_cache_all(void * args)
292{
293 r4k_blast_dcache();
294 r4k_blast_icache();
295
296 switch (current_cpu_data.cputype) {
297 case CPU_R4000SC:
298 case CPU_R4000MC:
299 case CPU_R4400SC:
300 case CPU_R4400MC:
301 case CPU_R10000:
302 case CPU_R12000:
303 r4k_blast_scache();
304 }
305}
306
307static void r4k___flush_cache_all(void)
308{
309 on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1);
310}
311
312static inline void local_r4k_flush_cache_range(void * args)
313{
314 struct vm_area_struct *vma = args;
315 int exec;
316
317 if (!(cpu_context(smp_processor_id(), vma->vm_mm)))
318 return;
319
320 exec = vma->vm_flags & VM_EXEC;
321 if (cpu_has_dc_aliases || exec)
322 r4k_blast_dcache();
323 if (exec)
324 r4k_blast_icache();
325}
326
327static void r4k_flush_cache_range(struct vm_area_struct *vma,
328 unsigned long start, unsigned long end)
329{
330 on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1);
331}
332
333static inline void local_r4k_flush_cache_mm(void * args)
334{
335 struct mm_struct *mm = args;
336
337 if (!cpu_context(smp_processor_id(), mm))
338 return;
339
340 r4k_blast_dcache();
341 r4k_blast_icache();
342
343 /*
344 * Kludge alert. For obscure reasons R4000SC and R4400SC go nuts if we
345 * only flush the primary caches but R10000 and R12000 behave sane ...
346 */
347 if (current_cpu_data.cputype == CPU_R4000SC ||
348 current_cpu_data.cputype == CPU_R4000MC ||
349 current_cpu_data.cputype == CPU_R4400SC ||
350 current_cpu_data.cputype == CPU_R4400MC)
351 r4k_blast_scache();
352}
353
354static void r4k_flush_cache_mm(struct mm_struct *mm)
355{
356 if (!cpu_has_dc_aliases)
357 return;
358
359 on_each_cpu(local_r4k_flush_cache_mm, mm, 1, 1);
360}
361
362struct flush_cache_page_args {
363 struct vm_area_struct *vma;
364 unsigned long page;
365};
366
367static inline void local_r4k_flush_cache_page(void *args)
368{
369 struct flush_cache_page_args *fcp_args = args;
370 struct vm_area_struct *vma = fcp_args->vma;
371 unsigned long page = fcp_args->page;
372 int exec = vma->vm_flags & VM_EXEC;
373 struct mm_struct *mm = vma->vm_mm;
374 pgd_t *pgdp;
375 pmd_t *pmdp;
376 pte_t *ptep;
377
378 page &= PAGE_MASK;
379 pgdp = pgd_offset(mm, page);
380 pmdp = pmd_offset(pgdp, page);
381 ptep = pte_offset(pmdp, page);
382
383 /*
384 * If the page isn't marked valid, the page cannot possibly be
385 * in the cache.
386 */
387 if (!(pte_val(*ptep) & _PAGE_PRESENT))
388 return;
389
390 /*
391 * Doing flushes for another ASID than the current one is
392 * too difficult since stupid R4k caches do a TLB translation
393 * for every cache flush operation. So we do indexed flushes
394 * in that case, which doesn't overly flush the cache too much.
395 */
396 if ((mm == current->active_mm) && (pte_val(*ptep) & _PAGE_VALID)) {
397 if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) {
398 r4k_blast_dcache_page(page);
399 if (exec && !cpu_icache_snoops_remote_store)
400 r4k_blast_scache_page(page);
401 }
402 if (exec)
403 r4k_blast_icache_page(page);
404
405 return;
406 }
407
408 /*
409 * Do indexed flush, too much work to get the (possible) TLB refills
410 * to work correctly.
411 */
412 page = INDEX_BASE + (page & (dcache_size - 1));
413 if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) {
414 r4k_blast_dcache_page_indexed(page);
415 if (exec && !cpu_icache_snoops_remote_store)
416 r4k_blast_scache_page_indexed(page);
417 }
418 if (exec) {
419 if (cpu_has_vtag_icache) {
420 int cpu = smp_processor_id();
421
422 if (cpu_context(cpu, vma->vm_mm) != 0)
423 drop_mmu_context(vma->vm_mm, cpu);
424 } else
425 r4k_blast_icache_page_indexed(page);
426 }
427}
428
429static void r4k_flush_cache_page(struct vm_area_struct *vma, unsigned long page, unsigned long pfn)
430{
431 struct flush_cache_page_args args;
432
433 /*
434 * If ownes no valid ASID yet, cannot possibly have gotten
435 * this page into the cache.
436 */
437 if (cpu_context(smp_processor_id(), vma->vm_mm) == 0)
438 return;
439
440 args.vma = vma;
441 args.page = page;
442
443 on_each_cpu(local_r4k_flush_cache_page, &args, 1, 1);
444}
445
446static inline void local_r4k_flush_data_cache_page(void * addr)
447{
448 r4k_blast_dcache_page((unsigned long) addr);
449}
450
451static void r4k_flush_data_cache_page(unsigned long addr)
452{
453 on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr, 1, 1);
454}
455
456struct flush_icache_range_args {
457 unsigned long start;
458 unsigned long end;
459};
460
461static inline void local_r4k_flush_icache_range(void *args)
462{
463 struct flush_icache_range_args *fir_args = args;
464 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
465 unsigned long ic_lsize = current_cpu_data.icache.linesz;
466 unsigned long sc_lsize = current_cpu_data.scache.linesz;
467 unsigned long start = fir_args->start;
468 unsigned long end = fir_args->end;
469 unsigned long addr, aend;
470
471 if (!cpu_has_ic_fills_f_dc) {
472 if (end - start > dcache_size) {
473 r4k_blast_dcache();
474 } else {
475 addr = start & ~(dc_lsize - 1);
476 aend = (end - 1) & ~(dc_lsize - 1);
477
478 while (1) {
479 /* Hit_Writeback_Inv_D */
480 protected_writeback_dcache_line(addr);
481 if (addr == aend)
482 break;
483 addr += dc_lsize;
484 }
485 }
486
487 if (!cpu_icache_snoops_remote_store) {
488 if (end - start > scache_size) {
489 r4k_blast_scache();
490 } else {
491 addr = start & ~(sc_lsize - 1);
492 aend = (end - 1) & ~(sc_lsize - 1);
493
494 while (1) {
495 /* Hit_Writeback_Inv_D */
496 protected_writeback_scache_line(addr);
497 if (addr == aend)
498 break;
499 addr += sc_lsize;
500 }
501 }
502 }
503 }
504
505 if (end - start > icache_size)
506 r4k_blast_icache();
507 else {
508 addr = start & ~(ic_lsize - 1);
509 aend = (end - 1) & ~(ic_lsize - 1);
510 while (1) {
511 /* Hit_Invalidate_I */
512 protected_flush_icache_line(addr);
513 if (addr == aend)
514 break;
515 addr += ic_lsize;
516 }
517 }
518}
519
520static void r4k_flush_icache_range(unsigned long start, unsigned long end)
521{
522 struct flush_icache_range_args args;
523
524 args.start = start;
525 args.end = end;
526
527 on_each_cpu(local_r4k_flush_icache_range, &args, 1, 1);
528}
529
530/*
531 * Ok, this seriously sucks. We use them to flush a user page but don't
532 * know the virtual address, so we have to blast away the whole icache
533 * which is significantly more expensive than the real thing. Otoh we at
534 * least know the kernel address of the page so we can flush it
535 * selectivly.
536 */
537
538struct flush_icache_page_args {
539 struct vm_area_struct *vma;
540 struct page *page;
541};
542
543static inline void local_r4k_flush_icache_page(void *args)
544{
545 struct flush_icache_page_args *fip_args = args;
546 struct vm_area_struct *vma = fip_args->vma;
547 struct page *page = fip_args->page;
548
549 /*
550 * Tricky ... Because we don't know the virtual address we've got the
551 * choice of either invalidating the entire primary and secondary
552 * caches or invalidating the secondary caches also. With the subset
553 * enforcment on R4000SC, R4400SC, R10000 and R12000 invalidating the
554 * secondary cache will result in any entries in the primary caches
555 * also getting invalidated which hopefully is a bit more economical.
556 */
557 if (cpu_has_subset_pcaches) {
558 unsigned long addr = (unsigned long) page_address(page);
559
560 r4k_blast_scache_page(addr);
561 ClearPageDcacheDirty(page);
562
563 return;
564 }
565
566 if (!cpu_has_ic_fills_f_dc) {
567 unsigned long addr = (unsigned long) page_address(page);
568 r4k_blast_dcache_page(addr);
569 if (!cpu_icache_snoops_remote_store)
570 r4k_blast_scache_page(addr);
571 ClearPageDcacheDirty(page);
572 }
573
574 /*
575 * We're not sure of the virtual address(es) involved here, so
576 * we have to flush the entire I-cache.
577 */
578 if (cpu_has_vtag_icache) {
579 int cpu = smp_processor_id();
580
581 if (cpu_context(cpu, vma->vm_mm) != 0)
582 drop_mmu_context(vma->vm_mm, cpu);
583 } else
584 r4k_blast_icache();
585}
586
587static void r4k_flush_icache_page(struct vm_area_struct *vma,
588 struct page *page)
589{
590 struct flush_icache_page_args args;
591
592 /*
593 * If there's no context yet, or the page isn't executable, no I-cache
594 * flush is needed.
595 */
596 if (!(vma->vm_flags & VM_EXEC))
597 return;
598
599 args.vma = vma;
600 args.page = page;
601
602 on_each_cpu(local_r4k_flush_icache_page, &args, 1, 1);
603}
604
605
606#ifdef CONFIG_DMA_NONCOHERENT
607
608static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
609{
610 unsigned long end, a;
611
612 /* Catch bad driver code */
613 BUG_ON(size == 0);
614
615 if (cpu_has_subset_pcaches) {
616 unsigned long sc_lsize = current_cpu_data.scache.linesz;
617
618 if (size >= scache_size) {
619 r4k_blast_scache();
620 return;
621 }
622
623 a = addr & ~(sc_lsize - 1);
624 end = (addr + size - 1) & ~(sc_lsize - 1);
625 while (1) {
626 flush_scache_line(a); /* Hit_Writeback_Inv_SD */
627 if (a == end)
628 break;
629 a += sc_lsize;
630 }
631 return;
632 }
633
634 /*
635 * Either no secondary cache or the available caches don't have the
636 * subset property so we have to flush the primary caches
637 * explicitly
638 */
639 if (size >= dcache_size) {
640 r4k_blast_dcache();
641 } else {
642 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
643
644 R4600_HIT_CACHEOP_WAR_IMPL;
645 a = addr & ~(dc_lsize - 1);
646 end = (addr + size - 1) & ~(dc_lsize - 1);
647 while (1) {
648 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
649 if (a == end)
650 break;
651 a += dc_lsize;
652 }
653 }
654
655 bc_wback_inv(addr, size);
656}
657
658static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
659{
660 unsigned long end, a;
661
662 /* Catch bad driver code */
663 BUG_ON(size == 0);
664
665 if (cpu_has_subset_pcaches) {
666 unsigned long sc_lsize = current_cpu_data.scache.linesz;
667
668 if (size >= scache_size) {
669 r4k_blast_scache();
670 return;
671 }
672
673 a = addr & ~(sc_lsize - 1);
674 end = (addr + size - 1) & ~(sc_lsize - 1);
675 while (1) {
676 flush_scache_line(a); /* Hit_Writeback_Inv_SD */
677 if (a == end)
678 break;
679 a += sc_lsize;
680 }
681 return;
682 }
683
684 if (size >= dcache_size) {
685 r4k_blast_dcache();
686 } else {
687 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
688
689 R4600_HIT_CACHEOP_WAR_IMPL;
690 a = addr & ~(dc_lsize - 1);
691 end = (addr + size - 1) & ~(dc_lsize - 1);
692 while (1) {
693 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
694 if (a == end)
695 break;
696 a += dc_lsize;
697 }
698 }
699
700 bc_inv(addr, size);
701}
702#endif /* CONFIG_DMA_NONCOHERENT */
703
704/*
705 * While we're protected against bad userland addresses we don't care
706 * very much about what happens in that case. Usually a segmentation
707 * fault will dump the process later on anyway ...
708 */
709static void local_r4k_flush_cache_sigtramp(void * arg)
710{
711 unsigned long ic_lsize = current_cpu_data.icache.linesz;
712 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
713 unsigned long sc_lsize = current_cpu_data.scache.linesz;
714 unsigned long addr = (unsigned long) arg;
715
716 R4600_HIT_CACHEOP_WAR_IMPL;
717 protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
718 if (!cpu_icache_snoops_remote_store)
719 protected_writeback_scache_line(addr & ~(sc_lsize - 1));
720 protected_flush_icache_line(addr & ~(ic_lsize - 1));
721 if (MIPS4K_ICACHE_REFILL_WAR) {
722 __asm__ __volatile__ (
723 ".set push\n\t"
724 ".set noat\n\t"
725 ".set mips3\n\t"
726#ifdef CONFIG_MIPS32
727 "la $at,1f\n\t"
728#endif
729#ifdef CONFIG_MIPS64
730 "dla $at,1f\n\t"
731#endif
732 "cache %0,($at)\n\t"
733 "nop; nop; nop\n"
734 "1:\n\t"
735 ".set pop"
736 :
737 : "i" (Hit_Invalidate_I));
738 }
739 if (MIPS_CACHE_SYNC_WAR)
740 __asm__ __volatile__ ("sync");
741}
742
743static void r4k_flush_cache_sigtramp(unsigned long addr)
744{
745 on_each_cpu(local_r4k_flush_cache_sigtramp, (void *) addr, 1, 1);
746}
747
748static void r4k_flush_icache_all(void)
749{
750 if (cpu_has_vtag_icache)
751 r4k_blast_icache();
752}
753
754static inline void rm7k_erratum31(void)
755{
756 const unsigned long ic_lsize = 32;
757 unsigned long addr;
758
759 /* RM7000 erratum #31. The icache is screwed at startup. */
760 write_c0_taglo(0);
761 write_c0_taghi(0);
762
763 for (addr = INDEX_BASE; addr <= INDEX_BASE + 4096; addr += ic_lsize) {
764 __asm__ __volatile__ (
765 ".set noreorder\n\t"
766 ".set mips3\n\t"
767 "cache\t%1, 0(%0)\n\t"
768 "cache\t%1, 0x1000(%0)\n\t"
769 "cache\t%1, 0x2000(%0)\n\t"
770 "cache\t%1, 0x3000(%0)\n\t"
771 "cache\t%2, 0(%0)\n\t"
772 "cache\t%2, 0x1000(%0)\n\t"
773 "cache\t%2, 0x2000(%0)\n\t"
774 "cache\t%2, 0x3000(%0)\n\t"
775 "cache\t%1, 0(%0)\n\t"
776 "cache\t%1, 0x1000(%0)\n\t"
777 "cache\t%1, 0x2000(%0)\n\t"
778 "cache\t%1, 0x3000(%0)\n\t"
779 ".set\tmips0\n\t"
780 ".set\treorder\n\t"
781 :
782 : "r" (addr), "i" (Index_Store_Tag_I), "i" (Fill));
783 }
784}
785
786static char *way_string[] __initdata = { NULL, "direct mapped", "2-way",
787 "3-way", "4-way", "5-way", "6-way", "7-way", "8-way"
788};
789
790static void __init probe_pcache(void)
791{
792 struct cpuinfo_mips *c = &current_cpu_data;
793 unsigned int config = read_c0_config();
794 unsigned int prid = read_c0_prid();
795 unsigned long config1;
796 unsigned int lsize;
797
798 switch (c->cputype) {
799 case CPU_R4600: /* QED style two way caches? */
800 case CPU_R4700:
801 case CPU_R5000:
802 case CPU_NEVADA:
803 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
804 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
805 c->icache.ways = 2;
806 c->icache.waybit = ffs(icache_size/2) - 1;
807
808 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
809 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
810 c->dcache.ways = 2;
811 c->dcache.waybit= ffs(dcache_size/2) - 1;
812
813 c->options |= MIPS_CPU_CACHE_CDEX_P;
814 break;
815
816 case CPU_R5432:
817 case CPU_R5500:
818 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
819 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
820 c->icache.ways = 2;
821 c->icache.waybit= 0;
822
823 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
824 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
825 c->dcache.ways = 2;
826 c->dcache.waybit = 0;
827
828 c->options |= MIPS_CPU_CACHE_CDEX_P;
829 break;
830
831 case CPU_TX49XX:
832 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
833 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
834 c->icache.ways = 4;
835 c->icache.waybit= 0;
836
837 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
838 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
839 c->dcache.ways = 4;
840 c->dcache.waybit = 0;
841
842 c->options |= MIPS_CPU_CACHE_CDEX_P;
843 break;
844
845 case CPU_R4000PC:
846 case CPU_R4000SC:
847 case CPU_R4000MC:
848 case CPU_R4400PC:
849 case CPU_R4400SC:
850 case CPU_R4400MC:
851 case CPU_R4300:
852 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
853 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
854 c->icache.ways = 1;
855 c->icache.waybit = 0; /* doesn't matter */
856
857 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
858 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
859 c->dcache.ways = 1;
860 c->dcache.waybit = 0; /* does not matter */
861
862 c->options |= MIPS_CPU_CACHE_CDEX_P;
863 break;
864
865 case CPU_R10000:
866 case CPU_R12000:
867 icache_size = 1 << (12 + ((config & R10K_CONF_IC) >> 29));
868 c->icache.linesz = 64;
869 c->icache.ways = 2;
870 c->icache.waybit = 0;
871
872 dcache_size = 1 << (12 + ((config & R10K_CONF_DC) >> 26));
873 c->dcache.linesz = 32;
874 c->dcache.ways = 2;
875 c->dcache.waybit = 0;
876
877 c->options |= MIPS_CPU_PREFETCH;
878 break;
879
880 case CPU_VR4133:
881 write_c0_config(config & ~CONF_EB);
882 case CPU_VR4131:
883 /* Workaround for cache instruction bug of VR4131 */
884 if (c->processor_id == 0x0c80U || c->processor_id == 0x0c81U ||
885 c->processor_id == 0x0c82U) {
886 config &= ~0x00000030U;
887 config |= 0x00410000U;
888 write_c0_config(config);
889 }
890 icache_size = 1 << (10 + ((config & CONF_IC) >> 9));
891 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
892 c->icache.ways = 2;
893 c->icache.waybit = ffs(icache_size/2) - 1;
894
895 dcache_size = 1 << (10 + ((config & CONF_DC) >> 6));
896 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
897 c->dcache.ways = 2;
898 c->dcache.waybit = ffs(dcache_size/2) - 1;
899
900 c->options |= MIPS_CPU_CACHE_CDEX_P;
901 break;
902
903 case CPU_VR41XX:
904 case CPU_VR4111:
905 case CPU_VR4121:
906 case CPU_VR4122:
907 case CPU_VR4181:
908 case CPU_VR4181A:
909 icache_size = 1 << (10 + ((config & CONF_IC) >> 9));
910 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
911 c->icache.ways = 1;
912 c->icache.waybit = 0; /* doesn't matter */
913
914 dcache_size = 1 << (10 + ((config & CONF_DC) >> 6));
915 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
916 c->dcache.ways = 1;
917 c->dcache.waybit = 0; /* does not matter */
918
919 c->options |= MIPS_CPU_CACHE_CDEX_P;
920 break;
921
922 case CPU_RM7000:
923 rm7k_erratum31();
924
925 case CPU_RM9000:
926 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
927 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
928 c->icache.ways = 4;
929 c->icache.waybit = ffs(icache_size / c->icache.ways) - 1;
930
931 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
932 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
933 c->dcache.ways = 4;
934 c->dcache.waybit = ffs(dcache_size / c->dcache.ways) - 1;
935
936#if !defined(CONFIG_SMP) || !defined(RM9000_CDEX_SMP_WAR)
937 c->options |= MIPS_CPU_CACHE_CDEX_P;
938#endif
939 c->options |= MIPS_CPU_PREFETCH;
940 break;
941
942 default:
943 if (!(config & MIPS_CONF_M))
944 panic("Don't know how to probe P-caches on this cpu.");
945
946 /*
947 * So we seem to be a MIPS32 or MIPS64 CPU
948 * So let's probe the I-cache ...
949 */
950 config1 = read_c0_config1();
951
952 if ((lsize = ((config1 >> 19) & 7)))
953 c->icache.linesz = 2 << lsize;
954 else
955 c->icache.linesz = lsize;
956 c->icache.sets = 64 << ((config1 >> 22) & 7);
957 c->icache.ways = 1 + ((config1 >> 16) & 7);
958
959 icache_size = c->icache.sets *
960 c->icache.ways *
961 c->icache.linesz;
962 c->icache.waybit = ffs(icache_size/c->icache.ways) - 1;
963
964 if (config & 0x8) /* VI bit */
965 c->icache.flags |= MIPS_CACHE_VTAG;
966
967 /*
968 * Now probe the MIPS32 / MIPS64 data cache.
969 */
970 c->dcache.flags = 0;
971
972 if ((lsize = ((config1 >> 10) & 7)))
973 c->dcache.linesz = 2 << lsize;
974 else
975 c->dcache.linesz= lsize;
976 c->dcache.sets = 64 << ((config1 >> 13) & 7);
977 c->dcache.ways = 1 + ((config1 >> 7) & 7);
978
979 dcache_size = c->dcache.sets *
980 c->dcache.ways *
981 c->dcache.linesz;
982 c->dcache.waybit = ffs(dcache_size/c->dcache.ways) - 1;
983
984 c->options |= MIPS_CPU_PREFETCH;
985 break;
986 }
987
988 /*
989 * Processor configuration sanity check for the R4000SC erratum
990 * #5. With page sizes larger than 32kB there is no possibility
991 * to get a VCE exception anymore so we don't care about this
992 * misconfiguration. The case is rather theoretical anyway;
993 * presumably no vendor is shipping his hardware in the "bad"
994 * configuration.
995 */
996 if ((prid & 0xff00) == PRID_IMP_R4000 && (prid & 0xff) < 0x40 &&
997 !(config & CONF_SC) && c->icache.linesz != 16 &&
998 PAGE_SIZE <= 0x8000)
999 panic("Improper R4000SC processor configuration detected");
1000
1001 /* compute a couple of other cache variables */
1002 c->icache.waysize = icache_size / c->icache.ways;
1003 c->dcache.waysize = dcache_size / c->dcache.ways;
1004
1005 c->icache.sets = icache_size / (c->icache.linesz * c->icache.ways);
1006 c->dcache.sets = dcache_size / (c->dcache.linesz * c->dcache.ways);
1007
1008 /*
1009 * R10000 and R12000 P-caches are odd in a positive way. They're 32kB
1010 * 2-way virtually indexed so normally would suffer from aliases. So
1011 * normally they'd suffer from aliases but magic in the hardware deals
1012 * with that for us so we don't need to take care ourselves.
1013 */
1014 if (c->cputype != CPU_R10000 && c->cputype != CPU_R12000)
1015 if (c->dcache.waysize > PAGE_SIZE)
1016 c->dcache.flags |= MIPS_CACHE_ALIASES;
1017
1018 switch (c->cputype) {
1019 case CPU_20KC:
1020 /*
1021 * Some older 20Kc chips doesn't have the 'VI' bit in
1022 * the config register.
1023 */
1024 c->icache.flags |= MIPS_CACHE_VTAG;
1025 break;
1026
1027 case CPU_AU1500:
1028 c->icache.flags |= MIPS_CACHE_IC_F_DC;
1029 break;
1030 }
1031
1032 printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n",
1033 icache_size >> 10,
1034 cpu_has_vtag_icache ? "virtually tagged" : "physically tagged",
1035 way_string[c->icache.ways], c->icache.linesz);
1036
1037 printk("Primary data cache %ldkB, %s, linesize %d bytes.\n",
1038 dcache_size >> 10, way_string[c->dcache.ways], c->dcache.linesz);
1039}
1040
1041/*
1042 * If you even _breathe_ on this function, look at the gcc output and make sure
1043 * it does not pop things on and off the stack for the cache sizing loop that
1044 * executes in KSEG1 space or else you will crash and burn badly. You have
1045 * been warned.
1046 */
1047static int __init probe_scache(void)
1048{
1049 extern unsigned long stext;
1050 unsigned long flags, addr, begin, end, pow2;
1051 unsigned int config = read_c0_config();
1052 struct cpuinfo_mips *c = &current_cpu_data;
1053 int tmp;
1054
1055 if (config & CONF_SC)
1056 return 0;
1057
1058 begin = (unsigned long) &stext;
1059 begin &= ~((4 * 1024 * 1024) - 1);
1060 end = begin + (4 * 1024 * 1024);
1061
1062 /*
1063 * This is such a bitch, you'd think they would make it easy to do
1064 * this. Away you daemons of stupidity!
1065 */
1066 local_irq_save(flags);
1067
1068 /* Fill each size-multiple cache line with a valid tag. */
1069 pow2 = (64 * 1024);
1070 for (addr = begin; addr < end; addr = (begin + pow2)) {
1071 unsigned long *p = (unsigned long *) addr;
1072 __asm__ __volatile__("nop" : : "r" (*p)); /* whee... */
1073 pow2 <<= 1;
1074 }
1075
1076 /* Load first line with zero (therefore invalid) tag. */
1077 write_c0_taglo(0);
1078 write_c0_taghi(0);
1079 __asm__ __volatile__("nop; nop; nop; nop;"); /* avoid the hazard */
1080 cache_op(Index_Store_Tag_I, begin);
1081 cache_op(Index_Store_Tag_D, begin);
1082 cache_op(Index_Store_Tag_SD, begin);
1083
1084 /* Now search for the wrap around point. */
1085 pow2 = (128 * 1024);
1086 tmp = 0;
1087 for (addr = begin + (128 * 1024); addr < end; addr = begin + pow2) {
1088 cache_op(Index_Load_Tag_SD, addr);
1089 __asm__ __volatile__("nop; nop; nop; nop;"); /* hazard... */
1090 if (!read_c0_taglo())
1091 break;
1092 pow2 <<= 1;
1093 }
1094 local_irq_restore(flags);
1095 addr -= begin;
1096
1097 scache_size = addr;
1098 c->scache.linesz = 16 << ((config & R4K_CONF_SB) >> 22);
1099 c->scache.ways = 1;
1100 c->dcache.waybit = 0; /* does not matter */
1101
1102 return 1;
1103}
1104
1105typedef int (*probe_func_t)(unsigned long);
1106extern int r5k_sc_init(void);
1107extern int rm7k_sc_init(void);
1108
1109static void __init setup_scache(void)
1110{
1111 struct cpuinfo_mips *c = &current_cpu_data;
1112 unsigned int config = read_c0_config();
1113 probe_func_t probe_scache_kseg1;
1114 int sc_present = 0;
1115
1116 /*
1117 * Do the probing thing on R4000SC and R4400SC processors. Other
1118 * processors don't have a S-cache that would be relevant to the
1119 * Linux memory managment.
1120 */
1121 switch (c->cputype) {
1122 case CPU_R4000SC:
1123 case CPU_R4000MC:
1124 case CPU_R4400SC:
1125 case CPU_R4400MC:
1126 probe_scache_kseg1 = (probe_func_t) (CKSEG1ADDR(&probe_scache));
1127 sc_present = probe_scache_kseg1(config);
1128 if (sc_present)
1129 c->options |= MIPS_CPU_CACHE_CDEX_S;
1130 break;
1131
1132 case CPU_R10000:
1133 case CPU_R12000:
1134 scache_size = 0x80000 << ((config & R10K_CONF_SS) >> 16);
1135 c->scache.linesz = 64 << ((config >> 13) & 1);
1136 c->scache.ways = 2;
1137 c->scache.waybit= 0;
1138 sc_present = 1;
1139 break;
1140
1141 case CPU_R5000:
1142 case CPU_NEVADA:
1143#ifdef CONFIG_R5000_CPU_SCACHE
1144 r5k_sc_init();
1145#endif
1146 return;
1147
1148 case CPU_RM7000:
1149 case CPU_RM9000:
1150#ifdef CONFIG_RM7000_CPU_SCACHE
1151 rm7k_sc_init();
1152#endif
1153 return;
1154
1155 default:
1156 sc_present = 0;
1157 }
1158
1159 if (!sc_present)
1160 return;
1161
1162 if ((c->isa_level == MIPS_CPU_ISA_M32 ||
1163 c->isa_level == MIPS_CPU_ISA_M64) &&
1164 !(c->scache.flags & MIPS_CACHE_NOT_PRESENT))
1165 panic("Dunno how to handle MIPS32 / MIPS64 second level cache");
1166
1167 /* compute a couple of other cache variables */
1168 c->scache.waysize = scache_size / c->scache.ways;
1169
1170 c->scache.sets = scache_size / (c->scache.linesz * c->scache.ways);
1171
1172 printk("Unified secondary cache %ldkB %s, linesize %d bytes.\n",
1173 scache_size >> 10, way_string[c->scache.ways], c->scache.linesz);
1174
1175 c->options |= MIPS_CPU_SUBSET_CACHES;
1176}
1177
1178static inline void coherency_setup(void)
1179{
1180 change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT);
1181
1182 /*
1183 * c0_status.cu=0 specifies that updates by the sc instruction use
1184 * the coherency mode specified by the TLB; 1 means cachable
1185 * coherent update on write will be used. Not all processors have
1186 * this bit and; some wire it to zero, others like Toshiba had the
1187 * silly idea of putting something else there ...
1188 */
1189 switch (current_cpu_data.cputype) {
1190 case CPU_R4000PC:
1191 case CPU_R4000SC:
1192 case CPU_R4000MC:
1193 case CPU_R4400PC:
1194 case CPU_R4400SC:
1195 case CPU_R4400MC:
1196 clear_c0_config(CONF_CU);
1197 break;
1198 }
1199}
1200
1201void __init ld_mmu_r4xx0(void)
1202{
1203 extern void build_clear_page(void);
1204 extern void build_copy_page(void);
1205 extern char except_vec2_generic;
1206 struct cpuinfo_mips *c = &current_cpu_data;
1207
1208 /* Default cache error handler for R4000 and R5000 family */
1209 memcpy((void *)(CAC_BASE + 0x100), &except_vec2_generic, 0x80);
1210 memcpy((void *)(UNCAC_BASE + 0x100), &except_vec2_generic, 0x80);
1211
1212 probe_pcache();
1213 setup_scache();
1214
1215 if (c->dcache.sets * c->dcache.ways > PAGE_SIZE)
1216 c->dcache.flags |= MIPS_CACHE_ALIASES;
1217
1218 r4k_blast_dcache_page_setup();
1219 r4k_blast_dcache_page_indexed_setup();
1220 r4k_blast_dcache_setup();
1221 r4k_blast_icache_page_setup();
1222 r4k_blast_icache_page_indexed_setup();
1223 r4k_blast_icache_setup();
1224 r4k_blast_scache_page_setup();
1225 r4k_blast_scache_page_indexed_setup();
1226 r4k_blast_scache_setup();
1227
1228 /*
1229 * Some MIPS32 and MIPS64 processors have physically indexed caches.
1230 * This code supports virtually indexed processors and will be
1231 * unnecessarily inefficient on physically indexed processors.
1232 */
1233 shm_align_mask = max_t( unsigned long,
1234 c->dcache.sets * c->dcache.linesz - 1,
1235 PAGE_SIZE - 1);
1236
1237 flush_cache_all = r4k_flush_cache_all;
1238 __flush_cache_all = r4k___flush_cache_all;
1239 flush_cache_mm = r4k_flush_cache_mm;
1240 flush_cache_page = r4k_flush_cache_page;
1241 flush_icache_page = r4k_flush_icache_page;
1242 flush_cache_range = r4k_flush_cache_range;
1243
1244 flush_cache_sigtramp = r4k_flush_cache_sigtramp;
1245 flush_icache_all = r4k_flush_icache_all;
1246 flush_data_cache_page = r4k_flush_data_cache_page;
1247 flush_icache_range = r4k_flush_icache_range;
1248
1249#ifdef CONFIG_DMA_NONCOHERENT
1250 _dma_cache_wback_inv = r4k_dma_cache_wback_inv;
1251 _dma_cache_wback = r4k_dma_cache_wback_inv;
1252 _dma_cache_inv = r4k_dma_cache_inv;
1253#endif
1254
1255 __flush_cache_all();
1256 coherency_setup();
1257
1258 build_clear_page();
1259 build_copy_page();
1260}
diff --git a/arch/mips/mm/c-sb1.c b/arch/mips/mm/c-sb1.c
new file mode 100644
index 000000000000..ab30afd63b32
--- /dev/null
+++ b/arch/mips/mm/c-sb1.c
@@ -0,0 +1,558 @@
1/*
2 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
3 * Copyright (C) 1997, 2001 Ralf Baechle (ralf@gnu.org)
4 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
5 * Copyright (C) 2004 Maciej W. Rozycki
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21#include <linux/config.h>
22#include <linux/init.h>
23
24#include <asm/asm.h>
25#include <asm/bootinfo.h>
26#include <asm/cacheops.h>
27#include <asm/cpu.h>
28#include <asm/mipsregs.h>
29#include <asm/mmu_context.h>
30#include <asm/uaccess.h>
31
32extern void sb1_dma_init(void);
33
34/* These are probed at ld_mmu time */
35static unsigned long icache_size;
36static unsigned long dcache_size;
37
38static unsigned short icache_line_size;
39static unsigned short dcache_line_size;
40
41static unsigned int icache_index_mask;
42static unsigned int dcache_index_mask;
43
44static unsigned short icache_assoc;
45static unsigned short dcache_assoc;
46
47static unsigned short icache_sets;
48static unsigned short dcache_sets;
49
50static unsigned int icache_range_cutoff;
51static unsigned int dcache_range_cutoff;
52
53/*
54 * The dcache is fully coherent to the system, with one
55 * big caveat: the instruction stream. In other words,
56 * if we miss in the icache, and have dirty data in the
57 * L1 dcache, then we'll go out to memory (or the L2) and
58 * get the not-as-recent data.
59 *
60 * So the only time we have to flush the dcache is when
61 * we're flushing the icache. Since the L2 is fully
62 * coherent to everything, including I/O, we never have
63 * to flush it
64 */
65
66#define cache_set_op(op, addr) \
67 __asm__ __volatile__( \
68 " .set noreorder \n" \
69 " .set mips64\n\t \n" \
70 " cache %0, (0<<13)(%1) \n" \
71 " cache %0, (1<<13)(%1) \n" \
72 " cache %0, (2<<13)(%1) \n" \
73 " cache %0, (3<<13)(%1) \n" \
74 " .set mips0 \n" \
75 " .set reorder" \
76 : \
77 : "i" (op), "r" (addr))
78
79#define sync() \
80 __asm__ __volatile( \
81 " .set mips64\n\t \n" \
82 " sync \n" \
83 " .set mips0")
84
85#define mispredict() \
86 __asm__ __volatile__( \
87 " bnezl $0, 1f \n" /* Force mispredict */ \
88 "1: \n");
89
90/*
91 * Writeback and invalidate the entire dcache
92 */
93static inline void __sb1_writeback_inv_dcache_all(void)
94{
95 unsigned long addr = 0;
96
97 while (addr < dcache_line_size * dcache_sets) {
98 cache_set_op(Index_Writeback_Inv_D, addr);
99 addr += dcache_line_size;
100 }
101}
102
103/*
104 * Writeback and invalidate a range of the dcache. The addresses are
105 * virtual, and since we're using index ops and bit 12 is part of both
106 * the virtual frame and physical index, we have to clear both sets
107 * (bit 12 set and cleared).
108 */
109static inline void __sb1_writeback_inv_dcache_range(unsigned long start,
110 unsigned long end)
111{
112 unsigned long index;
113
114 start &= ~(dcache_line_size - 1);
115 end = (end + dcache_line_size - 1) & ~(dcache_line_size - 1);
116
117 while (start != end) {
118 index = start & dcache_index_mask;
119 cache_set_op(Index_Writeback_Inv_D, index);
120 cache_set_op(Index_Writeback_Inv_D, index ^ (1<<12));
121 start += dcache_line_size;
122 }
123 sync();
124}
125
126/*
127 * Writeback and invalidate a range of the dcache. With physical
128 * addresseses, we don't have to worry about possible bit 12 aliasing.
129 * XXXKW is it worth turning on KX and using hit ops with xkphys?
130 */
131static inline void __sb1_writeback_inv_dcache_phys_range(unsigned long start,
132 unsigned long end)
133{
134 start &= ~(dcache_line_size - 1);
135 end = (end + dcache_line_size - 1) & ~(dcache_line_size - 1);
136
137 while (start != end) {
138 cache_set_op(Index_Writeback_Inv_D, start & dcache_index_mask);
139 start += dcache_line_size;
140 }
141 sync();
142}
143
144
145/*
146 * Invalidate the entire icache
147 */
148static inline void __sb1_flush_icache_all(void)
149{
150 unsigned long addr = 0;
151
152 while (addr < icache_line_size * icache_sets) {
153 cache_set_op(Index_Invalidate_I, addr);
154 addr += icache_line_size;
155 }
156}
157
158/*
159 * Flush the icache for a given physical page. Need to writeback the
160 * dcache first, then invalidate the icache. If the page isn't
161 * executable, nothing is required.
162 */
163static void local_sb1_flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
164{
165 int cpu = smp_processor_id();
166
167#ifndef CONFIG_SMP
168 if (!(vma->vm_flags & VM_EXEC))
169 return;
170#endif
171
172 __sb1_writeback_inv_dcache_range(addr, addr + PAGE_SIZE);
173
174 /*
175 * Bumping the ASID is probably cheaper than the flush ...
176 */
177 if (cpu_context(cpu, vma->vm_mm) != 0)
178 drop_mmu_context(vma->vm_mm, cpu);
179}
180
181#ifdef CONFIG_SMP
182struct flush_cache_page_args {
183 struct vm_area_struct *vma;
184 unsigned long addr;
185 unsigned long pfn;
186};
187
188static void sb1_flush_cache_page_ipi(void *info)
189{
190 struct flush_cache_page_args *args = info;
191
192 local_sb1_flush_cache_page(args->vma, args->addr, args->pfn);
193}
194
195/* Dirty dcache could be on another CPU, so do the IPIs */
196static void sb1_flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
197{
198 struct flush_cache_page_args args;
199
200 if (!(vma->vm_flags & VM_EXEC))
201 return;
202
203 addr &= PAGE_MASK;
204 args.vma = vma;
205 args.addr = addr;
206 args.pfn = pfn;
207 on_each_cpu(sb1_flush_cache_page_ipi, (void *) &args, 1, 1);
208}
209#else
210void sb1_flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
211 __attribute__((alias("local_sb1_flush_cache_page")));
212#endif
213
214/*
215 * Invalidate a range of the icache. The addresses are virtual, and
216 * the cache is virtually indexed and tagged. However, we don't
217 * necessarily have the right ASID context, so use index ops instead
218 * of hit ops.
219 */
220static inline void __sb1_flush_icache_range(unsigned long start,
221 unsigned long end)
222{
223 start &= ~(icache_line_size - 1);
224 end = (end + icache_line_size - 1) & ~(icache_line_size - 1);
225
226 while (start != end) {
227 cache_set_op(Index_Invalidate_I, start & icache_index_mask);
228 start += icache_line_size;
229 }
230 mispredict();
231 sync();
232}
233
234
235/*
236 * Invalidate all caches on this CPU
237 */
238static void local_sb1___flush_cache_all(void)
239{
240 __sb1_writeback_inv_dcache_all();
241 __sb1_flush_icache_all();
242}
243
244#ifdef CONFIG_SMP
245void sb1___flush_cache_all_ipi(void *ignored)
246 __attribute__((alias("local_sb1___flush_cache_all")));
247
248static void sb1___flush_cache_all(void)
249{
250 on_each_cpu(sb1___flush_cache_all_ipi, 0, 1, 1);
251}
252#else
253void sb1___flush_cache_all(void)
254 __attribute__((alias("local_sb1___flush_cache_all")));
255#endif
256
257/*
258 * When flushing a range in the icache, we have to first writeback
259 * the dcache for the same range, so new ifetches will see any
260 * data that was dirty in the dcache.
261 *
262 * The start/end arguments are Kseg addresses (possibly mapped Kseg).
263 */
264
265static void local_sb1_flush_icache_range(unsigned long start,
266 unsigned long end)
267{
268 /* Just wb-inv the whole dcache if the range is big enough */
269 if ((end - start) > dcache_range_cutoff)
270 __sb1_writeback_inv_dcache_all();
271 else
272 __sb1_writeback_inv_dcache_range(start, end);
273
274 /* Just flush the whole icache if the range is big enough */
275 if ((end - start) > icache_range_cutoff)
276 __sb1_flush_icache_all();
277 else
278 __sb1_flush_icache_range(start, end);
279}
280
281#ifdef CONFIG_SMP
282struct flush_icache_range_args {
283 unsigned long start;
284 unsigned long end;
285};
286
287static void sb1_flush_icache_range_ipi(void *info)
288{
289 struct flush_icache_range_args *args = info;
290
291 local_sb1_flush_icache_range(args->start, args->end);
292}
293
294void sb1_flush_icache_range(unsigned long start, unsigned long end)
295{
296 struct flush_icache_range_args args;
297
298 args.start = start;
299 args.end = end;
300 on_each_cpu(sb1_flush_icache_range_ipi, &args, 1, 1);
301}
302#else
303void sb1_flush_icache_range(unsigned long start, unsigned long end)
304 __attribute__((alias("local_sb1_flush_icache_range")));
305#endif
306
307/*
308 * Flush the icache for a given physical page. Need to writeback the
309 * dcache first, then invalidate the icache. If the page isn't
310 * executable, nothing is required.
311 */
312static void local_sb1_flush_icache_page(struct vm_area_struct *vma,
313 struct page *page)
314{
315 unsigned long start;
316 int cpu = smp_processor_id();
317
318#ifndef CONFIG_SMP
319 if (!(vma->vm_flags & VM_EXEC))
320 return;
321#endif
322
323 /* Need to writeback any dirty data for that page, we have the PA */
324 start = (unsigned long)(page-mem_map) << PAGE_SHIFT;
325 __sb1_writeback_inv_dcache_phys_range(start, start + PAGE_SIZE);
326 /*
327 * If there's a context, bump the ASID (cheaper than a flush,
328 * since we don't know VAs!)
329 */
330 if (cpu_context(cpu, vma->vm_mm) != 0) {
331 drop_mmu_context(vma->vm_mm, cpu);
332 }
333}
334
335#ifdef CONFIG_SMP
336struct flush_icache_page_args {
337 struct vm_area_struct *vma;
338 struct page *page;
339};
340
341static void sb1_flush_icache_page_ipi(void *info)
342{
343 struct flush_icache_page_args *args = info;
344 local_sb1_flush_icache_page(args->vma, args->page);
345}
346
347/* Dirty dcache could be on another CPU, so do the IPIs */
348static void sb1_flush_icache_page(struct vm_area_struct *vma,
349 struct page *page)
350{
351 struct flush_icache_page_args args;
352
353 if (!(vma->vm_flags & VM_EXEC))
354 return;
355 args.vma = vma;
356 args.page = page;
357 on_each_cpu(sb1_flush_icache_page_ipi, (void *) &args, 1, 1);
358}
359#else
360void sb1_flush_icache_page(struct vm_area_struct *vma, struct page *page)
361 __attribute__((alias("local_sb1_flush_icache_page")));
362#endif
363
364/*
365 * A signal trampoline must fit into a single cacheline.
366 */
367static void local_sb1_flush_cache_sigtramp(unsigned long addr)
368{
369 cache_set_op(Index_Writeback_Inv_D, addr & dcache_index_mask);
370 cache_set_op(Index_Writeback_Inv_D, (addr ^ (1<<12)) & dcache_index_mask);
371 cache_set_op(Index_Invalidate_I, addr & icache_index_mask);
372 mispredict();
373}
374
375#ifdef CONFIG_SMP
376static void sb1_flush_cache_sigtramp_ipi(void *info)
377{
378 unsigned long iaddr = (unsigned long) info;
379 local_sb1_flush_cache_sigtramp(iaddr);
380}
381
382static void sb1_flush_cache_sigtramp(unsigned long addr)
383{
384 on_each_cpu(sb1_flush_cache_sigtramp_ipi, (void *) addr, 1, 1);
385}
386#else
387void sb1_flush_cache_sigtramp(unsigned long addr)
388 __attribute__((alias("local_sb1_flush_cache_sigtramp")));
389#endif
390
391
392/*
393 * Anything that just flushes dcache state can be ignored, as we're always
394 * coherent in dcache space. This is just a dummy function that all the
395 * nop'ed routines point to
396 */
397static void sb1_nop(void)
398{
399}
400
401/*
402 * Cache set values (from the mips64 spec)
403 * 0 - 64
404 * 1 - 128
405 * 2 - 256
406 * 3 - 512
407 * 4 - 1024
408 * 5 - 2048
409 * 6 - 4096
410 * 7 - Reserved
411 */
412
413static unsigned int decode_cache_sets(unsigned int config_field)
414{
415 if (config_field == 7) {
416 /* JDCXXX - Find a graceful way to abort. */
417 return 0;
418 }
419 return (1<<(config_field + 6));
420}
421
422/*
423 * Cache line size values (from the mips64 spec)
424 * 0 - No cache present.
425 * 1 - 4 bytes
426 * 2 - 8 bytes
427 * 3 - 16 bytes
428 * 4 - 32 bytes
429 * 5 - 64 bytes
430 * 6 - 128 bytes
431 * 7 - Reserved
432 */
433
434static unsigned int decode_cache_line_size(unsigned int config_field)
435{
436 if (config_field == 0) {
437 return 0;
438 } else if (config_field == 7) {
439 /* JDCXXX - Find a graceful way to abort. */
440 return 0;
441 }
442 return (1<<(config_field + 1));
443}
444
445/*
446 * Relevant bits of the config1 register format (from the MIPS32/MIPS64 specs)
447 *
448 * 24:22 Icache sets per way
449 * 21:19 Icache line size
450 * 18:16 Icache Associativity
451 * 15:13 Dcache sets per way
452 * 12:10 Dcache line size
453 * 9:7 Dcache Associativity
454 */
455
456static char *way_string[] = {
457 "direct mapped", "2-way", "3-way", "4-way",
458 "5-way", "6-way", "7-way", "8-way",
459};
460
461static __init void probe_cache_sizes(void)
462{
463 u32 config1;
464
465 config1 = read_c0_config1();
466 icache_line_size = decode_cache_line_size((config1 >> 19) & 0x7);
467 dcache_line_size = decode_cache_line_size((config1 >> 10) & 0x7);
468 icache_sets = decode_cache_sets((config1 >> 22) & 0x7);
469 dcache_sets = decode_cache_sets((config1 >> 13) & 0x7);
470 icache_assoc = ((config1 >> 16) & 0x7) + 1;
471 dcache_assoc = ((config1 >> 7) & 0x7) + 1;
472 icache_size = icache_line_size * icache_sets * icache_assoc;
473 dcache_size = dcache_line_size * dcache_sets * dcache_assoc;
474 /* Need to remove non-index bits for index ops */
475 icache_index_mask = (icache_sets - 1) * icache_line_size;
476 dcache_index_mask = (dcache_sets - 1) * dcache_line_size;
477 /*
478 * These are for choosing range (index ops) versus all.
479 * icache flushes all ways for each set, so drop icache_assoc.
480 * dcache flushes all ways and each setting of bit 12 for each
481 * index, so drop dcache_assoc and halve the dcache_sets.
482 */
483 icache_range_cutoff = icache_sets * icache_line_size;
484 dcache_range_cutoff = (dcache_sets / 2) * icache_line_size;
485
486 printk("Primary instruction cache %ldkB, %s, linesize %d bytes.\n",
487 icache_size >> 10, way_string[icache_assoc - 1],
488 icache_line_size);
489 printk("Primary data cache %ldkB, %s, linesize %d bytes.\n",
490 dcache_size >> 10, way_string[dcache_assoc - 1],
491 dcache_line_size);
492}
493
494/*
495 * This is called from loadmmu.c. We have to set up all the
496 * memory management function pointers, as well as initialize
497 * the caches and tlbs
498 */
499void ld_mmu_sb1(void)
500{
501 extern char except_vec2_sb1;
502 extern char handle_vec2_sb1;
503
504 /* Special cache error handler for SB1 */
505 memcpy((void *)(CAC_BASE + 0x100), &except_vec2_sb1, 0x80);
506 memcpy((void *)(UNCAC_BASE + 0x100), &except_vec2_sb1, 0x80);
507 memcpy((void *)CKSEG1ADDR(&handle_vec2_sb1), &handle_vec2_sb1, 0x80);
508
509 probe_cache_sizes();
510
511#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
512 sb1_dma_init();
513#endif
514
515 /*
516 * None of these are needed for the SB1 - the Dcache is
517 * physically indexed and tagged, so no virtual aliasing can
518 * occur
519 */
520 flush_cache_range = (void *) sb1_nop;
521 flush_cache_mm = (void (*)(struct mm_struct *))sb1_nop;
522 flush_cache_all = sb1_nop;
523
524 /* These routines are for Icache coherence with the Dcache */
525 flush_icache_range = sb1_flush_icache_range;
526 flush_icache_page = sb1_flush_icache_page;
527 flush_icache_all = __sb1_flush_icache_all; /* local only */
528
529 /* This implies an Icache flush too, so can't be nop'ed */
530 flush_cache_page = sb1_flush_cache_page;
531
532 flush_cache_sigtramp = sb1_flush_cache_sigtramp;
533 flush_data_cache_page = (void *) sb1_nop;
534
535 /* Full flush */
536 __flush_cache_all = sb1___flush_cache_all;
537
538 change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT);
539
540 /*
541 * This is the only way to force the update of K0 to complete
542 * before subsequent instruction fetch.
543 */
544 __asm__ __volatile__(
545 ".set push \n"
546 " .set noat \n"
547 " .set noreorder \n"
548 " .set mips3 \n"
549 " " STR(PTR_LA) " $1, 1f \n"
550 " " STR(MTC0) " $1, $14 \n"
551 " eret \n"
552 "1: .set pop"
553 :
554 :
555 : "memory");
556
557 flush_cache_all();
558}
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
new file mode 100644
index 000000000000..ff5afab64b2f
--- /dev/null
+++ b/arch/mips/mm/c-tx39.c
@@ -0,0 +1,493 @@
1/*
2 * r2300.c: R2000 and R3000 specific mmu/cache code.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 *
6 * with a lot of changes to make this thing work for R3000s
7 * Tx39XX R4k style caches added. HK
8 * Copyright (C) 1998, 1999, 2000 Harald Koerfgen
9 * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
10 */
11#include <linux/init.h>
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/mm.h>
15
16#include <asm/cacheops.h>
17#include <asm/page.h>
18#include <asm/pgtable.h>
19#include <asm/mmu_context.h>
20#include <asm/system.h>
21#include <asm/isadep.h>
22#include <asm/io.h>
23#include <asm/bootinfo.h>
24#include <asm/cpu.h>
25
26/* For R3000 cores with R4000 style caches */
27static unsigned long icache_size, dcache_size; /* Size in bytes */
28
29#include <asm/r4kcache.h>
30
31extern int r3k_have_wired_reg; /* in r3k-tlb.c */
32
33/* This sequence is required to ensure icache is disabled immediately */
34#define TX39_STOP_STREAMING() \
35__asm__ __volatile__( \
36 ".set push\n\t" \
37 ".set noreorder\n\t" \
38 "b 1f\n\t" \
39 "nop\n\t" \
40 "1:\n\t" \
41 ".set pop" \
42 )
43
44/* TX39H-style cache flush routines. */
45static void tx39h_flush_icache_all(void)
46{
47 unsigned long start = KSEG0;
48 unsigned long end = (start + icache_size);
49 unsigned long flags, config;
50
51 /* disable icache (set ICE#) */
52 local_irq_save(flags);
53 config = read_c0_conf();
54 write_c0_conf(config & ~TX39_CONF_ICE);
55 TX39_STOP_STREAMING();
56
57 /* invalidate icache */
58 while (start < end) {
59 cache16_unroll32(start, Index_Invalidate_I);
60 start += 0x200;
61 }
62
63 write_c0_conf(config);
64 local_irq_restore(flags);
65}
66
67static void tx39h_dma_cache_wback_inv(unsigned long addr, unsigned long size)
68{
69 unsigned long end, a;
70 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
71
72 /* Catch bad driver code */
73 BUG_ON(size == 0);
74
75 iob();
76 a = addr & ~(dc_lsize - 1);
77 end = (addr + size - 1) & ~(dc_lsize - 1);
78 while (1) {
79 invalidate_dcache_line(a); /* Hit_Invalidate_D */
80 if (a == end) break;
81 a += dc_lsize;
82 }
83}
84
85
86/* TX39H2,TX39H3 */
87static inline void tx39_blast_dcache_page(unsigned long addr)
88{
89 if (current_cpu_data.cputype != CPU_TX3912)
90 blast_dcache16_page(addr);
91}
92
93static inline void tx39_blast_dcache_page_indexed(unsigned long addr)
94{
95 blast_dcache16_page_indexed(addr);
96}
97
98static inline void tx39_blast_dcache(void)
99{
100 blast_dcache16();
101}
102
103static inline void tx39_blast_icache_page(unsigned long addr)
104{
105 unsigned long flags, config;
106 /* disable icache (set ICE#) */
107 local_irq_save(flags);
108 config = read_c0_conf();
109 write_c0_conf(config & ~TX39_CONF_ICE);
110 TX39_STOP_STREAMING();
111 blast_icache16_page(addr);
112 write_c0_conf(config);
113 local_irq_restore(flags);
114}
115
116static inline void tx39_blast_icache_page_indexed(unsigned long addr)
117{
118 unsigned long flags, config;
119 /* disable icache (set ICE#) */
120 local_irq_save(flags);
121 config = read_c0_conf();
122 write_c0_conf(config & ~TX39_CONF_ICE);
123 TX39_STOP_STREAMING();
124 blast_icache16_page_indexed(addr);
125 write_c0_conf(config);
126 local_irq_restore(flags);
127}
128
129static inline void tx39_blast_icache(void)
130{
131 unsigned long flags, config;
132 /* disable icache (set ICE#) */
133 local_irq_save(flags);
134 config = read_c0_conf();
135 write_c0_conf(config & ~TX39_CONF_ICE);
136 TX39_STOP_STREAMING();
137 blast_icache16();
138 write_c0_conf(config);
139 local_irq_restore(flags);
140}
141
142static inline void tx39_flush_cache_all(void)
143{
144 if (!cpu_has_dc_aliases)
145 return;
146
147 tx39_blast_dcache();
148 tx39_blast_icache();
149}
150
151static inline void tx39___flush_cache_all(void)
152{
153 tx39_blast_dcache();
154 tx39_blast_icache();
155}
156
157static void tx39_flush_cache_mm(struct mm_struct *mm)
158{
159 if (!cpu_has_dc_aliases)
160 return;
161
162 if (cpu_context(smp_processor_id(), mm) != 0) {
163 tx39_flush_cache_all();
164 }
165}
166
167static void tx39_flush_cache_range(struct vm_area_struct *vma,
168 unsigned long start, unsigned long end)
169{
170 struct mm_struct *mm = vma->vm_mm;
171
172 if (!cpu_has_dc_aliases)
173 return;
174
175 if (cpu_context(smp_processor_id(), mm) != 0) {
176 tx39_blast_dcache();
177 tx39_blast_icache();
178 }
179}
180
181static void tx39_flush_cache_page(struct vm_area_struct *vma, unsigned long page, unsigned long pfn)
182{
183 int exec = vma->vm_flags & VM_EXEC;
184 struct mm_struct *mm = vma->vm_mm;
185 pgd_t *pgdp;
186 pmd_t *pmdp;
187 pte_t *ptep;
188
189 /*
190 * If ownes no valid ASID yet, cannot possibly have gotten
191 * this page into the cache.
192 */
193 if (cpu_context(smp_processor_id(), mm) == 0)
194 return;
195
196 page &= PAGE_MASK;
197 pgdp = pgd_offset(mm, page);
198 pmdp = pmd_offset(pgdp, page);
199 ptep = pte_offset(pmdp, page);
200
201 /*
202 * If the page isn't marked valid, the page cannot possibly be
203 * in the cache.
204 */
205 if (!(pte_val(*ptep) & _PAGE_PRESENT))
206 return;
207
208 /*
209 * Doing flushes for another ASID than the current one is
210 * too difficult since stupid R4k caches do a TLB translation
211 * for every cache flush operation. So we do indexed flushes
212 * in that case, which doesn't overly flush the cache too much.
213 */
214 if ((mm == current->active_mm) && (pte_val(*ptep) & _PAGE_VALID)) {
215 if (cpu_has_dc_aliases || exec)
216 tx39_blast_dcache_page(page);
217 if (exec)
218 tx39_blast_icache_page(page);
219
220 return;
221 }
222
223 /*
224 * Do indexed flush, too much work to get the (possible) TLB refills
225 * to work correctly.
226 */
227 page = (KSEG0 + (page & (dcache_size - 1)));
228 if (cpu_has_dc_aliases || exec)
229 tx39_blast_dcache_page_indexed(page);
230 if (exec)
231 tx39_blast_icache_page_indexed(page);
232}
233
234static void tx39_flush_data_cache_page(unsigned long addr)
235{
236 tx39_blast_dcache_page(addr);
237}
238
239static void tx39_flush_icache_range(unsigned long start, unsigned long end)
240{
241 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
242 unsigned long addr, aend;
243
244 if (end - start > dcache_size)
245 tx39_blast_dcache();
246 else {
247 addr = start & ~(dc_lsize - 1);
248 aend = (end - 1) & ~(dc_lsize - 1);
249
250 while (1) {
251 /* Hit_Writeback_Inv_D */
252 protected_writeback_dcache_line(addr);
253 if (addr == aend)
254 break;
255 addr += dc_lsize;
256 }
257 }
258
259 if (end - start > icache_size)
260 tx39_blast_icache();
261 else {
262 unsigned long flags, config;
263 addr = start & ~(dc_lsize - 1);
264 aend = (end - 1) & ~(dc_lsize - 1);
265 /* disable icache (set ICE#) */
266 local_irq_save(flags);
267 config = read_c0_conf();
268 write_c0_conf(config & ~TX39_CONF_ICE);
269 TX39_STOP_STREAMING();
270 while (1) {
271 /* Hit_Invalidate_I */
272 protected_flush_icache_line(addr);
273 if (addr == aend)
274 break;
275 addr += dc_lsize;
276 }
277 write_c0_conf(config);
278 local_irq_restore(flags);
279 }
280}
281
282/*
283 * Ok, this seriously sucks. We use them to flush a user page but don't
284 * know the virtual address, so we have to blast away the whole icache
285 * which is significantly more expensive than the real thing. Otoh we at
286 * least know the kernel address of the page so we can flush it
287 * selectivly.
288 */
289static void tx39_flush_icache_page(struct vm_area_struct *vma, struct page *page)
290{
291 unsigned long addr;
292 /*
293 * If there's no context yet, or the page isn't executable, no icache
294 * flush is needed.
295 */
296 if (!(vma->vm_flags & VM_EXEC))
297 return;
298
299 addr = (unsigned long) page_address(page);
300 tx39_blast_dcache_page(addr);
301
302 /*
303 * We're not sure of the virtual address(es) involved here, so
304 * we have to flush the entire I-cache.
305 */
306 tx39_blast_icache();
307}
308
309static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size)
310{
311 unsigned long end, a;
312
313 if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
314 end = addr + size;
315 do {
316 tx39_blast_dcache_page(addr);
317 addr += PAGE_SIZE;
318 } while(addr != end);
319 } else if (size > dcache_size) {
320 tx39_blast_dcache();
321 } else {
322 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
323 a = addr & ~(dc_lsize - 1);
324 end = (addr + size - 1) & ~(dc_lsize - 1);
325 while (1) {
326 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
327 if (a == end) break;
328 a += dc_lsize;
329 }
330 }
331}
332
333static void tx39_dma_cache_inv(unsigned long addr, unsigned long size)
334{
335 unsigned long end, a;
336
337 if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
338 end = addr + size;
339 do {
340 tx39_blast_dcache_page(addr);
341 addr += PAGE_SIZE;
342 } while(addr != end);
343 } else if (size > dcache_size) {
344 tx39_blast_dcache();
345 } else {
346 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
347 a = addr & ~(dc_lsize - 1);
348 end = (addr + size - 1) & ~(dc_lsize - 1);
349 while (1) {
350 invalidate_dcache_line(a); /* Hit_Invalidate_D */
351 if (a == end) break;
352 a += dc_lsize;
353 }
354 }
355}
356
357static void tx39_flush_cache_sigtramp(unsigned long addr)
358{
359 unsigned long ic_lsize = current_cpu_data.icache.linesz;
360 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
361 unsigned long config;
362 unsigned long flags;
363
364 protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
365
366 /* disable icache (set ICE#) */
367 local_irq_save(flags);
368 config = read_c0_conf();
369 write_c0_conf(config & ~TX39_CONF_ICE);
370 TX39_STOP_STREAMING();
371 protected_flush_icache_line(addr & ~(ic_lsize - 1));
372 write_c0_conf(config);
373 local_irq_restore(flags);
374}
375
376static __init void tx39_probe_cache(void)
377{
378 unsigned long config;
379
380 config = read_c0_conf();
381
382 icache_size = 1 << (10 + ((config & TX39_CONF_ICS_MASK) >>
383 TX39_CONF_ICS_SHIFT));
384 dcache_size = 1 << (10 + ((config & TX39_CONF_DCS_MASK) >>
385 TX39_CONF_DCS_SHIFT));
386
387 current_cpu_data.icache.linesz = 16;
388 switch (current_cpu_data.cputype) {
389 case CPU_TX3912:
390 current_cpu_data.icache.ways = 1;
391 current_cpu_data.dcache.ways = 1;
392 current_cpu_data.dcache.linesz = 4;
393 break;
394
395 case CPU_TX3927:
396 current_cpu_data.icache.ways = 2;
397 current_cpu_data.dcache.ways = 2;
398 current_cpu_data.dcache.linesz = 16;
399 break;
400
401 case CPU_TX3922:
402 default:
403 current_cpu_data.icache.ways = 1;
404 current_cpu_data.dcache.ways = 1;
405 current_cpu_data.dcache.linesz = 16;
406 break;
407 }
408}
409
410void __init ld_mmu_tx39(void)
411{
412 extern void build_clear_page(void);
413 extern void build_copy_page(void);
414 unsigned long config;
415
416 config = read_c0_conf();
417 config &= ~TX39_CONF_WBON;
418 write_c0_conf(config);
419
420 tx39_probe_cache();
421
422 switch (current_cpu_data.cputype) {
423 case CPU_TX3912:
424 /* TX39/H core (writethru direct-map cache) */
425 flush_cache_all = tx39h_flush_icache_all;
426 __flush_cache_all = tx39h_flush_icache_all;
427 flush_cache_mm = (void *) tx39h_flush_icache_all;
428 flush_cache_range = (void *) tx39h_flush_icache_all;
429 flush_cache_page = (void *) tx39h_flush_icache_all;
430 flush_icache_page = (void *) tx39h_flush_icache_all;
431 flush_icache_range = (void *) tx39h_flush_icache_all;
432
433 flush_cache_sigtramp = (void *) tx39h_flush_icache_all;
434 flush_data_cache_page = (void *) tx39h_flush_icache_all;
435
436 _dma_cache_wback_inv = tx39h_dma_cache_wback_inv;
437
438 shm_align_mask = PAGE_SIZE - 1;
439
440 break;
441
442 case CPU_TX3922:
443 case CPU_TX3927:
444 default:
445 /* TX39/H2,H3 core (writeback 2way-set-associative cache) */
446 r3k_have_wired_reg = 1;
447 write_c0_wired(0); /* set 8 on reset... */
448 /* board-dependent init code may set WBON */
449
450 flush_cache_all = tx39_flush_cache_all;
451 __flush_cache_all = tx39___flush_cache_all;
452 flush_cache_mm = tx39_flush_cache_mm;
453 flush_cache_range = tx39_flush_cache_range;
454 flush_cache_page = tx39_flush_cache_page;
455 flush_icache_page = tx39_flush_icache_page;
456 flush_icache_range = tx39_flush_icache_range;
457
458 flush_cache_sigtramp = tx39_flush_cache_sigtramp;
459 flush_data_cache_page = tx39_flush_data_cache_page;
460
461 _dma_cache_wback_inv = tx39_dma_cache_wback_inv;
462 _dma_cache_wback = tx39_dma_cache_wback_inv;
463 _dma_cache_inv = tx39_dma_cache_inv;
464
465 shm_align_mask = max_t(unsigned long,
466 (dcache_size / current_cpu_data.dcache.ways) - 1,
467 PAGE_SIZE - 1);
468
469 break;
470 }
471
472 current_cpu_data.icache.waysize = icache_size / current_cpu_data.icache.ways;
473 current_cpu_data.dcache.waysize = dcache_size / current_cpu_data.dcache.ways;
474
475 current_cpu_data.icache.sets =
476 current_cpu_data.icache.waysize / current_cpu_data.icache.linesz;
477 current_cpu_data.dcache.sets =
478 current_cpu_data.dcache.waysize / current_cpu_data.dcache.linesz;
479
480 if (current_cpu_data.dcache.waysize > PAGE_SIZE)
481 current_cpu_data.dcache.flags |= MIPS_CACHE_ALIASES;
482
483 current_cpu_data.icache.waybit = 0;
484 current_cpu_data.dcache.waybit = 0;
485
486 printk("Primary instruction cache %ldkB, linesize %d bytes\n",
487 icache_size >> 10, current_cpu_data.icache.linesz);
488 printk("Primary data cache %ldkB, linesize %d bytes\n",
489 dcache_size >> 10, current_cpu_data.dcache.linesz);
490
491 build_clear_page();
492 build_copy_page();
493}
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
new file mode 100644
index 000000000000..1d95cdb77bed
--- /dev/null
+++ b/arch/mips/mm/cache.c
@@ -0,0 +1,157 @@
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) 1994 - 2003 by Ralf Baechle
7 */
8#include <linux/config.h>
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/module.h>
12#include <linux/sched.h>
13#include <linux/mm.h>
14
15#include <asm/cacheflush.h>
16#include <asm/processor.h>
17#include <asm/cpu.h>
18#include <asm/cpu-features.h>
19
20/* Cache operations. */
21void (*flush_cache_all)(void);
22void (*__flush_cache_all)(void);
23void (*flush_cache_mm)(struct mm_struct *mm);
24void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start,
25 unsigned long end);
26void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);
27void (*flush_icache_range)(unsigned long start, unsigned long end);
28void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page);
29
30/* MIPS specific cache operations */
31void (*flush_cache_sigtramp)(unsigned long addr);
32void (*flush_data_cache_page)(unsigned long addr);
33void (*flush_icache_all)(void);
34
35#ifdef CONFIG_DMA_NONCOHERENT
36
37/* DMA cache operations. */
38void (*_dma_cache_wback_inv)(unsigned long start, unsigned long size);
39void (*_dma_cache_wback)(unsigned long start, unsigned long size);
40void (*_dma_cache_inv)(unsigned long start, unsigned long size);
41
42EXPORT_SYMBOL(_dma_cache_wback_inv);
43EXPORT_SYMBOL(_dma_cache_wback);
44EXPORT_SYMBOL(_dma_cache_inv);
45
46#endif /* CONFIG_DMA_NONCOHERENT */
47
48/*
49 * We could optimize the case where the cache argument is not BCACHE but
50 * that seems very atypical use ...
51 */
52asmlinkage int sys_cacheflush(unsigned long addr, unsigned long int bytes,
53 unsigned int cache)
54{
55 if (!access_ok(VERIFY_WRITE, (void *) addr, bytes))
56 return -EFAULT;
57
58 flush_icache_range(addr, addr + bytes);
59
60 return 0;
61}
62
63void __flush_dcache_page(struct page *page)
64{
65 struct address_space *mapping = page_mapping(page);
66 unsigned long addr;
67
68 if (mapping && !mapping_mapped(mapping)) {
69 SetPageDcacheDirty(page);
70 return;
71 }
72
73 /*
74 * We could delay the flush for the !page_mapping case too. But that
75 * case is for exec env/arg pages and those are %99 certainly going to
76 * get faulted into the tlb (and thus flushed) anyways.
77 */
78 addr = (unsigned long) page_address(page);
79 flush_data_cache_page(addr);
80}
81
82EXPORT_SYMBOL(__flush_dcache_page);
83
84void __update_cache(struct vm_area_struct *vma, unsigned long address,
85 pte_t pte)
86{
87 struct page *page;
88 unsigned long pfn, addr;
89
90 pfn = pte_pfn(pte);
91 if (pfn_valid(pfn) && (page = pfn_to_page(pfn), page_mapping(page)) &&
92 Page_dcache_dirty(page)) {
93 if (pages_do_alias((unsigned long)page_address(page),
94 address & PAGE_MASK)) {
95 addr = (unsigned long) page_address(page);
96 flush_data_cache_page(addr);
97 }
98
99 ClearPageDcacheDirty(page);
100 }
101}
102
103extern void ld_mmu_r23000(void);
104extern void ld_mmu_r4xx0(void);
105extern void ld_mmu_tx39(void);
106extern void ld_mmu_r6000(void);
107extern void ld_mmu_tfp(void);
108extern void ld_mmu_andes(void);
109extern void ld_mmu_sb1(void);
110
111void __init cpu_cache_init(void)
112{
113 if (cpu_has_4ktlb) {
114#if defined(CONFIG_CPU_R4X00) || defined(CONFIG_CPU_VR41XX) || \
115 defined(CONFIG_CPU_R4300) || defined(CONFIG_CPU_R5000) || \
116 defined(CONFIG_CPU_NEVADA) || defined(CONFIG_CPU_R5432) || \
117 defined(CONFIG_CPU_R5500) || defined(CONFIG_CPU_MIPS32) || \
118 defined(CONFIG_CPU_MIPS64) || defined(CONFIG_CPU_TX49XX) || \
119 defined(CONFIG_CPU_RM7000) || defined(CONFIG_CPU_RM9000)
120 ld_mmu_r4xx0();
121#endif
122 } else switch (current_cpu_data.cputype) {
123#ifdef CONFIG_CPU_R3000
124 case CPU_R2000:
125 case CPU_R3000:
126 case CPU_R3000A:
127 case CPU_R3081E:
128 ld_mmu_r23000();
129 break;
130#endif
131#ifdef CONFIG_CPU_TX39XX
132 case CPU_TX3912:
133 case CPU_TX3922:
134 case CPU_TX3927:
135 ld_mmu_tx39();
136 break;
137#endif
138#ifdef CONFIG_CPU_R10000
139 case CPU_R10000:
140 case CPU_R12000:
141 ld_mmu_r4xx0();
142 break;
143#endif
144#ifdef CONFIG_CPU_SB1
145 case CPU_SB1:
146 ld_mmu_sb1();
147 break;
148#endif
149
150 case CPU_R8000:
151 panic("R8000 is unsupported");
152 break;
153
154 default:
155 panic("Yeee, unsupported cache architecture.");
156 }
157}
diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c
new file mode 100644
index 000000000000..13d96d62764e
--- /dev/null
+++ b/arch/mips/mm/cerr-sb1.c
@@ -0,0 +1,543 @@
1/*
2 * Copyright (C) 2001,2002,2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/config.h>
19#include <linux/sched.h>
20#include <asm/mipsregs.h>
21#include <asm/sibyte/sb1250.h>
22
23#ifndef CONFIG_SIBYTE_BUS_WATCHER
24#include <asm/io.h>
25#include <asm/sibyte/sb1250_regs.h>
26#include <asm/sibyte/sb1250_scd.h>
27#endif
28
29/* SB1 definitions */
30
31/* XXX should come from config1 XXX */
32#define SB1_CACHE_INDEX_MASK 0x1fe0
33
34#define CP0_ERRCTL_RECOVERABLE (1 << 31)
35#define CP0_ERRCTL_DCACHE (1 << 30)
36#define CP0_ERRCTL_ICACHE (1 << 29)
37#define CP0_ERRCTL_MULTIBUS (1 << 23)
38#define CP0_ERRCTL_MC_TLB (1 << 15)
39#define CP0_ERRCTL_MC_TIMEOUT (1 << 14)
40
41#define CP0_CERRI_TAG_PARITY (1 << 29)
42#define CP0_CERRI_DATA_PARITY (1 << 28)
43#define CP0_CERRI_EXTERNAL (1 << 26)
44
45#define CP0_CERRI_IDX_VALID(c) (!((c) & CP0_CERRI_EXTERNAL))
46#define CP0_CERRI_DATA (CP0_CERRI_DATA_PARITY)
47
48#define CP0_CERRD_MULTIPLE (1 << 31)
49#define CP0_CERRD_TAG_STATE (1 << 30)
50#define CP0_CERRD_TAG_ADDRESS (1 << 29)
51#define CP0_CERRD_DATA_SBE (1 << 28)
52#define CP0_CERRD_DATA_DBE (1 << 27)
53#define CP0_CERRD_EXTERNAL (1 << 26)
54#define CP0_CERRD_LOAD (1 << 25)
55#define CP0_CERRD_STORE (1 << 24)
56#define CP0_CERRD_FILLWB (1 << 23)
57#define CP0_CERRD_COHERENCY (1 << 22)
58#define CP0_CERRD_DUPTAG (1 << 21)
59
60#define CP0_CERRD_DPA_VALID(c) (!((c) & CP0_CERRD_EXTERNAL))
61#define CP0_CERRD_IDX_VALID(c) \
62 (((c) & (CP0_CERRD_LOAD | CP0_CERRD_STORE)) ? (!((c) & CP0_CERRD_EXTERNAL)) : 0)
63#define CP0_CERRD_CAUSES \
64 (CP0_CERRD_LOAD | CP0_CERRD_STORE | CP0_CERRD_FILLWB | CP0_CERRD_COHERENCY | CP0_CERRD_DUPTAG)
65#define CP0_CERRD_TYPES \
66 (CP0_CERRD_TAG_STATE | CP0_CERRD_TAG_ADDRESS | CP0_CERRD_DATA_SBE | CP0_CERRD_DATA_DBE | CP0_CERRD_EXTERNAL)
67#define CP0_CERRD_DATA (CP0_CERRD_DATA_SBE | CP0_CERRD_DATA_DBE)
68
69static uint32_t extract_ic(unsigned short addr, int data);
70static uint32_t extract_dc(unsigned short addr, int data);
71
72static inline void breakout_errctl(unsigned int val)
73{
74 if (val & CP0_ERRCTL_RECOVERABLE)
75 prom_printf(" recoverable");
76 if (val & CP0_ERRCTL_DCACHE)
77 prom_printf(" dcache");
78 if (val & CP0_ERRCTL_ICACHE)
79 prom_printf(" icache");
80 if (val & CP0_ERRCTL_MULTIBUS)
81 prom_printf(" multiple-buserr");
82 prom_printf("\n");
83}
84
85static inline void breakout_cerri(unsigned int val)
86{
87 if (val & CP0_CERRI_TAG_PARITY)
88 prom_printf(" tag-parity");
89 if (val & CP0_CERRI_DATA_PARITY)
90 prom_printf(" data-parity");
91 if (val & CP0_CERRI_EXTERNAL)
92 prom_printf(" external");
93 prom_printf("\n");
94}
95
96static inline void breakout_cerrd(unsigned int val)
97{
98 switch (val & CP0_CERRD_CAUSES) {
99 case CP0_CERRD_LOAD:
100 prom_printf(" load,");
101 break;
102 case CP0_CERRD_STORE:
103 prom_printf(" store,");
104 break;
105 case CP0_CERRD_FILLWB:
106 prom_printf(" fill/wb,");
107 break;
108 case CP0_CERRD_COHERENCY:
109 prom_printf(" coherency,");
110 break;
111 case CP0_CERRD_DUPTAG:
112 prom_printf(" duptags,");
113 break;
114 default:
115 prom_printf(" NO CAUSE,");
116 break;
117 }
118 if (!(val & CP0_CERRD_TYPES))
119 prom_printf(" NO TYPE");
120 else {
121 if (val & CP0_CERRD_MULTIPLE)
122 prom_printf(" multi-err");
123 if (val & CP0_CERRD_TAG_STATE)
124 prom_printf(" tag-state");
125 if (val & CP0_CERRD_TAG_ADDRESS)
126 prom_printf(" tag-address");
127 if (val & CP0_CERRD_DATA_SBE)
128 prom_printf(" data-SBE");
129 if (val & CP0_CERRD_DATA_DBE)
130 prom_printf(" data-DBE");
131 if (val & CP0_CERRD_EXTERNAL)
132 prom_printf(" external");
133 }
134 prom_printf("\n");
135}
136
137#ifndef CONFIG_SIBYTE_BUS_WATCHER
138
139static void check_bus_watcher(void)
140{
141 uint32_t status, l2_err, memio_err;
142
143 /* Destructive read, clears register and interrupt */
144 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS));
145 /* Bit 31 is always on, but there's no #define for that */
146 if (status & ~(1UL << 31)) {
147 l2_err = csr_in32(IOADDR(A_BUS_L2_ERRORS));
148 memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS));
149 prom_printf("Bus watcher error counters: %08x %08x\n", l2_err, memio_err);
150 prom_printf("\nLast recorded signature:\n");
151 prom_printf("Request %02x from %d, answered by %d with Dcode %d\n",
152 (unsigned int)(G_SCD_BERR_TID(status) & 0x3f),
153 (int)(G_SCD_BERR_TID(status) >> 6),
154 (int)G_SCD_BERR_RID(status),
155 (int)G_SCD_BERR_DCODE(status));
156 } else {
157 prom_printf("Bus watcher indicates no error\n");
158 }
159}
160#else
161extern void check_bus_watcher(void);
162#endif
163
164asmlinkage void sb1_cache_error(void)
165{
166 uint64_t cerr_dpa;
167 uint32_t errctl, cerr_i, cerr_d, dpalo, dpahi, eepc, res;
168
169 prom_printf("Cache error exception on CPU %x:\n",
170 (read_c0_prid() >> 25) & 0x7);
171
172 __asm__ __volatile__ (
173 " .set push\n\t"
174 " .set mips64\n\t"
175 " .set noat\n\t"
176 " mfc0 %0, $26\n\t"
177 " mfc0 %1, $27\n\t"
178 " mfc0 %2, $27, 1\n\t"
179 " dmfc0 $1, $27, 3\n\t"
180 " dsrl32 %3, $1, 0 \n\t"
181 " sll %4, $1, 0 \n\t"
182 " mfc0 %5, $30\n\t"
183 " .set pop"
184 : "=r" (errctl), "=r" (cerr_i), "=r" (cerr_d),
185 "=r" (dpahi), "=r" (dpalo), "=r" (eepc));
186
187 cerr_dpa = (((uint64_t)dpahi) << 32) | dpalo;
188 prom_printf(" c0_errorepc == %08x\n", eepc);
189 prom_printf(" c0_errctl == %08x", errctl);
190 breakout_errctl(errctl);
191 if (errctl & CP0_ERRCTL_ICACHE) {
192 prom_printf(" c0_cerr_i == %08x", cerr_i);
193 breakout_cerri(cerr_i);
194 if (CP0_CERRI_IDX_VALID(cerr_i)) {
195 /* Check index of EPC, allowing for delay slot */
196 if (((eepc & SB1_CACHE_INDEX_MASK) != (cerr_i & SB1_CACHE_INDEX_MASK)) &&
197 ((eepc & SB1_CACHE_INDEX_MASK) != ((cerr_i & SB1_CACHE_INDEX_MASK) - 4)))
198 prom_printf(" cerr_i idx doesn't match eepc\n");
199 else {
200 res = extract_ic(cerr_i & SB1_CACHE_INDEX_MASK,
201 (cerr_i & CP0_CERRI_DATA) != 0);
202 if (!(res & cerr_i))
203 prom_printf("...didn't see indicated icache problem\n");
204 }
205 }
206 }
207 if (errctl & CP0_ERRCTL_DCACHE) {
208 prom_printf(" c0_cerr_d == %08x", cerr_d);
209 breakout_cerrd(cerr_d);
210 if (CP0_CERRD_DPA_VALID(cerr_d)) {
211 prom_printf(" c0_cerr_dpa == %010llx\n", cerr_dpa);
212 if (!CP0_CERRD_IDX_VALID(cerr_d)) {
213 res = extract_dc(cerr_dpa & SB1_CACHE_INDEX_MASK,
214 (cerr_d & CP0_CERRD_DATA) != 0);
215 if (!(res & cerr_d))
216 prom_printf("...didn't see indicated dcache problem\n");
217 } else {
218 if ((cerr_dpa & SB1_CACHE_INDEX_MASK) != (cerr_d & SB1_CACHE_INDEX_MASK))
219 prom_printf(" cerr_d idx doesn't match cerr_dpa\n");
220 else {
221 res = extract_dc(cerr_d & SB1_CACHE_INDEX_MASK,
222 (cerr_d & CP0_CERRD_DATA) != 0);
223 if (!(res & cerr_d))
224 prom_printf("...didn't see indicated problem\n");
225 }
226 }
227 }
228 }
229
230 check_bus_watcher();
231
232 while (1);
233 /*
234 * This tends to make things get really ugly; let's just stall instead.
235 * panic("Can't handle the cache error!");
236 */
237}
238
239
240/* Parity lookup table. */
241static const uint8_t parity[256] = {
242 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
243 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
244 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
245 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
246 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
247 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
248 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
249 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
250};
251
252/* Masks to select bits for Hamming parity, mask_72_64[i] for bit[i] */
253static const uint64_t mask_72_64[8] = {
254 0x0738C808099264FFULL,
255 0x38C808099264FF07ULL,
256 0xC808099264FF0738ULL,
257 0x08099264FF0738C8ULL,
258 0x099264FF0738C808ULL,
259 0x9264FF0738C80809ULL,
260 0x64FF0738C8080992ULL,
261 0xFF0738C808099264ULL
262};
263
264/* Calculate the parity on a range of bits */
265static char range_parity(uint64_t dword, int max, int min)
266{
267 char parity = 0;
268 int i;
269 dword >>= min;
270 for (i=max-min; i>=0; i--) {
271 if (dword & 0x1)
272 parity = !parity;
273 dword >>= 1;
274 }
275 return parity;
276}
277
278/* Calculate the 4-bit even byte-parity for an instruction */
279static unsigned char inst_parity(uint32_t word)
280{
281 int i, j;
282 char parity = 0;
283 for (j=0; j<4; j++) {
284 char byte_parity = 0;
285 for (i=0; i<8; i++) {
286 if (word & 0x80000000)
287 byte_parity = !byte_parity;
288 word <<= 1;
289 }
290 parity <<= 1;
291 parity |= byte_parity;
292 }
293 return parity;
294}
295
296static uint32_t extract_ic(unsigned short addr, int data)
297{
298 unsigned short way;
299 int valid;
300 uint64_t taglo, va, tlo_tmp;
301 uint32_t taghi, taglolo, taglohi;
302 uint8_t lru;
303 int res = 0;
304
305 prom_printf("Icache index 0x%04x ", addr);
306 for (way = 0; way < 4; way++) {
307 /* Index-load-tag-I */
308 __asm__ __volatile__ (
309 " .set push \n\t"
310 " .set noreorder \n\t"
311 " .set mips64 \n\t"
312 " .set noat \n\t"
313 " cache 4, 0(%3) \n\t"
314 " mfc0 %0, $29 \n\t"
315 " dmfc0 $1, $28 \n\t"
316 " dsrl32 %1, $1, 0 \n\t"
317 " sll %2, $1, 0 \n\t"
318 " .set pop"
319 : "=r" (taghi), "=r" (taglohi), "=r" (taglolo)
320 : "r" ((way << 13) | addr));
321
322 taglo = ((unsigned long long)taglohi << 32) | taglolo;
323 if (way == 0) {
324 lru = (taghi >> 14) & 0xff;
325 prom_printf("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n",
326 ((addr >> 5) & 0x3), /* bank */
327 ((addr >> 7) & 0x3f), /* index */
328 (lru & 0x3),
329 ((lru >> 2) & 0x3),
330 ((lru >> 4) & 0x3),
331 ((lru >> 6) & 0x3));
332 }
333 va = (taglo & 0xC0000FFFFFFFE000ULL) | addr;
334 if ((taglo & (1 << 31)) && (((taglo >> 62) & 0x3) == 3))
335 va |= 0x3FFFF00000000000ULL;
336 valid = ((taghi >> 29) & 1);
337 if (valid) {
338 tlo_tmp = taglo & 0xfff3ff;
339 if (((taglo >> 10) & 1) ^ range_parity(tlo_tmp, 23, 0)) {
340 prom_printf(" ** bad parity in VTag0/G/ASID\n");
341 res |= CP0_CERRI_TAG_PARITY;
342 }
343 if (((taglo >> 11) & 1) ^ range_parity(taglo, 63, 24)) {
344 prom_printf(" ** bad parity in R/VTag1\n");
345 res |= CP0_CERRI_TAG_PARITY;
346 }
347 }
348 if (valid ^ ((taghi >> 27) & 1)) {
349 prom_printf(" ** bad parity for valid bit\n");
350 res |= CP0_CERRI_TAG_PARITY;
351 }
352 prom_printf(" %d [VA %016llx] [Vld? %d] raw tags: %08X-%016llX\n",
353 way, va, valid, taghi, taglo);
354
355 if (data) {
356 uint32_t datahi, insta, instb;
357 uint8_t predecode;
358 int offset;
359
360 /* (hit all banks and ways) */
361 for (offset = 0; offset < 4; offset++) {
362 /* Index-load-data-I */
363 __asm__ __volatile__ (
364 " .set push\n\t"
365 " .set noreorder\n\t"
366 " .set mips64\n\t"
367 " .set noat\n\t"
368 " cache 6, 0(%3) \n\t"
369 " mfc0 %0, $29, 1\n\t"
370 " dmfc0 $1, $28, 1\n\t"
371 " dsrl32 %1, $1, 0 \n\t"
372 " sll %2, $1, 0 \n\t"
373 " .set pop \n"
374 : "=r" (datahi), "=r" (insta), "=r" (instb)
375 : "r" ((way << 13) | addr | (offset << 3)));
376 predecode = (datahi >> 8) & 0xff;
377 if (((datahi >> 16) & 1) != (uint32_t)range_parity(predecode, 7, 0)) {
378 prom_printf(" ** bad parity in predecode\n");
379 res |= CP0_CERRI_DATA_PARITY;
380 }
381 /* XXXKW should/could check predecode bits themselves */
382 if (((datahi >> 4) & 0xf) ^ inst_parity(insta)) {
383 prom_printf(" ** bad parity in instruction a\n");
384 res |= CP0_CERRI_DATA_PARITY;
385 }
386 if ((datahi & 0xf) ^ inst_parity(instb)) {
387 prom_printf(" ** bad parity in instruction b\n");
388 res |= CP0_CERRI_DATA_PARITY;
389 }
390 prom_printf(" %05X-%08X%08X", datahi, insta, instb);
391 }
392 prom_printf("\n");
393 }
394 }
395 return res;
396}
397
398/* Compute the ECC for a data doubleword */
399static uint8_t dc_ecc(uint64_t dword)
400{
401 uint64_t t;
402 uint32_t w;
403 uint8_t p;
404 int i;
405
406 p = 0;
407 for (i = 7; i >= 0; i--)
408 {
409 p <<= 1;
410 t = dword & mask_72_64[i];
411 w = (uint32_t)(t >> 32);
412 p ^= (parity[w>>24] ^ parity[(w>>16) & 0xFF]
413 ^ parity[(w>>8) & 0xFF] ^ parity[w & 0xFF]);
414 w = (uint32_t)(t & 0xFFFFFFFF);
415 p ^= (parity[w>>24] ^ parity[(w>>16) & 0xFF]
416 ^ parity[(w>>8) & 0xFF] ^ parity[w & 0xFF]);
417 }
418 return p;
419}
420
421struct dc_state {
422 unsigned char val;
423 char *name;
424};
425
426static struct dc_state dc_states[] = {
427 { 0x00, "INVALID" },
428 { 0x0f, "COH-SHD" },
429 { 0x13, "NCO-E-C" },
430 { 0x19, "NCO-E-D" },
431 { 0x16, "COH-E-C" },
432 { 0x1c, "COH-E-D" },
433 { 0xff, "*ERROR*" }
434};
435
436#define DC_TAG_VALID(state) \
437 (((state) == 0xf) || ((state) == 0x13) || ((state) == 0x19) || ((state == 0x16)) || ((state) == 0x1c))
438
439static char *dc_state_str(unsigned char state)
440{
441 struct dc_state *dsc = dc_states;
442 while (dsc->val != 0xff) {
443 if (dsc->val == state)
444 break;
445 dsc++;
446 }
447 return dsc->name;
448}
449
450static uint32_t extract_dc(unsigned short addr, int data)
451{
452 int valid, way;
453 unsigned char state;
454 uint64_t taglo, pa;
455 uint32_t taghi, taglolo, taglohi;
456 uint8_t ecc, lru;
457 int res = 0;
458
459 prom_printf("Dcache index 0x%04x ", addr);
460 for (way = 0; way < 4; way++) {
461 __asm__ __volatile__ (
462 " .set push\n\t"
463 " .set noreorder\n\t"
464 " .set mips64\n\t"
465 " .set noat\n\t"
466 " cache 5, 0(%3)\n\t" /* Index-load-tag-D */
467 " mfc0 %0, $29, 2\n\t"
468 " dmfc0 $1, $28, 2\n\t"
469 " dsrl32 %1, $1, 0\n\t"
470 " sll %2, $1, 0\n\t"
471 " .set pop"
472 : "=r" (taghi), "=r" (taglohi), "=r" (taglolo)
473 : "r" ((way << 13) | addr));
474
475 taglo = ((unsigned long long)taglohi << 32) | taglolo;
476 pa = (taglo & 0xFFFFFFE000ULL) | addr;
477 if (way == 0) {
478 lru = (taghi >> 14) & 0xff;
479 prom_printf("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n",
480 ((addr >> 11) & 0x2) | ((addr >> 5) & 1), /* bank */
481 ((addr >> 6) & 0x3f), /* index */
482 (lru & 0x3),
483 ((lru >> 2) & 0x3),
484 ((lru >> 4) & 0x3),
485 ((lru >> 6) & 0x3));
486 }
487 state = (taghi >> 25) & 0x1f;
488 valid = DC_TAG_VALID(state);
489 prom_printf(" %d [PA %010llx] [state %s (%02x)] raw tags: %08X-%016llX\n",
490 way, pa, dc_state_str(state), state, taghi, taglo);
491 if (valid) {
492 if (((taglo >> 11) & 1) ^ range_parity(taglo, 39, 26)) {
493 prom_printf(" ** bad parity in PTag1\n");
494 res |= CP0_CERRD_TAG_ADDRESS;
495 }
496 if (((taglo >> 10) & 1) ^ range_parity(taglo, 25, 13)) {
497 prom_printf(" ** bad parity in PTag0\n");
498 res |= CP0_CERRD_TAG_ADDRESS;
499 }
500 } else {
501 res |= CP0_CERRD_TAG_STATE;
502 }
503
504 if (data) {
505 uint64_t datalo;
506 uint32_t datalohi, datalolo, datahi;
507 int offset;
508
509 for (offset = 0; offset < 4; offset++) {
510 /* Index-load-data-D */
511 __asm__ __volatile__ (
512 " .set push\n\t"
513 " .set noreorder\n\t"
514 " .set mips64\n\t"
515 " .set noat\n\t"
516 " cache 7, 0(%3)\n\t" /* Index-load-data-D */
517 " mfc0 %0, $29, 3\n\t"
518 " dmfc0 $1, $28, 3\n\t"
519 " dsrl32 %1, $1, 0 \n\t"
520 " sll %2, $1, 0 \n\t"
521 " .set pop"
522 : "=r" (datahi), "=r" (datalohi), "=r" (datalolo)
523 : "r" ((way << 13) | addr | (offset << 3)));
524 datalo = ((unsigned long long)datalohi << 32) | datalolo;
525 ecc = dc_ecc(datalo);
526 if (ecc != datahi) {
527 int bits = 0;
528 prom_printf(" ** bad ECC (%02x %02x) ->",
529 datahi, ecc);
530 ecc ^= datahi;
531 while (ecc) {
532 if (ecc & 1) bits++;
533 ecc >>= 1;
534 }
535 res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE;
536 }
537 prom_printf(" %02X-%016llX", datahi, datalo);
538 }
539 prom_printf("\n");
540 }
541 }
542 return res;
543}
diff --git a/arch/mips/mm/cex-gen.S b/arch/mips/mm/cex-gen.S
new file mode 100644
index 000000000000..e743622fd24d
--- /dev/null
+++ b/arch/mips/mm/cex-gen.S
@@ -0,0 +1,42 @@
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) 1995 - 1999 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 *
9 * Cache error handler
10 */
11#include <asm/asm.h>
12#include <asm/regdef.h>
13#include <asm/mipsregs.h>
14#include <asm/stackframe.h>
15
16/*
17 * Game over. Go to the button. Press gently. Swear where allowed by
18 * legislation.
19 */
20 LEAF(except_vec2_generic)
21 .set noreorder
22 .set noat
23 .set mips0
24 /*
25 * This is a very bad place to be. Our cache error
26 * detection has triggered. If we have write-back data
27 * in the cache, we may not be able to recover. As a
28 * first-order desperate measure, turn off KSEG0 cacheing.
29 */
30 mfc0 k0,CP0_CONFIG
31 li k1,~CONF_CM_CMASK
32 and k0,k0,k1
33 ori k0,k0,CONF_CM_UNCACHED
34 mtc0 k0,CP0_CONFIG
35 /* Give it a few cycles to sink in... */
36 nop
37 nop
38 nop
39
40 j cache_parity_error
41 nop
42 END(except_vec2_generic)
diff --git a/arch/mips/mm/cex-sb1.S b/arch/mips/mm/cex-sb1.S
new file mode 100644
index 000000000000..2c3a23aa88c3
--- /dev/null
+++ b/arch/mips/mm/cex-sb1.S
@@ -0,0 +1,170 @@
1/*
2 * Copyright (C) 2001,2002,2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/init.h>
19
20#include <asm/asm.h>
21#include <asm/regdef.h>
22#include <asm/mipsregs.h>
23#include <asm/stackframe.h>
24#include <asm/cacheops.h>
25#include <asm/sibyte/board.h>
26
27#define C0_ERRCTL $26 /* CP0: Error info */
28#define C0_CERR_I $27 /* CP0: Icache error */
29#define C0_CERR_D $27,1 /* CP0: Dcache error */
30
31 /*
32 * Based on SiByte sample software cache-err/cerr.S
33 * CVS revision 1.8. Only the 'unrecoverable' case
34 * is changed.
35 */
36
37 __INIT
38
39 .set mips64
40 .set noreorder
41 .set noat
42
43 /*
44 * sb1_cerr_vec: code to be copied to the Cache Error
45 * Exception vector. The code must be pushed out to memory
46 * (either by copying to Kseg0 and Kseg1 both, or by flushing
47 * the L1 and L2) since it is fetched as 0xa0000100.
48 *
49 * NOTE: Be sure this handler is at most 28 instructions long
50 * since the final 16 bytes of the exception vector memory
51 * (0x170-0x17f) are used to preserve k0, k1, and ra.
52 */
53
54LEAF(except_vec2_sb1)
55 /*
56 * If this error is recoverable, we need to exit the handler
57 * without having dirtied any registers. To do this,
58 * save/restore k0 and k1 from low memory (Useg is direct
59 * mapped while ERL=1). Note that we can't save to a
60 * CPU-specific location without ruining a register in the
61 * process. This means we are vulnerable to data corruption
62 * whenever the handler is reentered by a second CPU.
63 */
64 sd k0,0x170($0)
65 sd k1,0x178($0)
66
67 /*
68 * M_ERRCTL_RECOVERABLE is bit 31, which makes it easy to tell
69 * if we can fast-path out of here for a h/w-recovered error.
70 */
71 mfc0 k1,C0_ERRCTL
72 bgtz k1,attempt_recovery
73 sll k0,k1,1
74
75recovered_dcache:
76 /*
77 * Unlock CacheErr-D (which in turn unlocks CacheErr-DPA).
78 * Ought to log the occurence of this recovered dcache error.
79 */
80 b recovered
81 mtc0 $0,C0_CERR_D
82
83attempt_recovery:
84 /*
85 * k0 has C0_ERRCTL << 1, which puts 'DC' at bit 31. Any
86 * Dcache errors we can recover from will take more extensive
87 * processing. For now, they are considered "unrecoverable".
88 * Note that 'DC' becoming set (outside of ERL mode) will
89 * cause 'IC' to clear; so if there's an Icache error, we'll
90 * only find out about it if we recover from this error and
91 * continue executing.
92 */
93 bltz k0,unrecoverable
94 sll k0,1
95
96 /*
97 * k0 has C0_ERRCTL << 2, which puts 'IC' at bit 31. If an
98 * Icache error isn't indicated, I'm not sure why we got here.
99 * Consider that case "unrecoverable" for now.
100 */
101 bgez k0,unrecoverable
102
103attempt_icache_recovery:
104 /*
105 * External icache errors are due to uncorrectable ECC errors
106 * in the L2 cache or Memory Controller and cannot be
107 * recovered here.
108 */
109 mfc0 k0,C0_CERR_I /* delay slot */
110 li k1,1 << 26 /* ICACHE_EXTERNAL */
111 and k1,k0
112 bnez k1,unrecoverable
113 andi k0,0x1fe0
114
115 /*
116 * Since the error is internal, the 'IDX' field from
117 * CacheErr-I is valid and we can just invalidate all blocks
118 * in that set.
119 */
120 cache Index_Invalidate_I,(0<<13)(k0)
121 cache Index_Invalidate_I,(1<<13)(k0)
122 cache Index_Invalidate_I,(2<<13)(k0)
123 cache Index_Invalidate_I,(3<<13)(k0)
124
125 /* Ought to log this recovered icache error */
126
127recovered:
128 /* Restore the saved registers */
129 ld k0,0x170($0)
130 ld k1,0x178($0)
131 eret
132
133unrecoverable:
134 /* Unrecoverable Icache or Dcache error; log it and/or fail */
135 j handle_vec2_sb1
136 nop
137
138END(except_vec2_sb1)
139
140 __FINIT
141
142 LEAF(handle_vec2_sb1)
143 mfc0 k0,CP0_CONFIG
144 li k1,~CONF_CM_CMASK
145 and k0,k0,k1
146 ori k0,k0,CONF_CM_UNCACHED
147 mtc0 k0,CP0_CONFIG
148
149 SSNOP
150 SSNOP
151 SSNOP
152 SSNOP
153 bnezl $0, 1f
1541:
155 mfc0 k0, CP0_STATUS
156 sll k0, k0, 3 # check CU0 (kernel?)
157 bltz k0, 2f
158 nop
159
160 /* Get a valid Kseg0 stack pointer. Any task's stack pointer
161 * will do, although if we ever want to resume execution we
162 * better not have corrupted any state. */
163 get_saved_sp
164 move sp, k1
165
1662:
167 j sb1_cache_error
168 nop
169
170 END(handle_vec2_sb1)
diff --git a/arch/mips/mm/dma-coherent.c b/arch/mips/mm/dma-coherent.c
new file mode 100644
index 000000000000..97a50d38c98f
--- /dev/null
+++ b/arch/mips/mm/dma-coherent.c
@@ -0,0 +1,255 @@
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) 2000 Ani Joshi <ajoshi@unixbox.com>
7 * Copyright (C) 2000, 2001 Ralf Baechle <ralf@gnu.org>
8 * swiped from i386, and cloned for MIPS by Geert, polished by Ralf.
9 */
10#include <linux/config.h>
11#include <linux/types.h>
12#include <linux/mm.h>
13#include <linux/module.h>
14#include <linux/string.h>
15#include <linux/pci.h>
16
17#include <asm/cache.h>
18#include <asm/io.h>
19
20void *dma_alloc_noncoherent(struct device *dev, size_t size,
21 dma_addr_t * dma_handle, int gfp)
22{
23 void *ret;
24 /* ignore region specifiers */
25 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
26
27 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
28 gfp |= GFP_DMA;
29 ret = (void *) __get_free_pages(gfp, get_order(size));
30
31 if (ret != NULL) {
32 memset(ret, 0, size);
33 *dma_handle = virt_to_phys(ret);
34 }
35
36 return ret;
37}
38
39EXPORT_SYMBOL(dma_alloc_noncoherent);
40
41void *dma_alloc_coherent(struct device *dev, size_t size,
42 dma_addr_t * dma_handle, int gfp)
43 __attribute__((alias("dma_alloc_noncoherent")));
44
45EXPORT_SYMBOL(dma_alloc_coherent);
46
47void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr,
48 dma_addr_t dma_handle)
49{
50 unsigned long addr = (unsigned long) vaddr;
51
52 free_pages(addr, get_order(size));
53}
54
55EXPORT_SYMBOL(dma_free_noncoherent);
56
57void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
58 dma_addr_t dma_handle) __attribute__((alias("dma_free_noncoherent")));
59
60EXPORT_SYMBOL(dma_free_coherent);
61
62dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
63 enum dma_data_direction direction)
64{
65 BUG_ON(direction == DMA_NONE);
66
67 return __pa(ptr);
68}
69
70EXPORT_SYMBOL(dma_map_single);
71
72void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
73 enum dma_data_direction direction)
74{
75 BUG_ON(direction == DMA_NONE);
76}
77
78EXPORT_SYMBOL(dma_unmap_single);
79
80int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
81 enum dma_data_direction direction)
82{
83 int i;
84
85 BUG_ON(direction == DMA_NONE);
86
87 for (i = 0; i < nents; i++, sg++) {
88 sg->dma_address = (dma_addr_t)page_to_phys(sg->page) + sg->offset;
89 }
90
91 return nents;
92}
93
94EXPORT_SYMBOL(dma_map_sg);
95
96dma_addr_t dma_map_page(struct device *dev, struct page *page,
97 unsigned long offset, size_t size, enum dma_data_direction direction)
98{
99 BUG_ON(direction == DMA_NONE);
100
101 return page_to_phys(page) + offset;
102}
103
104EXPORT_SYMBOL(dma_map_page);
105
106void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
107 enum dma_data_direction direction)
108{
109 BUG_ON(direction == DMA_NONE);
110}
111
112EXPORT_SYMBOL(dma_unmap_page);
113
114void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
115 enum dma_data_direction direction)
116{
117 BUG_ON(direction == DMA_NONE);
118}
119
120EXPORT_SYMBOL(dma_unmap_sg);
121
122void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
123 size_t size, enum dma_data_direction direction)
124{
125 BUG_ON(direction == DMA_NONE);
126}
127
128EXPORT_SYMBOL(dma_sync_single_for_cpu);
129
130void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
131 size_t size, enum dma_data_direction direction)
132{
133 BUG_ON(direction == DMA_NONE);
134}
135
136EXPORT_SYMBOL(dma_sync_single_for_device);
137
138void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
139 unsigned long offset, size_t size,
140 enum dma_data_direction direction)
141{
142 BUG_ON(direction == DMA_NONE);
143}
144
145EXPORT_SYMBOL(dma_sync_single_range_for_cpu);
146
147void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
148 unsigned long offset, size_t size,
149 enum dma_data_direction direction)
150{
151 BUG_ON(direction == DMA_NONE);
152}
153
154EXPORT_SYMBOL(dma_sync_single_range_for_device);
155
156void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
157 enum dma_data_direction direction)
158{
159 BUG_ON(direction == DMA_NONE);
160}
161
162EXPORT_SYMBOL(dma_sync_sg_for_cpu);
163
164void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
165 enum dma_data_direction direction)
166{
167 BUG_ON(direction == DMA_NONE);
168}
169
170EXPORT_SYMBOL(dma_sync_sg_for_device);
171
172int dma_mapping_error(dma_addr_t dma_addr)
173{
174 return 0;
175}
176
177EXPORT_SYMBOL(dma_mapping_error);
178
179int dma_supported(struct device *dev, u64 mask)
180{
181 /*
182 * we fall back to GFP_DMA when the mask isn't all 1s,
183 * so we can't guarantee allocations that must be
184 * within a tighter range than GFP_DMA..
185 */
186 if (mask < 0x00ffffff)
187 return 0;
188
189 return 1;
190}
191
192EXPORT_SYMBOL(dma_supported);
193
194int dma_is_consistent(dma_addr_t dma_addr)
195{
196 return 1;
197}
198
199EXPORT_SYMBOL(dma_is_consistent);
200
201void dma_cache_sync(void *vaddr, size_t size,
202 enum dma_data_direction direction)
203{
204 BUG_ON(direction == DMA_NONE);
205}
206
207EXPORT_SYMBOL(dma_cache_sync);
208
209/* The DAC routines are a PCIism.. */
210
211#ifdef CONFIG_PCI
212
213#include <linux/pci.h>
214
215dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
216 struct page *page, unsigned long offset, int direction)
217{
218 return (dma64_addr_t)page_to_phys(page) + offset;
219}
220
221EXPORT_SYMBOL(pci_dac_page_to_dma);
222
223struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
224 dma64_addr_t dma_addr)
225{
226 return mem_map + (dma_addr >> PAGE_SHIFT);
227}
228
229EXPORT_SYMBOL(pci_dac_dma_to_page);
230
231unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
232 dma64_addr_t dma_addr)
233{
234 return dma_addr & ~PAGE_MASK;
235}
236
237EXPORT_SYMBOL(pci_dac_dma_to_offset);
238
239void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
240 dma64_addr_t dma_addr, size_t len, int direction)
241{
242 BUG_ON(direction == PCI_DMA_NONE);
243}
244
245EXPORT_SYMBOL(pci_dac_dma_sync_single_for_cpu);
246
247void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
248 dma64_addr_t dma_addr, size_t len, int direction)
249{
250 BUG_ON(direction == PCI_DMA_NONE);
251}
252
253EXPORT_SYMBOL(pci_dac_dma_sync_single_for_device);
254
255#endif /* CONFIG_PCI */
diff --git a/arch/mips/mm/dma-ip27.c b/arch/mips/mm/dma-ip27.c
new file mode 100644
index 000000000000..aa7c94b5d781
--- /dev/null
+++ b/arch/mips/mm/dma-ip27.c
@@ -0,0 +1,257 @@
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) 2000 Ani Joshi <ajoshi@unixbox.com>
7 * Copyright (C) 2000, 2001 Ralf Baechle <ralf@gnu.org>
8 * swiped from i386, and cloned for MIPS by Geert, polished by Ralf.
9 */
10#include <linux/types.h>
11#include <linux/mm.h>
12#include <linux/module.h>
13#include <linux/string.h>
14#include <linux/pci.h>
15
16#include <asm/cache.h>
17#include <asm/pci/bridge.h>
18
19#define pdev_to_baddr(pdev, addr) \
20 (BRIDGE_CONTROLLER(pdev->bus)->baddr + (addr))
21#define dev_to_baddr(dev, addr) \
22 pdev_to_baddr(to_pci_dev(dev), (addr))
23
24void *dma_alloc_noncoherent(struct device *dev, size_t size,
25 dma_addr_t * dma_handle, int gfp)
26{
27 void *ret;
28
29 /* ignore region specifiers */
30 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
31
32 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
33 gfp |= GFP_DMA;
34 ret = (void *) __get_free_pages(gfp, get_order(size));
35
36 if (ret != NULL) {
37 memset(ret, 0, size);
38 *dma_handle = dev_to_baddr(dev, virt_to_phys(ret));
39 }
40
41 return ret;
42}
43
44EXPORT_SYMBOL(dma_alloc_noncoherent);
45
46void *dma_alloc_coherent(struct device *dev, size_t size,
47 dma_addr_t * dma_handle, int gfp)
48 __attribute__((alias("dma_alloc_noncoherent")));
49
50EXPORT_SYMBOL(dma_alloc_coherent);
51
52void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr,
53 dma_addr_t dma_handle)
54{
55 unsigned long addr = (unsigned long) vaddr;
56
57 free_pages(addr, get_order(size));
58}
59
60EXPORT_SYMBOL(dma_free_noncoherent);
61
62void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
63 dma_addr_t dma_handle) __attribute__((alias("dma_free_noncoherent")));
64
65EXPORT_SYMBOL(dma_free_coherent);
66
67dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
68 enum dma_data_direction direction)
69{
70 BUG_ON(direction == DMA_NONE);
71
72 return dev_to_baddr(dev, __pa(ptr));
73}
74
75EXPORT_SYMBOL(dma_map_single);
76
77void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
78 enum dma_data_direction direction)
79{
80 BUG_ON(direction == DMA_NONE);
81}
82
83EXPORT_SYMBOL(dma_unmap_single);
84
85int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
86 enum dma_data_direction direction)
87{
88 int i;
89
90 BUG_ON(direction == DMA_NONE);
91
92 for (i = 0; i < nents; i++, sg++) {
93 sg->dma_address = (dma_addr_t) dev_to_baddr(dev,
94 page_to_phys(sg->page) + sg->offset);
95 }
96
97 return nents;
98}
99
100EXPORT_SYMBOL(dma_map_sg);
101
102dma_addr_t dma_map_page(struct device *dev, struct page *page,
103 unsigned long offset, size_t size, enum dma_data_direction direction)
104{
105 BUG_ON(direction == DMA_NONE);
106
107 return dev_to_baddr(dev, page_to_phys(page) + offset);
108}
109
110EXPORT_SYMBOL(dma_map_page);
111
112void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
113 enum dma_data_direction direction)
114{
115 BUG_ON(direction == DMA_NONE);
116}
117
118EXPORT_SYMBOL(dma_unmap_page);
119
120void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
121 enum dma_data_direction direction)
122{
123 BUG_ON(direction == DMA_NONE);
124}
125
126EXPORT_SYMBOL(dma_unmap_sg);
127
128void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
129 enum dma_data_direction direction)
130{
131 BUG_ON(direction == DMA_NONE);
132}
133
134EXPORT_SYMBOL(dma_sync_single_for_cpu);
135
136void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
137 enum dma_data_direction direction)
138{
139 BUG_ON(direction == DMA_NONE);
140}
141
142EXPORT_SYMBOL(dma_sync_single_for_device);
143
144void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
145 unsigned long offset, size_t size,
146 enum dma_data_direction direction)
147{
148 BUG_ON(direction == DMA_NONE);
149}
150
151EXPORT_SYMBOL(dma_sync_single_range_for_cpu);
152
153void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
154 unsigned long offset, size_t size,
155 enum dma_data_direction direction)
156{
157 BUG_ON(direction == DMA_NONE);
158}
159
160EXPORT_SYMBOL(dma_sync_single_range_for_device);
161
162void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
163 enum dma_data_direction direction)
164{
165 BUG_ON(direction == DMA_NONE);
166}
167
168EXPORT_SYMBOL(dma_sync_sg_for_cpu);
169
170void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
171 enum dma_data_direction direction)
172{
173 BUG_ON(direction == DMA_NONE);
174}
175
176EXPORT_SYMBOL(dma_sync_sg_for_device);
177
178int dma_mapping_error(dma_addr_t dma_addr)
179{
180 return 0;
181}
182
183EXPORT_SYMBOL(dma_mapping_error);
184
185int dma_supported(struct device *dev, u64 mask)
186{
187 /*
188 * we fall back to GFP_DMA when the mask isn't all 1s,
189 * so we can't guarantee allocations that must be
190 * within a tighter range than GFP_DMA..
191 */
192 if (mask < 0x00ffffff)
193 return 0;
194
195 return 1;
196}
197
198EXPORT_SYMBOL(dma_supported);
199
200int dma_is_consistent(dma_addr_t dma_addr)
201{
202 return 1;
203}
204
205EXPORT_SYMBOL(dma_is_consistent);
206
207void dma_cache_sync(void *vaddr, size_t size,
208 enum dma_data_direction direction)
209{
210 BUG_ON(direction == DMA_NONE);
211}
212
213EXPORT_SYMBOL(dma_cache_sync);
214
215dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
216 struct page *page, unsigned long offset, int direction)
217{
218 dma64_addr_t addr = page_to_phys(page) + offset;
219
220 return (dma64_addr_t) pdev_to_baddr(pdev, addr);
221}
222
223EXPORT_SYMBOL(pci_dac_page_to_dma);
224
225struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
226 dma64_addr_t dma_addr)
227{
228 struct bridge_controller *bc = BRIDGE_CONTROLLER(pdev->bus);
229
230 return pfn_to_page((dma_addr - bc->baddr) >> PAGE_SHIFT);
231}
232
233EXPORT_SYMBOL(pci_dac_dma_to_page);
234
235unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
236 dma64_addr_t dma_addr)
237{
238 return dma_addr & ~PAGE_MASK;
239}
240
241EXPORT_SYMBOL(pci_dac_dma_to_offset);
242
243void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
244 dma64_addr_t dma_addr, size_t len, int direction)
245{
246 BUG_ON(direction == PCI_DMA_NONE);
247}
248
249EXPORT_SYMBOL(pci_dac_dma_sync_single_for_cpu);
250
251void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
252 dma64_addr_t dma_addr, size_t len, int direction)
253{
254 BUG_ON(direction == PCI_DMA_NONE);
255}
256
257EXPORT_SYMBOL(pci_dac_dma_sync_single_for_device);
diff --git a/arch/mips/mm/dma-ip32.c b/arch/mips/mm/dma-ip32.c
new file mode 100644
index 000000000000..2cbe196c35fb
--- /dev/null
+++ b/arch/mips/mm/dma-ip32.c
@@ -0,0 +1,382 @@
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) 2000 Ani Joshi <ajoshi@unixbox.com>
7 * Copyright (C) 2000, 2001 Ralf Baechle <ralf@gnu.org>
8 * Copyright (C) 2005 Ilya A. Volynets-Evenbakh <ilya@total-knowledge.com>
9 * swiped from i386, and cloned for MIPS by Geert, polished by Ralf.
10 * IP32 changes by Ilya.
11 */
12#include <linux/types.h>
13#include <linux/mm.h>
14#include <linux/module.h>
15#include <linux/string.h>
16#include <linux/dma-mapping.h>
17
18#include <asm/cache.h>
19#include <asm/io.h>
20#include <asm/ip32/crime.h>
21
22/*
23 * Warning on the terminology - Linux calls an uncached area coherent;
24 * MIPS terminology calls memory areas with hardware maintained coherency
25 * coherent.
26 */
27
28/*
29 * Few notes.
30 * 1. CPU sees memory as two chunks: 0-256M@0x0, and the rest @0x40000000+256M
31 * 2. PCI sees memory as one big chunk @0x0 (or we could use 0x40000000 for native-endian)
32 * 3. All other devices see memory as one big chunk at 0x40000000
33 * 4. Non-PCI devices will pass NULL as struct device*
34 * Thus we translate differently, depending on device.
35 */
36
37#define RAM_OFFSET_MASK 0x3fffffff
38
39void *dma_alloc_noncoherent(struct device *dev, size_t size,
40 dma_addr_t * dma_handle, int gfp)
41{
42 void *ret;
43 /* ignore region specifiers */
44 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
45
46 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
47 gfp |= GFP_DMA;
48 ret = (void *) __get_free_pages(gfp, get_order(size));
49
50 if (ret != NULL) {
51 unsigned long addr = virt_to_phys(ret)&RAM_OFFSET_MASK;
52 memset(ret, 0, size);
53 if(dev==NULL)
54 addr+= CRIME_HI_MEM_BASE;
55 *dma_handle = addr;
56 }
57
58 return ret;
59}
60
61EXPORT_SYMBOL(dma_alloc_noncoherent);
62
63void *dma_alloc_coherent(struct device *dev, size_t size,
64 dma_addr_t * dma_handle, int gfp)
65{
66 void *ret;
67
68 ret = dma_alloc_noncoherent(dev, size, dma_handle, gfp);
69 if (ret) {
70 dma_cache_wback_inv((unsigned long) ret, size);
71 ret = UNCAC_ADDR(ret);
72 }
73
74 return ret;
75}
76
77EXPORT_SYMBOL(dma_alloc_coherent);
78
79void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr,
80 dma_addr_t dma_handle)
81{
82 free_pages((unsigned long) vaddr, get_order(size));
83}
84
85EXPORT_SYMBOL(dma_free_noncoherent);
86
87void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
88 dma_addr_t dma_handle)
89{
90 unsigned long addr = (unsigned long) vaddr;
91
92 addr = CAC_ADDR(addr);
93 free_pages(addr, get_order(size));
94}
95
96EXPORT_SYMBOL(dma_free_coherent);
97
98static inline void __dma_sync(unsigned long addr, size_t size,
99 enum dma_data_direction direction)
100{
101 switch (direction) {
102 case DMA_TO_DEVICE:
103 dma_cache_wback(addr, size);
104 break;
105
106 case DMA_FROM_DEVICE:
107 dma_cache_inv(addr, size);
108 break;
109
110 case DMA_BIDIRECTIONAL:
111 dma_cache_wback_inv(addr, size);
112 break;
113
114 default:
115 BUG();
116 }
117}
118
119dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
120 enum dma_data_direction direction)
121{
122 unsigned long addr = (unsigned long) ptr;
123
124 switch (direction) {
125 case DMA_TO_DEVICE:
126 dma_cache_wback(addr, size);
127 break;
128
129 case DMA_FROM_DEVICE:
130 dma_cache_inv(addr, size);
131 break;
132
133 case DMA_BIDIRECTIONAL:
134 dma_cache_wback_inv(addr, size);
135 break;
136
137 default:
138 BUG();
139 }
140
141 addr = virt_to_phys(ptr)&RAM_OFFSET_MASK;;
142 if(dev == NULL)
143 addr+=CRIME_HI_MEM_BASE;
144 return (dma_addr_t)addr;
145}
146
147EXPORT_SYMBOL(dma_map_single);
148
149void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
150 enum dma_data_direction direction)
151{
152 switch (direction) {
153 case DMA_TO_DEVICE:
154 break;
155
156 case DMA_FROM_DEVICE:
157 break;
158
159 case DMA_BIDIRECTIONAL:
160 break;
161
162 default:
163 BUG();
164 }
165}
166
167EXPORT_SYMBOL(dma_unmap_single);
168
169int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
170 enum dma_data_direction direction)
171{
172 int i;
173
174 BUG_ON(direction == DMA_NONE);
175
176 for (i = 0; i < nents; i++, sg++) {
177 unsigned long addr;
178
179 addr = (unsigned long) page_address(sg->page)+sg->offset;
180 if (addr)
181 __dma_sync(addr, sg->length, direction);
182 addr = __pa(addr)&RAM_OFFSET_MASK;;
183 if(dev == NULL)
184 addr += CRIME_HI_MEM_BASE;
185 sg->dma_address = (dma_addr_t)addr;
186 }
187
188 return nents;
189}
190
191EXPORT_SYMBOL(dma_map_sg);
192
193dma_addr_t dma_map_page(struct device *dev, struct page *page,
194 unsigned long offset, size_t size, enum dma_data_direction direction)
195{
196 unsigned long addr;
197
198 BUG_ON(direction == DMA_NONE);
199
200 addr = (unsigned long) page_address(page) + offset;
201 dma_cache_wback_inv(addr, size);
202 addr = __pa(addr)&RAM_OFFSET_MASK;;
203 if(dev == NULL)
204 addr += CRIME_HI_MEM_BASE;
205
206 return (dma_addr_t)addr;
207}
208
209EXPORT_SYMBOL(dma_map_page);
210
211void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
212 enum dma_data_direction direction)
213{
214 BUG_ON(direction == DMA_NONE);
215
216 if (direction != DMA_TO_DEVICE) {
217 unsigned long addr;
218
219 dma_address&=RAM_OFFSET_MASK;
220 addr = dma_address + PAGE_OFFSET;
221 if(dma_address>=256*1024*1024)
222 addr+=CRIME_HI_MEM_BASE;
223 dma_cache_wback_inv(addr, size);
224 }
225}
226
227EXPORT_SYMBOL(dma_unmap_page);
228
229void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
230 enum dma_data_direction direction)
231{
232 unsigned long addr;
233 int i;
234
235 BUG_ON(direction == DMA_NONE);
236
237 if (direction == DMA_TO_DEVICE)
238 return;
239
240 for (i = 0; i < nhwentries; i++, sg++) {
241 addr = (unsigned long) page_address(sg->page);
242 if (!addr)
243 continue;
244 dma_cache_wback_inv(addr + sg->offset, sg->length);
245 }
246}
247
248EXPORT_SYMBOL(dma_unmap_sg);
249
250void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
251 size_t size, enum dma_data_direction direction)
252{
253 unsigned long addr;
254
255 BUG_ON(direction == DMA_NONE);
256
257 dma_handle&=RAM_OFFSET_MASK;
258 addr = dma_handle + PAGE_OFFSET;
259 if(dma_handle>=256*1024*1024)
260 addr+=CRIME_HI_MEM_BASE;
261 __dma_sync(addr, size, direction);
262}
263
264EXPORT_SYMBOL(dma_sync_single_for_cpu);
265
266void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
267 size_t size, enum dma_data_direction direction)
268{
269 unsigned long addr;
270
271 BUG_ON(direction == DMA_NONE);
272
273 dma_handle&=RAM_OFFSET_MASK;
274 addr = dma_handle + PAGE_OFFSET;
275 if(dma_handle>=256*1024*1024)
276 addr+=CRIME_HI_MEM_BASE;
277 __dma_sync(addr, size, direction);
278}
279
280EXPORT_SYMBOL(dma_sync_single_for_device);
281
282void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
283 unsigned long offset, size_t size, enum dma_data_direction direction)
284{
285 unsigned long addr;
286
287 BUG_ON(direction == DMA_NONE);
288
289 dma_handle&=RAM_OFFSET_MASK;
290 addr = dma_handle + offset + PAGE_OFFSET;
291 if(dma_handle>=256*1024*1024)
292 addr+=CRIME_HI_MEM_BASE;
293 __dma_sync(addr, size, direction);
294}
295
296EXPORT_SYMBOL(dma_sync_single_range_for_cpu);
297
298void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
299 unsigned long offset, size_t size, enum dma_data_direction direction)
300{
301 unsigned long addr;
302
303 BUG_ON(direction == DMA_NONE);
304
305 dma_handle&=RAM_OFFSET_MASK;
306 addr = dma_handle + offset + PAGE_OFFSET;
307 if(dma_handle>=256*1024*1024)
308 addr+=CRIME_HI_MEM_BASE;
309 __dma_sync(addr, size, direction);
310}
311
312EXPORT_SYMBOL(dma_sync_single_range_for_device);
313
314void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
315 enum dma_data_direction direction)
316{
317 int i;
318
319 BUG_ON(direction == DMA_NONE);
320
321 /* Make sure that gcc doesn't leave the empty loop body. */
322 for (i = 0; i < nelems; i++, sg++)
323 __dma_sync((unsigned long)page_address(sg->page),
324 sg->length, direction);
325}
326
327EXPORT_SYMBOL(dma_sync_sg_for_cpu);
328
329void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
330 enum dma_data_direction direction)
331{
332 int i;
333
334 BUG_ON(direction == DMA_NONE);
335
336 /* Make sure that gcc doesn't leave the empty loop body. */
337 for (i = 0; i < nelems; i++, sg++)
338 __dma_sync((unsigned long)page_address(sg->page),
339 sg->length, direction);
340}
341
342EXPORT_SYMBOL(dma_sync_sg_for_device);
343
344int dma_mapping_error(dma_addr_t dma_addr)
345{
346 return 0;
347}
348
349EXPORT_SYMBOL(dma_mapping_error);
350
351int dma_supported(struct device *dev, u64 mask)
352{
353 /*
354 * we fall back to GFP_DMA when the mask isn't all 1s,
355 * so we can't guarantee allocations that must be
356 * within a tighter range than GFP_DMA..
357 */
358 if (mask < 0x00ffffff)
359 return 0;
360
361 return 1;
362}
363
364EXPORT_SYMBOL(dma_supported);
365
366int dma_is_consistent(dma_addr_t dma_addr)
367{
368 return 1;
369}
370
371EXPORT_SYMBOL(dma_is_consistent);
372
373void dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction direction)
374{
375 if (direction == DMA_NONE)
376 return;
377
378 dma_cache_wback_inv((unsigned long)vaddr, size);
379}
380
381EXPORT_SYMBOL(dma_cache_sync);
382
diff --git a/arch/mips/mm/dma-noncoherent.c b/arch/mips/mm/dma-noncoherent.c
new file mode 100644
index 000000000000..9895e32b0fce
--- /dev/null
+++ b/arch/mips/mm/dma-noncoherent.c
@@ -0,0 +1,400 @@
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) 2000 Ani Joshi <ajoshi@unixbox.com>
7 * Copyright (C) 2000, 2001 Ralf Baechle <ralf@gnu.org>
8 * swiped from i386, and cloned for MIPS by Geert, polished by Ralf.
9 */
10#include <linux/config.h>
11#include <linux/types.h>
12#include <linux/mm.h>
13#include <linux/module.h>
14#include <linux/string.h>
15#include <linux/dma-mapping.h>
16
17#include <asm/cache.h>
18#include <asm/io.h>
19
20/*
21 * Warning on the terminology - Linux calls an uncached area coherent;
22 * MIPS terminology calls memory areas with hardware maintained coherency
23 * coherent.
24 */
25
26void *dma_alloc_noncoherent(struct device *dev, size_t size,
27 dma_addr_t * dma_handle, int gfp)
28{
29 void *ret;
30 /* ignore region specifiers */
31 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
32
33 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
34 gfp |= GFP_DMA;
35 ret = (void *) __get_free_pages(gfp, get_order(size));
36
37 if (ret != NULL) {
38 memset(ret, 0, size);
39 *dma_handle = virt_to_phys(ret);
40 }
41
42 return ret;
43}
44
45EXPORT_SYMBOL(dma_alloc_noncoherent);
46
47void *dma_alloc_coherent(struct device *dev, size_t size,
48 dma_addr_t * dma_handle, int gfp)
49{
50 void *ret;
51
52 ret = dma_alloc_noncoherent(dev, size, dma_handle, gfp);
53 if (ret) {
54 dma_cache_wback_inv((unsigned long) ret, size);
55 ret = UNCAC_ADDR(ret);
56 }
57
58 return ret;
59}
60
61EXPORT_SYMBOL(dma_alloc_coherent);
62
63void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr,
64 dma_addr_t dma_handle)
65{
66 free_pages((unsigned long) vaddr, get_order(size));
67}
68
69EXPORT_SYMBOL(dma_free_noncoherent);
70
71void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
72 dma_addr_t dma_handle)
73{
74 unsigned long addr = (unsigned long) vaddr;
75
76 addr = CAC_ADDR(addr);
77 free_pages(addr, get_order(size));
78}
79
80EXPORT_SYMBOL(dma_free_coherent);
81
82static inline void __dma_sync(unsigned long addr, size_t size,
83 enum dma_data_direction direction)
84{
85 switch (direction) {
86 case DMA_TO_DEVICE:
87 dma_cache_wback(addr, size);
88 break;
89
90 case DMA_FROM_DEVICE:
91 dma_cache_inv(addr, size);
92 break;
93
94 case DMA_BIDIRECTIONAL:
95 dma_cache_wback_inv(addr, size);
96 break;
97
98 default:
99 BUG();
100 }
101}
102
103dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
104 enum dma_data_direction direction)
105{
106 unsigned long addr = (unsigned long) ptr;
107
108 switch (direction) {
109 case DMA_TO_DEVICE:
110 dma_cache_wback(addr, size);
111 break;
112
113 case DMA_FROM_DEVICE:
114 dma_cache_inv(addr, size);
115 break;
116
117 case DMA_BIDIRECTIONAL:
118 dma_cache_wback_inv(addr, size);
119 break;
120
121 default:
122 BUG();
123 }
124
125 return virt_to_phys(ptr);
126}
127
128EXPORT_SYMBOL(dma_map_single);
129
130void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
131 enum dma_data_direction direction)
132{
133 unsigned long addr;
134 addr = dma_addr + PAGE_OFFSET;
135
136 switch (direction) {
137 case DMA_TO_DEVICE:
138 //dma_cache_wback(addr, size);
139 break;
140
141 case DMA_FROM_DEVICE:
142 //dma_cache_inv(addr, size);
143 break;
144
145 case DMA_BIDIRECTIONAL:
146 //dma_cache_wback_inv(addr, size);
147 break;
148
149 default:
150 BUG();
151 }
152}
153
154EXPORT_SYMBOL(dma_unmap_single);
155
156int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
157 enum dma_data_direction direction)
158{
159 int i;
160
161 BUG_ON(direction == DMA_NONE);
162
163 for (i = 0; i < nents; i++, sg++) {
164 unsigned long addr;
165
166 addr = (unsigned long) page_address(sg->page);
167 if (addr)
168 __dma_sync(addr + sg->offset, sg->length, direction);
169 sg->dma_address = (dma_addr_t)
170 (page_to_phys(sg->page) + sg->offset);
171 }
172
173 return nents;
174}
175
176EXPORT_SYMBOL(dma_map_sg);
177
178dma_addr_t dma_map_page(struct device *dev, struct page *page,
179 unsigned long offset, size_t size, enum dma_data_direction direction)
180{
181 unsigned long addr;
182
183 BUG_ON(direction == DMA_NONE);
184
185 addr = (unsigned long) page_address(page) + offset;
186 dma_cache_wback_inv(addr, size);
187
188 return page_to_phys(page) + offset;
189}
190
191EXPORT_SYMBOL(dma_map_page);
192
193void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
194 enum dma_data_direction direction)
195{
196 BUG_ON(direction == DMA_NONE);
197
198 if (direction != DMA_TO_DEVICE) {
199 unsigned long addr;
200
201 addr = dma_address + PAGE_OFFSET;
202 dma_cache_wback_inv(addr, size);
203 }
204}
205
206EXPORT_SYMBOL(dma_unmap_page);
207
208void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
209 enum dma_data_direction direction)
210{
211 unsigned long addr;
212 int i;
213
214 BUG_ON(direction == DMA_NONE);
215
216 if (direction == DMA_TO_DEVICE)
217 return;
218
219 for (i = 0; i < nhwentries; i++, sg++) {
220 addr = (unsigned long) page_address(sg->page);
221 if (!addr)
222 continue;
223 dma_cache_wback_inv(addr + sg->offset, sg->length);
224 }
225}
226
227EXPORT_SYMBOL(dma_unmap_sg);
228
229void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
230 size_t size, enum dma_data_direction direction)
231{
232 unsigned long addr;
233
234 BUG_ON(direction == DMA_NONE);
235
236 addr = dma_handle + PAGE_OFFSET;
237 __dma_sync(addr, size, direction);
238}
239
240EXPORT_SYMBOL(dma_sync_single_for_cpu);
241
242void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
243 size_t size, enum dma_data_direction direction)
244{
245 unsigned long addr;
246
247 BUG_ON(direction == DMA_NONE);
248
249 addr = dma_handle + PAGE_OFFSET;
250 __dma_sync(addr, size, direction);
251}
252
253EXPORT_SYMBOL(dma_sync_single_for_device);
254
255void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
256 unsigned long offset, size_t size, enum dma_data_direction direction)
257{
258 unsigned long addr;
259
260 BUG_ON(direction == DMA_NONE);
261
262 addr = dma_handle + offset + PAGE_OFFSET;
263 __dma_sync(addr, size, direction);
264}
265
266EXPORT_SYMBOL(dma_sync_single_range_for_cpu);
267
268void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
269 unsigned long offset, size_t size, enum dma_data_direction direction)
270{
271 unsigned long addr;
272
273 BUG_ON(direction == DMA_NONE);
274
275 addr = dma_handle + offset + PAGE_OFFSET;
276 __dma_sync(addr, size, direction);
277}
278
279EXPORT_SYMBOL(dma_sync_single_range_for_device);
280
281void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
282 enum dma_data_direction direction)
283{
284 int i;
285
286 BUG_ON(direction == DMA_NONE);
287
288 /* Make sure that gcc doesn't leave the empty loop body. */
289 for (i = 0; i < nelems; i++, sg++)
290 __dma_sync((unsigned long)page_address(sg->page),
291 sg->length, direction);
292}
293
294EXPORT_SYMBOL(dma_sync_sg_for_cpu);
295
296void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
297 enum dma_data_direction direction)
298{
299 int i;
300
301 BUG_ON(direction == DMA_NONE);
302
303 /* Make sure that gcc doesn't leave the empty loop body. */
304 for (i = 0; i < nelems; i++, sg++)
305 __dma_sync((unsigned long)page_address(sg->page),
306 sg->length, direction);
307}
308
309EXPORT_SYMBOL(dma_sync_sg_for_device);
310
311int dma_mapping_error(dma_addr_t dma_addr)
312{
313 return 0;
314}
315
316EXPORT_SYMBOL(dma_mapping_error);
317
318int dma_supported(struct device *dev, u64 mask)
319{
320 /*
321 * we fall back to GFP_DMA when the mask isn't all 1s,
322 * so we can't guarantee allocations that must be
323 * within a tighter range than GFP_DMA..
324 */
325 if (mask < 0x00ffffff)
326 return 0;
327
328 return 1;
329}
330
331EXPORT_SYMBOL(dma_supported);
332
333int dma_is_consistent(dma_addr_t dma_addr)
334{
335 return 1;
336}
337
338EXPORT_SYMBOL(dma_is_consistent);
339
340void dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction direction)
341{
342 if (direction == DMA_NONE)
343 return;
344
345 dma_cache_wback_inv((unsigned long)vaddr, size);
346}
347
348EXPORT_SYMBOL(dma_cache_sync);
349
350/* The DAC routines are a PCIism.. */
351
352#ifdef CONFIG_PCI
353
354#include <linux/pci.h>
355
356dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
357 struct page *page, unsigned long offset, int direction)
358{
359 return (dma64_addr_t)page_to_phys(page) + offset;
360}
361
362EXPORT_SYMBOL(pci_dac_page_to_dma);
363
364struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
365 dma64_addr_t dma_addr)
366{
367 return mem_map + (dma_addr >> PAGE_SHIFT);
368}
369
370EXPORT_SYMBOL(pci_dac_dma_to_page);
371
372unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
373 dma64_addr_t dma_addr)
374{
375 return dma_addr & ~PAGE_MASK;
376}
377
378EXPORT_SYMBOL(pci_dac_dma_to_offset);
379
380void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
381 dma64_addr_t dma_addr, size_t len, int direction)
382{
383 BUG_ON(direction == PCI_DMA_NONE);
384
385 dma_cache_wback_inv(dma_addr + PAGE_OFFSET, len);
386}
387
388EXPORT_SYMBOL(pci_dac_dma_sync_single_for_cpu);
389
390void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
391 dma64_addr_t dma_addr, size_t len, int direction)
392{
393 BUG_ON(direction == PCI_DMA_NONE);
394
395 dma_cache_wback_inv(dma_addr + PAGE_OFFSET, len);
396}
397
398EXPORT_SYMBOL(pci_dac_dma_sync_single_for_device);
399
400#endif /* CONFIG_PCI */
diff --git a/arch/mips/mm/extable.c b/arch/mips/mm/extable.c
new file mode 100644
index 000000000000..297fb9f390dc
--- /dev/null
+++ b/arch/mips/mm/extable.c
@@ -0,0 +1,21 @@
1/*
2 * linux/arch/mips/mm/extable.c
3 */
4#include <linux/module.h>
5#include <linux/spinlock.h>
6#include <asm/branch.h>
7#include <asm/uaccess.h>
8
9int fixup_exception(struct pt_regs *regs)
10{
11 const struct exception_table_entry *fixup;
12
13 fixup = search_exception_tables(exception_epc(regs));
14 if (fixup) {
15 regs->cp0_epc = fixup->nextinsn;
16
17 return 1;
18 }
19
20 return 0;
21}
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
new file mode 100644
index 000000000000..ec8077c74e9c
--- /dev/null
+++ b/arch/mips/mm/fault.c
@@ -0,0 +1,236 @@
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) 1995 - 2000 by Ralf Baechle
7 */
8#include <linux/signal.h>
9#include <linux/sched.h>
10#include <linux/interrupt.h>
11#include <linux/kernel.h>
12#include <linux/errno.h>
13#include <linux/string.h>
14#include <linux/types.h>
15#include <linux/ptrace.h>
16#include <linux/mman.h>
17#include <linux/mm.h>
18#include <linux/smp.h>
19#include <linux/smp_lock.h>
20#include <linux/vt_kern.h> /* For unblank_screen() */
21#include <linux/module.h>
22
23#include <asm/branch.h>
24#include <asm/mmu_context.h>
25#include <asm/system.h>
26#include <asm/uaccess.h>
27#include <asm/ptrace.h>
28
29/*
30 * This routine handles page faults. It determines the address,
31 * and the problem, and then passes it off to one of the appropriate
32 * routines.
33 */
34asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
35 unsigned long address)
36{
37 struct vm_area_struct * vma = NULL;
38 struct task_struct *tsk = current;
39 struct mm_struct *mm = tsk->mm;
40 const int field = sizeof(unsigned long) * 2;
41 siginfo_t info;
42
43#if 0
44 printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", smp_processor_id(),
45 current->comm, current->pid, field, address, write,
46 field, regs->cp0_epc);
47#endif
48
49 info.si_code = SEGV_MAPERR;
50
51 /*
52 * We fault-in kernel-space virtual memory on-demand. The
53 * 'reference' page table is init_mm.pgd.
54 *
55 * NOTE! We MUST NOT take any locks for this case. We may
56 * be in an interrupt or a critical region, and should
57 * only copy the information from the master page table,
58 * nothing more.
59 */
60 if (unlikely(address >= VMALLOC_START))
61 goto vmalloc_fault;
62
63 /*
64 * If we're in an interrupt or have no user
65 * context, we must not take the fault..
66 */
67 if (in_atomic() || !mm)
68 goto bad_area_nosemaphore;
69
70 down_read(&mm->mmap_sem);
71 vma = find_vma(mm, address);
72 if (!vma)
73 goto bad_area;
74 if (vma->vm_start <= address)
75 goto good_area;
76 if (!(vma->vm_flags & VM_GROWSDOWN))
77 goto bad_area;
78 if (expand_stack(vma, address))
79 goto bad_area;
80/*
81 * Ok, we have a good vm_area for this memory access, so
82 * we can handle it..
83 */
84good_area:
85 info.si_code = SEGV_ACCERR;
86
87 if (write) {
88 if (!(vma->vm_flags & VM_WRITE))
89 goto bad_area;
90 } else {
91 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
92 goto bad_area;
93 }
94
95survive:
96 /*
97 * If for any reason at all we couldn't handle the fault,
98 * make sure we exit gracefully rather than endlessly redo
99 * the fault.
100 */
101 switch (handle_mm_fault(mm, vma, address, write)) {
102 case VM_FAULT_MINOR:
103 tsk->min_flt++;
104 break;
105 case VM_FAULT_MAJOR:
106 tsk->maj_flt++;
107 break;
108 case VM_FAULT_SIGBUS:
109 goto do_sigbus;
110 case VM_FAULT_OOM:
111 goto out_of_memory;
112 default:
113 BUG();
114 }
115
116 up_read(&mm->mmap_sem);
117 return;
118
119/*
120 * Something tried to access memory that isn't in our memory map..
121 * Fix it, but check if it's kernel or user first..
122 */
123bad_area:
124 up_read(&mm->mmap_sem);
125
126bad_area_nosemaphore:
127 /* User mode accesses just cause a SIGSEGV */
128 if (user_mode(regs)) {
129 tsk->thread.cp0_badvaddr = address;
130 tsk->thread.error_code = write;
131#if 0
132 printk("do_page_fault() #2: sending SIGSEGV to %s for "
133 "invalid %s\n%0*lx (epc == %0*lx, ra == %0*lx)\n",
134 tsk->comm,
135 write ? "write access to" : "read access from",
136 field, address,
137 field, (unsigned long) regs->cp0_epc,
138 field, (unsigned long) regs->regs[31]);
139#endif
140 info.si_signo = SIGSEGV;
141 info.si_errno = 0;
142 /* info.si_code has been set above */
143 info.si_addr = (void *) address;
144 force_sig_info(SIGSEGV, &info, tsk);
145 return;
146 }
147
148no_context:
149 /* Are we prepared to handle this kernel fault? */
150 if (fixup_exception(regs)) {
151 current->thread.cp0_baduaddr = address;
152 return;
153 }
154
155 /*
156 * Oops. The kernel tried to access some bad page. We'll have to
157 * terminate things with extreme prejudice.
158 */
159
160 bust_spinlocks(1);
161
162 printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at "
163 "virtual address %0*lx, epc == %0*lx, ra == %0*lx\n",
164 smp_processor_id(), field, address, field, regs->cp0_epc,
165 field, regs->regs[31]);
166 die("Oops", regs);
167
168/*
169 * We ran out of memory, or some other thing happened to us that made
170 * us unable to handle the page fault gracefully.
171 */
172out_of_memory:
173 up_read(&mm->mmap_sem);
174 if (tsk->pid == 1) {
175 yield();
176 down_read(&mm->mmap_sem);
177 goto survive;
178 }
179 printk("VM: killing process %s\n", tsk->comm);
180 if (user_mode(regs))
181 do_exit(SIGKILL);
182 goto no_context;
183
184do_sigbus:
185 up_read(&mm->mmap_sem);
186
187 /* Kernel mode? Handle exceptions or die */
188 if (!user_mode(regs))
189 goto no_context;
190
191 /*
192 * Send a sigbus, regardless of whether we were in kernel
193 * or user mode.
194 */
195 tsk->thread.cp0_badvaddr = address;
196 info.si_signo = SIGBUS;
197 info.si_errno = 0;
198 info.si_code = BUS_ADRERR;
199 info.si_addr = (void *) address;
200 force_sig_info(SIGBUS, &info, tsk);
201
202 return;
203
204vmalloc_fault:
205 {
206 /*
207 * Synchronize this task's top level page-table
208 * with the 'reference' page table.
209 *
210 * Do _not_ use "tsk" here. We might be inside
211 * an interrupt in the middle of a task switch..
212 */
213 int offset = __pgd_offset(address);
214 pgd_t *pgd, *pgd_k;
215 pmd_t *pmd, *pmd_k;
216 pte_t *pte_k;
217
218 pgd = (pgd_t *) pgd_current[smp_processor_id()] + offset;
219 pgd_k = init_mm.pgd + offset;
220
221 if (!pgd_present(*pgd_k))
222 goto no_context;
223 set_pgd(pgd, *pgd_k);
224
225 pmd = pmd_offset(pgd, address);
226 pmd_k = pmd_offset(pgd_k, address);
227 if (!pmd_present(*pmd_k))
228 goto no_context;
229 set_pmd(pmd, *pmd_k);
230
231 pte_k = pte_offset_kernel(pmd_k, address);
232 if (!pte_present(*pte_k))
233 goto no_context;
234 return;
235 }
236}
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
new file mode 100644
index 000000000000..dd5e2e31885b
--- /dev/null
+++ b/arch/mips/mm/highmem.c
@@ -0,0 +1,103 @@
1#include <linux/config.h>
2#include <linux/module.h>
3#include <linux/highmem.h>
4#include <asm/tlbflush.h>
5
6void *__kmap(struct page *page)
7{
8 void *addr;
9
10 might_sleep();
11 if (!PageHighMem(page))
12 return page_address(page);
13 addr = kmap_high(page);
14 flush_tlb_one((unsigned long)addr);
15
16 return addr;
17}
18
19void __kunmap(struct page *page)
20{
21 if (in_interrupt())
22 BUG();
23 if (!PageHighMem(page))
24 return;
25 kunmap_high(page);
26}
27
28/*
29 * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
30 * no global lock is needed and because the kmap code must perform a global TLB
31 * invalidation when the kmap pool wraps.
32 *
33 * However when holding an atomic kmap is is not legal to sleep, so atomic
34 * kmaps are appropriate for short, tight code paths only.
35 */
36
37void *__kmap_atomic(struct page *page, enum km_type type)
38{
39 enum fixed_addresses idx;
40 unsigned long vaddr;
41
42 /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
43 inc_preempt_count();
44 if (!PageHighMem(page))
45 return page_address(page);
46
47 idx = type + KM_TYPE_NR*smp_processor_id();
48 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
49#ifdef CONFIG_DEBUG_HIGHMEM
50 if (!pte_none(*(kmap_pte-idx)))
51 BUG();
52#endif
53 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
54 local_flush_tlb_one((unsigned long)vaddr);
55
56 return (void*) vaddr;
57}
58
59void __kunmap_atomic(void *kvaddr, enum km_type type)
60{
61#ifdef CONFIG_DEBUG_HIGHMEM
62 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
63 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
64
65 if (vaddr < FIXADDR_START) { // FIXME
66 dec_preempt_count();
67 preempt_check_resched();
68 return;
69 }
70
71 if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx))
72 BUG();
73
74 /*
75 * force other mappings to Oops if they'll try to access
76 * this pte without first remap it
77 */
78 pte_clear(&init_mm, vaddr, kmap_pte-idx);
79 local_flush_tlb_one(vaddr);
80#endif
81
82 dec_preempt_count();
83 preempt_check_resched();
84}
85
86struct page *__kmap_atomic_to_page(void *ptr)
87{
88 unsigned long idx, vaddr = (unsigned long)ptr;
89 pte_t *pte;
90
91 if (vaddr < FIXADDR_START)
92 return virt_to_page(ptr);
93
94 idx = virt_to_fix(vaddr);
95 pte = kmap_pte - (idx - FIX_KMAP_BEGIN);
96 return pte_page(*pte);
97}
98
99EXPORT_SYMBOL(__kmap);
100EXPORT_SYMBOL(__kunmap);
101EXPORT_SYMBOL(__kmap_atomic);
102EXPORT_SYMBOL(__kunmap_atomic);
103EXPORT_SYMBOL(__kmap_atomic_to_page);
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
new file mode 100644
index 000000000000..b027ce7efbc6
--- /dev/null
+++ b/arch/mips/mm/init.c
@@ -0,0 +1,304 @@
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) 1994 - 2000 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
9 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
10 */
11#include <linux/config.h>
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/signal.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/errno.h>
18#include <linux/string.h>
19#include <linux/types.h>
20#include <linux/pagemap.h>
21#include <linux/ptrace.h>
22#include <linux/mman.h>
23#include <linux/mm.h>
24#include <linux/bootmem.h>
25#include <linux/highmem.h>
26#include <linux/swap.h>
27
28#include <asm/bootinfo.h>
29#include <asm/cachectl.h>
30#include <asm/cpu.h>
31#include <asm/dma.h>
32#include <asm/mmu_context.h>
33#include <asm/sections.h>
34#include <asm/pgtable.h>
35#include <asm/pgalloc.h>
36#include <asm/tlb.h>
37
38DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
39
40unsigned long highstart_pfn, highend_pfn;
41
42/*
43 * We have up to 8 empty zeroed pages so we can map one of the right colour
44 * when needed. This is necessary only on R4000 / R4400 SC and MC versions
45 * where we have to avoid VCED / VECI exceptions for good performance at
46 * any price. Since page is never written to after the initialization we
47 * don't have to care about aliases on other CPUs.
48 */
49unsigned long empty_zero_page, zero_page_mask;
50
51/*
52 * Not static inline because used by IP27 special magic initialization code
53 */
54unsigned long setup_zero_pages(void)
55{
56 unsigned long order, size;
57 struct page *page;
58
59 if (cpu_has_vce)
60 order = 3;
61 else
62 order = 0;
63
64 empty_zero_page = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
65 if (!empty_zero_page)
66 panic("Oh boy, that early out of memory?");
67
68 page = virt_to_page(empty_zero_page);
69 while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) {
70 set_bit(PG_reserved, &page->flags);
71 set_page_count(page, 0);
72 page++;
73 }
74
75 size = PAGE_SIZE << order;
76 zero_page_mask = (size - 1) & PAGE_MASK;
77
78 return 1UL << order;
79}
80
81#ifdef CONFIG_HIGHMEM
82pte_t *kmap_pte;
83pgprot_t kmap_prot;
84
85#define kmap_get_fixmap_pte(vaddr) \
86 pte_offset_kernel(pmd_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr))
87
88static void __init kmap_init(void)
89{
90 unsigned long kmap_vstart;
91
92 /* cache the first kmap pte */
93 kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN);
94 kmap_pte = kmap_get_fixmap_pte(kmap_vstart);
95
96 kmap_prot = PAGE_KERNEL;
97}
98
99#ifdef CONFIG_MIPS64
100static void __init fixrange_init(unsigned long start, unsigned long end,
101 pgd_t *pgd_base)
102{
103 pgd_t *pgd;
104 pmd_t *pmd;
105 pte_t *pte;
106 int i, j;
107 unsigned long vaddr;
108
109 vaddr = start;
110 i = __pgd_offset(vaddr);
111 j = __pmd_offset(vaddr);
112 pgd = pgd_base + i;
113
114 for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) {
115 pmd = (pmd_t *)pgd;
116 for (; (j < PTRS_PER_PMD) && (vaddr != end); pmd++, j++) {
117 if (pmd_none(*pmd)) {
118 pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
119 set_pmd(pmd, __pmd(pte));
120 if (pte != pte_offset_kernel(pmd, 0))
121 BUG();
122 }
123 vaddr += PMD_SIZE;
124 }
125 j = 0;
126 }
127}
128#endif /* CONFIG_MIPS64 */
129#endif /* CONFIG_HIGHMEM */
130
131#ifndef CONFIG_DISCONTIGMEM
132extern void pagetable_init(void);
133
134void __init paging_init(void)
135{
136 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
137 unsigned long max_dma, high, low;
138
139 pagetable_init();
140
141#ifdef CONFIG_HIGHMEM
142 kmap_init();
143#endif
144
145 max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
146 low = max_low_pfn;
147 high = highend_pfn;
148
149#ifdef CONFIG_ISA
150 if (low < max_dma)
151 zones_size[ZONE_DMA] = low;
152 else {
153 zones_size[ZONE_DMA] = max_dma;
154 zones_size[ZONE_NORMAL] = low - max_dma;
155 }
156#else
157 zones_size[ZONE_DMA] = low;
158#endif
159#ifdef CONFIG_HIGHMEM
160 if (cpu_has_dc_aliases) {
161 printk(KERN_WARNING "This processor doesn't support highmem.");
162 if (high - low)
163 printk(" %ldk highmem ignored", high - low);
164 printk("\n");
165 } else
166 zones_size[ZONE_HIGHMEM] = high - low;
167#endif
168
169 free_area_init(zones_size);
170}
171
172#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
173#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
174
175static inline int page_is_ram(unsigned long pagenr)
176{
177 int i;
178
179 for (i = 0; i < boot_mem_map.nr_map; i++) {
180 unsigned long addr, end;
181
182 if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
183 /* not usable memory */
184 continue;
185
186 addr = PFN_UP(boot_mem_map.map[i].addr);
187 end = PFN_DOWN(boot_mem_map.map[i].addr +
188 boot_mem_map.map[i].size);
189
190 if (pagenr >= addr && pagenr < end)
191 return 1;
192 }
193
194 return 0;
195}
196
197void __init mem_init(void)
198{
199 unsigned long codesize, reservedpages, datasize, initsize;
200 unsigned long tmp, ram;
201
202#ifdef CONFIG_HIGHMEM
203#ifdef CONFIG_DISCONTIGMEM
204#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet"
205#endif
206 max_mapnr = num_physpages = highend_pfn;
207#else
208 max_mapnr = num_physpages = max_low_pfn;
209#endif
210 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
211
212 totalram_pages += free_all_bootmem();
213 totalram_pages -= setup_zero_pages(); /* Setup zeroed pages. */
214
215 reservedpages = ram = 0;
216 for (tmp = 0; tmp < max_low_pfn; tmp++)
217 if (page_is_ram(tmp)) {
218 ram++;
219 if (PageReserved(mem_map+tmp))
220 reservedpages++;
221 }
222
223#ifdef CONFIG_HIGHMEM
224 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
225 struct page *page = mem_map + tmp;
226
227 if (!page_is_ram(tmp)) {
228 SetPageReserved(page);
229 continue;
230 }
231 ClearPageReserved(page);
232#ifdef CONFIG_LIMITED_DMA
233 set_page_address(page, lowmem_page_address(page));
234#endif
235 set_bit(PG_highmem, &page->flags);
236 set_page_count(page, 1);
237 __free_page(page);
238 totalhigh_pages++;
239 }
240 totalram_pages += totalhigh_pages;
241#endif
242
243 codesize = (unsigned long) &_etext - (unsigned long) &_text;
244 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
245 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
246
247 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
248 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
249 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
250 ram << (PAGE_SHIFT-10),
251 codesize >> 10,
252 reservedpages << (PAGE_SHIFT-10),
253 datasize >> 10,
254 initsize >> 10,
255 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
256}
257#endif /* !CONFIG_DISCONTIGMEM */
258
259#ifdef CONFIG_BLK_DEV_INITRD
260void free_initrd_mem(unsigned long start, unsigned long end)
261{
262#ifdef CONFIG_MIPS64
263 /* Switch from KSEG0 to XKPHYS addresses */
264 start = (unsigned long)phys_to_virt(CPHYSADDR(start));
265 end = (unsigned long)phys_to_virt(CPHYSADDR(end));
266#endif
267 if (start < end)
268 printk(KERN_INFO "Freeing initrd memory: %ldk freed\n",
269 (end - start) >> 10);
270
271 for (; start < end; start += PAGE_SIZE) {
272 ClearPageReserved(virt_to_page(start));
273 set_page_count(virt_to_page(start), 1);
274 free_page(start);
275 totalram_pages++;
276 }
277}
278#endif
279
280extern unsigned long prom_free_prom_memory(void);
281
282void free_initmem(void)
283{
284 unsigned long addr, page, freed;
285
286 freed = prom_free_prom_memory();
287
288 addr = (unsigned long) &__init_begin;
289 while (addr < (unsigned long) &__init_end) {
290#ifdef CONFIG_MIPS64
291 page = PAGE_OFFSET | CPHYSADDR(addr);
292#else
293 page = addr;
294#endif
295 ClearPageReserved(virt_to_page(page));
296 set_page_count(virt_to_page(page), 1);
297 free_page(page);
298 totalram_pages++;
299 freed += PAGE_SIZE;
300 addr += PAGE_SIZE;
301 }
302 printk(KERN_INFO "Freeing unused kernel memory: %ldk freed\n",
303 freed >> 10);
304}
diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
new file mode 100644
index 000000000000..adf352273f63
--- /dev/null
+++ b/arch/mips/mm/ioremap.c
@@ -0,0 +1,202 @@
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 * (C) Copyright 1995 1996 Linus Torvalds
7 * (C) Copyright 2001, 2002 Ralf Baechle
8 */
9#include <linux/module.h>
10#include <asm/addrspace.h>
11#include <asm/byteorder.h>
12
13#include <linux/vmalloc.h>
14#include <asm/cacheflush.h>
15#include <asm/io.h>
16#include <asm/tlbflush.h>
17
18static inline void remap_area_pte(pte_t * pte, unsigned long address,
19 phys_t size, phys_t phys_addr, unsigned long flags)
20{
21 phys_t end;
22 unsigned long pfn;
23 pgprot_t pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | __READABLE
24 | __WRITEABLE | flags);
25
26 address &= ~PMD_MASK;
27 end = address + size;
28 if (end > PMD_SIZE)
29 end = PMD_SIZE;
30 if (address >= end)
31 BUG();
32 pfn = phys_addr >> PAGE_SHIFT;
33 do {
34 if (!pte_none(*pte)) {
35 printk("remap_area_pte: page already exists\n");
36 BUG();
37 }
38 set_pte(pte, pfn_pte(pfn, pgprot));
39 address += PAGE_SIZE;
40 pfn++;
41 pte++;
42 } while (address && (address < end));
43}
44
45static inline int remap_area_pmd(pmd_t * pmd, unsigned long address,
46 phys_t size, phys_t phys_addr, unsigned long flags)
47{
48 phys_t end;
49
50 address &= ~PGDIR_MASK;
51 end = address + size;
52 if (end > PGDIR_SIZE)
53 end = PGDIR_SIZE;
54 phys_addr -= address;
55 if (address >= end)
56 BUG();
57 do {
58 pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address);
59 if (!pte)
60 return -ENOMEM;
61 remap_area_pte(pte, address, end - address, address + phys_addr, flags);
62 address = (address + PMD_SIZE) & PMD_MASK;
63 pmd++;
64 } while (address && (address < end));
65 return 0;
66}
67
68static int remap_area_pages(unsigned long address, phys_t phys_addr,
69 phys_t size, unsigned long flags)
70{
71 int error;
72 pgd_t * dir;
73 unsigned long end = address + size;
74
75 phys_addr -= address;
76 dir = pgd_offset(&init_mm, address);
77 flush_cache_all();
78 if (address >= end)
79 BUG();
80 spin_lock(&init_mm.page_table_lock);
81 do {
82 pmd_t *pmd;
83 pmd = pmd_alloc(&init_mm, dir, address);
84 error = -ENOMEM;
85 if (!pmd)
86 break;
87 if (remap_area_pmd(pmd, address, end - address,
88 phys_addr + address, flags))
89 break;
90 error = 0;
91 address = (address + PGDIR_SIZE) & PGDIR_MASK;
92 dir++;
93 } while (address && (address < end));
94 spin_unlock(&init_mm.page_table_lock);
95 flush_tlb_all();
96 return error;
97}
98
99/*
100 * Allow physical addresses to be fixed up to help 36 bit peripherals.
101 */
102phys_t __attribute__ ((weak))
103fixup_bigphys_addr(phys_t phys_addr, phys_t size)
104{
105 return phys_addr;
106}
107
108/*
109 * Generic mapping function (not visible outside):
110 */
111
112/*
113 * Remap an arbitrary physical address space into the kernel virtual
114 * address space. Needed when the kernel wants to access high addresses
115 * directly.
116 *
117 * NOTE! We need to allow non-page-aligned mappings too: we will obviously
118 * have to convert them into an offset in a page-aligned mapping, but the
119 * caller shouldn't need to know that small detail.
120 */
121
122#define IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL))
123
124void * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags)
125{
126 struct vm_struct * area;
127 unsigned long offset;
128 phys_t last_addr;
129 void * addr;
130
131 phys_addr = fixup_bigphys_addr(phys_addr, size);
132
133 /* Don't allow wraparound or zero size */
134 last_addr = phys_addr + size - 1;
135 if (!size || last_addr < phys_addr)
136 return NULL;
137
138 /*
139 * Map uncached objects in the low 512mb of address space using KSEG1,
140 * otherwise map using page tables.
141 */
142 if (IS_LOW512(phys_addr) && IS_LOW512(last_addr) &&
143 flags == _CACHE_UNCACHED)
144 return (void *) KSEG1ADDR(phys_addr);
145
146 /*
147 * Don't allow anybody to remap normal RAM that we're using..
148 */
149 if (phys_addr < virt_to_phys(high_memory)) {
150 char *t_addr, *t_end;
151 struct page *page;
152
153 t_addr = __va(phys_addr);
154 t_end = t_addr + (size - 1);
155
156 for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
157 if(!PageReserved(page))
158 return NULL;
159 }
160
161 /*
162 * Mappings have to be page-aligned
163 */
164 offset = phys_addr & ~PAGE_MASK;
165 phys_addr &= PAGE_MASK;
166 size = PAGE_ALIGN(last_addr + 1) - phys_addr;
167
168 /*
169 * Ok, go for it..
170 */
171 area = get_vm_area(size, VM_IOREMAP);
172 if (!area)
173 return NULL;
174 addr = area->addr;
175 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) {
176 vunmap(addr);
177 return NULL;
178 }
179
180 return (void *) (offset + (char *)addr);
181}
182
183#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1)
184
185void __iounmap(volatile void __iomem *addr)
186{
187 struct vm_struct *p;
188
189 if (IS_KSEG1(addr))
190 return;
191
192 p = remove_vm_area((void *) (PAGE_MASK & (unsigned long __force) addr));
193 if (!p) {
194 printk(KERN_ERR "iounmap: bad address %p\n", addr);
195 return;
196 }
197
198 kfree(p);
199}
200
201EXPORT_SYMBOL(__ioremap);
202EXPORT_SYMBOL(__iounmap);
diff --git a/arch/mips/mm/pg-r4k.c b/arch/mips/mm/pg-r4k.c
new file mode 100644
index 000000000000..9f8b16541577
--- /dev/null
+++ b/arch/mips/mm/pg-r4k.c
@@ -0,0 +1,489 @@
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) 2003, 04, 05 Ralf Baechle (ralf@linux-mips.org)
7 */
8#include <linux/init.h>
9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <linux/mm.h>
12#include <linux/module.h>
13#include <linux/proc_fs.h>
14
15#include <asm/cacheops.h>
16#include <asm/inst.h>
17#include <asm/io.h>
18#include <asm/page.h>
19#include <asm/pgtable.h>
20#include <asm/prefetch.h>
21#include <asm/system.h>
22#include <asm/bootinfo.h>
23#include <asm/mipsregs.h>
24#include <asm/mmu_context.h>
25#include <asm/cpu.h>
26#include <asm/war.h>
27
28#define half_scache_line_size() (cpu_scache_line_size() >> 1)
29
30/*
31 * Maximum sizes:
32 *
33 * R4000 128 bytes S-cache: 0x58 bytes
34 * R4600 v1.7: 0x5c bytes
35 * R4600 v2.0: 0x60 bytes
36 * With prefetching, 16 byte strides 0xa0 bytes
37 */
38
39static unsigned int clear_page_array[0x130 / 4];
40
41void clear_page(void * page) __attribute__((alias("clear_page_array")));
42
43EXPORT_SYMBOL(clear_page);
44
45/*
46 * Maximum sizes:
47 *
48 * R4000 128 bytes S-cache: 0x11c bytes
49 * R4600 v1.7: 0x080 bytes
50 * R4600 v2.0: 0x07c bytes
51 * With prefetching, 16 byte strides 0x0b8 bytes
52 */
53static unsigned int copy_page_array[0x148 / 4];
54
55void copy_page(void *to, void *from) __attribute__((alias("copy_page_array")));
56
57EXPORT_SYMBOL(copy_page);
58
59/*
60 * This is suboptimal for 32-bit kernels; we assume that R10000 is only used
61 * with 64-bit kernels. The prefetch offsets have been experimentally tuned
62 * an Origin 200.
63 */
64static int pref_offset_clear __initdata = 512;
65static int pref_offset_copy __initdata = 256;
66
67static unsigned int pref_src_mode __initdata;
68static unsigned int pref_dst_mode __initdata;
69
70static int load_offset __initdata;
71static int store_offset __initdata;
72
73static unsigned int __initdata *dest, *epc;
74
75static unsigned int instruction_pending;
76static union mips_instruction delayed_mi;
77
78static void __init emit_instruction(union mips_instruction mi)
79{
80 if (instruction_pending)
81 *epc++ = delayed_mi.word;
82
83 instruction_pending = 1;
84 delayed_mi = mi;
85}
86
87static inline void flush_delay_slot_or_nop(void)
88{
89 if (instruction_pending) {
90 *epc++ = delayed_mi.word;
91 instruction_pending = 0;
92 return;
93 }
94
95 *epc++ = 0;
96}
97
98static inline unsigned int *label(void)
99{
100 if (instruction_pending) {
101 *epc++ = delayed_mi.word;
102 instruction_pending = 0;
103 }
104
105 return epc;
106}
107
108static inline void build_insn_word(unsigned int word)
109{
110 union mips_instruction mi;
111
112 mi.word = word;
113
114 emit_instruction(mi);
115}
116
117static inline void build_nop(void)
118{
119 build_insn_word(0); /* nop */
120}
121
122static inline void build_src_pref(int advance)
123{
124 if (!(load_offset & (cpu_dcache_line_size() - 1))) {
125 union mips_instruction mi;
126
127 mi.i_format.opcode = pref_op;
128 mi.i_format.rs = 5; /* $a1 */
129 mi.i_format.rt = pref_src_mode;
130 mi.i_format.simmediate = load_offset + advance;
131
132 emit_instruction(mi);
133 }
134}
135
136static inline void __build_load_reg(int reg)
137{
138 union mips_instruction mi;
139 unsigned int width;
140
141 if (cpu_has_64bit_gp_regs) {
142 mi.i_format.opcode = ld_op;
143 width = 8;
144 } else {
145 mi.i_format.opcode = lw_op;
146 width = 4;
147 }
148 mi.i_format.rs = 5; /* $a1 */
149 mi.i_format.rt = reg; /* $reg */
150 mi.i_format.simmediate = load_offset;
151
152 load_offset += width;
153 emit_instruction(mi);
154}
155
156static inline void build_load_reg(int reg)
157{
158 if (cpu_has_prefetch)
159 build_src_pref(pref_offset_copy);
160
161 __build_load_reg(reg);
162}
163
164static inline void build_dst_pref(int advance)
165{
166 if (!(store_offset & (cpu_dcache_line_size() - 1))) {
167 union mips_instruction mi;
168
169 mi.i_format.opcode = pref_op;
170 mi.i_format.rs = 4; /* $a0 */
171 mi.i_format.rt = pref_dst_mode;
172 mi.i_format.simmediate = store_offset + advance;
173
174 emit_instruction(mi);
175 }
176}
177
178static inline void build_cdex_s(void)
179{
180 union mips_instruction mi;
181
182 if ((store_offset & (cpu_scache_line_size() - 1)))
183 return;
184
185 mi.c_format.opcode = cache_op;
186 mi.c_format.rs = 4; /* $a0 */
187 mi.c_format.c_op = 3; /* Create Dirty Exclusive */
188 mi.c_format.cache = 3; /* Secondary Data Cache */
189 mi.c_format.simmediate = store_offset;
190
191 emit_instruction(mi);
192}
193
194static inline void build_cdex_p(void)
195{
196 union mips_instruction mi;
197
198 if (store_offset & (cpu_dcache_line_size() - 1))
199 return;
200
201 if (R4600_V1_HIT_CACHEOP_WAR && ((read_c0_prid() & 0xfff0) == 0x2010)) {
202 build_nop();
203 build_nop();
204 build_nop();
205 build_nop();
206 }
207
208 if (R4600_V2_HIT_CACHEOP_WAR && ((read_c0_prid() & 0xfff0) == 0x2020))
209 build_insn_word(0x8c200000); /* lw $zero, ($at) */
210
211 mi.c_format.opcode = cache_op;
212 mi.c_format.rs = 4; /* $a0 */
213 mi.c_format.c_op = 3; /* Create Dirty Exclusive */
214 mi.c_format.cache = 1; /* Data Cache */
215 mi.c_format.simmediate = store_offset;
216
217 emit_instruction(mi);
218}
219
220static void __init __build_store_reg(int reg)
221{
222 union mips_instruction mi;
223 unsigned int width;
224
225 if (cpu_has_64bit_gp_regs ||
226 (cpu_has_64bit_zero_reg && reg == 0)) {
227 mi.i_format.opcode = sd_op;
228 width = 8;
229 } else {
230 mi.i_format.opcode = sw_op;
231 width = 4;
232 }
233 mi.i_format.rs = 4; /* $a0 */
234 mi.i_format.rt = reg; /* $reg */
235 mi.i_format.simmediate = store_offset;
236
237 store_offset += width;
238 emit_instruction(mi);
239}
240
241static inline void build_store_reg(int reg)
242{
243 if (cpu_has_prefetch)
244 if (reg)
245 build_dst_pref(pref_offset_copy);
246 else
247 build_dst_pref(pref_offset_clear);
248 else if (cpu_has_cache_cdex_s)
249 build_cdex_s();
250 else if (cpu_has_cache_cdex_p)
251 build_cdex_p();
252
253 __build_store_reg(reg);
254}
255
256static inline void build_addiu_a2_a0(unsigned long offset)
257{
258 union mips_instruction mi;
259
260 BUG_ON(offset > 0x7fff);
261
262 mi.i_format.opcode = cpu_has_64bit_gp_regs ? daddiu_op : addiu_op;
263 mi.i_format.rs = 4; /* $a0 */
264 mi.i_format.rt = 6; /* $a2 */
265 mi.i_format.simmediate = offset;
266
267 emit_instruction(mi);
268}
269
270static inline void build_addiu_a1(unsigned long offset)
271{
272 union mips_instruction mi;
273
274 BUG_ON(offset > 0x7fff);
275
276 mi.i_format.opcode = cpu_has_64bit_gp_regs ? daddiu_op : addiu_op;
277 mi.i_format.rs = 5; /* $a1 */
278 mi.i_format.rt = 5; /* $a1 */
279 mi.i_format.simmediate = offset;
280
281 load_offset -= offset;
282
283 emit_instruction(mi);
284}
285
286static inline void build_addiu_a0(unsigned long offset)
287{
288 union mips_instruction mi;
289
290 BUG_ON(offset > 0x7fff);
291
292 mi.i_format.opcode = cpu_has_64bit_gp_regs ? daddiu_op : addiu_op;
293 mi.i_format.rs = 4; /* $a0 */
294 mi.i_format.rt = 4; /* $a0 */
295 mi.i_format.simmediate = offset;
296
297 store_offset -= offset;
298
299 emit_instruction(mi);
300}
301
302static inline void build_bne(unsigned int *dest)
303{
304 union mips_instruction mi;
305
306 mi.i_format.opcode = bne_op;
307 mi.i_format.rs = 6; /* $a2 */
308 mi.i_format.rt = 4; /* $a0 */
309 mi.i_format.simmediate = dest - epc - 1;
310
311 *epc++ = mi.word;
312 flush_delay_slot_or_nop();
313}
314
315static inline void build_jr_ra(void)
316{
317 union mips_instruction mi;
318
319 mi.r_format.opcode = spec_op;
320 mi.r_format.rs = 31;
321 mi.r_format.rt = 0;
322 mi.r_format.rd = 0;
323 mi.r_format.re = 0;
324 mi.r_format.func = jr_op;
325
326 *epc++ = mi.word;
327 flush_delay_slot_or_nop();
328}
329
330void __init build_clear_page(void)
331{
332 unsigned int loop_start;
333
334 epc = (unsigned int *) &clear_page_array;
335 instruction_pending = 0;
336 store_offset = 0;
337
338 if (cpu_has_prefetch) {
339 switch (current_cpu_data.cputype) {
340 case CPU_RM9000:
341 /*
342 * As a workaround for erratum G105 which make the
343 * PrepareForStore hint unusable we fall back to
344 * StoreRetained on the RM9000. Once it is known which
345 * versions of the RM9000 we'll be able to condition-
346 * alize this.
347 */
348
349 case CPU_R10000:
350 case CPU_R12000:
351 pref_src_mode = Pref_LoadStreamed;
352 pref_dst_mode = Pref_StoreStreamed;
353 break;
354
355 default:
356 pref_src_mode = Pref_LoadStreamed;
357 pref_dst_mode = Pref_PrepareForStore;
358 break;
359 }
360 }
361
362 build_addiu_a2_a0(PAGE_SIZE - (cpu_has_prefetch ? pref_offset_clear : 0));
363
364 if (R4600_V2_HIT_CACHEOP_WAR && ((read_c0_prid() & 0xfff0) == 0x2020))
365 build_insn_word(0x3c01a000); /* lui $at, 0xa000 */
366
367dest = label();
368 do {
369 build_store_reg(0);
370 build_store_reg(0);
371 build_store_reg(0);
372 build_store_reg(0);
373 } while (store_offset < half_scache_line_size());
374 build_addiu_a0(2 * store_offset);
375 loop_start = store_offset;
376 do {
377 build_store_reg(0);
378 build_store_reg(0);
379 build_store_reg(0);
380 build_store_reg(0);
381 } while ((store_offset - loop_start) < half_scache_line_size());
382 build_bne(dest);
383
384 if (cpu_has_prefetch && pref_offset_clear) {
385 build_addiu_a2_a0(pref_offset_clear);
386 dest = label();
387 loop_start = store_offset;
388 do {
389 __build_store_reg(0);
390 __build_store_reg(0);
391 __build_store_reg(0);
392 __build_store_reg(0);
393 } while ((store_offset - loop_start) < half_scache_line_size());
394 build_addiu_a0(2 * store_offset);
395 loop_start = store_offset;
396 do {
397 __build_store_reg(0);
398 __build_store_reg(0);
399 __build_store_reg(0);
400 __build_store_reg(0);
401 } while ((store_offset - loop_start) < half_scache_line_size());
402 build_bne(dest);
403 }
404
405 build_jr_ra();
406
407 flush_icache_range((unsigned long)&clear_page_array,
408 (unsigned long) epc);
409
410 BUG_ON(epc > clear_page_array + ARRAY_SIZE(clear_page_array));
411}
412
413void __init build_copy_page(void)
414{
415 unsigned int loop_start;
416
417 epc = (unsigned int *) &copy_page_array;
418 store_offset = load_offset = 0;
419 instruction_pending = 0;
420
421 build_addiu_a2_a0(PAGE_SIZE - (cpu_has_prefetch ? pref_offset_copy : 0));
422
423 if (R4600_V2_HIT_CACHEOP_WAR && ((read_c0_prid() & 0xfff0) == 0x2020))
424 build_insn_word(0x3c01a000); /* lui $at, 0xa000 */
425
426dest = label();
427 loop_start = store_offset;
428 do {
429 build_load_reg( 8);
430 build_load_reg( 9);
431 build_load_reg(10);
432 build_load_reg(11);
433 build_store_reg( 8);
434 build_store_reg( 9);
435 build_store_reg(10);
436 build_store_reg(11);
437 } while ((store_offset - loop_start) < half_scache_line_size());
438 build_addiu_a0(2 * store_offset);
439 build_addiu_a1(2 * load_offset);
440 loop_start = store_offset;
441 do {
442 build_load_reg( 8);
443 build_load_reg( 9);
444 build_load_reg(10);
445 build_load_reg(11);
446 build_store_reg( 8);
447 build_store_reg( 9);
448 build_store_reg(10);
449 build_store_reg(11);
450 } while ((store_offset - loop_start) < half_scache_line_size());
451 build_bne(dest);
452
453 if (cpu_has_prefetch && pref_offset_copy) {
454 build_addiu_a2_a0(pref_offset_copy);
455 dest = label();
456 loop_start = store_offset;
457 do {
458 __build_load_reg( 8);
459 __build_load_reg( 9);
460 __build_load_reg(10);
461 __build_load_reg(11);
462 __build_store_reg( 8);
463 __build_store_reg( 9);
464 __build_store_reg(10);
465 __build_store_reg(11);
466 } while ((store_offset - loop_start) < half_scache_line_size());
467 build_addiu_a0(2 * store_offset);
468 build_addiu_a1(2 * load_offset);
469 loop_start = store_offset;
470 do {
471 __build_load_reg( 8);
472 __build_load_reg( 9);
473 __build_load_reg(10);
474 __build_load_reg(11);
475 __build_store_reg( 8);
476 __build_store_reg( 9);
477 __build_store_reg(10);
478 __build_store_reg(11);
479 } while ((store_offset - loop_start) < half_scache_line_size());
480 build_bne(dest);
481 }
482
483 build_jr_ra();
484
485 flush_icache_range((unsigned long)&copy_page_array,
486 (unsigned long) epc);
487
488 BUG_ON(epc > copy_page_array + ARRAY_SIZE(copy_page_array));
489}
diff --git a/arch/mips/mm/pg-sb1.c b/arch/mips/mm/pg-sb1.c
new file mode 100644
index 000000000000..59d131b5e536
--- /dev/null
+++ b/arch/mips/mm/pg-sb1.c
@@ -0,0 +1,287 @@
1/*
2 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
3 * Copyright (C) 1997, 2001 Ralf Baechle (ralf@gnu.org)
4 * Copyright (C) 2000 SiByte, Inc.
5 * Copyright (C) 2005 Thiemo Seufer
6 *
7 * Written by Justin Carlson of SiByte, Inc.
8 * and Kip Walker of Broadcom Corp.
9 *
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 */
25#include <linux/config.h>
26#include <linux/module.h>
27#include <linux/sched.h>
28#include <linux/smp.h>
29
30#include <asm/io.h>
31#include <asm/sibyte/sb1250.h>
32#include <asm/sibyte/sb1250_regs.h>
33#include <asm/sibyte/sb1250_dma.h>
34
35#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
36#define SB1_PREF_LOAD_STREAMED_HINT "0"
37#define SB1_PREF_STORE_STREAMED_HINT "1"
38#else
39#define SB1_PREF_LOAD_STREAMED_HINT "4"
40#define SB1_PREF_STORE_STREAMED_HINT "5"
41#endif
42
43static inline void clear_page_cpu(void *page)
44{
45 unsigned char *addr = (unsigned char *) page;
46 unsigned char *end = addr + PAGE_SIZE;
47
48 /*
49 * JDCXXX - This should be bottlenecked by the write buffer, but these
50 * things tend to be mildly unpredictable...should check this on the
51 * performance model
52 *
53 * We prefetch 4 lines ahead. We're also "cheating" slightly here...
54 * since we know we're on an SB1, we force the assembler to take
55 * 64-bit operands to speed things up
56 */
57 __asm__ __volatile__(
58 " .set push \n"
59 " .set mips4 \n"
60 " .set noreorder \n"
61#ifdef CONFIG_CPU_HAS_PREFETCH
62 " daddiu %0, %0, 128 \n"
63 " pref " SB1_PREF_STORE_STREAMED_HINT ", -128(%0) \n" /* Prefetch the first 4 lines */
64 " pref " SB1_PREF_STORE_STREAMED_HINT ", -96(%0) \n"
65 " pref " SB1_PREF_STORE_STREAMED_HINT ", -64(%0) \n"
66 " pref " SB1_PREF_STORE_STREAMED_HINT ", -32(%0) \n"
67 "1: sd $0, -128(%0) \n" /* Throw out a cacheline of 0's */
68 " sd $0, -120(%0) \n"
69 " sd $0, -112(%0) \n"
70 " sd $0, -104(%0) \n"
71 " daddiu %0, %0, 32 \n"
72 " bnel %0, %1, 1b \n"
73 " pref " SB1_PREF_STORE_STREAMED_HINT ", -32(%0) \n"
74 " daddiu %0, %0, -128 \n"
75#endif
76 " sd $0, 0(%0) \n" /* Throw out a cacheline of 0's */
77 "1: sd $0, 8(%0) \n"
78 " sd $0, 16(%0) \n"
79 " sd $0, 24(%0) \n"
80 " daddiu %0, %0, 32 \n"
81 " bnel %0, %1, 1b \n"
82 " sd $0, 0(%0) \n"
83 " .set pop \n"
84 : "+r" (addr)
85 : "r" (end)
86 : "memory");
87}
88
89static inline void copy_page_cpu(void *to, void *from)
90{
91 unsigned char *src = (unsigned char *)from;
92 unsigned char *dst = (unsigned char *)to;
93 unsigned char *end = src + PAGE_SIZE;
94
95 /*
96 * The pref's used here are using "streaming" hints, which cause the
97 * copied data to be kicked out of the cache sooner. A page copy often
98 * ends up copying a lot more data than is commonly used, so this seems
99 * to make sense in terms of reducing cache pollution, but I've no real
100 * performance data to back this up
101 */
102 __asm__ __volatile__(
103 " .set push \n"
104 " .set mips4 \n"
105 " .set noreorder \n"
106#ifdef CONFIG_CPU_HAS_PREFETCH
107 " daddiu %0, %0, 128 \n"
108 " daddiu %1, %1, 128 \n"
109 " pref " SB1_PREF_LOAD_STREAMED_HINT ", -128(%0)\n" /* Prefetch the first 4 lines */
110 " pref " SB1_PREF_STORE_STREAMED_HINT ", -128(%1)\n"
111 " pref " SB1_PREF_LOAD_STREAMED_HINT ", -96(%0)\n"
112 " pref " SB1_PREF_STORE_STREAMED_HINT ", -96(%1)\n"
113 " pref " SB1_PREF_LOAD_STREAMED_HINT ", -64(%0)\n"
114 " pref " SB1_PREF_STORE_STREAMED_HINT ", -64(%1)\n"
115 " pref " SB1_PREF_LOAD_STREAMED_HINT ", -32(%0)\n"
116 "1: pref " SB1_PREF_STORE_STREAMED_HINT ", -32(%1)\n"
117# ifdef CONFIG_MIPS64
118 " ld $8, -128(%0) \n" /* Block copy a cacheline */
119 " ld $9, -120(%0) \n"
120 " ld $10, -112(%0) \n"
121 " ld $11, -104(%0) \n"
122 " sd $8, -128(%1) \n"
123 " sd $9, -120(%1) \n"
124 " sd $10, -112(%1) \n"
125 " sd $11, -104(%1) \n"
126# else
127 " lw $2, -128(%0) \n" /* Block copy a cacheline */
128 " lw $3, -124(%0) \n"
129 " lw $6, -120(%0) \n"
130 " lw $7, -116(%0) \n"
131 " lw $8, -112(%0) \n"
132 " lw $9, -108(%0) \n"
133 " lw $10, -104(%0) \n"
134 " lw $11, -100(%0) \n"
135 " sw $2, -128(%1) \n"
136 " sw $3, -124(%1) \n"
137 " sw $6, -120(%1) \n"
138 " sw $7, -116(%1) \n"
139 " sw $8, -112(%1) \n"
140 " sw $9, -108(%1) \n"
141 " sw $10, -104(%1) \n"
142 " sw $11, -100(%1) \n"
143# endif
144 " daddiu %0, %0, 32 \n"
145 " daddiu %1, %1, 32 \n"
146 " bnel %0, %2, 1b \n"
147 " pref " SB1_PREF_LOAD_STREAMED_HINT ", -32(%0)\n"
148 " daddiu %0, %0, -128 \n"
149 " daddiu %1, %1, -128 \n"
150#endif
151#ifdef CONFIG_MIPS64
152 " ld $8, 0(%0) \n" /* Block copy a cacheline */
153 "1: ld $9, 8(%0) \n"
154 " ld $10, 16(%0) \n"
155 " ld $11, 24(%0) \n"
156 " sd $8, 0(%1) \n"
157 " sd $9, 8(%1) \n"
158 " sd $10, 16(%1) \n"
159 " sd $11, 24(%1) \n"
160#else
161 " lw $2, 0(%0) \n" /* Block copy a cacheline */
162 "1: lw $3, 4(%0) \n"
163 " lw $6, 8(%0) \n"
164 " lw $7, 12(%0) \n"
165 " lw $8, 16(%0) \n"
166 " lw $9, 20(%0) \n"
167 " lw $10, 24(%0) \n"
168 " lw $11, 28(%0) \n"
169 " sw $2, 0(%1) \n"
170 " sw $3, 4(%1) \n"
171 " sw $6, 8(%1) \n"
172 " sw $7, 12(%1) \n"
173 " sw $8, 16(%1) \n"
174 " sw $9, 20(%1) \n"
175 " sw $10, 24(%1) \n"
176 " sw $11, 28(%1) \n"
177#endif
178 " daddiu %0, %0, 32 \n"
179 " daddiu %1, %1, 32 \n"
180 " bnel %0, %2, 1b \n"
181#ifdef CONFIG_MIPS64
182 " ld $8, 0(%0) \n"
183#else
184 " lw $2, 0(%0) \n"
185#endif
186 " .set pop \n"
187 : "+r" (src), "+r" (dst)
188 : "r" (end)
189#ifdef CONFIG_MIPS64
190 : "$8","$9","$10","$11","memory");
191#else
192 : "$2","$3","$6","$7","$8","$9","$10","$11","memory");
193#endif
194}
195
196
197#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
198
199/*
200 * Pad descriptors to cacheline, since each is exclusively owned by a
201 * particular CPU.
202 */
203typedef struct dmadscr_s {
204 u64 dscr_a;
205 u64 dscr_b;
206 u64 pad_a;
207 u64 pad_b;
208} dmadscr_t;
209
210static dmadscr_t page_descr[NR_CPUS] __attribute__((aligned(SMP_CACHE_BYTES)));
211
212void sb1_dma_init(void)
213{
214 int cpu = smp_processor_id();
215 u64 base_val = CPHYSADDR(&page_descr[cpu]) | V_DM_DSCR_BASE_RINGSZ(1);
216
217 bus_writeq(base_val,
218 (void *)IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE)));
219 bus_writeq(base_val | M_DM_DSCR_BASE_RESET,
220 (void *)IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE)));
221 bus_writeq(base_val | M_DM_DSCR_BASE_ENABL,
222 (void *)IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE)));
223}
224
225void clear_page(void *page)
226{
227 int cpu = smp_processor_id();
228
229 /* if the page is above Kseg0, use old way */
230 if ((long)KSEGX(page) != (long)CKSEG0)
231 return clear_page_cpu(page);
232
233 page_descr[cpu].dscr_a = CPHYSADDR(page) | M_DM_DSCRA_ZERO_MEM | M_DM_DSCRA_L2C_DEST | M_DM_DSCRA_INTERRUPT;
234 page_descr[cpu].dscr_b = V_DM_DSCRB_SRC_LENGTH(PAGE_SIZE);
235 bus_writeq(1, (void *)IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_COUNT)));
236
237 /*
238 * Don't really want to do it this way, but there's no
239 * reliable way to delay completion detection.
240 */
241 while (!(bus_readq((void *)(IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE_DEBUG)) &
242 M_DM_DSCR_BASE_INTERRUPT))))
243 ;
244 bus_readq((void *)IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE)));
245}
246
247void copy_page(void *to, void *from)
248{
249 unsigned long from_phys = CPHYSADDR(from);
250 unsigned long to_phys = CPHYSADDR(to);
251 int cpu = smp_processor_id();
252
253 /* if either page is above Kseg0, use old way */
254 if ((long)KSEGX(to) != (long)CKSEG0
255 || (long)KSEGX(from) != (long)CKSEG0)
256 return copy_page_cpu(to, from);
257
258 page_descr[cpu].dscr_a = CPHYSADDR(to_phys) | M_DM_DSCRA_L2C_DEST | M_DM_DSCRA_INTERRUPT;
259 page_descr[cpu].dscr_b = CPHYSADDR(from_phys) | V_DM_DSCRB_SRC_LENGTH(PAGE_SIZE);
260 bus_writeq(1, (void *)IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_COUNT)));
261
262 /*
263 * Don't really want to do it this way, but there's no
264 * reliable way to delay completion detection.
265 */
266 while (!(bus_readq((void *)(IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE_DEBUG)) &
267 M_DM_DSCR_BASE_INTERRUPT))))
268 ;
269 bus_readq((void *)IOADDR(A_DM_REGISTER(cpu, R_DM_DSCR_BASE)));
270}
271
272#else /* !CONFIG_SIBYTE_DMA_PAGEOPS */
273
274void clear_page(void *page)
275{
276 return clear_page_cpu(page);
277}
278
279void copy_page(void *to, void *from)
280{
281 return copy_page_cpu(to, from);
282}
283
284#endif /* !CONFIG_SIBYTE_DMA_PAGEOPS */
285
286EXPORT_SYMBOL(clear_page);
287EXPORT_SYMBOL(copy_page);
diff --git a/arch/mips/mm/pgtable-32.c b/arch/mips/mm/pgtable-32.c
new file mode 100644
index 000000000000..4f07f81e8500
--- /dev/null
+++ b/arch/mips/mm/pgtable-32.c
@@ -0,0 +1,97 @@
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) 2003 by Ralf Baechle
7 */
8#include <linux/config.h>
9#include <linux/init.h>
10#include <linux/mm.h>
11#include <linux/bootmem.h>
12#include <linux/highmem.h>
13#include <asm/pgtable.h>
14
15void pgd_init(unsigned long page)
16{
17 unsigned long *p = (unsigned long *) page;
18 int i;
19
20 for (i = 0; i < USER_PTRS_PER_PGD; i+=8) {
21 p[i + 0] = (unsigned long) invalid_pte_table;
22 p[i + 1] = (unsigned long) invalid_pte_table;
23 p[i + 2] = (unsigned long) invalid_pte_table;
24 p[i + 3] = (unsigned long) invalid_pte_table;
25 p[i + 4] = (unsigned long) invalid_pte_table;
26 p[i + 5] = (unsigned long) invalid_pte_table;
27 p[i + 6] = (unsigned long) invalid_pte_table;
28 p[i + 7] = (unsigned long) invalid_pte_table;
29 }
30}
31
32#ifdef CONFIG_HIGHMEM
33static void __init fixrange_init (unsigned long start, unsigned long end,
34 pgd_t *pgd_base)
35{
36 pgd_t *pgd;
37 pmd_t *pmd;
38 pte_t *pte;
39 int i, j;
40 unsigned long vaddr;
41
42 vaddr = start;
43 i = __pgd_offset(vaddr);
44 j = __pmd_offset(vaddr);
45 pgd = pgd_base + i;
46
47 for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) {
48 pmd = (pmd_t *)pgd;
49 for (; (j < PTRS_PER_PMD) && (vaddr != end); pmd++, j++) {
50 if (pmd_none(*pmd)) {
51 pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
52 set_pmd(pmd, __pmd((unsigned long)pte));
53 if (pte != pte_offset_kernel(pmd, 0))
54 BUG();
55 }
56 vaddr += PMD_SIZE;
57 }
58 j = 0;
59 }
60}
61#endif
62
63void __init pagetable_init(void)
64{
65#ifdef CONFIG_HIGHMEM
66 unsigned long vaddr;
67 pgd_t *pgd, *pgd_base;
68 pmd_t *pmd;
69 pte_t *pte;
70#endif
71
72 /* Initialize the entire pgd. */
73 pgd_init((unsigned long)swapper_pg_dir);
74 pgd_init((unsigned long)swapper_pg_dir
75 + sizeof(pgd_t) * USER_PTRS_PER_PGD);
76
77#ifdef CONFIG_HIGHMEM
78 pgd_base = swapper_pg_dir;
79
80 /*
81 * Fixed mappings:
82 */
83 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
84 fixrange_init(vaddr, 0, pgd_base);
85
86 /*
87 * Permanent kmaps:
88 */
89 vaddr = PKMAP_BASE;
90 fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
91
92 pgd = swapper_pg_dir + __pgd_offset(vaddr);
93 pmd = pmd_offset(pgd, vaddr);
94 pte = pte_offset_kernel(pmd, vaddr);
95 pkmap_page_table = pte;
96#endif
97}
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c
new file mode 100644
index 000000000000..44b5e97fff65
--- /dev/null
+++ b/arch/mips/mm/pgtable-64.c
@@ -0,0 +1,58 @@
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) 1999, 2000 by Silicon Graphics
7 * Copyright (C) 2003 by Ralf Baechle
8 */
9#include <linux/init.h>
10#include <linux/mm.h>
11#include <asm/pgtable.h>
12
13void pgd_init(unsigned long page)
14{
15 unsigned long *p, *end;
16
17 p = (unsigned long *) page;
18 end = p + PTRS_PER_PGD;
19
20 while (p < end) {
21 p[0] = (unsigned long) invalid_pmd_table;
22 p[1] = (unsigned long) invalid_pmd_table;
23 p[2] = (unsigned long) invalid_pmd_table;
24 p[3] = (unsigned long) invalid_pmd_table;
25 p[4] = (unsigned long) invalid_pmd_table;
26 p[5] = (unsigned long) invalid_pmd_table;
27 p[6] = (unsigned long) invalid_pmd_table;
28 p[7] = (unsigned long) invalid_pmd_table;
29 p += 8;
30 }
31}
32
33void pmd_init(unsigned long addr, unsigned long pagetable)
34{
35 unsigned long *p, *end;
36
37 p = (unsigned long *) addr;
38 end = p + PTRS_PER_PMD;
39
40 while (p < end) {
41 p[0] = (unsigned long)pagetable;
42 p[1] = (unsigned long)pagetable;
43 p[2] = (unsigned long)pagetable;
44 p[3] = (unsigned long)pagetable;
45 p[4] = (unsigned long)pagetable;
46 p[5] = (unsigned long)pagetable;
47 p[6] = (unsigned long)pagetable;
48 p[7] = (unsigned long)pagetable;
49 p += 8;
50 }
51}
52
53void __init pagetable_init(void)
54{
55 /* Initialize the entire pgd. */
56 pgd_init((unsigned long)swapper_pg_dir);
57 pmd_init((unsigned long)invalid_pmd_table, (unsigned long)invalid_pte_table);
58}
diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c
new file mode 100644
index 000000000000..3b88fdeef329
--- /dev/null
+++ b/arch/mips/mm/pgtable.c
@@ -0,0 +1,36 @@
1#include <linux/config.h>
2#include <linux/kernel.h>
3#include <linux/mm.h>
4#include <linux/swap.h>
5
6void show_mem(void)
7{
8#ifndef CONFIG_DISCONTIGMEM /* XXX(hch): later.. */
9 int pfn, total = 0, reserved = 0;
10 int shared = 0, cached = 0;
11 int highmem = 0;
12 struct page *page;
13
14 printk("Mem-info:\n");
15 show_free_areas();
16 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
17 pfn = max_mapnr;
18 while (pfn-- > 0) {
19 page = pfn_to_page(pfn);
20 total++;
21 if (PageHighMem(page))
22 highmem++;
23 if (PageReserved(page))
24 reserved++;
25 else if (PageSwapCache(page))
26 cached++;
27 else if (page_count(page))
28 shared += page_count(page) - 1;
29 }
30 printk("%d pages of RAM\n", total);
31 printk("%d pages of HIGHMEM\n",highmem);
32 printk("%d reserved pages\n",reserved);
33 printk("%d pages shared\n",shared);
34 printk("%d pages swap cached\n",cached);
35#endif
36}
diff --git a/arch/mips/mm/sc-ip22.c b/arch/mips/mm/sc-ip22.c
new file mode 100644
index 000000000000..d236cf8b7374
--- /dev/null
+++ b/arch/mips/mm/sc-ip22.c
@@ -0,0 +1,177 @@
1/*
2 * sc-ip22.c: Indy cache management functions.
3 *
4 * Copyright (C) 1997, 2001 Ralf Baechle (ralf@gnu.org),
5 * derived from r4xx0.c by David S. Miller (dm@engr.sgi.com).
6 */
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/mm.h>
11
12#include <asm/bcache.h>
13#include <asm/page.h>
14#include <asm/pgtable.h>
15#include <asm/system.h>
16#include <asm/bootinfo.h>
17#include <asm/sgi/ip22.h>
18#include <asm/sgi/mc.h>
19
20/* Secondary cache size in bytes, if present. */
21static unsigned long scache_size;
22
23#undef DEBUG_CACHE
24
25#define SC_SIZE 0x00080000
26#define SC_LINE 32
27#define CI_MASK (SC_SIZE - SC_LINE)
28#define SC_INDEX(n) ((n) & CI_MASK)
29
30static inline void indy_sc_wipe(unsigned long first, unsigned long last)
31{
32 unsigned long tmp;
33
34 __asm__ __volatile__(
35 ".set\tpush\t\t\t# indy_sc_wipe\n\t"
36 ".set\tnoreorder\n\t"
37 ".set\tmips3\n\t"
38 ".set\tnoat\n\t"
39 "mfc0\t%2, $12\n\t"
40 "li\t$1, 0x80\t\t\t# Go 64 bit\n\t"
41 "mtc0\t$1, $12\n\t"
42
43 "dli\t$1, 0x9000000080000000\n\t"
44 "or\t%0, $1\t\t\t# first line to flush\n\t"
45 "or\t%1, $1\t\t\t# last line to flush\n\t"
46 ".set\tat\n\t"
47
48 "1:\tsw\t$0, 0(%0)\n\t"
49 "bne\t%0, %1, 1b\n\t"
50 " daddu\t%0, 32\n\t"
51
52 "mtc0\t%2, $12\t\t\t# Back to 32 bit\n\t"
53 "nop; nop; nop; nop;\n\t"
54 ".set\tpop"
55 : "=r" (first), "=r" (last), "=&r" (tmp)
56 : "0" (first), "1" (last));
57}
58
59static void indy_sc_wback_invalidate(unsigned long addr, unsigned long size)
60{
61 unsigned long first_line, last_line;
62 unsigned long flags;
63
64#ifdef DEBUG_CACHE
65 printk("indy_sc_wback_invalidate[%08lx,%08lx]", addr, size);
66#endif
67
68 /* Catch bad driver code */
69 BUG_ON(size == 0);
70
71 /* Which lines to flush? */
72 first_line = SC_INDEX(addr);
73 last_line = SC_INDEX(addr + size - 1);
74
75 local_irq_save(flags);
76 if (first_line <= last_line) {
77 indy_sc_wipe(first_line, last_line);
78 goto out;
79 }
80
81 indy_sc_wipe(first_line, SC_SIZE - SC_LINE);
82 indy_sc_wipe(0, last_line);
83out:
84 local_irq_restore(flags);
85}
86
87static void indy_sc_enable(void)
88{
89 unsigned long addr, tmp1, tmp2;
90
91 /* This is really cool... */
92#ifdef DEBUG_CACHE
93 printk("Enabling R4600 SCACHE\n");
94#endif
95 __asm__ __volatile__(
96 ".set\tpush\n\t"
97 ".set\tnoreorder\n\t"
98 ".set\tmips3\n\t"
99 "mfc0\t%2, $12\n\t"
100 "nop; nop; nop; nop;\n\t"
101 "li\t%1, 0x80\n\t"
102 "mtc0\t%1, $12\n\t"
103 "nop; nop; nop; nop;\n\t"
104 "li\t%0, 0x1\n\t"
105 "dsll\t%0, 31\n\t"
106 "lui\t%1, 0x9000\n\t"
107 "dsll32\t%1, 0\n\t"
108 "or\t%0, %1, %0\n\t"
109 "sb\t$0, 0(%0)\n\t"
110 "mtc0\t$0, $12\n\t"
111 "nop; nop; nop; nop;\n\t"
112 "mtc0\t%2, $12\n\t"
113 "nop; nop; nop; nop;\n\t"
114 ".set\tpop"
115 : "=r" (tmp1), "=r" (tmp2), "=r" (addr));
116}
117
118static void indy_sc_disable(void)
119{
120 unsigned long tmp1, tmp2, tmp3;
121
122#ifdef DEBUG_CACHE
123 printk("Disabling R4600 SCACHE\n");
124#endif
125 __asm__ __volatile__(
126 ".set\tpush\n\t"
127 ".set\tnoreorder\n\t"
128 ".set\tmips3\n\t"
129 "li\t%0, 0x1\n\t"
130 "dsll\t%0, 31\n\t"
131 "lui\t%1, 0x9000\n\t"
132 "dsll32\t%1, 0\n\t"
133 "or\t%0, %1, %0\n\t"
134 "mfc0\t%2, $12\n\t"
135 "nop; nop; nop; nop\n\t"
136 "li\t%1, 0x80\n\t"
137 "mtc0\t%1, $12\n\t"
138 "nop; nop; nop; nop\n\t"
139 "sh\t$0, 0(%0)\n\t"
140 "mtc0\t$0, $12\n\t"
141 "nop; nop; nop; nop\n\t"
142 "mtc0\t%2, $12\n\t"
143 "nop; nop; nop; nop\n\t"
144 ".set\tpop"
145 : "=r" (tmp1), "=r" (tmp2), "=r" (tmp3));
146}
147
148static inline int __init indy_sc_probe(void)
149{
150 unsigned int size = ip22_eeprom_read(&sgimc->eeprom, 17);
151 if (size == 0)
152 return 0;
153
154 size <<= PAGE_SHIFT;
155 printk(KERN_INFO "R4600/R5000 SCACHE size %dK, linesize 32 bytes.\n",
156 size >> 10);
157 scache_size = size;
158
159 return 1;
160}
161
162/* XXX Check with wje if the Indy caches can differenciate between
163 writeback + invalidate and just invalidate. */
164struct bcache_ops indy_sc_ops = {
165 .bc_enable = indy_sc_enable,
166 .bc_disable = indy_sc_disable,
167 .bc_wback_inv = indy_sc_wback_invalidate,
168 .bc_inv = indy_sc_wback_invalidate
169};
170
171void __init indy_sc_init(void)
172{
173 if (indy_sc_probe()) {
174 indy_sc_enable();
175 bcops = &indy_sc_ops;
176 }
177}
diff --git a/arch/mips/mm/sc-r5k.c b/arch/mips/mm/sc-r5k.c
new file mode 100644
index 000000000000..d35b6c1103a3
--- /dev/null
+++ b/arch/mips/mm/sc-r5k.c
@@ -0,0 +1,108 @@
1/*
2 * Copyright (C) 1997, 2001 Ralf Baechle (ralf@gnu.org),
3 * derived from r4xx0.c by David S. Miller (dm@engr.sgi.com).
4 */
5#include <linux/init.h>
6#include <linux/kernel.h>
7#include <linux/sched.h>
8#include <linux/mm.h>
9
10#include <asm/mipsregs.h>
11#include <asm/bcache.h>
12#include <asm/cacheops.h>
13#include <asm/page.h>
14#include <asm/pgtable.h>
15#include <asm/system.h>
16#include <asm/mmu_context.h>
17#include <asm/r4kcache.h>
18
19/* Secondary cache size in bytes, if present. */
20static unsigned long scache_size;
21
22#define SC_LINE 32
23#define SC_PAGE (128*SC_LINE)
24
25static inline void blast_r5000_scache(void)
26{
27 unsigned long start = INDEX_BASE;
28 unsigned long end = start + scache_size;
29
30 while(start < end) {
31 cache_op(R5K_Page_Invalidate_S, start);
32 start += SC_PAGE;
33 }
34}
35
36static void r5k_dma_cache_inv_sc(unsigned long addr, unsigned long size)
37{
38 unsigned long end, a;
39
40 /* Catch bad driver code */
41 BUG_ON(size == 0);
42
43 if (size >= scache_size) {
44 blast_r5000_scache();
45 return;
46 }
47
48 /* On the R5000 secondary cache we cannot
49 * invalidate less than a page at a time.
50 * The secondary cache is physically indexed, write-through.
51 */
52 a = addr & ~(SC_PAGE - 1);
53 end = (addr + size - 1) & ~(SC_PAGE - 1);
54 while (a <= end) {
55 cache_op(R5K_Page_Invalidate_S, a);
56 a += SC_PAGE;
57 }
58}
59
60static void r5k_sc_enable(void)
61{
62 unsigned long flags;
63
64 local_irq_save(flags);
65 set_c0_config(R5K_CONF_SE);
66 blast_r5000_scache();
67 local_irq_restore(flags);
68}
69
70static void r5k_sc_disable(void)
71{
72 unsigned long flags;
73
74 local_irq_save(flags);
75 blast_r5000_scache();
76 clear_c0_config(R5K_CONF_SE);
77 local_irq_restore(flags);
78}
79
80static inline int __init r5k_sc_probe(void)
81{
82 unsigned long config = read_c0_config();
83
84 if (config & CONF_SC)
85 return(0);
86
87 scache_size = (512 * 1024) << ((config & R5K_CONF_SS) >> 20);
88
89 printk("R5000 SCACHE size %ldkB, linesize 32 bytes.\n",
90 scache_size >> 10);
91
92 return 1;
93}
94
95static struct bcache_ops r5k_sc_ops = {
96 .bc_enable = r5k_sc_enable,
97 .bc_disable = r5k_sc_disable,
98 .bc_wback_inv = r5k_dma_cache_inv_sc,
99 .bc_inv = r5k_dma_cache_inv_sc
100};
101
102void __init r5k_sc_init(void)
103{
104 if (r5k_sc_probe()) {
105 r5k_sc_enable();
106 bcops = &r5k_sc_ops;
107 }
108}
diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c
new file mode 100644
index 000000000000..4e92f931aaba
--- /dev/null
+++ b/arch/mips/mm/sc-rm7k.c
@@ -0,0 +1,193 @@
1/*
2 * sc-rm7k.c: RM7000 cache management functions.
3 *
4 * Copyright (C) 1997, 2001, 2003, 2004 Ralf Baechle (ralf@linux-mips.org)
5 */
6
7#undef DEBUG
8
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/mm.h>
12
13#include <asm/addrspace.h>
14#include <asm/bcache.h>
15#include <asm/cacheops.h>
16#include <asm/mipsregs.h>
17#include <asm/processor.h>
18
19/* Primary cache parameters. */
20#define sc_lsize 32
21#define tc_pagesize (32*128)
22
23/* Secondary cache parameters. */
24#define scache_size (256*1024) /* Fixed to 256KiB on RM7000 */
25
26extern unsigned long icache_way_size, dcache_way_size;
27
28#include <asm/r4kcache.h>
29
30int rm7k_tcache_enabled;
31
32/*
33 * Writeback and invalidate the primary cache dcache before DMA.
34 * (XXX These need to be fixed ...)
35 */
36static void rm7k_sc_wback_inv(unsigned long addr, unsigned long size)
37{
38 unsigned long end, a;
39
40 pr_debug("rm7k_sc_wback_inv[%08lx,%08lx]", addr, size);
41
42 /* Catch bad driver code */
43 BUG_ON(size == 0);
44
45 a = addr & ~(sc_lsize - 1);
46 end = (addr + size - 1) & ~(sc_lsize - 1);
47 while (1) {
48 flush_scache_line(a); /* Hit_Writeback_Inv_SD */
49 if (a == end)
50 break;
51 a += sc_lsize;
52 }
53
54 if (!rm7k_tcache_enabled)
55 return;
56
57 a = addr & ~(tc_pagesize - 1);
58 end = (addr + size - 1) & ~(tc_pagesize - 1);
59 while(1) {
60 invalidate_tcache_page(a); /* Page_Invalidate_T */
61 if (a == end)
62 break;
63 a += tc_pagesize;
64 }
65}
66
67static void rm7k_sc_inv(unsigned long addr, unsigned long size)
68{
69 unsigned long end, a;
70
71 pr_debug("rm7k_sc_inv[%08lx,%08lx]", addr, size);
72
73 /* Catch bad driver code */
74 BUG_ON(size == 0);
75
76 a = addr & ~(sc_lsize - 1);
77 end = (addr + size - 1) & ~(sc_lsize - 1);
78 while (1) {
79 invalidate_scache_line(a); /* Hit_Invalidate_SD */
80 if (a == end)
81 break;
82 a += sc_lsize;
83 }
84
85 if (!rm7k_tcache_enabled)
86 return;
87
88 a = addr & ~(tc_pagesize - 1);
89 end = (addr + size - 1) & ~(tc_pagesize - 1);
90 while(1) {
91 invalidate_tcache_page(a); /* Page_Invalidate_T */
92 if (a == end)
93 break;
94 a += tc_pagesize;
95 }
96}
97
98/*
99 * This function is executed in the uncached segment CKSEG1.
100 * It must not touch the stack, because the stack pointer still points
101 * into CKSEG0.
102 *
103 * Three options:
104 * - Write it in assembly and guarantee that we don't use the stack.
105 * - Disable caching for CKSEG0 before calling it.
106 * - Pray that GCC doesn't randomly start using the stack.
107 *
108 * This being Linux, we obviously take the least sane of those options -
109 * following DaveM's lead in c-r4k.c
110 *
111 * It seems we get our kicks from relying on unguaranteed behaviour in GCC
112 */
113static __init void __rm7k_sc_enable(void)
114{
115 int i;
116
117 set_c0_config(1 << 3); /* CONF_SE */
118
119 write_c0_taglo(0);
120 write_c0_taghi(0);
121
122 for (i = 0; i < scache_size; i += sc_lsize) {
123 __asm__ __volatile__ (
124 ".set noreorder\n\t"
125 ".set mips3\n\t"
126 "cache %1, (%0)\n\t"
127 ".set mips0\n\t"
128 ".set reorder"
129 :
130 : "r" (KSEG0ADDR(i)), "i" (Index_Store_Tag_SD));
131 }
132}
133
134static __init void rm7k_sc_enable(void)
135{
136 void (*func)(void) = (void *) KSEG1ADDR(&__rm7k_sc_enable);
137
138 if (read_c0_config() & 0x08) /* CONF_SE */
139 return;
140
141 printk(KERN_INFO "Enabling secondary cache...");
142 func();
143}
144
145static void rm7k_sc_disable(void)
146{
147 clear_c0_config(1<<3); /* CONF_SE */
148}
149
150struct bcache_ops rm7k_sc_ops = {
151 .bc_enable = rm7k_sc_enable,
152 .bc_disable = rm7k_sc_disable,
153 .bc_wback_inv = rm7k_sc_wback_inv,
154 .bc_inv = rm7k_sc_inv
155};
156
157void __init rm7k_sc_init(void)
158{
159 unsigned int config = read_c0_config();
160
161 if ((config >> 31) & 1) /* Bit 31 set -> no S-Cache */
162 return;
163
164 printk(KERN_INFO "Secondary cache size %dK, linesize %d bytes.\n",
165 (scache_size >> 10), sc_lsize);
166
167 if (!((config >> 3) & 1)) /* CONF_SE */
168 rm7k_sc_enable();
169
170 /*
171 * While we're at it let's deal with the tertiary cache.
172 */
173 if (!((config >> 17) & 1)) {
174
175 /*
176 * We can't enable the L3 cache yet. There may be board-specific
177 * magic necessary to turn it on, and blindly asking the CPU to
178 * start using it would may give cache errors.
179 *
180 * Also, board-specific knowledge may allow us to use the
181 * CACHE Flash_Invalidate_T instruction if the tag RAM supports
182 * it, and may specify the size of the L3 cache so we don't have
183 * to probe it.
184 */
185 printk(KERN_INFO "Tertiary cache present, %s enabled\n",
186 config&(1<<12) ? "already" : "not (yet)");
187
188 if ((config >> 12) & 1)
189 rm7k_tcache_enabled = 1;
190 }
191
192 bcops = &rm7k_sc_ops;
193}
diff --git a/arch/mips/mm/tlb-andes.c b/arch/mips/mm/tlb-andes.c
new file mode 100644
index 000000000000..167e08e9661a
--- /dev/null
+++ b/arch/mips/mm/tlb-andes.c
@@ -0,0 +1,257 @@
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) 1997, 1998, 1999 Ralf Baechle (ralf@gnu.org)
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 * Copyright (C) 2000 Kanoj Sarcar (kanoj@sgi.com)
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/sched.h>
13#include <linux/mm.h>
14#include <asm/page.h>
15#include <asm/pgtable.h>
16#include <asm/system.h>
17#include <asm/mmu_context.h>
18
19extern void build_tlb_refill_handler(void);
20
21#define NTLB_ENTRIES 64
22#define NTLB_ENTRIES_HALF 32
23
24void local_flush_tlb_all(void)
25{
26 unsigned long flags;
27 unsigned long old_ctx;
28 unsigned long entry;
29
30 local_irq_save(flags);
31 /* Save old context and create impossible VPN2 value */
32 old_ctx = read_c0_entryhi() & ASID_MASK;
33 write_c0_entryhi(CKSEG0);
34 write_c0_entrylo0(0);
35 write_c0_entrylo1(0);
36
37 entry = read_c0_wired();
38
39 /* Blast 'em all away. */
40 while (entry < NTLB_ENTRIES) {
41 write_c0_index(entry);
42 tlb_write_indexed();
43 entry++;
44 }
45 write_c0_entryhi(old_ctx);
46 local_irq_restore(flags);
47}
48
49void local_flush_tlb_mm(struct mm_struct *mm)
50{
51 int cpu = smp_processor_id();
52 if (cpu_context(cpu, mm) != 0) {
53 drop_mmu_context(mm,cpu);
54 }
55}
56
57void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
58 unsigned long end)
59{
60 struct mm_struct *mm = vma->vm_mm;
61 int cpu = smp_processor_id();
62
63 if (cpu_context(cpu, mm) != 0) {
64 unsigned long flags;
65 int size;
66
67 local_irq_save(flags);
68 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
69 size = (size + 1) >> 1;
70 if (size <= NTLB_ENTRIES_HALF) {
71 int oldpid = (read_c0_entryhi() & ASID_MASK);
72 int newpid = (cpu_context(smp_processor_id(), mm)
73 & ASID_MASK);
74
75 start &= (PAGE_MASK << 1);
76 end += ((PAGE_SIZE << 1) - 1);
77 end &= (PAGE_MASK << 1);
78 while(start < end) {
79 int idx;
80
81 write_c0_entryhi(start | newpid);
82 start += (PAGE_SIZE << 1);
83 tlb_probe();
84 idx = read_c0_index();
85 write_c0_entrylo0(0);
86 write_c0_entrylo1(0);
87 write_c0_entryhi(CKSEG0);
88 if(idx < 0)
89 continue;
90 tlb_write_indexed();
91 }
92 write_c0_entryhi(oldpid);
93 } else {
94 drop_mmu_context(mm, cpu);
95 }
96 local_irq_restore(flags);
97 }
98}
99
100void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
101{
102 unsigned long flags;
103 int size;
104
105 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
106 size = (size + 1) >> 1;
107
108 local_irq_save(flags);
109 if (size <= NTLB_ENTRIES_HALF) {
110 int pid = read_c0_entryhi();
111
112 start &= (PAGE_MASK << 1);
113 end += ((PAGE_SIZE << 1) - 1);
114 end &= (PAGE_MASK << 1);
115
116 while (start < end) {
117 int idx;
118
119 write_c0_entryhi(start);
120 start += (PAGE_SIZE << 1);
121 tlb_probe();
122 idx = read_c0_index();
123 write_c0_entrylo0(0);
124 write_c0_entrylo1(0);
125 write_c0_entryhi(CKSEG0 + (idx << (PAGE_SHIFT+1)));
126 if (idx < 0)
127 continue;
128 tlb_write_indexed();
129 }
130 write_c0_entryhi(pid);
131 } else {
132 local_flush_tlb_all();
133 }
134 local_irq_restore(flags);
135}
136
137void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
138{
139 if (cpu_context(smp_processor_id(), vma->vm_mm) != 0) {
140 unsigned long flags;
141 int oldpid, newpid, idx;
142
143 newpid = (cpu_context(smp_processor_id(), vma->vm_mm) &
144 ASID_MASK);
145 page &= (PAGE_MASK << 1);
146 local_irq_save(flags);
147 oldpid = (read_c0_entryhi() & ASID_MASK);
148 write_c0_entryhi(page | newpid);
149 tlb_probe();
150 idx = read_c0_index();
151 write_c0_entrylo0(0);
152 write_c0_entrylo1(0);
153 write_c0_entryhi(CKSEG0);
154 if (idx < 0)
155 goto finish;
156 tlb_write_indexed();
157
158 finish:
159 write_c0_entryhi(oldpid);
160 local_irq_restore(flags);
161 }
162}
163
164/*
165 * This one is only used for pages with the global bit set so we don't care
166 * much about the ASID.
167 */
168void local_flush_tlb_one(unsigned long page)
169{
170 unsigned long flags;
171 int oldpid, idx;
172
173 local_irq_save(flags);
174 page &= (PAGE_MASK << 1);
175 oldpid = read_c0_entryhi() & 0xff;
176 write_c0_entryhi(page);
177 tlb_probe();
178 idx = read_c0_index();
179 write_c0_entrylo0(0);
180 write_c0_entrylo1(0);
181 if (idx >= 0) {
182 /* Make sure all entries differ. */
183 write_c0_entryhi(CKSEG0+(idx<<(PAGE_SHIFT+1)));
184 tlb_write_indexed();
185 }
186 write_c0_entryhi(oldpid);
187
188 local_irq_restore(flags);
189}
190
191/* XXX Simplify this. On the R10000 writing a TLB entry for an virtual
192 address that already exists will overwrite the old entry and not result
193 in TLB malfunction or TLB shutdown. */
194void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
195{
196 unsigned long flags;
197 pgd_t *pgdp;
198 pmd_t *pmdp;
199 pte_t *ptep;
200 int idx, pid;
201
202 /*
203 * Handle debugger faulting in for debugee.
204 */
205 if (current->active_mm != vma->vm_mm)
206 return;
207
208 pid = read_c0_entryhi() & ASID_MASK;
209
210 if ((pid != (cpu_context(smp_processor_id(), vma->vm_mm) & ASID_MASK))
211 || (cpu_context(smp_processor_id(), vma->vm_mm) == 0)) {
212 printk(KERN_WARNING
213 "%s: Wheee, bogus tlbpid mmpid=%d tlbpid=%d\n",
214 __FUNCTION__, (int) (cpu_context(smp_processor_id(),
215 vma->vm_mm) & ASID_MASK), pid);
216 }
217
218 local_irq_save(flags);
219 address &= (PAGE_MASK << 1);
220 write_c0_entryhi(address | (pid));
221 pgdp = pgd_offset(vma->vm_mm, address);
222 tlb_probe();
223 pmdp = pmd_offset(pgdp, address);
224 idx = read_c0_index();
225 ptep = pte_offset_map(pmdp, address);
226 write_c0_entrylo0(pte_val(*ptep++) >> 6);
227 write_c0_entrylo1(pte_val(*ptep) >> 6);
228 write_c0_entryhi(address | pid);
229 if (idx < 0) {
230 tlb_write_random();
231 } else {
232 tlb_write_indexed();
233 }
234 write_c0_entryhi(pid);
235 local_irq_restore(flags);
236}
237
238void __init tlb_init(void)
239{
240 /*
241 * You should never change this register:
242 * - On R4600 1.7 the tlbp never hits for pages smaller than
243 * the value in the c0_pagemask register.
244 * - The entire mm handling assumes the c0_pagemask register to
245 * be set for 4kb pages.
246 */
247 write_c0_pagemask(PM_4K);
248 write_c0_wired(0);
249 write_c0_framemask(0);
250
251 /* From this point on the ARC firmware is dead. */
252 local_flush_tlb_all();
253
254 /* Did I tell you that ARC SUCKS? */
255
256 build_tlb_refill_handler();
257}
diff --git a/arch/mips/mm/tlb-r3k.c b/arch/mips/mm/tlb-r3k.c
new file mode 100644
index 000000000000..7948e9a5e372
--- /dev/null
+++ b/arch/mips/mm/tlb-r3k.c
@@ -0,0 +1,289 @@
1/*
2 * r2300.c: R2000 and R3000 specific mmu/cache code.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 *
6 * with a lot of changes to make this thing work for R3000s
7 * Tx39XX R4k style caches added. HK
8 * Copyright (C) 1998, 1999, 2000 Harald Koerfgen
9 * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
10 * Copyright (C) 2002 Ralf Baechle
11 * Copyright (C) 2002 Maciej W. Rozycki
12 */
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/mm.h>
17
18#include <asm/page.h>
19#include <asm/pgtable.h>
20#include <asm/mmu_context.h>
21#include <asm/system.h>
22#include <asm/isadep.h>
23#include <asm/io.h>
24#include <asm/bootinfo.h>
25#include <asm/cpu.h>
26
27#undef DEBUG_TLB
28
29extern void build_tlb_refill_handler(void);
30
31/* CP0 hazard avoidance. */
32#define BARRIER \
33 __asm__ __volatile__( \
34 ".set push\n\t" \
35 ".set noreorder\n\t" \
36 "nop\n\t" \
37 ".set pop\n\t")
38
39int r3k_have_wired_reg; /* should be in cpu_data? */
40
41/* TLB operations. */
42void local_flush_tlb_all(void)
43{
44 unsigned long flags;
45 unsigned long old_ctx;
46 int entry;
47
48#ifdef DEBUG_TLB
49 printk("[tlball]");
50#endif
51
52 local_irq_save(flags);
53 old_ctx = read_c0_entryhi() & ASID_MASK;
54 write_c0_entrylo0(0);
55 entry = r3k_have_wired_reg ? read_c0_wired() : 8;
56 for (; entry < current_cpu_data.tlbsize; entry++) {
57 write_c0_index(entry << 8);
58 write_c0_entryhi((entry | 0x80000) << 12);
59 BARRIER;
60 tlb_write_indexed();
61 }
62 write_c0_entryhi(old_ctx);
63 local_irq_restore(flags);
64}
65
66void local_flush_tlb_mm(struct mm_struct *mm)
67{
68 int cpu = smp_processor_id();
69
70 if (cpu_context(cpu, mm) != 0) {
71#ifdef DEBUG_TLB
72 printk("[tlbmm<%lu>]", (unsigned long)cpu_context(cpu, mm));
73#endif
74 drop_mmu_context(mm, cpu);
75 }
76}
77
78void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
79 unsigned long end)
80{
81 struct mm_struct *mm = vma->vm_mm;
82 int cpu = smp_processor_id();
83
84 if (cpu_context(cpu, mm) != 0) {
85 unsigned long flags;
86 int size;
87
88#ifdef DEBUG_TLB
89 printk("[tlbrange<%lu,0x%08lx,0x%08lx>]",
90 cpu_context(cpu, mm) & ASID_MASK, start, end);
91#endif
92 local_irq_save(flags);
93 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
94 if (size <= current_cpu_data.tlbsize) {
95 int oldpid = read_c0_entryhi() & ASID_MASK;
96 int newpid = cpu_context(cpu, mm) & ASID_MASK;
97
98 start &= PAGE_MASK;
99 end += PAGE_SIZE - 1;
100 end &= PAGE_MASK;
101 while (start < end) {
102 int idx;
103
104 write_c0_entryhi(start | newpid);
105 start += PAGE_SIZE; /* BARRIER */
106 tlb_probe();
107 idx = read_c0_index();
108 write_c0_entrylo0(0);
109 write_c0_entryhi(KSEG0);
110 if (idx < 0) /* BARRIER */
111 continue;
112 tlb_write_indexed();
113 }
114 write_c0_entryhi(oldpid);
115 } else {
116 drop_mmu_context(mm, cpu);
117 }
118 local_irq_restore(flags);
119 }
120}
121
122void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
123{
124 unsigned long flags;
125 int size;
126
127#ifdef DEBUG_TLB
128 printk("[tlbrange<%lu,0x%08lx,0x%08lx>]", start, end);
129#endif
130 local_irq_save(flags);
131 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
132 if (size <= current_cpu_data.tlbsize) {
133 int pid = read_c0_entryhi();
134
135 start &= PAGE_MASK;
136 end += PAGE_SIZE - 1;
137 end &= PAGE_MASK;
138
139 while (start < end) {
140 int idx;
141
142 write_c0_entryhi(start);
143 start += PAGE_SIZE; /* BARRIER */
144 tlb_probe();
145 idx = read_c0_index();
146 write_c0_entrylo0(0);
147 write_c0_entryhi(KSEG0);
148 if (idx < 0) /* BARRIER */
149 continue;
150 tlb_write_indexed();
151 }
152 write_c0_entryhi(pid);
153 } else {
154 local_flush_tlb_all();
155 }
156 local_irq_restore(flags);
157}
158
159void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
160{
161 int cpu = smp_processor_id();
162
163 if (!vma || cpu_context(cpu, vma->vm_mm) != 0) {
164 unsigned long flags;
165 int oldpid, newpid, idx;
166
167#ifdef DEBUG_TLB
168 printk("[tlbpage<%lu,0x%08lx>]", cpu_context(cpu, vma->vm_mm), page);
169#endif
170 newpid = cpu_context(cpu, vma->vm_mm) & ASID_MASK;
171 page &= PAGE_MASK;
172 local_irq_save(flags);
173 oldpid = read_c0_entryhi() & ASID_MASK;
174 write_c0_entryhi(page | newpid);
175 BARRIER;
176 tlb_probe();
177 idx = read_c0_index();
178 write_c0_entrylo0(0);
179 write_c0_entryhi(KSEG0);
180 if (idx < 0) /* BARRIER */
181 goto finish;
182 tlb_write_indexed();
183
184finish:
185 write_c0_entryhi(oldpid);
186 local_irq_restore(flags);
187 }
188}
189
190void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
191{
192 unsigned long flags;
193 int idx, pid;
194
195 /*
196 * Handle debugger faulting in for debugee.
197 */
198 if (current->active_mm != vma->vm_mm)
199 return;
200
201 pid = read_c0_entryhi() & ASID_MASK;
202
203#ifdef DEBUG_TLB
204 if ((pid != (cpu_context(cpu, vma->vm_mm) & ASID_MASK)) || (cpu_context(cpu, vma->vm_mm) == 0)) {
205 printk("update_mmu_cache: Wheee, bogus tlbpid mmpid=%lu tlbpid=%d\n",
206 (cpu_context(cpu, vma->vm_mm)), pid);
207 }
208#endif
209
210 local_irq_save(flags);
211 address &= PAGE_MASK;
212 write_c0_entryhi(address | pid);
213 BARRIER;
214 tlb_probe();
215 idx = read_c0_index();
216 write_c0_entrylo0(pte_val(pte));
217 write_c0_entryhi(address | pid);
218 if (idx < 0) { /* BARRIER */
219 tlb_write_random();
220 } else {
221 tlb_write_indexed();
222 }
223 write_c0_entryhi(pid);
224 local_irq_restore(flags);
225}
226
227void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
228 unsigned long entryhi, unsigned long pagemask)
229{
230 unsigned long flags;
231 unsigned long old_ctx;
232 static unsigned long wired = 0;
233
234 if (r3k_have_wired_reg) { /* TX39XX */
235 unsigned long old_pagemask;
236 unsigned long w;
237
238#ifdef DEBUG_TLB
239 printk("[tlbwired<entry lo0 %8x, hi %8x\n, pagemask %8x>]\n",
240 entrylo0, entryhi, pagemask);
241#endif
242
243 local_irq_save(flags);
244 /* Save old context and create impossible VPN2 value */
245 old_ctx = read_c0_entryhi() & ASID_MASK;
246 old_pagemask = read_c0_pagemask();
247 w = read_c0_wired();
248 write_c0_wired(w + 1);
249 if (read_c0_wired() != w + 1) {
250 printk("[tlbwired] No WIRED reg?\n");
251 return;
252 }
253 write_c0_index(w << 8);
254 write_c0_pagemask(pagemask);
255 write_c0_entryhi(entryhi);
256 write_c0_entrylo0(entrylo0);
257 BARRIER;
258 tlb_write_indexed();
259
260 write_c0_entryhi(old_ctx);
261 write_c0_pagemask(old_pagemask);
262 local_flush_tlb_all();
263 local_irq_restore(flags);
264
265 } else if (wired < 8) {
266#ifdef DEBUG_TLB
267 printk("[tlbwired<entry lo0 %8x, hi %8x\n>]\n",
268 entrylo0, entryhi);
269#endif
270
271 local_irq_save(flags);
272 old_ctx = read_c0_entryhi() & ASID_MASK;
273 write_c0_entrylo0(entrylo0);
274 write_c0_entryhi(entryhi);
275 write_c0_index(wired);
276 wired++; /* BARRIER */
277 tlb_write_indexed();
278 write_c0_entryhi(old_ctx);
279 local_flush_tlb_all();
280 local_irq_restore(flags);
281 }
282}
283
284void __init tlb_init(void)
285{
286 local_flush_tlb_all();
287
288 build_tlb_refill_handler();
289}
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
new file mode 100644
index 000000000000..59d38bc05b69
--- /dev/null
+++ b/arch/mips/mm/tlb-r4k.c
@@ -0,0 +1,419 @@
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) 1996 David S. Miller (dm@engr.sgi.com)
7 * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle ralf@gnu.org
8 * Carsten Langgaard, carstenl@mips.com
9 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
10 */
11#include <linux/config.h>
12#include <linux/init.h>
13#include <linux/sched.h>
14#include <linux/mm.h>
15
16#include <asm/cpu.h>
17#include <asm/bootinfo.h>
18#include <asm/mmu_context.h>
19#include <asm/pgtable.h>
20#include <asm/system.h>
21
22extern void build_tlb_refill_handler(void);
23
24/* CP0 hazard avoidance. */
25#define BARRIER __asm__ __volatile__(".set noreorder\n\t" \
26 "nop; nop; nop; nop; nop; nop;\n\t" \
27 ".set reorder\n\t")
28
29void local_flush_tlb_all(void)
30{
31 unsigned long flags;
32 unsigned long old_ctx;
33 int entry;
34
35 local_irq_save(flags);
36 /* Save old context and create impossible VPN2 value */
37 old_ctx = read_c0_entryhi();
38 write_c0_entrylo0(0);
39 write_c0_entrylo1(0);
40
41 entry = read_c0_wired();
42
43 /* Blast 'em all away. */
44 while (entry < current_cpu_data.tlbsize) {
45 /*
46 * Make sure all entries differ. If they're not different
47 * MIPS32 will take revenge ...
48 */
49 write_c0_entryhi(CKSEG0 + (entry << (PAGE_SHIFT + 1)));
50 write_c0_index(entry);
51 mtc0_tlbw_hazard();
52 tlb_write_indexed();
53 entry++;
54 }
55 tlbw_use_hazard();
56 write_c0_entryhi(old_ctx);
57 local_irq_restore(flags);
58}
59
60void local_flush_tlb_mm(struct mm_struct *mm)
61{
62 int cpu = smp_processor_id();
63
64 if (cpu_context(cpu, mm) != 0)
65 drop_mmu_context(mm,cpu);
66}
67
68void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
69 unsigned long end)
70{
71 struct mm_struct *mm = vma->vm_mm;
72 int cpu = smp_processor_id();
73
74 if (cpu_context(cpu, mm) != 0) {
75 unsigned long flags;
76 int size;
77
78 local_irq_save(flags);
79 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
80 size = (size + 1) >> 1;
81 if (size <= current_cpu_data.tlbsize/2) {
82 int oldpid = read_c0_entryhi();
83 int newpid = cpu_asid(cpu, mm);
84
85 start &= (PAGE_MASK << 1);
86 end += ((PAGE_SIZE << 1) - 1);
87 end &= (PAGE_MASK << 1);
88 while (start < end) {
89 int idx;
90
91 write_c0_entryhi(start | newpid);
92 start += (PAGE_SIZE << 1);
93 mtc0_tlbw_hazard();
94 tlb_probe();
95 BARRIER;
96 idx = read_c0_index();
97 write_c0_entrylo0(0);
98 write_c0_entrylo1(0);
99 if (idx < 0)
100 continue;
101 /* Make sure all entries differ. */
102 write_c0_entryhi(CKSEG0 +
103 (idx << (PAGE_SHIFT + 1)));
104 mtc0_tlbw_hazard();
105 tlb_write_indexed();
106 }
107 tlbw_use_hazard();
108 write_c0_entryhi(oldpid);
109 } else {
110 drop_mmu_context(mm, cpu);
111 }
112 local_irq_restore(flags);
113 }
114}
115
116void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
117{
118 unsigned long flags;
119 int size;
120
121 local_irq_save(flags);
122 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
123 size = (size + 1) >> 1;
124 if (size <= current_cpu_data.tlbsize / 2) {
125 int pid = read_c0_entryhi();
126
127 start &= (PAGE_MASK << 1);
128 end += ((PAGE_SIZE << 1) - 1);
129 end &= (PAGE_MASK << 1);
130
131 while (start < end) {
132 int idx;
133
134 write_c0_entryhi(start);
135 start += (PAGE_SIZE << 1);
136 mtc0_tlbw_hazard();
137 tlb_probe();
138 BARRIER;
139 idx = read_c0_index();
140 write_c0_entrylo0(0);
141 write_c0_entrylo1(0);
142 if (idx < 0)
143 continue;
144 /* Make sure all entries differ. */
145 write_c0_entryhi(CKSEG0 + (idx << (PAGE_SHIFT + 1)));
146 mtc0_tlbw_hazard();
147 tlb_write_indexed();
148 }
149 tlbw_use_hazard();
150 write_c0_entryhi(pid);
151 } else {
152 local_flush_tlb_all();
153 }
154 local_irq_restore(flags);
155}
156
157void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
158{
159 int cpu = smp_processor_id();
160
161 if (cpu_context(cpu, vma->vm_mm) != 0) {
162 unsigned long flags;
163 int oldpid, newpid, idx;
164
165 newpid = cpu_asid(cpu, vma->vm_mm);
166 page &= (PAGE_MASK << 1);
167 local_irq_save(flags);
168 oldpid = read_c0_entryhi();
169 write_c0_entryhi(page | newpid);
170 mtc0_tlbw_hazard();
171 tlb_probe();
172 BARRIER;
173 idx = read_c0_index();
174 write_c0_entrylo0(0);
175 write_c0_entrylo1(0);
176 if (idx < 0)
177 goto finish;
178 /* Make sure all entries differ. */
179 write_c0_entryhi(CKSEG0 + (idx << (PAGE_SHIFT + 1)));
180 mtc0_tlbw_hazard();
181 tlb_write_indexed();
182 tlbw_use_hazard();
183
184 finish:
185 write_c0_entryhi(oldpid);
186 local_irq_restore(flags);
187 }
188}
189
190/*
191 * This one is only used for pages with the global bit set so we don't care
192 * much about the ASID.
193 */
194void local_flush_tlb_one(unsigned long page)
195{
196 unsigned long flags;
197 int oldpid, idx;
198
199 local_irq_save(flags);
200 page &= (PAGE_MASK << 1);
201 oldpid = read_c0_entryhi();
202 write_c0_entryhi(page);
203 mtc0_tlbw_hazard();
204 tlb_probe();
205 BARRIER;
206 idx = read_c0_index();
207 write_c0_entrylo0(0);
208 write_c0_entrylo1(0);
209 if (idx >= 0) {
210 /* Make sure all entries differ. */
211 write_c0_entryhi(CKSEG0 + (idx << (PAGE_SHIFT + 1)));
212 mtc0_tlbw_hazard();
213 tlb_write_indexed();
214 tlbw_use_hazard();
215 }
216 write_c0_entryhi(oldpid);
217
218 local_irq_restore(flags);
219}
220
221/*
222 * We will need multiple versions of update_mmu_cache(), one that just
223 * updates the TLB with the new pte(s), and another which also checks
224 * for the R4k "end of page" hardware bug and does the needy.
225 */
226void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
227{
228 unsigned long flags;
229 pgd_t *pgdp;
230 pmd_t *pmdp;
231 pte_t *ptep;
232 int idx, pid;
233
234 /*
235 * Handle debugger faulting in for debugee.
236 */
237 if (current->active_mm != vma->vm_mm)
238 return;
239
240 pid = read_c0_entryhi() & ASID_MASK;
241
242 local_irq_save(flags);
243 address &= (PAGE_MASK << 1);
244 write_c0_entryhi(address | pid);
245 pgdp = pgd_offset(vma->vm_mm, address);
246 mtc0_tlbw_hazard();
247 tlb_probe();
248 BARRIER;
249 pmdp = pmd_offset(pgdp, address);
250 idx = read_c0_index();
251 ptep = pte_offset_map(pmdp, address);
252
253 #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
254 write_c0_entrylo0(ptep->pte_high);
255 ptep++;
256 write_c0_entrylo1(ptep->pte_high);
257#else
258 write_c0_entrylo0(pte_val(*ptep++) >> 6);
259 write_c0_entrylo1(pte_val(*ptep) >> 6);
260#endif
261 write_c0_entryhi(address | pid);
262 mtc0_tlbw_hazard();
263 if (idx < 0)
264 tlb_write_random();
265 else
266 tlb_write_indexed();
267 tlbw_use_hazard();
268 write_c0_entryhi(pid);
269 local_irq_restore(flags);
270}
271
272#if 0
273static void r4k_update_mmu_cache_hwbug(struct vm_area_struct * vma,
274 unsigned long address, pte_t pte)
275{
276 unsigned long flags;
277 unsigned int asid;
278 pgd_t *pgdp;
279 pmd_t *pmdp;
280 pte_t *ptep;
281 int idx;
282
283 local_irq_save(flags);
284 address &= (PAGE_MASK << 1);
285 asid = read_c0_entryhi() & ASID_MASK;
286 write_c0_entryhi(address | asid);
287 pgdp = pgd_offset(vma->vm_mm, address);
288 mtc0_tlbw_hazard();
289 tlb_probe();
290 BARRIER;
291 pmdp = pmd_offset(pgdp, address);
292 idx = read_c0_index();
293 ptep = pte_offset_map(pmdp, address);
294 write_c0_entrylo0(pte_val(*ptep++) >> 6);
295 write_c0_entrylo1(pte_val(*ptep) >> 6);
296 mtc0_tlbw_hazard();
297 if (idx < 0)
298 tlb_write_random();
299 else
300 tlb_write_indexed();
301 tlbw_use_hazard();
302 local_irq_restore(flags);
303}
304#endif
305
306void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
307 unsigned long entryhi, unsigned long pagemask)
308{
309 unsigned long flags;
310 unsigned long wired;
311 unsigned long old_pagemask;
312 unsigned long old_ctx;
313
314 local_irq_save(flags);
315 /* Save old context and create impossible VPN2 value */
316 old_ctx = read_c0_entryhi();
317 old_pagemask = read_c0_pagemask();
318 wired = read_c0_wired();
319 write_c0_wired(wired + 1);
320 write_c0_index(wired);
321 BARRIER;
322 write_c0_pagemask(pagemask);
323 write_c0_entryhi(entryhi);
324 write_c0_entrylo0(entrylo0);
325 write_c0_entrylo1(entrylo1);
326 mtc0_tlbw_hazard();
327 tlb_write_indexed();
328 tlbw_use_hazard();
329
330 write_c0_entryhi(old_ctx);
331 BARRIER;
332 write_c0_pagemask(old_pagemask);
333 local_flush_tlb_all();
334 local_irq_restore(flags);
335}
336
337/*
338 * Used for loading TLB entries before trap_init() has started, when we
339 * don't actually want to add a wired entry which remains throughout the
340 * lifetime of the system
341 */
342
343static int temp_tlb_entry __initdata;
344
345__init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
346 unsigned long entryhi, unsigned long pagemask)
347{
348 int ret = 0;
349 unsigned long flags;
350 unsigned long wired;
351 unsigned long old_pagemask;
352 unsigned long old_ctx;
353
354 local_irq_save(flags);
355 /* Save old context and create impossible VPN2 value */
356 old_ctx = read_c0_entryhi();
357 old_pagemask = read_c0_pagemask();
358 wired = read_c0_wired();
359 if (--temp_tlb_entry < wired) {
360 printk(KERN_WARNING "No TLB space left for add_temporary_entry\n");
361 ret = -ENOSPC;
362 goto out;
363 }
364
365 write_c0_index(temp_tlb_entry);
366 write_c0_pagemask(pagemask);
367 write_c0_entryhi(entryhi);
368 write_c0_entrylo0(entrylo0);
369 write_c0_entrylo1(entrylo1);
370 mtc0_tlbw_hazard();
371 tlb_write_indexed();
372 tlbw_use_hazard();
373
374 write_c0_entryhi(old_ctx);
375 write_c0_pagemask(old_pagemask);
376out:
377 local_irq_restore(flags);
378 return ret;
379}
380
381static void __init probe_tlb(unsigned long config)
382{
383 struct cpuinfo_mips *c = &current_cpu_data;
384 unsigned int reg;
385
386 /*
387 * If this isn't a MIPS32 / MIPS64 compliant CPU. Config 1 register
388 * is not supported, we assume R4k style. Cpu probing already figured
389 * out the number of tlb entries.
390 */
391 if ((c->processor_id & 0xff0000) == PRID_COMP_LEGACY)
392 return;
393
394 reg = read_c0_config1();
395 if (!((config >> 7) & 3))
396 panic("No TLB present");
397
398 c->tlbsize = ((reg >> 25) & 0x3f) + 1;
399}
400
401void __init tlb_init(void)
402{
403 unsigned int config = read_c0_config();
404
405 /*
406 * You should never change this register:
407 * - On R4600 1.7 the tlbp never hits for pages smaller than
408 * the value in the c0_pagemask register.
409 * - The entire mm handling assumes the c0_pagemask register to
410 * be set for 4kb pages.
411 */
412 probe_tlb(config);
413 write_c0_pagemask(PM_DEFAULT_MASK);
414 write_c0_wired(0);
415 temp_tlb_entry = current_cpu_data.tlbsize - 1;
416 local_flush_tlb_all();
417
418 build_tlb_refill_handler();
419}
diff --git a/arch/mips/mm/tlb-r8k.c b/arch/mips/mm/tlb-r8k.c
new file mode 100644
index 000000000000..1bfb09198ce3
--- /dev/null
+++ b/arch/mips/mm/tlb-r8k.c
@@ -0,0 +1,250 @@
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) 1996 David S. Miller (dm@engr.sgi.com)
7 * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle ralf@gnu.org
8 * Carsten Langgaard, carstenl@mips.com
9 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
10 */
11#include <linux/config.h>
12#include <linux/init.h>
13#include <linux/sched.h>
14#include <linux/mm.h>
15
16#include <asm/cpu.h>
17#include <asm/bootinfo.h>
18#include <asm/mmu_context.h>
19#include <asm/pgtable.h>
20#include <asm/system.h>
21
22extern void build_tlb_refill_handler(void);
23
24#define TFP_TLB_SIZE 384
25#define TFP_TLB_SET_SHIFT 7
26
27/* CP0 hazard avoidance. */
28#define BARRIER __asm__ __volatile__(".set noreorder\n\t" \
29 "nop; nop; nop; nop; nop; nop;\n\t" \
30 ".set reorder\n\t")
31
32void local_flush_tlb_all(void)
33{
34 unsigned long flags;
35 unsigned long old_ctx;
36 int entry;
37
38 local_irq_save(flags);
39 /* Save old context and create impossible VPN2 value */
40 old_ctx = read_c0_entryhi();
41 write_c0_entrylo(0);
42
43 for (entry = 0; entry < TFP_TLB_SIZE; entry++) {
44 write_c0_tlbset(entry >> TFP_TLB_SET_SHIFT);
45 write_c0_vaddr(entry << PAGE_SHIFT);
46 write_c0_entryhi(CKSEG0 + (entry << (PAGE_SHIFT + 1)));
47 mtc0_tlbw_hazard();
48 tlb_write();
49 }
50 tlbw_use_hazard();
51 write_c0_entryhi(old_ctx);
52 local_irq_restore(flags);
53}
54
55void local_flush_tlb_mm(struct mm_struct *mm)
56{
57 int cpu = smp_processor_id();
58
59 if (cpu_context(cpu, mm) != 0)
60 drop_mmu_context(mm,cpu);
61}
62
63void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
64 unsigned long end)
65{
66 struct mm_struct *mm = vma->vm_mm;
67 int cpu = smp_processor_id();
68 unsigned long flags;
69 int oldpid, newpid, size;
70
71 if (!cpu_context(cpu, mm))
72 return;
73
74 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
75 size = (size + 1) >> 1;
76
77 local_irq_save(flags);
78
79 if (size > TFP_TLB_SIZE / 2) {
80 drop_mmu_context(mm, cpu);
81 goto out_restore;
82 }
83
84 oldpid = read_c0_entryhi();
85 newpid = cpu_asid(cpu, mm);
86
87 write_c0_entrylo(0);
88
89 start &= PAGE_MASK;
90 end += (PAGE_SIZE - 1);
91 end &= PAGE_MASK;
92 while (start < end) {
93 signed long idx;
94
95 write_c0_vaddr(start);
96 write_c0_entryhi(start);
97 start += PAGE_SIZE;
98 tlb_probe();
99 idx = read_c0_tlbset();
100 if (idx < 0)
101 continue;
102
103 write_c0_entryhi(CKSEG0 + (idx << (PAGE_SHIFT + 1)));
104 tlb_write();
105 }
106 write_c0_entryhi(oldpid);
107
108out_restore:
109 local_irq_restore(flags);
110}
111
112/* Usable for KV1 addresses only! */
113void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
114{
115 unsigned long flags;
116 int size;
117
118 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
119 size = (size + 1) >> 1;
120
121 if (size > TFP_TLB_SIZE / 2) {
122 local_flush_tlb_all();
123 return;
124 }
125
126 local_irq_save(flags);
127
128 write_c0_entrylo(0);
129
130 start &= PAGE_MASK;
131 end += (PAGE_SIZE - 1);
132 end &= PAGE_MASK;
133 while (start < end) {
134 signed long idx;
135
136 write_c0_vaddr(start);
137 write_c0_entryhi(start);
138 start += PAGE_SIZE;
139 tlb_probe();
140 idx = read_c0_tlbset();
141 if (idx < 0)
142 continue;
143
144 write_c0_entryhi(CKSEG0 + (idx << (PAGE_SHIFT + 1)));
145 tlb_write();
146 }
147
148 local_irq_restore(flags);
149}
150
151void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
152{
153 int cpu = smp_processor_id();
154 unsigned long flags;
155 int oldpid, newpid;
156 signed long idx;
157
158 if (!cpu_context(cpu, vma->vm_mm))
159 return;
160
161 newpid = cpu_asid(cpu, vma->vm_mm);
162 page &= PAGE_MASK;
163 local_irq_save(flags);
164 oldpid = read_c0_entryhi();
165 write_c0_vaddr(page);
166 write_c0_entryhi(newpid);
167 tlb_probe();
168 idx = read_c0_tlbset();
169 if (idx < 0)
170 goto finish;
171
172 write_c0_entrylo(0);
173 write_c0_entryhi(CKSEG0 + (idx << (PAGE_SHIFT + 1)));
174 tlb_write();
175
176finish:
177 write_c0_entryhi(oldpid);
178 local_irq_restore(flags);
179}
180
181/*
182 * We will need multiple versions of update_mmu_cache(), one that just
183 * updates the TLB with the new pte(s), and another which also checks
184 * for the R4k "end of page" hardware bug and does the needy.
185 */
186void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
187{
188 unsigned long flags;
189 pgd_t *pgdp;
190 pmd_t *pmdp;
191 pte_t *ptep;
192 int pid;
193
194 /*
195 * Handle debugger faulting in for debugee.
196 */
197 if (current->active_mm != vma->vm_mm)
198 return;
199
200 pid = read_c0_entryhi() & ASID_MASK;
201
202 local_irq_save(flags);
203 address &= PAGE_MASK;
204 write_c0_vaddr(address);
205 write_c0_entryhi(pid);
206 pgdp = pgd_offset(vma->vm_mm, address);
207 pmdp = pmd_offset(pgdp, address);
208 ptep = pte_offset_map(pmdp, address);
209 tlb_probe();
210
211 write_c0_entrylo(pte_val(*ptep++) >> 6);
212 tlb_write();
213
214 write_c0_entryhi(pid);
215 local_irq_restore(flags);
216}
217
218static void __init probe_tlb(unsigned long config)
219{
220 struct cpuinfo_mips *c = &current_cpu_data;
221
222 c->tlbsize = 3 * 128; /* 3 sets each 128 entries */
223}
224
225void __init tlb_init(void)
226{
227 unsigned int config = read_c0_config();
228 unsigned long status;
229
230 probe_tlb(config);
231
232 status = read_c0_status();
233 status &= ~(ST0_UPS | ST0_KPS);
234#ifdef CONFIG_PAGE_SIZE_4KB
235 status |= (TFP_PAGESIZE_4K << 32) | (TFP_PAGESIZE_4K << 36);
236#elif defined(CONFIG_PAGE_SIZE_8KB)
237 status |= (TFP_PAGESIZE_8K << 32) | (TFP_PAGESIZE_8K << 36);
238#elif defined(CONFIG_PAGE_SIZE_16KB)
239 status |= (TFP_PAGESIZE_16K << 32) | (TFP_PAGESIZE_16K << 36);
240#elif defined(CONFIG_PAGE_SIZE_64KB)
241 status |= (TFP_PAGESIZE_64K << 32) | (TFP_PAGESIZE_64K << 36);
242#endif
243 write_c0_status(status);
244
245 write_c0_wired(0);
246
247 local_flush_tlb_all();
248
249 build_tlb_refill_handler();
250}
diff --git a/arch/mips/mm/tlb-sb1.c b/arch/mips/mm/tlb-sb1.c
new file mode 100644
index 000000000000..6256cafcf3a2
--- /dev/null
+++ b/arch/mips/mm/tlb-sb1.c
@@ -0,0 +1,376 @@
1/*
2 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
3 * Copyright (C) 1997, 2001 Ralf Baechle (ralf@gnu.org)
4 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20#include <linux/init.h>
21#include <asm/mmu_context.h>
22#include <asm/bootinfo.h>
23#include <asm/cpu.h>
24
25extern void build_tlb_refill_handler(void);
26
27#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
28
29/* Dump the current entry* and pagemask registers */
30static inline void dump_cur_tlb_regs(void)
31{
32 unsigned int entryhihi, entryhilo, entrylo0hi, entrylo0lo, entrylo1hi;
33 unsigned int entrylo1lo, pagemask;
34
35 __asm__ __volatile__ (
36 ".set push \n"
37 ".set noreorder \n"
38 ".set mips64 \n"
39 ".set noat \n"
40 " tlbr \n"
41 " dmfc0 $1, $10 \n"
42 " dsrl32 %0, $1, 0 \n"
43 " sll %1, $1, 0 \n"
44 " dmfc0 $1, $2 \n"
45 " dsrl32 %2, $1, 0 \n"
46 " sll %3, $1, 0 \n"
47 " dmfc0 $1, $3 \n"
48 " dsrl32 %4, $1, 0 \n"
49 " sll %5, $1, 0 \n"
50 " mfc0 %6, $5 \n"
51 ".set pop \n"
52 : "=r" (entryhihi), "=r" (entryhilo),
53 "=r" (entrylo0hi), "=r" (entrylo0lo),
54 "=r" (entrylo1hi), "=r" (entrylo1lo),
55 "=r" (pagemask));
56
57 printk("%08X%08X %08X%08X %08X%08X %08X",
58 entryhihi, entryhilo,
59 entrylo0hi, entrylo0lo,
60 entrylo1hi, entrylo1lo,
61 pagemask);
62}
63
64void sb1_dump_tlb(void)
65{
66 unsigned long old_ctx;
67 unsigned long flags;
68 int entry;
69 local_irq_save(flags);
70 old_ctx = read_c0_entryhi();
71 printk("Current TLB registers state:\n"
72 " EntryHi EntryLo0 EntryLo1 PageMask Index\n"
73 "--------------------------------------------------------------------\n");
74 dump_cur_tlb_regs();
75 printk(" %08X\n", read_c0_index());
76 printk("\n\nFull TLB Dump:\n"
77 "Idx EntryHi EntryLo0 EntryLo1 PageMask\n"
78 "--------------------------------------------------------------\n");
79 for (entry = 0; entry < current_cpu_data.tlbsize; entry++) {
80 write_c0_index(entry);
81 printk("\n%02i ", entry);
82 dump_cur_tlb_regs();
83 }
84 printk("\n");
85 write_c0_entryhi(old_ctx);
86 local_irq_restore(flags);
87}
88
89void local_flush_tlb_all(void)
90{
91 unsigned long flags;
92 unsigned long old_ctx;
93 int entry;
94
95 local_irq_save(flags);
96 /* Save old context and create impossible VPN2 value */
97 old_ctx = read_c0_entryhi() & ASID_MASK;
98 write_c0_entrylo0(0);
99 write_c0_entrylo1(0);
100
101 entry = read_c0_wired();
102 while (entry < current_cpu_data.tlbsize) {
103 write_c0_entryhi(UNIQUE_ENTRYHI(entry));
104 write_c0_index(entry);
105 tlb_write_indexed();
106 entry++;
107 }
108 write_c0_entryhi(old_ctx);
109 local_irq_restore(flags);
110}
111
112
113/*
114 * Use a bogus region of memory (starting at 0) to sanitize the TLB's.
115 * Use increments of the maximum page size (16MB), and check for duplicate
116 * entries before doing a given write. Then, when we're safe from collisions
117 * with the firmware, go back and give all the entries invalid addresses with
118 * the normal flush routine. Wired entries will be killed as well!
119 */
120static void __init sb1_sanitize_tlb(void)
121{
122 int entry;
123 long addr = 0;
124
125 long inc = 1<<24; /* 16MB */
126 /* Save old context and create impossible VPN2 value */
127 write_c0_entrylo0(0);
128 write_c0_entrylo1(0);
129 for (entry = 0; entry < current_cpu_data.tlbsize; entry++) {
130 do {
131 addr += inc;
132 write_c0_entryhi(addr);
133 tlb_probe();
134 } while ((int)(read_c0_index()) >= 0);
135 write_c0_index(entry);
136 tlb_write_indexed();
137 }
138 /* Now that we know we're safe from collisions, we can safely flush
139 the TLB with the "normal" routine. */
140 local_flush_tlb_all();
141}
142
143void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
144 unsigned long end)
145{
146 struct mm_struct *mm = vma->vm_mm;
147 unsigned long flags;
148 int cpu;
149
150 local_irq_save(flags);
151 cpu = smp_processor_id();
152 if (cpu_context(cpu, mm) != 0) {
153 int size;
154 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
155 size = (size + 1) >> 1;
156 if (size <= (current_cpu_data.tlbsize/2)) {
157 int oldpid = read_c0_entryhi() & ASID_MASK;
158 int newpid = cpu_asid(cpu, mm);
159
160 start &= (PAGE_MASK << 1);
161 end += ((PAGE_SIZE << 1) - 1);
162 end &= (PAGE_MASK << 1);
163 while (start < end) {
164 int idx;
165
166 write_c0_entryhi(start | newpid);
167 start += (PAGE_SIZE << 1);
168 tlb_probe();
169 idx = read_c0_index();
170 write_c0_entrylo0(0);
171 write_c0_entrylo1(0);
172 write_c0_entryhi(UNIQUE_ENTRYHI(idx));
173 if (idx < 0)
174 continue;
175 tlb_write_indexed();
176 }
177 write_c0_entryhi(oldpid);
178 } else {
179 drop_mmu_context(mm, cpu);
180 }
181 }
182 local_irq_restore(flags);
183}
184
185void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
186{
187 unsigned long flags;
188 int size;
189
190 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
191 size = (size + 1) >> 1;
192
193 local_irq_save(flags);
194 if (size <= (current_cpu_data.tlbsize/2)) {
195 int pid = read_c0_entryhi();
196
197 start &= (PAGE_MASK << 1);
198 end += ((PAGE_SIZE << 1) - 1);
199 end &= (PAGE_MASK << 1);
200
201 while (start < end) {
202 int idx;
203
204 write_c0_entryhi(start);
205 start += (PAGE_SIZE << 1);
206 tlb_probe();
207 idx = read_c0_index();
208 write_c0_entrylo0(0);
209 write_c0_entrylo1(0);
210 write_c0_entryhi(UNIQUE_ENTRYHI(idx));
211 if (idx < 0)
212 continue;
213 tlb_write_indexed();
214 }
215 write_c0_entryhi(pid);
216 } else {
217 local_flush_tlb_all();
218 }
219 local_irq_restore(flags);
220}
221
222void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
223{
224 unsigned long flags;
225 int cpu = smp_processor_id();
226
227 local_irq_save(flags);
228 if (cpu_context(cpu, vma->vm_mm) != 0) {
229 int oldpid, newpid, idx;
230 newpid = cpu_asid(cpu, vma->vm_mm);
231 page &= (PAGE_MASK << 1);
232 oldpid = read_c0_entryhi() & ASID_MASK;
233 write_c0_entryhi(page | newpid);
234 tlb_probe();
235 idx = read_c0_index();
236 write_c0_entrylo0(0);
237 write_c0_entrylo1(0);
238 if (idx < 0)
239 goto finish;
240 /* Make sure all entries differ. */
241 write_c0_entryhi(UNIQUE_ENTRYHI(idx));
242 tlb_write_indexed();
243 finish:
244 write_c0_entryhi(oldpid);
245 }
246 local_irq_restore(flags);
247}
248
249/*
250 * Remove one kernel space TLB entry. This entry is assumed to be marked
251 * global so we don't do the ASID thing.
252 */
253void local_flush_tlb_one(unsigned long page)
254{
255 unsigned long flags;
256 int oldpid, idx;
257
258 page &= (PAGE_MASK << 1);
259 oldpid = read_c0_entryhi() & ASID_MASK;
260
261 local_irq_save(flags);
262 write_c0_entryhi(page);
263 tlb_probe();
264 idx = read_c0_index();
265 if (idx >= 0) {
266 /* Make sure all entries differ. */
267 write_c0_entryhi(UNIQUE_ENTRYHI(idx));
268 write_c0_entrylo0(0);
269 write_c0_entrylo1(0);
270 tlb_write_indexed();
271 }
272
273 write_c0_entryhi(oldpid);
274 local_irq_restore(flags);
275}
276
277/* All entries common to a mm share an asid. To effectively flush
278 these entries, we just bump the asid. */
279void local_flush_tlb_mm(struct mm_struct *mm)
280{
281 int cpu;
282
283 preempt_disable();
284
285 cpu = smp_processor_id();
286
287 if (cpu_context(cpu, mm) != 0) {
288 drop_mmu_context(mm, cpu);
289 }
290
291 preempt_enable();
292}
293
294/* Stolen from mips32 routines */
295
296void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
297{
298 unsigned long flags;
299 pgd_t *pgdp;
300 pmd_t *pmdp;
301 pte_t *ptep;
302 int idx, pid;
303
304 /*
305 * Handle debugger faulting in for debugee.
306 */
307 if (current->active_mm != vma->vm_mm)
308 return;
309
310 local_irq_save(flags);
311
312 pid = read_c0_entryhi() & ASID_MASK;
313 address &= (PAGE_MASK << 1);
314 write_c0_entryhi(address | (pid));
315 pgdp = pgd_offset(vma->vm_mm, address);
316 tlb_probe();
317 pmdp = pmd_offset(pgdp, address);
318 idx = read_c0_index();
319 ptep = pte_offset_map(pmdp, address);
320 write_c0_entrylo0(pte_val(*ptep++) >> 6);
321 write_c0_entrylo1(pte_val(*ptep) >> 6);
322 if (idx < 0) {
323 tlb_write_random();
324 } else {
325 tlb_write_indexed();
326 }
327 local_irq_restore(flags);
328}
329
330void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
331 unsigned long entryhi, unsigned long pagemask)
332{
333 unsigned long flags;
334 unsigned long wired;
335 unsigned long old_pagemask;
336 unsigned long old_ctx;
337
338 local_irq_save(flags);
339 old_ctx = read_c0_entryhi() & 0xff;
340 old_pagemask = read_c0_pagemask();
341 wired = read_c0_wired();
342 write_c0_wired(wired + 1);
343 write_c0_index(wired);
344
345 write_c0_pagemask(pagemask);
346 write_c0_entryhi(entryhi);
347 write_c0_entrylo0(entrylo0);
348 write_c0_entrylo1(entrylo1);
349 tlb_write_indexed();
350
351 write_c0_entryhi(old_ctx);
352 write_c0_pagemask(old_pagemask);
353
354 local_flush_tlb_all();
355 local_irq_restore(flags);
356}
357
358/*
359 * This is called from loadmmu.c. We have to set up all the
360 * memory management function pointers, as well as initialize
361 * the caches and tlbs
362 */
363void tlb_init(void)
364{
365 write_c0_pagemask(PM_DEFAULT_MASK);
366 write_c0_wired(0);
367
368 /*
369 * We don't know what state the firmware left the TLB's in, so this is
370 * the ultra-conservative way to flush the TLB's and avoid machine
371 * check exceptions due to duplicate TLB entries
372 */
373 sb1_sanitize_tlb();
374
375 build_tlb_refill_handler();
376}
diff --git a/arch/mips/mm/tlbex-fault.S b/arch/mips/mm/tlbex-fault.S
new file mode 100644
index 000000000000..9e7f4175b493
--- /dev/null
+++ b/arch/mips/mm/tlbex-fault.S
@@ -0,0 +1,28 @@
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) 1999 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#include <asm/mipsregs.h>
10#include <asm/page.h>
11#include <asm/regdef.h>
12#include <asm/stackframe.h>
13
14 .macro tlb_do_page_fault, write
15 NESTED(tlb_do_page_fault_\write, PT_SIZE, sp)
16 SAVE_ALL
17 MFC0 a2, CP0_BADVADDR
18 KMODE
19 move a0, sp
20 REG_S a2, PT_BVADDR(sp)
21 li a1, \write
22 jal do_page_fault
23 j ret_from_exception
24 END(tlb_do_page_fault_\write)
25 .endm
26
27 tlb_do_page_fault 0
28 tlb_do_page_fault 1
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
new file mode 100644
index 000000000000..87e229f4d3d5
--- /dev/null
+++ b/arch/mips/mm/tlbex.c
@@ -0,0 +1,1815 @@
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 * Synthesize TLB refill handlers at runtime.
7 *
8 * Copyright (C) 2004,2005 by Thiemo Seufer
9 */
10
11#include <stdarg.h>
12
13#include <linux/config.h>
14#include <linux/mm.h>
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/string.h>
18#include <linux/init.h>
19
20#include <asm/pgtable.h>
21#include <asm/cacheflush.h>
22#include <asm/mmu_context.h>
23#include <asm/inst.h>
24#include <asm/elf.h>
25#include <asm/smp.h>
26#include <asm/war.h>
27
28/* #define DEBUG_TLB */
29
30static __init int __attribute__((unused)) r45k_bvahwbug(void)
31{
32 /* XXX: We should probe for the presence of this bug, but we don't. */
33 return 0;
34}
35
36static __init int __attribute__((unused)) r4k_250MHZhwbug(void)
37{
38 /* XXX: We should probe for the presence of this bug, but we don't. */
39 return 0;
40}
41
42static __init int __attribute__((unused)) bcm1250_m3_war(void)
43{
44 return BCM1250_M3_WAR;
45}
46
47static __init int __attribute__((unused)) r10000_llsc_war(void)
48{
49 return R10000_LLSC_WAR;
50}
51
52/*
53 * A little micro-assembler, intended for TLB refill handler
54 * synthesizing. It is intentionally kept simple, does only support
55 * a subset of instructions, and does not try to hide pipeline effects
56 * like branch delay slots.
57 */
58
59enum fields
60{
61 RS = 0x001,
62 RT = 0x002,
63 RD = 0x004,
64 RE = 0x008,
65 SIMM = 0x010,
66 UIMM = 0x020,
67 BIMM = 0x040,
68 JIMM = 0x080,
69 FUNC = 0x100,
70};
71
72#define OP_MASK 0x2f
73#define OP_SH 26
74#define RS_MASK 0x1f
75#define RS_SH 21
76#define RT_MASK 0x1f
77#define RT_SH 16
78#define RD_MASK 0x1f
79#define RD_SH 11
80#define RE_MASK 0x1f
81#define RE_SH 6
82#define IMM_MASK 0xffff
83#define IMM_SH 0
84#define JIMM_MASK 0x3ffffff
85#define JIMM_SH 0
86#define FUNC_MASK 0x2f
87#define FUNC_SH 0
88
89enum opcode {
90 insn_invalid,
91 insn_addu, insn_addiu, insn_and, insn_andi, insn_beq,
92 insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl,
93 insn_bne, insn_daddu, insn_daddiu, insn_dmfc0, insn_dmtc0,
94 insn_dsll, insn_dsll32, insn_dsra, insn_dsrl, insn_dsrl32,
95 insn_dsubu, insn_eret, insn_j, insn_jal, insn_jr, insn_ld,
96 insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0, insn_mtc0,
97 insn_ori, insn_rfe, insn_sc, insn_scd, insn_sd, insn_sll,
98 insn_sra, insn_srl, insn_subu, insn_sw, insn_tlbp, insn_tlbwi,
99 insn_tlbwr, insn_xor, insn_xori
100};
101
102struct insn {
103 enum opcode opcode;
104 u32 match;
105 enum fields fields;
106};
107
108/* This macro sets the non-variable bits of an instruction. */
109#define M(a, b, c, d, e, f) \
110 ((a) << OP_SH \
111 | (b) << RS_SH \
112 | (c) << RT_SH \
113 | (d) << RD_SH \
114 | (e) << RE_SH \
115 | (f) << FUNC_SH)
116
117static __initdata struct insn insn_table[] = {
118 { insn_addiu, M(addiu_op,0,0,0,0,0), RS | RT | SIMM },
119 { insn_addu, M(spec_op,0,0,0,0,addu_op), RS | RT | RD },
120 { insn_and, M(spec_op,0,0,0,0,and_op), RS | RT | RD },
121 { insn_andi, M(andi_op,0,0,0,0,0), RS | RT | UIMM },
122 { insn_beq, M(beq_op,0,0,0,0,0), RS | RT | BIMM },
123 { insn_beql, M(beql_op,0,0,0,0,0), RS | RT | BIMM },
124 { insn_bgez, M(bcond_op,0,bgez_op,0,0,0), RS | BIMM },
125 { insn_bgezl, M(bcond_op,0,bgezl_op,0,0,0), RS | BIMM },
126 { insn_bltz, M(bcond_op,0,bltz_op,0,0,0), RS | BIMM },
127 { insn_bltzl, M(bcond_op,0,bltzl_op,0,0,0), RS | BIMM },
128 { insn_bne, M(bne_op,0,0,0,0,0), RS | RT | BIMM },
129 { insn_daddiu, M(daddiu_op,0,0,0,0,0), RS | RT | SIMM },
130 { insn_daddu, M(spec_op,0,0,0,0,daddu_op), RS | RT | RD },
131 { insn_dmfc0, M(cop0_op,dmfc_op,0,0,0,0), RT | RD },
132 { insn_dmtc0, M(cop0_op,dmtc_op,0,0,0,0), RT | RD },
133 { insn_dsll, M(spec_op,0,0,0,0,dsll_op), RT | RD | RE },
134 { insn_dsll32, M(spec_op,0,0,0,0,dsll32_op), RT | RD | RE },
135 { insn_dsra, M(spec_op,0,0,0,0,dsra_op), RT | RD | RE },
136 { insn_dsrl, M(spec_op,0,0,0,0,dsrl_op), RT | RD | RE },
137 { insn_dsrl32, M(spec_op,0,0,0,0,dsrl32_op), RT | RD | RE },
138 { insn_dsubu, M(spec_op,0,0,0,0,dsubu_op), RS | RT | RD },
139 { insn_eret, M(cop0_op,cop_op,0,0,0,eret_op), 0 },
140 { insn_j, M(j_op,0,0,0,0,0), JIMM },
141 { insn_jal, M(jal_op,0,0,0,0,0), JIMM },
142 { insn_jr, M(spec_op,0,0,0,0,jr_op), RS },
143 { insn_ld, M(ld_op,0,0,0,0,0), RS | RT | SIMM },
144 { insn_ll, M(ll_op,0,0,0,0,0), RS | RT | SIMM },
145 { insn_lld, M(lld_op,0,0,0,0,0), RS | RT | SIMM },
146 { insn_lui, M(lui_op,0,0,0,0,0), RT | SIMM },
147 { insn_lw, M(lw_op,0,0,0,0,0), RS | RT | SIMM },
148 { insn_mfc0, M(cop0_op,mfc_op,0,0,0,0), RT | RD },
149 { insn_mtc0, M(cop0_op,mtc_op,0,0,0,0), RT | RD },
150 { insn_ori, M(ori_op,0,0,0,0,0), RS | RT | UIMM },
151 { insn_rfe, M(cop0_op,cop_op,0,0,0,rfe_op), 0 },
152 { insn_sc, M(sc_op,0,0,0,0,0), RS | RT | SIMM },
153 { insn_scd, M(scd_op,0,0,0,0,0), RS | RT | SIMM },
154 { insn_sd, M(sd_op,0,0,0,0,0), RS | RT | SIMM },
155 { insn_sll, M(spec_op,0,0,0,0,sll_op), RT | RD | RE },
156 { insn_sra, M(spec_op,0,0,0,0,sra_op), RT | RD | RE },
157 { insn_srl, M(spec_op,0,0,0,0,srl_op), RT | RD | RE },
158 { insn_subu, M(spec_op,0,0,0,0,subu_op), RS | RT | RD },
159 { insn_sw, M(sw_op,0,0,0,0,0), RS | RT | SIMM },
160 { insn_tlbp, M(cop0_op,cop_op,0,0,0,tlbp_op), 0 },
161 { insn_tlbwi, M(cop0_op,cop_op,0,0,0,tlbwi_op), 0 },
162 { insn_tlbwr, M(cop0_op,cop_op,0,0,0,tlbwr_op), 0 },
163 { insn_xor, M(spec_op,0,0,0,0,xor_op), RS | RT | RD },
164 { insn_xori, M(xori_op,0,0,0,0,0), RS | RT | UIMM },
165 { insn_invalid, 0, 0 }
166};
167
168#undef M
169
170static __init u32 build_rs(u32 arg)
171{
172 if (arg & ~RS_MASK)
173 printk(KERN_WARNING "TLB synthesizer field overflow\n");
174
175 return (arg & RS_MASK) << RS_SH;
176}
177
178static __init u32 build_rt(u32 arg)
179{
180 if (arg & ~RT_MASK)
181 printk(KERN_WARNING "TLB synthesizer field overflow\n");
182
183 return (arg & RT_MASK) << RT_SH;
184}
185
186static __init u32 build_rd(u32 arg)
187{
188 if (arg & ~RD_MASK)
189 printk(KERN_WARNING "TLB synthesizer field overflow\n");
190
191 return (arg & RD_MASK) << RD_SH;
192}
193
194static __init u32 build_re(u32 arg)
195{
196 if (arg & ~RE_MASK)
197 printk(KERN_WARNING "TLB synthesizer field overflow\n");
198
199 return (arg & RE_MASK) << RE_SH;
200}
201
202static __init u32 build_simm(s32 arg)
203{
204 if (arg > 0x7fff || arg < -0x8000)
205 printk(KERN_WARNING "TLB synthesizer field overflow\n");
206
207 return arg & 0xffff;
208}
209
210static __init u32 build_uimm(u32 arg)
211{
212 if (arg & ~IMM_MASK)
213 printk(KERN_WARNING "TLB synthesizer field overflow\n");
214
215 return arg & IMM_MASK;
216}
217
218static __init u32 build_bimm(s32 arg)
219{
220 if (arg > 0x1ffff || arg < -0x20000)
221 printk(KERN_WARNING "TLB synthesizer field overflow\n");
222
223 if (arg & 0x3)
224 printk(KERN_WARNING "Invalid TLB synthesizer branch target\n");
225
226 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff);
227}
228
229static __init u32 build_jimm(u32 arg)
230{
231 if (arg & ~((JIMM_MASK) << 2))
232 printk(KERN_WARNING "TLB synthesizer field overflow\n");
233
234 return (arg >> 2) & JIMM_MASK;
235}
236
237static __init u32 build_func(u32 arg)
238{
239 if (arg & ~FUNC_MASK)
240 printk(KERN_WARNING "TLB synthesizer field overflow\n");
241
242 return arg & FUNC_MASK;
243}
244
245/*
246 * The order of opcode arguments is implicitly left to right,
247 * starting with RS and ending with FUNC or IMM.
248 */
249static void __init build_insn(u32 **buf, enum opcode opc, ...)
250{
251 struct insn *ip = NULL;
252 unsigned int i;
253 va_list ap;
254 u32 op;
255
256 for (i = 0; insn_table[i].opcode != insn_invalid; i++)
257 if (insn_table[i].opcode == opc) {
258 ip = &insn_table[i];
259 break;
260 }
261
262 if (!ip)
263 panic("Unsupported TLB synthesizer instruction %d", opc);
264
265 op = ip->match;
266 va_start(ap, opc);
267 if (ip->fields & RS) op |= build_rs(va_arg(ap, u32));
268 if (ip->fields & RT) op |= build_rt(va_arg(ap, u32));
269 if (ip->fields & RD) op |= build_rd(va_arg(ap, u32));
270 if (ip->fields & RE) op |= build_re(va_arg(ap, u32));
271 if (ip->fields & SIMM) op |= build_simm(va_arg(ap, s32));
272 if (ip->fields & UIMM) op |= build_uimm(va_arg(ap, u32));
273 if (ip->fields & BIMM) op |= build_bimm(va_arg(ap, s32));
274 if (ip->fields & JIMM) op |= build_jimm(va_arg(ap, u32));
275 if (ip->fields & FUNC) op |= build_func(va_arg(ap, u32));
276 va_end(ap);
277
278 **buf = op;
279 (*buf)++;
280}
281
282#define I_u1u2u3(op) \
283 static inline void i##op(u32 **buf, unsigned int a, \
284 unsigned int b, unsigned int c) \
285 { \
286 build_insn(buf, insn##op, a, b, c); \
287 }
288
289#define I_u2u1u3(op) \
290 static inline void i##op(u32 **buf, unsigned int a, \
291 unsigned int b, unsigned int c) \
292 { \
293 build_insn(buf, insn##op, b, a, c); \
294 }
295
296#define I_u3u1u2(op) \
297 static inline void i##op(u32 **buf, unsigned int a, \
298 unsigned int b, unsigned int c) \
299 { \
300 build_insn(buf, insn##op, b, c, a); \
301 }
302
303#define I_u1u2s3(op) \
304 static inline void i##op(u32 **buf, unsigned int a, \
305 unsigned int b, signed int c) \
306 { \
307 build_insn(buf, insn##op, a, b, c); \
308 }
309
310#define I_u2s3u1(op) \
311 static inline void i##op(u32 **buf, unsigned int a, \
312 signed int b, unsigned int c) \
313 { \
314 build_insn(buf, insn##op, c, a, b); \
315 }
316
317#define I_u2u1s3(op) \
318 static inline void i##op(u32 **buf, unsigned int a, \
319 unsigned int b, signed int c) \
320 { \
321 build_insn(buf, insn##op, b, a, c); \
322 }
323
324#define I_u1u2(op) \
325 static inline void i##op(u32 **buf, unsigned int a, \
326 unsigned int b) \
327 { \
328 build_insn(buf, insn##op, a, b); \
329 }
330
331#define I_u1s2(op) \
332 static inline void i##op(u32 **buf, unsigned int a, \
333 signed int b) \
334 { \
335 build_insn(buf, insn##op, a, b); \
336 }
337
338#define I_u1(op) \
339 static inline void i##op(u32 **buf, unsigned int a) \
340 { \
341 build_insn(buf, insn##op, a); \
342 }
343
344#define I_0(op) \
345 static inline void i##op(u32 **buf) \
346 { \
347 build_insn(buf, insn##op); \
348 }
349
350I_u2u1s3(_addiu);
351I_u3u1u2(_addu);
352I_u2u1u3(_andi);
353I_u3u1u2(_and);
354I_u1u2s3(_beq);
355I_u1u2s3(_beql);
356I_u1s2(_bgez);
357I_u1s2(_bgezl);
358I_u1s2(_bltz);
359I_u1s2(_bltzl);
360I_u1u2s3(_bne);
361I_u1u2(_dmfc0);
362I_u1u2(_dmtc0);
363I_u2u1s3(_daddiu);
364I_u3u1u2(_daddu);
365I_u2u1u3(_dsll);
366I_u2u1u3(_dsll32);
367I_u2u1u3(_dsra);
368I_u2u1u3(_dsrl);
369I_u2u1u3(_dsrl32);
370I_u3u1u2(_dsubu);
371I_0(_eret);
372I_u1(_j);
373I_u1(_jal);
374I_u1(_jr);
375I_u2s3u1(_ld);
376I_u2s3u1(_ll);
377I_u2s3u1(_lld);
378I_u1s2(_lui);
379I_u2s3u1(_lw);
380I_u1u2(_mfc0);
381I_u1u2(_mtc0);
382I_u2u1u3(_ori);
383I_0(_rfe);
384I_u2s3u1(_sc);
385I_u2s3u1(_scd);
386I_u2s3u1(_sd);
387I_u2u1u3(_sll);
388I_u2u1u3(_sra);
389I_u2u1u3(_srl);
390I_u3u1u2(_subu);
391I_u2s3u1(_sw);
392I_0(_tlbp);
393I_0(_tlbwi);
394I_0(_tlbwr);
395I_u3u1u2(_xor)
396I_u2u1u3(_xori);
397
398/*
399 * handling labels
400 */
401
402enum label_id {
403 label_invalid,
404 label_second_part,
405 label_leave,
406 label_vmalloc,
407 label_vmalloc_done,
408 label_tlbw_hazard,
409 label_split,
410 label_nopage_tlbl,
411 label_nopage_tlbs,
412 label_nopage_tlbm,
413 label_smp_pgtable_change,
414 label_r3000_write_probe_fail,
415 label_r3000_write_probe_ok
416};
417
418struct label {
419 u32 *addr;
420 enum label_id lab;
421};
422
423static __init void build_label(struct label **lab, u32 *addr,
424 enum label_id l)
425{
426 (*lab)->addr = addr;
427 (*lab)->lab = l;
428 (*lab)++;
429}
430
431#define L_LA(lb) \
432 static inline void l##lb(struct label **lab, u32 *addr) \
433 { \
434 build_label(lab, addr, label##lb); \
435 }
436
437L_LA(_second_part)
438L_LA(_leave)
439L_LA(_vmalloc)
440L_LA(_vmalloc_done)
441L_LA(_tlbw_hazard)
442L_LA(_split)
443L_LA(_nopage_tlbl)
444L_LA(_nopage_tlbs)
445L_LA(_nopage_tlbm)
446L_LA(_smp_pgtable_change)
447L_LA(_r3000_write_probe_fail)
448L_LA(_r3000_write_probe_ok)
449
450/* convenience macros for instructions */
451#ifdef CONFIG_MIPS64
452# define i_LW(buf, rs, rt, off) i_ld(buf, rs, rt, off)
453# define i_SW(buf, rs, rt, off) i_sd(buf, rs, rt, off)
454# define i_SLL(buf, rs, rt, sh) i_dsll(buf, rs, rt, sh)
455# define i_SRA(buf, rs, rt, sh) i_dsra(buf, rs, rt, sh)
456# define i_SRL(buf, rs, rt, sh) i_dsrl(buf, rs, rt, sh)
457# define i_MFC0(buf, rt, rd) i_dmfc0(buf, rt, rd)
458# define i_MTC0(buf, rt, rd) i_dmtc0(buf, rt, rd)
459# define i_ADDIU(buf, rs, rt, val) i_daddiu(buf, rs, rt, val)
460# define i_ADDU(buf, rs, rt, rd) i_daddu(buf, rs, rt, rd)
461# define i_SUBU(buf, rs, rt, rd) i_dsubu(buf, rs, rt, rd)
462# define i_LL(buf, rs, rt, off) i_lld(buf, rs, rt, off)
463# define i_SC(buf, rs, rt, off) i_scd(buf, rs, rt, off)
464#else
465# define i_LW(buf, rs, rt, off) i_lw(buf, rs, rt, off)
466# define i_SW(buf, rs, rt, off) i_sw(buf, rs, rt, off)
467# define i_SLL(buf, rs, rt, sh) i_sll(buf, rs, rt, sh)
468# define i_SRA(buf, rs, rt, sh) i_sra(buf, rs, rt, sh)
469# define i_SRL(buf, rs, rt, sh) i_srl(buf, rs, rt, sh)
470# define i_MFC0(buf, rt, rd) i_mfc0(buf, rt, rd)
471# define i_MTC0(buf, rt, rd) i_mtc0(buf, rt, rd)
472# define i_ADDIU(buf, rs, rt, val) i_addiu(buf, rs, rt, val)
473# define i_ADDU(buf, rs, rt, rd) i_addu(buf, rs, rt, rd)
474# define i_SUBU(buf, rs, rt, rd) i_subu(buf, rs, rt, rd)
475# define i_LL(buf, rs, rt, off) i_ll(buf, rs, rt, off)
476# define i_SC(buf, rs, rt, off) i_sc(buf, rs, rt, off)
477#endif
478
479#define i_b(buf, off) i_beq(buf, 0, 0, off)
480#define i_beqz(buf, rs, off) i_beq(buf, rs, 0, off)
481#define i_beqzl(buf, rs, off) i_beql(buf, rs, 0, off)
482#define i_bnez(buf, rs, off) i_bne(buf, rs, 0, off)
483#define i_bnezl(buf, rs, off) i_bnel(buf, rs, 0, off)
484#define i_move(buf, a, b) i_ADDU(buf, a, 0, b)
485#define i_nop(buf) i_sll(buf, 0, 0, 0)
486#define i_ssnop(buf) i_sll(buf, 0, 0, 1)
487#define i_ehb(buf) i_sll(buf, 0, 0, 3)
488
489#ifdef CONFIG_MIPS64
490static __init int __attribute__((unused)) in_compat_space_p(long addr)
491{
492 /* Is this address in 32bit compat space? */
493 return (((addr) & 0xffffffff00000000) == 0xffffffff00000000);
494}
495
496static __init int __attribute__((unused)) rel_highest(long val)
497{
498 return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
499}
500
501static __init int __attribute__((unused)) rel_higher(long val)
502{
503 return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
504}
505#endif
506
507static __init int rel_hi(long val)
508{
509 return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000;
510}
511
512static __init int rel_lo(long val)
513{
514 return ((val & 0xffff) ^ 0x8000) - 0x8000;
515}
516
517static __init void i_LA_mostly(u32 **buf, unsigned int rs, long addr)
518{
519#if CONFIG_MIPS64
520 if (!in_compat_space_p(addr)) {
521 i_lui(buf, rs, rel_highest(addr));
522 if (rel_higher(addr))
523 i_daddiu(buf, rs, rs, rel_higher(addr));
524 if (rel_hi(addr)) {
525 i_dsll(buf, rs, rs, 16);
526 i_daddiu(buf, rs, rs, rel_hi(addr));
527 i_dsll(buf, rs, rs, 16);
528 } else
529 i_dsll32(buf, rs, rs, 0);
530 } else
531#endif
532 i_lui(buf, rs, rel_hi(addr));
533}
534
535static __init void __attribute__((unused)) i_LA(u32 **buf, unsigned int rs,
536 long addr)
537{
538 i_LA_mostly(buf, rs, addr);
539 if (rel_lo(addr))
540 i_ADDIU(buf, rs, rs, rel_lo(addr));
541}
542
543/*
544 * handle relocations
545 */
546
547struct reloc {
548 u32 *addr;
549 unsigned int type;
550 enum label_id lab;
551};
552
553static __init void r_mips_pc16(struct reloc **rel, u32 *addr,
554 enum label_id l)
555{
556 (*rel)->addr = addr;
557 (*rel)->type = R_MIPS_PC16;
558 (*rel)->lab = l;
559 (*rel)++;
560}
561
562static inline void __resolve_relocs(struct reloc *rel, struct label *lab)
563{
564 long laddr = (long)lab->addr;
565 long raddr = (long)rel->addr;
566
567 switch (rel->type) {
568 case R_MIPS_PC16:
569 *rel->addr |= build_bimm(laddr - (raddr + 4));
570 break;
571
572 default:
573 panic("Unsupported TLB synthesizer relocation %d",
574 rel->type);
575 }
576}
577
578static __init void resolve_relocs(struct reloc *rel, struct label *lab)
579{
580 struct label *l;
581
582 for (; rel->lab != label_invalid; rel++)
583 for (l = lab; l->lab != label_invalid; l++)
584 if (rel->lab == l->lab)
585 __resolve_relocs(rel, l);
586}
587
588static __init void move_relocs(struct reloc *rel, u32 *first, u32 *end,
589 long off)
590{
591 for (; rel->lab != label_invalid; rel++)
592 if (rel->addr >= first && rel->addr < end)
593 rel->addr += off;
594}
595
596static __init void move_labels(struct label *lab, u32 *first, u32 *end,
597 long off)
598{
599 for (; lab->lab != label_invalid; lab++)
600 if (lab->addr >= first && lab->addr < end)
601 lab->addr += off;
602}
603
604static __init void copy_handler(struct reloc *rel, struct label *lab,
605 u32 *first, u32 *end, u32 *target)
606{
607 long off = (long)(target - first);
608
609 memcpy(target, first, (end - first) * sizeof(u32));
610
611 move_relocs(rel, first, end, off);
612 move_labels(lab, first, end, off);
613}
614
615static __init int __attribute__((unused)) insn_has_bdelay(struct reloc *rel,
616 u32 *addr)
617{
618 for (; rel->lab != label_invalid; rel++) {
619 if (rel->addr == addr
620 && (rel->type == R_MIPS_PC16
621 || rel->type == R_MIPS_26))
622 return 1;
623 }
624
625 return 0;
626}
627
628/* convenience functions for labeled branches */
629static void __attribute__((unused)) il_bltz(u32 **p, struct reloc **r,
630 unsigned int reg, enum label_id l)
631{
632 r_mips_pc16(r, *p, l);
633 i_bltz(p, reg, 0);
634}
635
636static void __attribute__((unused)) il_b(u32 **p, struct reloc **r,
637 enum label_id l)
638{
639 r_mips_pc16(r, *p, l);
640 i_b(p, 0);
641}
642
643static void il_beqz(u32 **p, struct reloc **r, unsigned int reg,
644 enum label_id l)
645{
646 r_mips_pc16(r, *p, l);
647 i_beqz(p, reg, 0);
648}
649
650static void __attribute__((unused))
651il_beqzl(u32 **p, struct reloc **r, unsigned int reg, enum label_id l)
652{
653 r_mips_pc16(r, *p, l);
654 i_beqzl(p, reg, 0);
655}
656
657static void il_bnez(u32 **p, struct reloc **r, unsigned int reg,
658 enum label_id l)
659{
660 r_mips_pc16(r, *p, l);
661 i_bnez(p, reg, 0);
662}
663
664static void il_bgezl(u32 **p, struct reloc **r, unsigned int reg,
665 enum label_id l)
666{
667 r_mips_pc16(r, *p, l);
668 i_bgezl(p, reg, 0);
669}
670
671/* The only general purpose registers allowed in TLB handlers. */
672#define K0 26
673#define K1 27
674
675/* Some CP0 registers */
676#define C0_INDEX 0
677#define C0_ENTRYLO0 2
678#define C0_ENTRYLO1 3
679#define C0_CONTEXT 4
680#define C0_BADVADDR 8
681#define C0_ENTRYHI 10
682#define C0_EPC 14
683#define C0_XCONTEXT 20
684
685#ifdef CONFIG_MIPS64
686# define GET_CONTEXT(buf, reg) i_MFC0(buf, reg, C0_XCONTEXT)
687#else
688# define GET_CONTEXT(buf, reg) i_MFC0(buf, reg, C0_CONTEXT)
689#endif
690
691/* The worst case length of the handler is around 18 instructions for
692 * R3000-style TLBs and up to 63 instructions for R4000-style TLBs.
693 * Maximum space available is 32 instructions for R3000 and 64
694 * instructions for R4000.
695 *
696 * We deliberately chose a buffer size of 128, so we won't scribble
697 * over anything important on overflow before we panic.
698 */
699static __initdata u32 tlb_handler[128];
700
701/* simply assume worst case size for labels and relocs */
702static __initdata struct label labels[128];
703static __initdata struct reloc relocs[128];
704
705/*
706 * The R3000 TLB handler is simple.
707 */
708static void __init build_r3000_tlb_refill_handler(void)
709{
710 long pgdc = (long)pgd_current;
711 u32 *p;
712
713 memset(tlb_handler, 0, sizeof(tlb_handler));
714 p = tlb_handler;
715
716 i_mfc0(&p, K0, C0_BADVADDR);
717 i_lui(&p, K1, rel_hi(pgdc)); /* cp0 delay */
718 i_lw(&p, K1, rel_lo(pgdc), K1);
719 i_srl(&p, K0, K0, 22); /* load delay */
720 i_sll(&p, K0, K0, 2);
721 i_addu(&p, K1, K1, K0);
722 i_mfc0(&p, K0, C0_CONTEXT);
723 i_lw(&p, K1, 0, K1); /* cp0 delay */
724 i_andi(&p, K0, K0, 0xffc); /* load delay */
725 i_addu(&p, K1, K1, K0);
726 i_lw(&p, K0, 0, K1);
727 i_nop(&p); /* load delay */
728 i_mtc0(&p, K0, C0_ENTRYLO0);
729 i_mfc0(&p, K1, C0_EPC); /* cp0 delay */
730 i_tlbwr(&p); /* cp0 delay */
731 i_jr(&p, K1);
732 i_rfe(&p); /* branch delay */
733
734 if (p > tlb_handler + 32)
735 panic("TLB refill handler space exceeded");
736
737 printk("Synthesized TLB handler (%u instructions).\n",
738 (unsigned int)(p - tlb_handler));
739#ifdef DEBUG_TLB
740 {
741 int i;
742
743 for (i = 0; i < (p - tlb_handler); i++)
744 printk("%08x\n", tlb_handler[i]);
745 }
746#endif
747
748 memcpy((void *)CAC_BASE, tlb_handler, 0x80);
749 flush_icache_range(CAC_BASE, CAC_BASE + 0x80);
750}
751
752/*
753 * The R4000 TLB handler is much more complicated. We have two
754 * consecutive handler areas with 32 instructions space each.
755 * Since they aren't used at the same time, we can overflow in the
756 * other one.To keep things simple, we first assume linear space,
757 * then we relocate it to the final handler layout as needed.
758 */
759static __initdata u32 final_handler[64];
760
761/*
762 * Hazards
763 *
764 * From the IDT errata for the QED RM5230 (Nevada), processor revision 1.0:
765 * 2. A timing hazard exists for the TLBP instruction.
766 *
767 * stalling_instruction
768 * TLBP
769 *
770 * The JTLB is being read for the TLBP throughout the stall generated by the
771 * previous instruction. This is not really correct as the stalling instruction
772 * can modify the address used to access the JTLB. The failure symptom is that
773 * the TLBP instruction will use an address created for the stalling instruction
774 * and not the address held in C0_ENHI and thus report the wrong results.
775 *
776 * The software work-around is to not allow the instruction preceding the TLBP
777 * to stall - make it an NOP or some other instruction guaranteed not to stall.
778 *
779 * Errata 2 will not be fixed. This errata is also on the R5000.
780 *
781 * As if we MIPS hackers wouldn't know how to nop pipelines happy ...
782 */
783static __init void __attribute__((unused)) build_tlb_probe_entry(u32 **p)
784{
785 switch (current_cpu_data.cputype) {
786 case CPU_R5000:
787 case CPU_R5000A:
788 case CPU_NEVADA:
789 i_nop(p);
790 i_tlbp(p);
791 break;
792
793 default:
794 i_tlbp(p);
795 break;
796 }
797}
798
799/*
800 * Write random or indexed TLB entry, and care about the hazards from
801 * the preceeding mtc0 and for the following eret.
802 */
803enum tlb_write_entry { tlb_random, tlb_indexed };
804
805static __init void build_tlb_write_entry(u32 **p, struct label **l,
806 struct reloc **r,
807 enum tlb_write_entry wmode)
808{
809 void(*tlbw)(u32 **) = NULL;
810
811 switch (wmode) {
812 case tlb_random: tlbw = i_tlbwr; break;
813 case tlb_indexed: tlbw = i_tlbwi; break;
814 }
815
816 switch (current_cpu_data.cputype) {
817 case CPU_R4000PC:
818 case CPU_R4000SC:
819 case CPU_R4000MC:
820 case CPU_R4400PC:
821 case CPU_R4400SC:
822 case CPU_R4400MC:
823 /*
824 * This branch uses up a mtc0 hazard nop slot and saves
825 * two nops after the tlbw instruction.
826 */
827 il_bgezl(p, r, 0, label_tlbw_hazard);
828 tlbw(p);
829 l_tlbw_hazard(l, *p);
830 i_nop(p);
831 break;
832
833 case CPU_R4600:
834 case CPU_R4700:
835 case CPU_R5000:
836 case CPU_R5000A:
837 case CPU_5KC:
838 case CPU_TX49XX:
839 case CPU_AU1000:
840 case CPU_AU1100:
841 case CPU_AU1500:
842 case CPU_AU1550:
843 i_nop(p);
844 tlbw(p);
845 break;
846
847 case CPU_R10000:
848 case CPU_R12000:
849 case CPU_4KC:
850 case CPU_SB1:
851 case CPU_4KSC:
852 case CPU_20KC:
853 case CPU_25KF:
854 tlbw(p);
855 break;
856
857 case CPU_NEVADA:
858 i_nop(p); /* QED specifies 2 nops hazard */
859 /*
860 * This branch uses up a mtc0 hazard nop slot and saves
861 * a nop after the tlbw instruction.
862 */
863 il_bgezl(p, r, 0, label_tlbw_hazard);
864 tlbw(p);
865 l_tlbw_hazard(l, *p);
866 break;
867
868 case CPU_RM7000:
869 i_nop(p);
870 i_nop(p);
871 i_nop(p);
872 i_nop(p);
873 tlbw(p);
874 break;
875
876 case CPU_4KEC:
877 case CPU_24K:
878 i_ehb(p);
879 tlbw(p);
880 break;
881
882 case CPU_RM9000:
883 /*
884 * When the JTLB is updated by tlbwi or tlbwr, a subsequent
885 * use of the JTLB for instructions should not occur for 4
886 * cpu cycles and use for data translations should not occur
887 * for 3 cpu cycles.
888 */
889 i_ssnop(p);
890 i_ssnop(p);
891 i_ssnop(p);
892 i_ssnop(p);
893 tlbw(p);
894 i_ssnop(p);
895 i_ssnop(p);
896 i_ssnop(p);
897 i_ssnop(p);
898 break;
899
900 case CPU_VR4111:
901 case CPU_VR4121:
902 case CPU_VR4122:
903 case CPU_VR4181:
904 case CPU_VR4181A:
905 i_nop(p);
906 i_nop(p);
907 tlbw(p);
908 i_nop(p);
909 i_nop(p);
910 break;
911
912 case CPU_VR4131:
913 case CPU_VR4133:
914 i_nop(p);
915 i_nop(p);
916 tlbw(p);
917 break;
918
919 default:
920 panic("No TLB refill handler yet (CPU type: %d)",
921 current_cpu_data.cputype);
922 break;
923 }
924}
925
926#ifdef CONFIG_MIPS64
927/*
928 * TMP and PTR are scratch.
929 * TMP will be clobbered, PTR will hold the pmd entry.
930 */
931static __init void
932build_get_pmde64(u32 **p, struct label **l, struct reloc **r,
933 unsigned int tmp, unsigned int ptr)
934{
935 long pgdc = (long)pgd_current;
936
937 /*
938 * The vmalloc handling is not in the hotpath.
939 */
940 i_dmfc0(p, tmp, C0_BADVADDR);
941 il_bltz(p, r, tmp, label_vmalloc);
942 /* No i_nop needed here, since the next insn doesn't touch TMP. */
943
944#ifdef CONFIG_SMP
945 /*
946 * 64 bit SMP has the lower part of &pgd_current[smp_processor_id()]
947 * stored in CONTEXT.
948 */
949 if (in_compat_space_p(pgdc)) {
950 i_dmfc0(p, ptr, C0_CONTEXT);
951 i_dsra(p, ptr, ptr, 23);
952 i_ld(p, ptr, 0, ptr);
953 } else {
954#ifdef CONFIG_BUILD_ELF64
955 i_dmfc0(p, ptr, C0_CONTEXT);
956 i_dsrl(p, ptr, ptr, 23);
957 i_dsll(p, ptr, ptr, 3);
958 i_LA_mostly(p, tmp, pgdc);
959 i_daddu(p, ptr, ptr, tmp);
960 i_dmfc0(p, tmp, C0_BADVADDR);
961 i_ld(p, ptr, rel_lo(pgdc), ptr);
962#else
963 i_dmfc0(p, ptr, C0_CONTEXT);
964 i_lui(p, tmp, rel_highest(pgdc));
965 i_dsll(p, ptr, ptr, 9);
966 i_daddiu(p, tmp, tmp, rel_higher(pgdc));
967 i_dsrl32(p, ptr, ptr, 0);
968 i_and(p, ptr, ptr, tmp);
969 i_dmfc0(p, tmp, C0_BADVADDR);
970 i_ld(p, ptr, 0, ptr);
971#endif
972 }
973#else
974 i_LA_mostly(p, ptr, pgdc);
975 i_ld(p, ptr, rel_lo(pgdc), ptr);
976#endif
977
978 l_vmalloc_done(l, *p);
979 i_dsrl(p, tmp, tmp, PGDIR_SHIFT-3); /* get pgd offset in bytes */
980 i_andi(p, tmp, tmp, (PTRS_PER_PGD - 1)<<3);
981 i_daddu(p, ptr, ptr, tmp); /* add in pgd offset */
982 i_dmfc0(p, tmp, C0_BADVADDR); /* get faulting address */
983 i_ld(p, ptr, 0, ptr); /* get pmd pointer */
984 i_dsrl(p, tmp, tmp, PMD_SHIFT-3); /* get pmd offset in bytes */
985 i_andi(p, tmp, tmp, (PTRS_PER_PMD - 1)<<3);
986 i_daddu(p, ptr, ptr, tmp); /* add in pmd offset */
987}
988
989/*
990 * BVADDR is the faulting address, PTR is scratch.
991 * PTR will hold the pgd for vmalloc.
992 */
993static __init void
994build_get_pgd_vmalloc64(u32 **p, struct label **l, struct reloc **r,
995 unsigned int bvaddr, unsigned int ptr)
996{
997 long swpd = (long)swapper_pg_dir;
998
999 l_vmalloc(l, *p);
1000 i_LA(p, ptr, VMALLOC_START);
1001 i_dsubu(p, bvaddr, bvaddr, ptr);
1002
1003 if (in_compat_space_p(swpd) && !rel_lo(swpd)) {
1004 il_b(p, r, label_vmalloc_done);
1005 i_lui(p, ptr, rel_hi(swpd));
1006 } else {
1007 i_LA_mostly(p, ptr, swpd);
1008 il_b(p, r, label_vmalloc_done);
1009 i_daddiu(p, ptr, ptr, rel_lo(swpd));
1010 }
1011}
1012
1013#else /* !CONFIG_MIPS64 */
1014
1015/*
1016 * TMP and PTR are scratch.
1017 * TMP will be clobbered, PTR will hold the pgd entry.
1018 */
1019static __init void __attribute__((unused))
1020build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
1021{
1022 long pgdc = (long)pgd_current;
1023
1024 /* 32 bit SMP has smp_processor_id() stored in CONTEXT. */
1025#ifdef CONFIG_SMP
1026 i_mfc0(p, ptr, C0_CONTEXT);
1027 i_LA_mostly(p, tmp, pgdc);
1028 i_srl(p, ptr, ptr, 23);
1029 i_sll(p, ptr, ptr, 2);
1030 i_addu(p, ptr, tmp, ptr);
1031#else
1032 i_LA_mostly(p, ptr, pgdc);
1033#endif
1034 i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
1035 i_lw(p, ptr, rel_lo(pgdc), ptr);
1036 i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */
1037 i_sll(p, tmp, tmp, PGD_T_LOG2);
1038 i_addu(p, ptr, ptr, tmp); /* add in pgd offset */
1039}
1040
1041#endif /* !CONFIG_MIPS64 */
1042
1043static __init void build_adjust_context(u32 **p, unsigned int ctx)
1044{
1045 unsigned int shift = 4 - (PTE_T_LOG2 + 1);
1046 unsigned int mask = (PTRS_PER_PTE / 2 - 1) << (PTE_T_LOG2 + 1);
1047
1048 switch (current_cpu_data.cputype) {
1049 case CPU_VR41XX:
1050 case CPU_VR4111:
1051 case CPU_VR4121:
1052 case CPU_VR4122:
1053 case CPU_VR4131:
1054 case CPU_VR4181:
1055 case CPU_VR4181A:
1056 case CPU_VR4133:
1057 shift += 2;
1058 break;
1059
1060 default:
1061 break;
1062 }
1063
1064 if (shift)
1065 i_SRL(p, ctx, ctx, shift);
1066 i_andi(p, ctx, ctx, mask);
1067}
1068
1069static __init void build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)
1070{
1071 /*
1072 * Bug workaround for the Nevada. It seems as if under certain
1073 * circumstances the move from cp0_context might produce a
1074 * bogus result when the mfc0 instruction and its consumer are
1075 * in a different cacheline or a load instruction, probably any
1076 * memory reference, is between them.
1077 */
1078 switch (current_cpu_data.cputype) {
1079 case CPU_NEVADA:
1080 i_LW(p, ptr, 0, ptr);
1081 GET_CONTEXT(p, tmp); /* get context reg */
1082 break;
1083
1084 default:
1085 GET_CONTEXT(p, tmp); /* get context reg */
1086 i_LW(p, ptr, 0, ptr);
1087 break;
1088 }
1089
1090 build_adjust_context(p, tmp);
1091 i_ADDU(p, ptr, ptr, tmp); /* add in offset */
1092}
1093
1094static __init void build_update_entries(u32 **p, unsigned int tmp,
1095 unsigned int ptep)
1096{
1097 /*
1098 * 64bit address support (36bit on a 32bit CPU) in a 32bit
1099 * Kernel is a special case. Only a few CPUs use it.
1100 */
1101#ifdef CONFIG_64BIT_PHYS_ADDR
1102 if (cpu_has_64bits) {
1103 i_ld(p, tmp, 0, ptep); /* get even pte */
1104 i_ld(p, ptep, sizeof(pte_t), ptep); /* get odd pte */
1105 i_dsrl(p, tmp, tmp, 6); /* convert to entrylo0 */
1106 i_mtc0(p, tmp, C0_ENTRYLO0); /* load it */
1107 i_dsrl(p, ptep, ptep, 6); /* convert to entrylo1 */
1108 i_mtc0(p, ptep, C0_ENTRYLO1); /* load it */
1109 } else {
1110 int pte_off_even = sizeof(pte_t) / 2;
1111 int pte_off_odd = pte_off_even + sizeof(pte_t);
1112
1113 /* The pte entries are pre-shifted */
1114 i_lw(p, tmp, pte_off_even, ptep); /* get even pte */
1115 i_mtc0(p, tmp, C0_ENTRYLO0); /* load it */
1116 i_lw(p, ptep, pte_off_odd, ptep); /* get odd pte */
1117 i_mtc0(p, ptep, C0_ENTRYLO1); /* load it */
1118 }
1119#else
1120 i_LW(p, tmp, 0, ptep); /* get even pte */
1121 i_LW(p, ptep, sizeof(pte_t), ptep); /* get odd pte */
1122 if (r45k_bvahwbug())
1123 build_tlb_probe_entry(p);
1124 i_SRL(p, tmp, tmp, 6); /* convert to entrylo0 */
1125 if (r4k_250MHZhwbug())
1126 i_mtc0(p, 0, C0_ENTRYLO0);
1127 i_mtc0(p, tmp, C0_ENTRYLO0); /* load it */
1128 i_SRL(p, ptep, ptep, 6); /* convert to entrylo1 */
1129 if (r45k_bvahwbug())
1130 i_mfc0(p, tmp, C0_INDEX);
1131 if (r4k_250MHZhwbug())
1132 i_mtc0(p, 0, C0_ENTRYLO1);
1133 i_mtc0(p, ptep, C0_ENTRYLO1); /* load it */
1134#endif
1135}
1136
1137static void __init build_r4000_tlb_refill_handler(void)
1138{
1139 u32 *p = tlb_handler;
1140 struct label *l = labels;
1141 struct reloc *r = relocs;
1142 u32 *f;
1143 unsigned int final_len;
1144
1145 memset(tlb_handler, 0, sizeof(tlb_handler));
1146 memset(labels, 0, sizeof(labels));
1147 memset(relocs, 0, sizeof(relocs));
1148 memset(final_handler, 0, sizeof(final_handler));
1149
1150 /*
1151 * create the plain linear handler
1152 */
1153 if (bcm1250_m3_war()) {
1154 i_MFC0(&p, K0, C0_BADVADDR);
1155 i_MFC0(&p, K1, C0_ENTRYHI);
1156 i_xor(&p, K0, K0, K1);
1157 i_SRL(&p, K0, K0, PAGE_SHIFT + 1);
1158 il_bnez(&p, &r, K0, label_leave);
1159 /* No need for i_nop */
1160 }
1161
1162#ifdef CONFIG_MIPS64
1163 build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */
1164#else
1165 build_get_pgde32(&p, K0, K1); /* get pgd in K1 */
1166#endif
1167
1168 build_get_ptep(&p, K0, K1);
1169 build_update_entries(&p, K0, K1);
1170 build_tlb_write_entry(&p, &l, &r, tlb_random);
1171 l_leave(&l, p);
1172 i_eret(&p); /* return from trap */
1173
1174#ifdef CONFIG_MIPS64
1175 build_get_pgd_vmalloc64(&p, &l, &r, K0, K1);
1176#endif
1177
1178 /*
1179 * Overflow check: For the 64bit handler, we need at least one
1180 * free instruction slot for the wrap-around branch. In worst
1181 * case, if the intended insertion point is a delay slot, we
1182 * need three, with the the second nop'ed and the third being
1183 * unused.
1184 */
1185#ifdef CONFIG_MIPS32
1186 if ((p - tlb_handler) > 64)
1187 panic("TLB refill handler space exceeded");
1188#else
1189 if (((p - tlb_handler) > 63)
1190 || (((p - tlb_handler) > 61)
1191 && insn_has_bdelay(relocs, tlb_handler + 29)))
1192 panic("TLB refill handler space exceeded");
1193#endif
1194
1195 /*
1196 * Now fold the handler in the TLB refill handler space.
1197 */
1198#ifdef CONFIG_MIPS32
1199 f = final_handler;
1200 /* Simplest case, just copy the handler. */
1201 copy_handler(relocs, labels, tlb_handler, p, f);
1202 final_len = p - tlb_handler;
1203#else /* CONFIG_MIPS64 */
1204 f = final_handler + 32;
1205 if ((p - tlb_handler) <= 32) {
1206 /* Just copy the handler. */
1207 copy_handler(relocs, labels, tlb_handler, p, f);
1208 final_len = p - tlb_handler;
1209 } else {
1210 u32 *split = tlb_handler + 30;
1211
1212 /*
1213 * Find the split point.
1214 */
1215 if (insn_has_bdelay(relocs, split - 1))
1216 split--;
1217
1218 /* Copy first part of the handler. */
1219 copy_handler(relocs, labels, tlb_handler, split, f);
1220 f += split - tlb_handler;
1221
1222 /* Insert branch. */
1223 l_split(&l, final_handler);
1224 il_b(&f, &r, label_split);
1225 if (insn_has_bdelay(relocs, split))
1226 i_nop(&f);
1227 else {
1228 copy_handler(relocs, labels, split, split + 1, f);
1229 move_labels(labels, f, f + 1, -1);
1230 f++;
1231 split++;
1232 }
1233
1234 /* Copy the rest of the handler. */
1235 copy_handler(relocs, labels, split, p, final_handler);
1236 final_len = (f - (final_handler + 32)) + (p - split);
1237 }
1238#endif /* CONFIG_MIPS64 */
1239
1240 resolve_relocs(relocs, labels);
1241 printk("Synthesized TLB refill handler (%u instructions).\n",
1242 final_len);
1243
1244#ifdef DEBUG_TLB
1245 {
1246 int i;
1247
1248 for (i = 0; i < 64; i++)
1249 printk("%08x\n", final_handler[i]);
1250 }
1251#endif
1252
1253 memcpy((void *)CAC_BASE, final_handler, 0x100);
1254 flush_icache_range(CAC_BASE, CAC_BASE + 0x100);
1255}
1256
1257/*
1258 * TLB load/store/modify handlers.
1259 *
1260 * Only the fastpath gets synthesized at runtime, the slowpath for
1261 * do_page_fault remains normal asm.
1262 */
1263extern void tlb_do_page_fault_0(void);
1264extern void tlb_do_page_fault_1(void);
1265
1266#define __tlb_handler_align \
1267 __attribute__((__aligned__(1 << CONFIG_MIPS_L1_CACHE_SHIFT)))
1268
1269/*
1270 * 128 instructions for the fastpath handler is generous and should
1271 * never be exceeded.
1272 */
1273#define FASTPATH_SIZE 128
1274
1275u32 __tlb_handler_align handle_tlbl[FASTPATH_SIZE];
1276u32 __tlb_handler_align handle_tlbs[FASTPATH_SIZE];
1277u32 __tlb_handler_align handle_tlbm[FASTPATH_SIZE];
1278
1279static void __init
1280iPTE_LW(u32 **p, struct label **l, unsigned int pte, int offset,
1281 unsigned int ptr)
1282{
1283#ifdef CONFIG_SMP
1284# ifdef CONFIG_64BIT_PHYS_ADDR
1285 if (cpu_has_64bits)
1286 i_lld(p, pte, offset, ptr);
1287 else
1288# endif
1289 i_LL(p, pte, offset, ptr);
1290#else
1291# ifdef CONFIG_64BIT_PHYS_ADDR
1292 if (cpu_has_64bits)
1293 i_ld(p, pte, offset, ptr);
1294 else
1295# endif
1296 i_LW(p, pte, offset, ptr);
1297#endif
1298}
1299
1300static void __init
1301iPTE_SW(u32 **p, struct reloc **r, unsigned int pte, int offset,
1302 unsigned int ptr)
1303{
1304#ifdef CONFIG_SMP
1305# ifdef CONFIG_64BIT_PHYS_ADDR
1306 if (cpu_has_64bits)
1307 i_scd(p, pte, offset, ptr);
1308 else
1309# endif
1310 i_SC(p, pte, offset, ptr);
1311
1312 if (r10000_llsc_war())
1313 il_beqzl(p, r, pte, label_smp_pgtable_change);
1314 else
1315 il_beqz(p, r, pte, label_smp_pgtable_change);
1316
1317# ifdef CONFIG_64BIT_PHYS_ADDR
1318 if (!cpu_has_64bits) {
1319 /* no i_nop needed */
1320 i_ll(p, pte, sizeof(pte_t) / 2, ptr);
1321 i_ori(p, pte, pte, _PAGE_VALID);
1322 i_sc(p, pte, sizeof(pte_t) / 2, ptr);
1323 il_beqz(p, r, pte, label_smp_pgtable_change);
1324 /* no i_nop needed */
1325 i_lw(p, pte, 0, ptr);
1326 } else
1327 i_nop(p);
1328# else
1329 i_nop(p);
1330# endif
1331#else
1332# ifdef CONFIG_64BIT_PHYS_ADDR
1333 if (cpu_has_64bits)
1334 i_sd(p, pte, offset, ptr);
1335 else
1336# endif
1337 i_SW(p, pte, offset, ptr);
1338
1339# ifdef CONFIG_64BIT_PHYS_ADDR
1340 if (!cpu_has_64bits) {
1341 i_lw(p, pte, sizeof(pte_t) / 2, ptr);
1342 i_ori(p, pte, pte, _PAGE_VALID);
1343 i_sw(p, pte, sizeof(pte_t) / 2, ptr);
1344 i_lw(p, pte, 0, ptr);
1345 }
1346# endif
1347#endif
1348}
1349
1350/*
1351 * Check if PTE is present, if not then jump to LABEL. PTR points to
1352 * the page table where this PTE is located, PTE will be re-loaded
1353 * with it's original value.
1354 */
1355static void __init
1356build_pte_present(u32 **p, struct label **l, struct reloc **r,
1357 unsigned int pte, unsigned int ptr, enum label_id lid)
1358{
1359 i_andi(p, pte, pte, _PAGE_PRESENT | _PAGE_READ);
1360 i_xori(p, pte, pte, _PAGE_PRESENT | _PAGE_READ);
1361 il_bnez(p, r, pte, lid);
1362 iPTE_LW(p, l, pte, 0, ptr);
1363}
1364
1365/* Make PTE valid, store result in PTR. */
1366static void __init
1367build_make_valid(u32 **p, struct reloc **r, unsigned int pte,
1368 unsigned int ptr)
1369{
1370 i_ori(p, pte, pte, _PAGE_VALID | _PAGE_ACCESSED);
1371 iPTE_SW(p, r, pte, 0, ptr);
1372}
1373
1374/*
1375 * Check if PTE can be written to, if not branch to LABEL. Regardless
1376 * restore PTE with value from PTR when done.
1377 */
1378static void __init
1379build_pte_writable(u32 **p, struct label **l, struct reloc **r,
1380 unsigned int pte, unsigned int ptr, enum label_id lid)
1381{
1382 i_andi(p, pte, pte, _PAGE_PRESENT | _PAGE_WRITE);
1383 i_xori(p, pte, pte, _PAGE_PRESENT | _PAGE_WRITE);
1384 il_bnez(p, r, pte, lid);
1385 iPTE_LW(p, l, pte, 0, ptr);
1386}
1387
1388/* Make PTE writable, update software status bits as well, then store
1389 * at PTR.
1390 */
1391static void __init
1392build_make_write(u32 **p, struct reloc **r, unsigned int pte,
1393 unsigned int ptr)
1394{
1395 i_ori(p, pte, pte,
1396 _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_VALID | _PAGE_DIRTY);
1397 iPTE_SW(p, r, pte, 0, ptr);
1398}
1399
1400/*
1401 * Check if PTE can be modified, if not branch to LABEL. Regardless
1402 * restore PTE with value from PTR when done.
1403 */
1404static void __init
1405build_pte_modifiable(u32 **p, struct label **l, struct reloc **r,
1406 unsigned int pte, unsigned int ptr, enum label_id lid)
1407{
1408 i_andi(p, pte, pte, _PAGE_WRITE);
1409 il_beqz(p, r, pte, lid);
1410 iPTE_LW(p, l, pte, 0, ptr);
1411}
1412
1413/*
1414 * R3000 style TLB load/store/modify handlers.
1415 */
1416
1417/* This places the pte in the page table at PTR into ENTRYLO0. */
1418static void __init
1419build_r3000_pte_reload(u32 **p, unsigned int ptr)
1420{
1421 i_lw(p, ptr, 0, ptr);
1422 i_nop(p); /* load delay */
1423 i_mtc0(p, ptr, C0_ENTRYLO0);
1424 i_nop(p); /* cp0 delay */
1425}
1426
1427/*
1428 * The index register may have the probe fail bit set,
1429 * because we would trap on access kseg2, i.e. without refill.
1430 */
1431static void __init
1432build_r3000_tlb_write(u32 **p, struct label **l, struct reloc **r,
1433 unsigned int tmp)
1434{
1435 i_mfc0(p, tmp, C0_INDEX);
1436 i_nop(p); /* cp0 delay */
1437 il_bltz(p, r, tmp, label_r3000_write_probe_fail);
1438 i_nop(p); /* branch delay */
1439 i_tlbwi(p);
1440 il_b(p, r, label_r3000_write_probe_ok);
1441 i_nop(p); /* branch delay */
1442 l_r3000_write_probe_fail(l, *p);
1443 i_tlbwr(p);
1444 l_r3000_write_probe_ok(l, *p);
1445}
1446
1447static void __init
1448build_r3000_tlbchange_handler_head(u32 **p, unsigned int pte,
1449 unsigned int ptr)
1450{
1451 long pgdc = (long)pgd_current;
1452
1453 i_mfc0(p, pte, C0_BADVADDR);
1454 i_lui(p, ptr, rel_hi(pgdc)); /* cp0 delay */
1455 i_lw(p, ptr, rel_lo(pgdc), ptr);
1456 i_srl(p, pte, pte, 22); /* load delay */
1457 i_sll(p, pte, pte, 2);
1458 i_addu(p, ptr, ptr, pte);
1459 i_mfc0(p, pte, C0_CONTEXT);
1460 i_lw(p, ptr, 0, ptr); /* cp0 delay */
1461 i_andi(p, pte, pte, 0xffc); /* load delay */
1462 i_addu(p, ptr, ptr, pte);
1463 i_lw(p, pte, 0, ptr);
1464 i_nop(p); /* load delay */
1465 i_tlbp(p);
1466}
1467
1468static void __init
1469build_r3000_tlbchange_handler_tail(u32 **p, unsigned int tmp)
1470{
1471 i_mfc0(p, tmp, C0_EPC);
1472 i_nop(p); /* cp0 delay */
1473 i_jr(p, tmp);
1474 i_rfe(p); /* branch delay */
1475}
1476
1477static void __init build_r3000_tlb_load_handler(void)
1478{
1479 u32 *p = handle_tlbl;
1480 struct label *l = labels;
1481 struct reloc *r = relocs;
1482
1483 memset(handle_tlbl, 0, sizeof(handle_tlbl));
1484 memset(labels, 0, sizeof(labels));
1485 memset(relocs, 0, sizeof(relocs));
1486
1487 build_r3000_tlbchange_handler_head(&p, K0, K1);
1488 build_pte_present(&p, &l, &r, K0, K1, label_nopage_tlbl);
1489 build_make_valid(&p, &r, K0, K1);
1490 build_r3000_pte_reload(&p, K1);
1491 build_r3000_tlb_write(&p, &l, &r, K0);
1492 build_r3000_tlbchange_handler_tail(&p, K0);
1493
1494 l_nopage_tlbl(&l, p);
1495 i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff);
1496 i_nop(&p);
1497
1498 if ((p - handle_tlbl) > FASTPATH_SIZE)
1499 panic("TLB load handler fastpath space exceeded");
1500
1501 resolve_relocs(relocs, labels);
1502 printk("Synthesized TLB load handler fastpath (%u instructions).\n",
1503 (unsigned int)(p - handle_tlbl));
1504
1505#ifdef DEBUG_TLB
1506 {
1507 int i;
1508
1509 for (i = 0; i < FASTPATH_SIZE; i++)
1510 printk("%08x\n", handle_tlbl[i]);
1511 }
1512#endif
1513
1514 flush_icache_range((unsigned long)handle_tlbl,
1515 (unsigned long)handle_tlbl + FASTPATH_SIZE * sizeof(u32));
1516}
1517
1518static void __init build_r3000_tlb_store_handler(void)
1519{
1520 u32 *p = handle_tlbs;
1521 struct label *l = labels;
1522 struct reloc *r = relocs;
1523
1524 memset(handle_tlbs, 0, sizeof(handle_tlbs));
1525 memset(labels, 0, sizeof(labels));
1526 memset(relocs, 0, sizeof(relocs));
1527
1528 build_r3000_tlbchange_handler_head(&p, K0, K1);
1529 build_pte_writable(&p, &l, &r, K0, K1, label_nopage_tlbs);
1530 build_make_write(&p, &r, K0, K1);
1531 build_r3000_pte_reload(&p, K1);
1532 build_r3000_tlb_write(&p, &l, &r, K0);
1533 build_r3000_tlbchange_handler_tail(&p, K0);
1534
1535 l_nopage_tlbs(&l, p);
1536 i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
1537 i_nop(&p);
1538
1539 if ((p - handle_tlbs) > FASTPATH_SIZE)
1540 panic("TLB store handler fastpath space exceeded");
1541
1542 resolve_relocs(relocs, labels);
1543 printk("Synthesized TLB store handler fastpath (%u instructions).\n",
1544 (unsigned int)(p - handle_tlbs));
1545
1546#ifdef DEBUG_TLB
1547 {
1548 int i;
1549
1550 for (i = 0; i < FASTPATH_SIZE; i++)
1551 printk("%08x\n", handle_tlbs[i]);
1552 }
1553#endif
1554
1555 flush_icache_range((unsigned long)handle_tlbs,
1556 (unsigned long)handle_tlbs + FASTPATH_SIZE * sizeof(u32));
1557}
1558
1559static void __init build_r3000_tlb_modify_handler(void)
1560{
1561 u32 *p = handle_tlbm;
1562 struct label *l = labels;
1563 struct reloc *r = relocs;
1564
1565 memset(handle_tlbm, 0, sizeof(handle_tlbm));
1566 memset(labels, 0, sizeof(labels));
1567 memset(relocs, 0, sizeof(relocs));
1568
1569 build_r3000_tlbchange_handler_head(&p, K0, K1);
1570 build_pte_modifiable(&p, &l, &r, K0, K1, label_nopage_tlbm);
1571 build_make_write(&p, &r, K0, K1);
1572 build_r3000_pte_reload(&p, K1);
1573 i_tlbwi(&p);
1574 build_r3000_tlbchange_handler_tail(&p, K0);
1575
1576 l_nopage_tlbm(&l, p);
1577 i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
1578 i_nop(&p);
1579
1580 if ((p - handle_tlbm) > FASTPATH_SIZE)
1581 panic("TLB modify handler fastpath space exceeded");
1582
1583 resolve_relocs(relocs, labels);
1584 printk("Synthesized TLB modify handler fastpath (%u instructions).\n",
1585 (unsigned int)(p - handle_tlbm));
1586
1587#ifdef DEBUG_TLB
1588 {
1589 int i;
1590
1591 for (i = 0; i < FASTPATH_SIZE; i++)
1592 printk("%08x\n", handle_tlbm[i]);
1593 }
1594#endif
1595
1596 flush_icache_range((unsigned long)handle_tlbm,
1597 (unsigned long)handle_tlbm + FASTPATH_SIZE * sizeof(u32));
1598}
1599
1600/*
1601 * R4000 style TLB load/store/modify handlers.
1602 */
1603static void __init
1604build_r4000_tlbchange_handler_head(u32 **p, struct label **l,
1605 struct reloc **r, unsigned int pte,
1606 unsigned int ptr)
1607{
1608#ifdef CONFIG_MIPS64
1609 build_get_pmde64(p, l, r, pte, ptr); /* get pmd in ptr */
1610#else
1611 build_get_pgde32(p, pte, ptr); /* get pgd in ptr */
1612#endif
1613
1614 i_MFC0(p, pte, C0_BADVADDR);
1615 i_LW(p, ptr, 0, ptr);
1616 i_SRL(p, pte, pte, PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2);
1617 i_andi(p, pte, pte, (PTRS_PER_PTE - 1) << PTE_T_LOG2);
1618 i_ADDU(p, ptr, ptr, pte);
1619
1620#ifdef CONFIG_SMP
1621 l_smp_pgtable_change(l, *p);
1622# endif
1623 iPTE_LW(p, l, pte, 0, ptr); /* get even pte */
1624 build_tlb_probe_entry(p);
1625}
1626
1627static void __init
1628build_r4000_tlbchange_handler_tail(u32 **p, struct label **l,
1629 struct reloc **r, unsigned int tmp,
1630 unsigned int ptr)
1631{
1632 i_ori(p, ptr, ptr, sizeof(pte_t));
1633 i_xori(p, ptr, ptr, sizeof(pte_t));
1634 build_update_entries(p, tmp, ptr);
1635 build_tlb_write_entry(p, l, r, tlb_indexed);
1636 l_leave(l, *p);
1637 i_eret(p); /* return from trap */
1638
1639#ifdef CONFIG_MIPS64
1640 build_get_pgd_vmalloc64(p, l, r, tmp, ptr);
1641#endif
1642}
1643
1644static void __init build_r4000_tlb_load_handler(void)
1645{
1646 u32 *p = handle_tlbl;
1647 struct label *l = labels;
1648 struct reloc *r = relocs;
1649
1650 memset(handle_tlbl, 0, sizeof(handle_tlbl));
1651 memset(labels, 0, sizeof(labels));
1652 memset(relocs, 0, sizeof(relocs));
1653
1654 if (bcm1250_m3_war()) {
1655 i_MFC0(&p, K0, C0_BADVADDR);
1656 i_MFC0(&p, K1, C0_ENTRYHI);
1657 i_xor(&p, K0, K0, K1);
1658 i_SRL(&p, K0, K0, PAGE_SHIFT + 1);
1659 il_bnez(&p, &r, K0, label_leave);
1660 /* No need for i_nop */
1661 }
1662
1663 build_r4000_tlbchange_handler_head(&p, &l, &r, K0, K1);
1664 build_pte_present(&p, &l, &r, K0, K1, label_nopage_tlbl);
1665 build_make_valid(&p, &r, K0, K1);
1666 build_r4000_tlbchange_handler_tail(&p, &l, &r, K0, K1);
1667
1668 l_nopage_tlbl(&l, p);
1669 i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff);
1670 i_nop(&p);
1671
1672 if ((p - handle_tlbl) > FASTPATH_SIZE)
1673 panic("TLB load handler fastpath space exceeded");
1674
1675 resolve_relocs(relocs, labels);
1676 printk("Synthesized TLB load handler fastpath (%u instructions).\n",
1677 (unsigned int)(p - handle_tlbl));
1678
1679#ifdef DEBUG_TLB
1680 {
1681 int i;
1682
1683 for (i = 0; i < FASTPATH_SIZE; i++)
1684 printk("%08x\n", handle_tlbl[i]);
1685 }
1686#endif
1687
1688 flush_icache_range((unsigned long)handle_tlbl,
1689 (unsigned long)handle_tlbl + FASTPATH_SIZE * sizeof(u32));
1690}
1691
1692static void __init build_r4000_tlb_store_handler(void)
1693{
1694 u32 *p = handle_tlbs;
1695 struct label *l = labels;
1696 struct reloc *r = relocs;
1697
1698 memset(handle_tlbs, 0, sizeof(handle_tlbs));
1699 memset(labels, 0, sizeof(labels));
1700 memset(relocs, 0, sizeof(relocs));
1701
1702 build_r4000_tlbchange_handler_head(&p, &l, &r, K0, K1);
1703 build_pte_writable(&p, &l, &r, K0, K1, label_nopage_tlbs);
1704 build_make_write(&p, &r, K0, K1);
1705 build_r4000_tlbchange_handler_tail(&p, &l, &r, K0, K1);
1706
1707 l_nopage_tlbs(&l, p);
1708 i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
1709 i_nop(&p);
1710
1711 if ((p - handle_tlbs) > FASTPATH_SIZE)
1712 panic("TLB store handler fastpath space exceeded");
1713
1714 resolve_relocs(relocs, labels);
1715 printk("Synthesized TLB store handler fastpath (%u instructions).\n",
1716 (unsigned int)(p - handle_tlbs));
1717
1718#ifdef DEBUG_TLB
1719 {
1720 int i;
1721
1722 for (i = 0; i < FASTPATH_SIZE; i++)
1723 printk("%08x\n", handle_tlbs[i]);
1724 }
1725#endif
1726
1727 flush_icache_range((unsigned long)handle_tlbs,
1728 (unsigned long)handle_tlbs + FASTPATH_SIZE * sizeof(u32));
1729}
1730
1731static void __init build_r4000_tlb_modify_handler(void)
1732{
1733 u32 *p = handle_tlbm;
1734 struct label *l = labels;
1735 struct reloc *r = relocs;
1736
1737 memset(handle_tlbm, 0, sizeof(handle_tlbm));
1738 memset(labels, 0, sizeof(labels));
1739 memset(relocs, 0, sizeof(relocs));
1740
1741 build_r4000_tlbchange_handler_head(&p, &l, &r, K0, K1);
1742 build_pte_modifiable(&p, &l, &r, K0, K1, label_nopage_tlbm);
1743 /* Present and writable bits set, set accessed and dirty bits. */
1744 build_make_write(&p, &r, K0, K1);
1745 build_r4000_tlbchange_handler_tail(&p, &l, &r, K0, K1);
1746
1747 l_nopage_tlbm(&l, p);
1748 i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
1749 i_nop(&p);
1750
1751 if ((p - handle_tlbm) > FASTPATH_SIZE)
1752 panic("TLB modify handler fastpath space exceeded");
1753
1754 resolve_relocs(relocs, labels);
1755 printk("Synthesized TLB modify handler fastpath (%u instructions).\n",
1756 (unsigned int)(p - handle_tlbm));
1757
1758#ifdef DEBUG_TLB
1759 {
1760 int i;
1761
1762 for (i = 0; i < FASTPATH_SIZE; i++)
1763 printk("%08x\n", handle_tlbm[i]);
1764 }
1765#endif
1766
1767 flush_icache_range((unsigned long)handle_tlbm,
1768 (unsigned long)handle_tlbm + FASTPATH_SIZE * sizeof(u32));
1769}
1770
1771void __init build_tlb_refill_handler(void)
1772{
1773 /*
1774 * The refill handler is generated per-CPU, multi-node systems
1775 * may have local storage for it. The other handlers are only
1776 * needed once.
1777 */
1778 static int run_once = 0;
1779
1780 switch (current_cpu_data.cputype) {
1781 case CPU_R2000:
1782 case CPU_R3000:
1783 case CPU_R3000A:
1784 case CPU_R3081E:
1785 case CPU_TX3912:
1786 case CPU_TX3922:
1787 case CPU_TX3927:
1788 build_r3000_tlb_refill_handler();
1789 if (!run_once) {
1790 build_r3000_tlb_load_handler();
1791 build_r3000_tlb_store_handler();
1792 build_r3000_tlb_modify_handler();
1793 run_once++;
1794 }
1795 break;
1796
1797 case CPU_R6000:
1798 case CPU_R6000A:
1799 panic("No R6000 TLB refill handler yet");
1800 break;
1801
1802 case CPU_R8000:
1803 panic("No R8000 TLB refill handler yet");
1804 break;
1805
1806 default:
1807 build_r4000_tlb_refill_handler();
1808 if (!run_once) {
1809 build_r4000_tlb_load_handler();
1810 build_r4000_tlb_store_handler();
1811 build_r4000_tlb_modify_handler();
1812 run_once++;
1813 }
1814 }
1815}
diff --git a/arch/mips/momentum/jaguar_atx/Makefile b/arch/mips/momentum/jaguar_atx/Makefile
new file mode 100644
index 000000000000..20bbd3ea44a8
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/Makefile
@@ -0,0 +1,12 @@
1#
2# Makefile for Momentum Computer's Jaguar-ATX board.
3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8
9obj-y += int-handler.o irq.o prom.o reset.o setup.o
10
11obj-$(CONFIG_SERIAL_8250_CONSOLE) += ja-console.o
12obj-$(CONFIG_REMOTE_DEBUG) += dbg_io.o
diff --git a/arch/mips/momentum/jaguar_atx/dbg_io.c b/arch/mips/momentum/jaguar_atx/dbg_io.c
new file mode 100644
index 000000000000..542eac82b63c
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/dbg_io.c
@@ -0,0 +1,126 @@
1#include <linux/config.h>
2
3#if defined(CONFIG_REMOTE_DEBUG)
4
5#include <asm/serial.h> /* For the serial port location and base baud */
6
7/* --- CONFIG --- */
8
9typedef unsigned char uint8;
10typedef unsigned int uint32;
11
12/* --- END OF CONFIG --- */
13
14#define UART16550_BAUD_2400 2400
15#define UART16550_BAUD_4800 4800
16#define UART16550_BAUD_9600 9600
17#define UART16550_BAUD_19200 19200
18#define UART16550_BAUD_38400 38400
19#define UART16550_BAUD_57600 57600
20#define UART16550_BAUD_115200 115200
21
22#define UART16550_PARITY_NONE 0
23#define UART16550_PARITY_ODD 0x08
24#define UART16550_PARITY_EVEN 0x18
25#define UART16550_PARITY_MARK 0x28
26#define UART16550_PARITY_SPACE 0x38
27
28#define UART16550_DATA_5BIT 0x0
29#define UART16550_DATA_6BIT 0x1
30#define UART16550_DATA_7BIT 0x2
31#define UART16550_DATA_8BIT 0x3
32
33#define UART16550_STOP_1BIT 0x0
34#define UART16550_STOP_2BIT 0x4
35
36/* ----------------------------------------------------- */
37
38/* === CONFIG === */
39
40/* [jsun] we use the second serial port for kdb */
41#define BASE OCELOT_SERIAL1_BASE
42#define MAX_BAUD OCELOT_BASE_BAUD
43
44/* === END OF CONFIG === */
45
46#define REG_OFFSET 4
47
48/* register offset */
49#define OFS_RCV_BUFFER 0
50#define OFS_TRANS_HOLD 0
51#define OFS_SEND_BUFFER 0
52#define OFS_INTR_ENABLE (1*REG_OFFSET)
53#define OFS_INTR_ID (2*REG_OFFSET)
54#define OFS_DATA_FORMAT (3*REG_OFFSET)
55#define OFS_LINE_CONTROL (3*REG_OFFSET)
56#define OFS_MODEM_CONTROL (4*REG_OFFSET)
57#define OFS_RS232_OUTPUT (4*REG_OFFSET)
58#define OFS_LINE_STATUS (5*REG_OFFSET)
59#define OFS_MODEM_STATUS (6*REG_OFFSET)
60#define OFS_RS232_INPUT (6*REG_OFFSET)
61#define OFS_SCRATCH_PAD (7*REG_OFFSET)
62
63#define OFS_DIVISOR_LSB (0*REG_OFFSET)
64#define OFS_DIVISOR_MSB (1*REG_OFFSET)
65
66
67/* memory-mapped read/write of the port */
68#define UART16550_READ(y) (*((volatile uint8*)(BASE + y)))
69#define UART16550_WRITE(y, z) ((*((volatile uint8*)(BASE + y))) = z)
70
71void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
72{
73 /* disable interrupts */
74 UART16550_WRITE(OFS_INTR_ENABLE, 0);
75
76 /* set up buad rate */
77 {
78 uint32 divisor;
79
80 /* set DIAB bit */
81 UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
82
83 /* set divisor */
84 divisor = MAX_BAUD / baud;
85 UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
86 UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
87
88 /* clear DIAB bit */
89 UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
90 }
91
92 /* set data format */
93 UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
94}
95
96static int remoteDebugInitialized = 0;
97
98uint8 getDebugChar(void)
99{
100 if (!remoteDebugInitialized) {
101 remoteDebugInitialized = 1;
102 debugInit(UART16550_BAUD_38400,
103 UART16550_DATA_8BIT,
104 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
105 }
106
107 while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
108 return UART16550_READ(OFS_RCV_BUFFER);
109}
110
111
112int putDebugChar(uint8 byte)
113{
114 if (!remoteDebugInitialized) {
115 remoteDebugInitialized = 1;
116 debugInit(UART16550_BAUD_38400,
117 UART16550_DATA_8BIT,
118 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
119 }
120
121 while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
122 UART16550_WRITE(OFS_SEND_BUFFER, byte);
123 return 1;
124}
125
126#endif
diff --git a/arch/mips/momentum/jaguar_atx/int-handler.S b/arch/mips/momentum/jaguar_atx/int-handler.S
new file mode 100644
index 000000000000..43fd5a58077c
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/int-handler.S
@@ -0,0 +1,128 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Based on work:
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: jsun@mvista.com or jsun@junsun.net
8 *
9 * First-level interrupt dispatcher for Jaguar-ATX board.
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 <asm/asm.h>
17#include <asm/mipsregs.h>
18#include <asm/addrspace.h>
19#include <asm/regdef.h>
20#include <asm/stackframe.h>
21
22/*
23 * First level interrupt dispatcher for Ocelot-CS board
24 */
25 .align 5
26 NESTED(jaguar_handle_int, PT_SIZE, sp)
27 SAVE_ALL
28 CLI
29 .set at
30 mfc0 t0, CP0_CAUSE
31 mfc0 t2, CP0_STATUS
32
33 and t0, t2
34
35 andi t1, t0, STATUSF_IP0 /* sw0 software interrupt */
36 bnez t1, ll_sw0_irq
37 andi t1, t0, STATUSF_IP1 /* sw1 software interrupt */
38 bnez t1, ll_sw1_irq
39 andi t1, t0, STATUSF_IP2 /* int0 hardware line */
40 bnez t1, ll_pcixa_irq
41 andi t1, t0, STATUSF_IP3 /* int1 hardware line */
42 bnez t1, ll_pcixb_irq
43 andi t1, t0, STATUSF_IP4 /* int2 hardware line */
44 bnez t1, ll_pcia_irq
45 andi t1, t0, STATUSF_IP5 /* int3 hardware line */
46 bnez t1, ll_pcib_irq
47 andi t1, t0, STATUSF_IP6 /* int4 hardware line */
48 bnez t1, ll_uart_irq
49 andi t1, t0, STATUSF_IP7 /* cpu timer */
50 bnez t1, ll_cputimer_irq
51
52 nop
53 nop
54
55 /* now look at extended interrupts */
56 mfc0 t0, CP0_CAUSE
57 cfc0 t1, CP0_S1_INTCONTROL
58
59 /* shift the mask 8 bits left to line up the bits */
60 sll t2, t1, 8
61
62 and t0, t2
63 srl t0, t0, 16
64
65 andi t1, t0, STATUSF_IP8 /* int6 hardware line */
66 bnez t1, ll_mv64340_decode_irq
67
68 nop
69 nop
70
71 .set reorder
72
73 /* wrong alarm or masked ... */
74 j spurious_interrupt
75 nop
76 END(jaguar_handle_int)
77
78 .align 5
79ll_sw0_irq:
80 li a0, 0
81 move a1, sp
82 jal do_IRQ
83 j ret_from_irq
84ll_sw1_irq:
85 li a0, 1
86 move a1, sp
87 jal do_IRQ
88 j ret_from_irq
89ll_pcixa_irq:
90 li a0, 2
91 move a1, sp
92 jal do_IRQ
93 j ret_from_irq
94
95ll_pcixb_irq:
96 li a0, 3
97 move a1, sp
98 jal do_IRQ
99 j ret_from_irq
100
101ll_pcia_irq:
102 li a0, 4
103 move a1, sp
104 jal do_IRQ
105 j ret_from_irq
106
107ll_pcib_irq:
108 li a0, 5
109 move a1, sp
110 jal do_IRQ
111 j ret_from_irq
112
113ll_uart_irq:
114 li a0, 6
115 move a1, sp
116 jal do_IRQ
117 j ret_from_irq
118
119ll_cputimer_irq:
120 li a0, 7
121 move a1, sp
122 jal ll_timer_interrupt
123 j ret_from_irq
124
125ll_mv64340_decode_irq:
126 move a0, sp
127 jal ll_mv64340_irq
128 j ret_from_irq
diff --git a/arch/mips/momentum/jaguar_atx/irq.c b/arch/mips/momentum/jaguar_atx/irq.c
new file mode 100644
index 000000000000..15588f91ace2
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/irq.c
@@ -0,0 +1,67 @@
1/*
2 * Copyright (C) 2002 Momentum Computer, Inc.
3 * Author: Matthew Dharm, mdharm@momenco.com
4 *
5 * Based on work by:
6 * Copyright (C) 2000 RidgeRun, Inc.
7 * Author: RidgeRun, Inc.
8 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
9 *
10 * Copyright 2001 MontaVista Software Inc.
11 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
12 *
13 * Copyright (C) 2000, 2001 Ralf Baechle (ralf@gnu.org)
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35#include <linux/init.h>
36#include <linux/interrupt.h>
37#include <linux/signal.h>
38#include <linux/types.h>
39#include <asm/irq_cpu.h>
40#include <asm/mipsregs.h>
41
42extern asmlinkage void jaguar_handle_int(void);
43
44static struct irqaction cascade_mv64340 = {
45 no_action, SA_INTERRUPT, CPU_MASK_NONE, "MV64340-Cascade", NULL, NULL
46};
47
48void __init arch_init_irq(void)
49{
50 /*
51 * Clear all of the interrupts while we change the able around a bit.
52 * int-handler is not on bootstrap
53 */
54 clear_c0_status(ST0_IM);
55
56 /* Sets the first-level interrupt dispatcher. */
57 set_except_vector(0, jaguar_handle_int);
58 mips_cpu_irq_init(0);
59 rm7k_cpu_irq_init(8);
60
61 /* set up the cascading interrupts */
62 setup_irq(8, &cascade_mv64340);
63
64 mv64340_irq_init(16);
65
66 set_c0_status(ST0_IM);
67}
diff --git a/arch/mips/momentum/jaguar_atx/ja-console.c b/arch/mips/momentum/jaguar_atx/ja-console.c
new file mode 100644
index 000000000000..da6e1ed34db1
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/ja-console.c
@@ -0,0 +1,106 @@
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) 2001, 2002, 2004 Ralf Baechle
7 */
8#include <linux/init.h>
9#include <linux/console.h>
10#include <linux/kdev_t.h>
11#include <linux/major.h>
12#include <linux/termios.h>
13#include <linux/sched.h>
14#include <linux/tty.h>
15
16#include <linux/serial.h>
17#include <linux/serial_core.h>
18#include <asm/serial.h>
19
20/* SUPERIO uart register map */
21struct ja_uartregs {
22 union {
23 volatile u8 pad0[3];
24 volatile u8 rbr; /* read only, DLAB == 0 */
25 volatile u8 pad1[3];
26 volatile u8 thr; /* write only, DLAB == 0 */
27 volatile u8 pad2[3];
28 volatile u8 dll; /* DLAB == 1 */
29 } u1;
30 union {
31 volatile u8 pad0[3];
32 volatile u8 ier; /* DLAB == 0 */
33 volatile u8 pad1[3];
34 volatile u8 dlm; /* DLAB == 1 */
35 } u2;
36 union {
37 volatile u8 pad0[3];
38 volatile u8 iir; /* read only */
39 volatile u8 pad1[3];
40 volatile u8 fcr; /* write only */
41 } u3;
42 volatile u8 pad0[3];
43 volatile u8 iu_lcr;
44 volatile u8 pad1[3];
45 volatile u8 iu_mcr;
46 volatile u8 pad2[3];
47 volatile u8 iu_lsr;
48 volatile u8 pad3[3];
49 volatile u8 iu_msr;
50 volatile u8 pad4[3];
51 volatile u8 iu_scr;
52} ja_uregs_t;
53
54#define iu_rbr u1.rbr
55#define iu_thr u1.thr
56#define iu_dll u1.dll
57#define iu_ier u2.ier
58#define iu_dlm u2.dlm
59#define iu_iir u3.iir
60#define iu_fcr u3.fcr
61
62extern unsigned long uart_base;
63
64static inline struct ja_uartregs *console_uart(void)
65{
66 return (struct ja_uartregs *) (uart_base + 0x23UL);
67}
68
69void prom_putchar(char c)
70{
71 struct ja_uartregs *uart = console_uart();
72
73 while ((uart->iu_lsr & 0x20) == 0);
74 uart->iu_thr = c;
75}
76
77char __init prom_getchar(void)
78{
79 return 0;
80}
81
82static void inline ja_console_probe(void)
83{
84 struct uart_port up;
85
86 /*
87 * Register to interrupt zero because we share the interrupt with
88 * the serial driver which we don't properly support yet.
89 */
90 memset(&up, 0, sizeof(up));
91 up.membase = (unsigned char *) uart_base + 0x23UL;
92 up.irq = JAGUAR_ATX_SERIAL1_IRQ;
93 up.uartclk = JAGUAR_ATX_UART_CLK;
94 up.regshift = 2;
95 up.iotype = UPIO_MEM;
96 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
97 up.line = 0;
98
99 if (early_serial_setup(&up))
100 printk(KERN_ERR "Early serial init of port 0 failed\n");
101}
102
103__init void ja_setup_console(void)
104{
105 ja_console_probe();
106}
diff --git a/arch/mips/momentum/jaguar_atx/jaguar_atx_fpga.h b/arch/mips/momentum/jaguar_atx/jaguar_atx_fpga.h
new file mode 100644
index 000000000000..6978654c712b
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/jaguar_atx_fpga.h
@@ -0,0 +1,52 @@
1/*
2 * Jaguar-ATX Board Register Definitions
3 *
4 * (C) 2002 Momentum Computer Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#ifndef __JAGUAR_ATX_FPGA_H__
27#define __JAGUAR_ATX_FPGA_H__
28
29#define JAGUAR_ATX_REG_BOARDREV 0x0
30#define JAGUAR_ATX_REG_FPGA_REV 0x1
31#define JAGUAR_ATX_REG_FPGA_TYPE 0x2
32#define JAGUAR_ATX_REG_RESET_STATUS 0x3
33#define JAGUAR_ATX_REG_BOARD_STATUS 0x4
34#define JAGUAR_ATX_REG_RESERVED1 0x5
35#define JAGUAR_ATX_REG_SET 0x6
36#define JAGUAR_ATX_REG_CLR 0x7
37#define JAGUAR_ATX_REG_EEPROM_MODE 0x9
38#define JAGUAR_ATX_REG_RESERVED2 0xa
39#define JAGUAR_ATX_REG_RESERVED3 0xb
40#define JAGUAR_ATX_REG_RESERVED4 0xc
41#define JAGUAR_ATX_REG_PHY_INTSTAT 0xd
42#define JAGUAR_ATX_REG_RESERVED5 0xe
43#define JAGUAR_ATX_REG_RESERVED6 0xf
44
45#define JAGUAR_ATX_CS0_ADDR 0xfc000000L
46
47extern unsigned long ja_fpga_base;
48
49#define JAGUAR_FPGA_WRITE(x,y) writeb(x, ja_fpga_base + JAGUAR_ATX_REG_##y)
50#define JAGUAR_FPGA_READ(x) readb(ja_fpga_base + JAGUAR_ATX_REG_##x)
51
52#endif
diff --git a/arch/mips/momentum/jaguar_atx/prom.c b/arch/mips/momentum/jaguar_atx/prom.c
new file mode 100644
index 000000000000..fa5982ac0ac6
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/prom.c
@@ -0,0 +1,266 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Louis Hamilton, Red Hat, Inc.
6 * hamilton@redhat.com [MIPS64 modifications]
7 *
8 * Based on Ocelot Linux port, which is
9 * Copyright 2001 MontaVista Software Inc.
10 * Author: jsun@mvista.com or jsun@junsun.net
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * Added changes for SMP - Manish Lachwani (lachwani@pmc-sierra.com)
18 */
19#include <linux/config.h>
20#include <linux/init.h>
21#include <linux/mm.h>
22#include <linux/sched.h>
23#include <linux/bootmem.h>
24
25#include <asm/addrspace.h>
26#include <asm/bootinfo.h>
27#include <asm/mv64340.h>
28#include <asm/pmon.h>
29
30#include "jaguar_atx_fpga.h"
31
32extern void ja_setup_console(void);
33
34struct callvectors *debug_vectors;
35
36extern unsigned long cpu_clock;
37
38const char *get_system_type(void)
39{
40 return "Momentum Jaguar-ATX";
41}
42
43#ifdef CONFIG_MV643XX_ETH
44extern unsigned char prom_mac_addr_base[6];
45
46static void burn_clocks(void)
47{
48 int i;
49
50 /* this loop should burn at least 1us -- this should be plenty */
51 for (i = 0; i < 0x10000; i++)
52 ;
53}
54
55static u8 exchange_bit(u8 val, u8 cs)
56{
57 /* place the data */
58 JAGUAR_FPGA_WRITE((val << 2) | cs, EEPROM_MODE);
59 burn_clocks();
60
61 /* turn the clock on */
62 JAGUAR_FPGA_WRITE((val << 2) | cs | 0x2, EEPROM_MODE);
63 burn_clocks();
64
65 /* turn the clock off and read-strobe */
66 JAGUAR_FPGA_WRITE((val << 2) | cs | 0x10, EEPROM_MODE);
67
68 /* return the data */
69 return ((JAGUAR_FPGA_READ(EEPROM_MODE) >> 3) & 0x1);
70}
71
72void get_mac(char dest[6])
73{
74 u8 read_opcode[12] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
75 int i,j;
76
77 for (i = 0; i < 12; i++)
78 exchange_bit(read_opcode[i], 1);
79
80 for (j = 0; j < 6; j++) {
81 dest[j] = 0;
82 for (i = 0; i < 8; i++) {
83 dest[j] <<= 1;
84 dest[j] |= exchange_bit(0, 1);
85 }
86 }
87
88 /* turn off CS */
89 exchange_bit(0,0);
90}
91#endif
92
93#ifdef CONFIG_MIPS64
94
95unsigned long signext(unsigned long addr)
96{
97 addr &= 0xffffffff;
98 return (unsigned long)((int)addr);
99}
100
101void *get_arg(unsigned long args, int arc)
102{
103 unsigned long ul;
104 unsigned char *puc, uc;
105
106 args += (arc * 4);
107 ul = (unsigned long)signext(args);
108 puc = (unsigned char *)ul;
109 if (puc == 0)
110 return (void *)0;
111
112#ifdef CONFIG_CPU_LITTLE_ENDIAN
113 uc = *puc++;
114 l = (unsigned long)uc;
115 uc = *puc++;
116 ul |= (((unsigned long)uc) << 8);
117 uc = *puc++;
118 ul |= (((unsigned long)uc) << 16);
119 uc = *puc++;
120 ul |= (((unsigned long)uc) << 24);
121#else
122 uc = *puc++;
123 ul = ((unsigned long)uc) << 24;
124 uc = *puc++;
125 ul |= (((unsigned long)uc) << 16);
126 uc = *puc++;
127 ul |= (((unsigned long)uc) << 8);
128 uc = *puc++;
129 ul |= ((unsigned long)uc);
130#endif
131 ul = signext(ul);
132
133 return (void *)ul;
134}
135
136char *arg64(unsigned long addrin, int arg_index)
137{
138 unsigned long args;
139 char *p;
140
141 args = signext(addrin);
142 p = (char *)get_arg(args, arg_index);
143
144 return p;
145}
146#endif /* CONFIG_MIPS64 */
147
148/* PMON passes arguments in C main() style */
149void __init prom_init(void)
150{
151 int argc = fw_arg0;
152 char **arg = (char **) fw_arg1;
153 char **env = (char **) fw_arg2;
154 struct callvectors *cv = (struct callvectors *) fw_arg3;
155 int i;
156
157#ifdef CONFIG_SERIAL_8250_CONSOLE
158// ja_setup_console(); /* The very first thing. */
159#endif
160
161#ifdef CONFIG_MIPS64
162 char *ptr;
163
164 printk("Mips64 Jaguar-ATX\n");
165 /* save the PROM vectors for debugging use */
166 debug_vectors = (struct callvectors *)signext((unsigned long)cv);
167
168 /* arg[0] is "g", the rest is boot parameters */
169 arcs_cmdline[0] = '\0';
170
171 for (i = 1; i < argc; i++) {
172 ptr = (char *)arg64((unsigned long)arg, i);
173 if ((strlen(arcs_cmdline) + strlen(ptr) + 1) >=
174 sizeof(arcs_cmdline))
175 break;
176 strcat(arcs_cmdline, ptr);
177 strcat(arcs_cmdline, " ");
178 }
179
180 i = 0;
181 while (1) {
182 ptr = (char *)arg64((unsigned long)env, i);
183 if (! ptr)
184 break;
185
186 if (strncmp("gtbase", ptr, strlen("gtbase")) == 0) {
187 marvell_base = simple_strtol(ptr + strlen("gtbase="),
188 NULL, 16);
189
190 if ((marvell_base & 0xffffffff00000000) == 0)
191 marvell_base |= 0xffffffff00000000;
192
193 printk("marvell_base set to 0x%016lx\n", marvell_base);
194 }
195 if (strncmp("cpuclock", ptr, strlen("cpuclock")) == 0) {
196 cpu_clock = simple_strtol(ptr + strlen("cpuclock="),
197 NULL, 10);
198 printk("cpu_clock set to %d\n", cpu_clock);
199 }
200 i++;
201 }
202 printk("arcs_cmdline: %s\n", arcs_cmdline);
203
204#else /* CONFIG_MIPS64 */
205 /* save the PROM vectors for debugging use */
206 debug_vectors = cv;
207
208 /* arg[0] is "g", the rest is boot parameters */
209 arcs_cmdline[0] = '\0';
210 for (i = 1; i < argc; i++) {
211 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
212 >= sizeof(arcs_cmdline))
213 break;
214 strcat(arcs_cmdline, arg[i]);
215 strcat(arcs_cmdline, " ");
216 }
217
218 while (*env) {
219 if (strncmp("gtbase", *env, strlen("gtbase")) == 0) {
220 marvell_base = simple_strtol(*env + strlen("gtbase="),
221 NULL, 16);
222 }
223 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0) {
224 cpu_clock = simple_strtol(*env + strlen("cpuclock="),
225 NULL, 10);
226 }
227 env++;
228 }
229#endif /* CONFIG_MIPS64 */
230 mips_machgroup = MACH_GROUP_MOMENCO;
231 mips_machtype = MACH_MOMENCO_JAGUAR_ATX;
232
233#ifdef CONFIG_MV643XX_ETH
234 /* get the base MAC address for on-board ethernet ports */
235 get_mac(prom_mac_addr_base);
236#endif
237}
238
239void __init prom_free_prom_memory(void)
240{
241}
242
243void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
244{
245}
246
247int prom_boot_secondary(int cpu, unsigned long sp, unsigned long gp)
248{
249 /* Clear the semaphore */
250 *(volatile uint32_t *)(0xbb000a68) = 0x80000000;
251
252 return 1;
253}
254
255void prom_init_secondary(void)
256{
257 clear_c0_config(CONF_CM_CMASK);
258 set_c0_config(0x2);
259
260 clear_c0_status(ST0_IM);
261 set_c0_status(0x1ffff);
262}
263
264void prom_smp_finish(void)
265{
266}
diff --git a/arch/mips/momentum/jaguar_atx/reset.c b/arch/mips/momentum/jaguar_atx/reset.c
new file mode 100644
index 000000000000..48039484cdf9
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/reset.c
@@ -0,0 +1,57 @@
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 * Copyright (C) 2002 Momentum Computer Inc.
12 * Author: Matthew Dharm <mdharm@momenco.com>
13 *
14 * Louis Hamilton, Red Hat, Inc.
15 * hamilton@redhat.com [MIPS64 modifications]
16 */
17#include <linux/config.h>
18#include <linux/sched.h>
19#include <linux/mm.h>
20#include <asm/io.h>
21#include <asm/pgtable.h>
22#include <asm/processor.h>
23#include <asm/reboot.h>
24#include <asm/system.h>
25#include <linux/delay.h>
26
27void momenco_jaguar_restart(char *command)
28{
29 /* base address of timekeeper portion of part */
30#ifdef CONFIG_MIPS64
31 void *nvram = (void*) 0xfffffffffc807000;
32#else
33 void *nvram = (void*) 0xfc807000;
34#endif
35 /* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */
36 writeb(0x84, nvram + 0xff7);
37
38 /* wait for the watchdog to go off */
39 mdelay(100+(1000/16));
40
41 /* if the watchdog fails for some reason, let people know */
42 printk(KERN_NOTICE "Watchdog reset failed\n");
43}
44
45void momenco_jaguar_halt(void)
46{
47 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
48 while (1)
49 __asm__(".set\tmips3\n\t"
50 "wait\n\t"
51 ".set\tmips0");
52}
53
54void momenco_jaguar_power_off(void)
55{
56 momenco_jaguar_halt();
57}
diff --git a/arch/mips/momentum/jaguar_atx/setup.c b/arch/mips/momentum/jaguar_atx/setup.c
new file mode 100644
index 000000000000..30462e715066
--- /dev/null
+++ b/arch/mips/momentum/jaguar_atx/setup.c
@@ -0,0 +1,474 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Momentum Computer Jaguar-ATX board dependent boot routines
4 *
5 * Copyright (C) 1996, 1997, 2001, 2004 Ralf Baechle (ralf@linux-mips.org)
6 * Copyright (C) 2000 RidgeRun, Inc.
7 * Copyright (C) 2001 Red Hat, Inc.
8 * Copyright (C) 2002 Momentum Computer
9 *
10 * Author: Matthew Dharm, Momentum Computer
11 * mdharm@momenco.com
12 *
13 * Louis Hamilton, Red Hat, Inc.
14 * hamilton@redhat.com [MIPS64 modifications]
15 *
16 * Author: RidgeRun, Inc.
17 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
18 *
19 * Copyright 2001 MontaVista Software Inc.
20 * Author: jsun@mvista.com or jsun@junsun.net
21 *
22 * This program is free software; you can redistribute it and/or modify it
23 * under the terms of the GNU General Public License as published by the
24 * Free Software Foundation; either version 2 of the License, or (at your
25 * option) any later version.
26 *
27 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
28 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
29 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
30 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
33 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
34 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 * You should have received a copy of the GNU General Public License along
39 * with this program; if not, write to the Free Software Foundation, Inc.,
40 * 675 Mass Ave, Cambridge, MA 02139, USA.
41 */
42#include <linux/config.h>
43#include <linux/bcd.h>
44#include <linux/init.h>
45#include <linux/kernel.h>
46#include <linux/types.h>
47#include <linux/mm.h>
48#include <linux/bootmem.h>
49#include <linux/module.h>
50#include <linux/pci.h>
51#include <linux/swap.h>
52#include <linux/ioport.h>
53#include <linux/sched.h>
54#include <linux/interrupt.h>
55#include <linux/timex.h>
56#include <linux/vmalloc.h>
57#include <asm/time.h>
58#include <asm/bootinfo.h>
59#include <asm/page.h>
60#include <asm/io.h>
61#include <asm/irq.h>
62#include <asm/processor.h>
63#include <asm/ptrace.h>
64#include <asm/reboot.h>
65#include <asm/tlbflush.h>
66#include <asm/mv64340.h>
67
68#include "jaguar_atx_fpga.h"
69
70extern unsigned long mv64340_sram_base;
71unsigned long cpu_clock;
72
73/* These functions are used for rebooting or halting the machine*/
74extern void momenco_jaguar_restart(char *command);
75extern void momenco_jaguar_halt(void);
76extern void momenco_jaguar_power_off(void);
77
78void momenco_time_init(void);
79
80static char reset_reason;
81
82static inline unsigned long ENTRYLO(unsigned long paddr)
83{
84 return ((paddr & PAGE_MASK) |
85 (_PAGE_PRESENT | __READABLE | __WRITEABLE | _PAGE_GLOBAL |
86 _CACHE_UNCACHED)) >> 6;
87}
88
89void __init bus_error_init(void) { /* nothing */ }
90
91/*
92 * Load a few TLB entries for the MV64340 and perhiperals. The MV64340 is going
93 * to be hit on every IRQ anyway - there's absolutely no point in letting it be
94 * a random TLB entry, as it'll just cause needless churning of the TLB. And we
95 * use the other half for the serial port, which is just a PITA otherwise :)
96 *
97 * Device Physical Virtual
98 * MV64340 Internal Regs 0xf4000000 0xf4000000
99 * Ocelot-C[S] PLD (CS0) 0xfc000000 0xfc000000
100 * NVRAM (CS1) 0xfc800000 0xfc800000
101 * UARTs (CS2) 0xfd000000 0xfd000000
102 * Internal SRAM 0xfe000000 0xfe000000
103 * M-Systems DOC (CS3) 0xff000000 0xff000000
104 */
105
106static __init void wire_stupidity_into_tlb(void)
107{
108#ifdef CONFIG_MIPS32
109 write_c0_wired(0);
110 local_flush_tlb_all();
111
112 /* marvell and extra space */
113 add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xf4010000),
114 0xf4000000UL, PM_64K);
115 /* fpga, rtc, and uart */
116 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000),
117 0xfc000000UL, PM_16M);
118// /* m-sys and internal SRAM */
119// add_wired_entry(ENTRYLO(0xfe000000), ENTRYLO(0xff000000),
120// 0xfe000000UL, PM_16M);
121
122 marvell_base = 0xf4000000;
123 //mv64340_sram_base = 0xfe000000; /* Currently unused */
124#endif
125}
126
127unsigned long marvell_base = 0xf4000000L;
128unsigned long ja_fpga_base = JAGUAR_ATX_CS0_ADDR;
129unsigned long uart_base = 0xfd000000L;
130static unsigned char *rtc_base = (unsigned char*) 0xfc800000L;
131
132EXPORT_SYMBOL(marvell_base);
133
134static __init int per_cpu_mappings(void)
135{
136 marvell_base = (unsigned long) ioremap(0xf4000000, 0x10000);
137 ja_fpga_base = (unsigned long) ioremap(JAGUAR_ATX_CS0_ADDR, 0x1000);
138 uart_base = (unsigned long) ioremap(0xfd000000UL, 0x1000);
139 rtc_base = ioremap(0xfc000000UL, 0x8000);
140 // ioremap(0xfe000000, 32 << 20);
141 write_c0_wired(0);
142 local_flush_tlb_all();
143 ja_setup_console();
144
145 return 0;
146}
147arch_initcall(per_cpu_mappings);
148
149unsigned long m48t37y_get_time(void)
150{
151 unsigned int year, month, day, hour, min, sec;
152
153 /* stop the update */
154 rtc_base[0x7ff8] = 0x40;
155
156 year = BCD2BIN(rtc_base[0x7fff]);
157 year += BCD2BIN(rtc_base[0x7ff1]) * 100;
158
159 month = BCD2BIN(rtc_base[0x7ffe]);
160
161 day = BCD2BIN(rtc_base[0x7ffd]);
162
163 hour = BCD2BIN(rtc_base[0x7ffb]);
164 min = BCD2BIN(rtc_base[0x7ffa]);
165 sec = BCD2BIN(rtc_base[0x7ff9]);
166
167 /* start the update */
168 rtc_base[0x7ff8] = 0x00;
169
170 return mktime(year, month, day, hour, min, sec);
171}
172
173int m48t37y_set_time(unsigned long sec)
174{
175 struct rtc_time tm;
176
177 /* convert to a more useful format -- note months count from 0 */
178 to_tm(sec, &tm);
179 tm.tm_mon += 1;
180
181 /* enable writing */
182 rtc_base[0x7ff8] = 0x80;
183
184 /* year */
185 rtc_base[0x7fff] = BIN2BCD(tm.tm_year % 100);
186 rtc_base[0x7ff1] = BIN2BCD(tm.tm_year / 100);
187
188 /* month */
189 rtc_base[0x7ffe] = BIN2BCD(tm.tm_mon);
190
191 /* day */
192 rtc_base[0x7ffd] = BIN2BCD(tm.tm_mday);
193
194 /* hour/min/sec */
195 rtc_base[0x7ffb] = BIN2BCD(tm.tm_hour);
196 rtc_base[0x7ffa] = BIN2BCD(tm.tm_min);
197 rtc_base[0x7ff9] = BIN2BCD(tm.tm_sec);
198
199 /* day of week -- not really used, but let's keep it up-to-date */
200 rtc_base[0x7ffc] = BIN2BCD(tm.tm_wday + 1);
201
202 /* disable writing */
203 rtc_base[0x7ff8] = 0x00;
204
205 return 0;
206}
207
208void momenco_timer_setup(struct irqaction *irq)
209{
210 setup_irq(8, irq);
211}
212
213/*
214 * Ugly but the least of all evils. TLB initialization did flush the TLB so
215 * We need to setup mappings again before we can touch the RTC.
216 */
217void momenco_time_init(void)
218{
219 wire_stupidity_into_tlb();
220
221 mips_hpt_frequency = cpu_clock / 2;
222 board_timer_setup = momenco_timer_setup;
223
224 rtc_get_time = m48t37y_get_time;
225 rtc_set_time = m48t37y_set_time;
226}
227
228static struct resource mv_pci_io_mem0_resource = {
229 .name = "MV64340 PCI0 IO MEM",
230 .flags = IORESOURCE_IO
231};
232
233static struct resource mv_pci_mem0_resource = {
234 .name = "MV64340 PCI0 MEM",
235 .flags = IORESOURCE_MEM
236};
237
238static struct mv_pci_controller mv_bus0_controller = {
239 .pcic = {
240 .pci_ops = &mv_pci_ops,
241 .mem_resource = &mv_pci_mem0_resource,
242 .io_resource = &mv_pci_io_mem0_resource,
243 },
244 .config_addr = MV64340_PCI_0_CONFIG_ADDR,
245 .config_vreg = MV64340_PCI_0_CONFIG_DATA_VIRTUAL_REG,
246};
247
248static uint32_t mv_io_base, mv_io_size;
249
250static void ja_pci0_init(void)
251{
252 uint32_t mem0_base, mem0_size;
253 uint32_t io_base, io_size;
254
255 io_base = MV_READ(MV64340_PCI_0_IO_BASE_ADDR) << 16;
256 io_size = (MV_READ(MV64340_PCI_0_IO_SIZE) + 1) << 16;
257 mem0_base = MV_READ(MV64340_PCI_0_MEMORY0_BASE_ADDR) << 16;
258 mem0_size = (MV_READ(MV64340_PCI_0_MEMORY0_SIZE) + 1) << 16;
259
260 mv_pci_io_mem0_resource.start = 0;
261 mv_pci_io_mem0_resource.end = io_size - 1;
262 mv_pci_mem0_resource.start = mem0_base;
263 mv_pci_mem0_resource.end = mem0_base + mem0_size - 1;
264 mv_bus0_controller.pcic.mem_offset = mem0_base;
265 mv_bus0_controller.pcic.io_offset = 0;
266
267 ioport_resource.end = io_size - 1;
268
269 register_pci_controller(&mv_bus0_controller.pcic);
270
271 mv_io_base = io_base;
272 mv_io_size = io_size;
273}
274
275static struct resource mv_pci_io_mem1_resource = {
276 .name = "MV64340 PCI1 IO MEM",
277 .flags = IORESOURCE_IO
278};
279
280static struct resource mv_pci_mem1_resource = {
281 .name = "MV64340 PCI1 MEM",
282 .flags = IORESOURCE_MEM
283};
284
285static struct mv_pci_controller mv_bus1_controller = {
286 .pcic = {
287 .pci_ops = &mv_pci_ops,
288 .mem_resource = &mv_pci_mem1_resource,
289 .io_resource = &mv_pci_io_mem1_resource,
290 },
291 .config_addr = MV64340_PCI_1_CONFIG_ADDR,
292 .config_vreg = MV64340_PCI_1_CONFIG_DATA_VIRTUAL_REG,
293};
294
295static __init void ja_pci1_init(void)
296{
297 uint32_t mem0_base, mem0_size;
298 uint32_t io_base, io_size;
299
300 io_base = MV_READ(MV64340_PCI_1_IO_BASE_ADDR) << 16;
301 io_size = (MV_READ(MV64340_PCI_1_IO_SIZE) + 1) << 16;
302 mem0_base = MV_READ(MV64340_PCI_1_MEMORY0_BASE_ADDR) << 16;
303 mem0_size = (MV_READ(MV64340_PCI_1_MEMORY0_SIZE) + 1) << 16;
304
305 /*
306 * Here we assume the I/O window of second bus to be contiguous with
307 * the first. A gap is no problem but would waste address space for
308 * remapping the port space.
309 */
310 mv_pci_io_mem1_resource.start = mv_io_size;
311 mv_pci_io_mem1_resource.end = mv_io_size + io_size - 1;
312 mv_pci_mem1_resource.start = mem0_base;
313 mv_pci_mem1_resource.end = mem0_base + mem0_size - 1;
314 mv_bus1_controller.pcic.mem_offset = mem0_base;
315 mv_bus1_controller.pcic.io_offset = 0;
316
317 ioport_resource.end = io_base + io_size -mv_io_base - 1;
318
319 register_pci_controller(&mv_bus1_controller.pcic);
320
321 mv_io_size = io_base + io_size - mv_io_base;
322}
323
324static __init int __init ja_pci_init(void)
325{
326 unsigned long io_v_base;
327 uint32_t enable;
328
329 enable = ~MV_READ(MV64340_BASE_ADDR_ENABLE);
330
331 /*
332 * We require at least one enabled I/O or PCI memory window or we
333 * will ignore this PCI bus. We ignore PCI windows 1, 2 and 3.
334 */
335 if (enable & (0x01 << 9) || enable & (0x01 << 10))
336 ja_pci0_init();
337
338 if (enable & (0x01 << 14) || enable & (0x01 << 15))
339 ja_pci1_init();
340
341 if (mv_io_size) {
342 io_v_base = (unsigned long) ioremap(mv_io_base, mv_io_size);
343 if (!io_v_base)
344 panic("Could not ioremap I/O port range");
345
346 set_io_port_base(io_v_base);
347 }
348
349 return 0;
350}
351
352arch_initcall(ja_pci_init);
353
354static int __init momenco_jaguar_atx_setup(void)
355{
356 unsigned int tmpword;
357
358 board_time_init = momenco_time_init;
359
360 _machine_restart = momenco_jaguar_restart;
361 _machine_halt = momenco_jaguar_halt;
362 _machine_power_off = momenco_jaguar_power_off;
363
364 /*
365 * initrd_start = (ulong)jaguar_initrd_start;
366 * initrd_end = (ulong)jaguar_initrd_start + (ulong)jaguar_initrd_size;
367 * initrd_below_start_ok = 1;
368 */
369
370 wire_stupidity_into_tlb();
371
372 /*
373 * shut down ethernet ports, just to be sure our memory doesn't get
374 * corrupted by random ethernet traffic.
375 */
376 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0), 0xff << 8);
377 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1), 0xff << 8);
378 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(2), 0xff << 8);
379 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0), 0xff << 8);
380 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1), 0xff << 8);
381 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(2), 0xff << 8);
382 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0)) & 0xff);
383 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1)) & 0xff);
384 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(2)) & 0xff);
385 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0)) & 0xff);
386 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1)) & 0xff);
387 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(2)) & 0xff);
388 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0),
389 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0)) & ~1);
390 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1),
391 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1)) & ~1);
392 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(2),
393 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(2)) & ~1);
394
395 /* Turn off the Bit-Error LED */
396 JAGUAR_FPGA_WRITE(0x80, CLR);
397
398 tmpword = JAGUAR_FPGA_READ(BOARDREV);
399 if (tmpword < 26)
400 printk("Momentum Jaguar-ATX: Board Assembly Rev. %c\n",
401 'A'+tmpword);
402 else
403 printk("Momentum Jaguar-ATX: Board Assembly Revision #0x%x\n",
404 tmpword);
405
406 tmpword = JAGUAR_FPGA_READ(FPGA_REV);
407 printk("FPGA Rev: %d.%d\n", tmpword>>4, tmpword&15);
408 tmpword = JAGUAR_FPGA_READ(RESET_STATUS);
409 printk("Reset reason: 0x%x\n", tmpword);
410 switch (tmpword) {
411 case 0x1:
412 printk(" - Power-up reset\n");
413 break;
414 case 0x2:
415 printk(" - Push-button reset\n");
416 break;
417 case 0x8:
418 printk(" - Watchdog reset\n");
419 break;
420 case 0x10:
421 printk(" - JTAG reset\n");
422 break;
423 default:
424 printk(" - Unknown reset cause\n");
425 }
426 reset_reason = tmpword;
427 JAGUAR_FPGA_WRITE(0xff, RESET_STATUS);
428
429 tmpword = JAGUAR_FPGA_READ(BOARD_STATUS);
430 printk("Board Status register: 0x%02x\n", tmpword);
431 printk(" - User jumper: %s\n", (tmpword & 0x80)?"installed":"absent");
432 printk(" - Boot flash write jumper: %s\n", (tmpword&0x40)?"installed":"absent");
433
434 /* 256MiB of RM9000x2 DDR */
435// add_memory_region(0x0, 0x100<<20, BOOT_MEM_RAM);
436
437 /* 128MiB of MV-64340 DDR */
438// add_memory_region(0x100<<20, 0x80<<20, BOOT_MEM_RAM);
439
440 /* XXX Memory configuration should be picked up from PMON2k */
441#ifdef CONFIG_JAGUAR_DMALOW
442 printk("Jaguar ATX DMA-low mode set\n");
443 add_memory_region(0x00000000, 0x08000000, BOOT_MEM_RAM);
444 add_memory_region(0x08000000, 0x10000000, BOOT_MEM_RAM);
445#else
446 /* 128MiB of MV-64340 DDR RAM */
447 printk("Jaguar ATX DMA-low mode is not set\n");
448 add_memory_region(0x100<<20, 0x80<<20, BOOT_MEM_RAM);
449#endif
450
451#ifdef GEMDEBUG_TRACEBUFFER
452 {
453 unsigned int tbControl;
454 tbControl =
455 0 << 26 | /* post trigger delay 0 */
456 0x2 << 16 | /* sequential trace mode */
457 // 0x0 << 16 | /* non-sequential trace mode */
458 // 0xf << 4 | /* watchpoints disabled */
459 2 << 2 | /* armed */
460 2 ; /* interrupt disabled */
461 printk ("setting tbControl = %08lx\n", tbControl);
462 write_32bit_cp0_set1_register($22, tbControl);
463 __asm__ __volatile__(".set noreorder\n\t" \
464 "nop; nop; nop; nop; nop; nop;\n\t" \
465 "nop; nop; nop; nop; nop; nop;\n\t" \
466 ".set reorder\n\t");
467
468 }
469#endif
470
471 return 0;
472}
473
474early_initcall(momenco_jaguar_atx_setup);
diff --git a/arch/mips/momentum/ocelot_3/Makefile b/arch/mips/momentum/ocelot_3/Makefile
new file mode 100644
index 000000000000..aab8fd89f830
--- /dev/null
+++ b/arch/mips/momentum/ocelot_3/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for Momentum Computer's Ocelot-3 board.
3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8obj-y += int-handler.o irq.o prom.o reset.o setup.o
diff --git a/arch/mips/momentum/ocelot_3/int-handler.S b/arch/mips/momentum/ocelot_3/int-handler.S
new file mode 100644
index 000000000000..4522f09ed769
--- /dev/null
+++ b/arch/mips/momentum/ocelot_3/int-handler.S
@@ -0,0 +1,137 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: jsun@mvista.com or jsun@junsun.net
7 *
8 * Copyright 2004 PMC-Sierra
9 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
10 *
11 * Copyright (C) 2004 MontaVista Software Inc.
12 * Author: Manish Lachwani, mlachwani@mvista.com
13 *
14 * First-level interrupt dispatcher for Ocelot-3 board.
15 *
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version.
20 */
21#include <asm/asm.h>
22#include <asm/mipsregs.h>
23#include <asm/addrspace.h>
24#include <asm/regdef.h>
25#include <asm/stackframe.h>
26
27/*
28 * First level interrupt dispatcher for Ocelot-3 board
29 */
30 .align 5
31 NESTED(ocelot3_handle_int, PT_SIZE, sp)
32 SAVE_ALL
33 CLI
34 .set at
35
36 mfc0 t0, CP0_CAUSE
37 mfc0 t2, CP0_STATUS
38
39 and t0, t2
40
41 andi t1, t0, STATUSF_IP0 /* sw0 software interrupt (IRQ0) */
42 bnez t1, ll_sw0_irq
43
44 andi t1, t0, STATUSF_IP1 /* sw1 software interrupt (IRQ1) */
45 bnez t1, ll_sw1_irq
46
47 andi t1, t0, STATUSF_IP2 /* int0 hardware line (IRQ2) */
48 bnez t1, ll_pci0slot1_irq
49
50 andi t1, t0, STATUSF_IP3 /* int1 hardware line (IRQ3) */
51 bnez t1, ll_pci0slot2_irq
52
53 andi t1, t0, STATUSF_IP4 /* int2 hardware line (IRQ4) */
54 bnez t1, ll_pci1slot1_irq
55
56 andi t1, t0, STATUSF_IP5 /* int3 hardware line (IRQ5) */
57 bnez t1, ll_pci1slot2_irq
58
59 andi t1, t0, STATUSF_IP6 /* int4 hardware line (IRQ6) */
60 bnez t1, ll_uart_irq
61
62 andi t1, t0, STATUSF_IP7 /* cpu timer (IRQ7) */
63 bnez t1, ll_cputimer_irq
64
65 /* now look at extended interrupts */
66 mfc0 t0, CP0_CAUSE
67 cfc0 t1, CP0_S1_INTCONTROL
68
69 /* shift the mask 8 bits left to line up the bits */
70 sll t2, t1, 8
71
72 and t0, t2
73 srl t0, t0, 16
74
75 andi t1, t0, STATUSF_IP8 /* int6 hardware line (IRQ9) */
76 bnez t1, ll_mv64340_decode_irq
77
78 .set reorder
79
80 /* wrong alarm or masked ... */
81 j spurious_interrupt
82 nop
83 END(ocelot3_handle_int)
84
85 .align 5
86ll_sw0_irq:
87 li a0, 0 /* IRQ 1 */
88 move a1, sp
89 jal do_IRQ
90 j ret_from_irq
91ll_sw1_irq:
92 li a0, 1 /* IRQ 2 */
93 move a1, sp
94 jal do_IRQ
95 j ret_from_irq
96
97ll_pci0slot1_irq:
98 li a0, 2 /* IRQ 3 */
99 move a1, sp
100 jal do_IRQ
101 j ret_from_irq
102
103ll_pci0slot2_irq:
104 li a0, 3 /* IRQ 4 */
105 move a1, sp
106 jal do_IRQ
107 j ret_from_irq
108
109ll_pci1slot1_irq:
110 li a0, 4 /* IRQ 5 */
111 move a1, sp
112 jal do_IRQ
113 j ret_from_irq
114
115ll_pci1slot2_irq:
116 li a0, 5 /* IRQ 6 */
117 move a1, sp
118 jal do_IRQ
119 j ret_from_irq
120
121ll_uart_irq:
122 li a0, 6 /* IRQ 7 */
123 move a1, sp
124 jal do_IRQ
125 j ret_from_irq
126
127ll_cputimer_irq:
128 li a0, 7 /* IRQ 8 */
129 move a1, sp
130 jal do_IRQ
131 j ret_from_irq
132
133ll_mv64340_decode_irq:
134 move a0, sp
135 jal ll_mv64340_irq
136 j ret_from_irq
137
diff --git a/arch/mips/momentum/ocelot_3/irq.c b/arch/mips/momentum/ocelot_3/irq.c
new file mode 100644
index 000000000000..42464dbd4ad2
--- /dev/null
+++ b/arch/mips/momentum/ocelot_3/irq.c
@@ -0,0 +1,81 @@
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 Ralf Baechle (ralf@gnu.org)
9 *
10 * Copyright 2004 PMC-Sierra
11 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 *
33 * Copyright (C) 2004 MontaVista Software Inc.
34 * Author: Manish Lachwani, mlachwani@mvista.com
35 *
36 */
37#include <linux/errno.h>
38#include <linux/init.h>
39#include <linux/kernel_stat.h>
40#include <linux/module.h>
41#include <linux/signal.h>
42#include <linux/sched.h>
43#include <linux/types.h>
44#include <linux/interrupt.h>
45#include <linux/ioport.h>
46#include <linux/timex.h>
47#include <linux/slab.h>
48#include <linux/random.h>
49#include <asm/bitops.h>
50#include <asm/bootinfo.h>
51#include <asm/io.h>
52#include <asm/irq.h>
53#include <asm/mipsregs.h>
54#include <asm/system.h>
55
56extern asmlinkage void ocelot3_handle_int(void);
57
58static struct irqaction cascade_mv64340 = {
59 no_action, SA_INTERRUPT, CPU_MASK_NONE, "MV64340-Cascade", NULL, NULL
60};
61
62void __init arch_init_irq(void)
63{
64 /*
65 * Clear all of the interrupts while we change the able around a bit.
66 * int-handler is not on bootstrap
67 */
68 clear_c0_status(ST0_IM | ST0_BEV);
69
70 /* Sets the first-level interrupt dispatcher. */
71 set_except_vector(0, ocelot3_handle_int);
72 mips_cpu_irq_init(0);
73 rm7k_cpu_irq_init(8);
74
75 /* set up the cascading interrupts */
76 setup_irq(8, &cascade_mv64340); /* unmask intControl IM8, IRQ 9 */
77 mv64340_irq_init(16);
78
79 set_c0_status(ST0_IM); /* IE in the status register */
80
81}
diff --git a/arch/mips/momentum/ocelot_3/ocelot_3_fpga.h b/arch/mips/momentum/ocelot_3/ocelot_3_fpga.h
new file mode 100644
index 000000000000..227e429fe720
--- /dev/null
+++ b/arch/mips/momentum/ocelot_3/ocelot_3_fpga.h
@@ -0,0 +1,57 @@
1/*
2 * Ocelot-3 Board Register Definitions
3 *
4 * (C) 2002 Momentum Computer Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 * Louis Hamilton, Red Hat, Inc.
27 * hamilton@redhat.com [MIPS64 modifications]
28 *
29 * Copyright (C) 2004 MontaVista Software Inc.
30 * Author: Manish Lachwani, mlachwani@mvista.com
31 */
32
33#ifndef __OCELOT_3_FPGA_H__
34#define __OCELOT_3_FPGA_H__
35
36#define OCELOT_3_REG_BOARDREV 0x0
37#define OCELOT_3_REG_FPGA_REV 0x1
38#define OCELOT_3_REG_FPGA_TYPE 0x2
39#define OCELOT_3_REG_RESET_STATUS 0x3
40#define OCELOT_3_REG_BOARD_STATUS 0x4
41#define OCELOT_3_REG_CPCI_ID 0x5
42#define OCELOT_3_REG_SET 0x6
43#define OCELOT_3_REG_CLR 0x7
44#define OCELOT_3_REG_EEPROM_MODE 0x9
45#define OCELOT_3_REG_INTMASK 0xa
46#define OCELOT_3_REG_INTSTAT 0xb
47#define OCELOT_3_REG_UART_INTMASK 0xc
48#define OCELOT_3_REG_UART_INTSTAT 0xd
49#define OCELOT_3_REG_INTSET 0xe
50#define OCELOT_3_REG_INTCLR 0xf
51
52extern unsigned long ocelot_fpga_base;
53
54#define OCELOT_FPGA_WRITE(x, y) writeb(x, ocelot_fpga_base + OCELOT_3_REG_##y)
55#define OCELOT_FPGA_READ(x) readb(ocelot_fpga_base + OCELOT_3_REG_##x)
56
57#endif
diff --git a/arch/mips/momentum/ocelot_3/prom.c b/arch/mips/momentum/ocelot_3/prom.c
new file mode 100644
index 000000000000..89c17a0c0bed
--- /dev/null
+++ b/arch/mips/momentum/ocelot_3/prom.c
@@ -0,0 +1,248 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Louis Hamilton, Red Hat, Inc.
6 * hamilton@redhat.com [MIPS64 modifications]
7 *
8 * Copyright 2004 PMC-Sierra
9 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
10 *
11 * Based on Ocelot Linux port, which is
12 * Copyright 2001 MontaVista Software Inc.
13 * Author: jsun@mvista.com or jsun@junsun.net
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * Copyright (C) 2004 MontaVista Software Inc.
21 * Author: Manish Lachwani, mlachwani@mvista.com
22 *
23 */
24#include <linux/config.h>
25#include <linux/init.h>
26#include <linux/bootmem.h>
27#include <linux/mv643xx.h>
28
29#include <asm/addrspace.h>
30#include <asm/bootinfo.h>
31#include <asm/pmon.h>
32#include "ocelot_3_fpga.h"
33
34struct callvectors* debug_vectors;
35extern unsigned long marvell_base;
36extern unsigned long cpu_clock;
37
38#ifdef CONFIG_MV643XX_ETH
39extern unsigned char prom_mac_addr_base[6];
40#endif
41
42const char *get_system_type(void)
43{
44 return "Momentum Ocelot-3";
45}
46
47#ifdef CONFIG_MV643XX_ETH
48void burn_clocks(void)
49{
50 int i;
51
52 /* this loop should burn at least 1us -- this should be plenty */
53 for (i = 0; i < 0x10000; i++)
54 ;
55}
56
57u8 exchange_bit(u8 val, u8 cs)
58{
59 /* place the data */
60 OCELOT_FPGA_WRITE((val << 2) | cs, EEPROM_MODE);
61 burn_clocks();
62
63 /* turn the clock on */
64 OCELOT_FPGA_WRITE((val << 2) | cs | 0x2, EEPROM_MODE);
65 burn_clocks();
66
67 /* turn the clock off and read-strobe */
68 OCELOT_FPGA_WRITE((val << 2) | cs | 0x10, EEPROM_MODE);
69
70 /* return the data */
71 return ((OCELOT_FPGA_READ(EEPROM_MODE) >> 3) & 0x1);
72}
73
74void get_mac(char dest[6])
75{
76 u8 read_opcode[12] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
77 int i,j;
78
79 for (i = 0; i < 12; i++)
80 exchange_bit(read_opcode[i], 1);
81
82 for (j = 0; j < 6; j++) {
83 dest[j] = 0;
84 for (i = 0; i < 8; i++) {
85 dest[j] <<= 1;
86 dest[j] |= exchange_bit(0, 1);
87 }
88 }
89
90 /* turn off CS */
91 exchange_bit(0,0);
92}
93#endif
94
95
96#ifdef CONFIG_MIPS64
97
98unsigned long signext(unsigned long addr)
99{
100 addr &= 0xffffffff;
101 return (unsigned long)((int)addr);
102}
103
104void *get_arg(unsigned long args, int arc)
105{
106 unsigned long ul;
107 unsigned char *puc, uc;
108
109 args += (arc * 4);
110 ul = (unsigned long)signext(args);
111 puc = (unsigned char *)ul;
112 if (puc == 0)
113 return (void *)0;
114
115#ifdef CONFIG_CPU_LITTLE_ENDIAN
116 uc = *puc++;
117 ul = (unsigned long)uc;
118 uc = *puc++;
119 ul |= (((unsigned long)uc) << 8);
120 uc = *puc++;
121 ul |= (((unsigned long)uc) << 16);
122 uc = *puc++;
123 ul |= (((unsigned long)uc) << 24);
124#else /* CONFIG_CPU_LITTLE_ENDIAN */
125 uc = *puc++;
126 ul = ((unsigned long)uc) << 24;
127 uc = *puc++;
128 ul |= (((unsigned long)uc) << 16);
129 uc = *puc++;
130 ul |= (((unsigned long)uc) << 8);
131 uc = *puc++;
132 ul |= ((unsigned long)uc);
133#endif /* CONFIG_CPU_LITTLE_ENDIAN */
134 ul = signext(ul);
135 return (void *)ul;
136}
137
138char *arg64(unsigned long addrin, int arg_index)
139{
140 unsigned long args;
141 char *p;
142
143 args = signext(addrin);
144 p = (char *)get_arg(args, arg_index);
145
146 return p;
147}
148#endif /* CONFIG_MIPS64 */
149
150void __init prom_init(void)
151{
152 int argc = fw_arg0;
153 char **arg = (char **) fw_arg1;
154 char **env = (char **) fw_arg2;
155 struct callvectors *cv = (struct callvectors *) fw_arg3;
156 int i;
157
158#ifdef CONFIG_MIPS64
159 char *ptr;
160 printk("prom_init - MIPS64\n");
161
162 /* save the PROM vectors for debugging use */
163 debug_vectors = (struct callvectors *)signext((unsigned long)cv);
164
165 /* arg[0] is "g", the rest is boot parameters */
166 arcs_cmdline[0] = '\0';
167
168 for (i = 1; i < argc; i++) {
169 ptr = (char *)arg64((unsigned long)arg, i);
170 if ((strlen(arcs_cmdline) + strlen(ptr) + 1) >=
171 sizeof(arcs_cmdline))
172 break;
173 strcat(arcs_cmdline, ptr);
174 strcat(arcs_cmdline, " ");
175 }
176 i = 0;
177
178 while (1) {
179 ptr = (char *)arg64((unsigned long)env, i);
180 if (! ptr)
181 break;
182
183 if (strncmp("gtbase", ptr, strlen("gtbase")) == 0) {
184 marvell_base = simple_strtol(ptr + strlen("gtbase="),
185 NULL, 16);
186
187 if ((marvell_base & 0xffffffff00000000) == 0)
188 marvell_base |= 0xffffffff00000000;
189
190 printk("marvell_base set to 0x%016lx\n", marvell_base);
191 }
192 if (strncmp("cpuclock", ptr, strlen("cpuclock")) == 0) {
193 cpu_clock = simple_strtol(ptr + strlen("cpuclock="),
194 NULL, 10);
195 printk("cpu_clock set to %d\n", cpu_clock);
196 }
197 i++;
198 }
199 printk("arcs_cmdline: %s\n", arcs_cmdline);
200
201#else /* CONFIG_MIPS64 */
202
203 /* save the PROM vectors for debugging use */
204 debug_vectors = cv;
205
206 /* arg[0] is "g", the rest is boot parameters */
207 arcs_cmdline[0] = '\0';
208 for (i = 1; i < argc; i++) {
209 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
210 >= sizeof(arcs_cmdline))
211 break;
212 strcat(arcs_cmdline, arg[i]);
213 strcat(arcs_cmdline, " ");
214 }
215
216 while (*env) {
217 if (strncmp("gtbase", *env, strlen("gtbase")) == 0) {
218 marvell_base = simple_strtol(*env + strlen("gtbase="),
219 NULL, 16);
220 }
221 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0) {
222 cpu_clock = simple_strtol(*env + strlen("cpuclock="),
223 NULL, 10);
224 }
225 env++;
226 }
227#endif /* CONFIG_MIPS64 */
228
229 mips_machgroup = MACH_GROUP_MOMENCO;
230 mips_machtype = MACH_MOMENCO_OCELOT_3;
231
232#ifdef CONFIG_MV643XX_ETH
233 /* get the base MAC address for on-board ethernet ports */
234 get_mac(prom_mac_addr_base);
235#endif
236
237#ifndef CONFIG_MIPS64
238 debug_vectors->printf("Booting Linux kernel...\n");
239#endif
240}
241
242void __init prom_free_prom_memory(void)
243{
244}
245
246void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
247{
248}
diff --git a/arch/mips/momentum/ocelot_3/reset.c b/arch/mips/momentum/ocelot_3/reset.c
new file mode 100644
index 000000000000..72b4423c0864
--- /dev/null
+++ b/arch/mips/momentum/ocelot_3/reset.c
@@ -0,0 +1,59 @@
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, 01, 05 Ralf Baechle
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
10 *
11 * Copyright (C) 2002 Momentum Computer Inc.
12 * Author: Matthew Dharm <mdharm@momenco.com>
13 *
14 * Louis Hamilton, Red Hat, Inc.
15 * hamilton@redhat.com [MIPS64 modifications]
16 *
17 * Copyright 2004 PMC-Sierra
18 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
19 *
20 * Copyright (C) 2004 MontaVista Software Inc.
21 * Author: Manish Lachwani, mlachwani@mvista.com
22 */
23#include <linux/sched.h>
24#include <linux/mm.h>
25#include <linux/delay.h>
26#include <asm/io.h>
27#include <asm/pgtable.h>
28#include <asm/processor.h>
29#include <asm/reboot.h>
30#include <asm/system.h>
31
32void momenco_ocelot_restart(char *command)
33{
34 /* base address of timekeeper portion of part */
35 void *nvram = (void *) 0xfc807000L;
36
37 /* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */
38 writeb(0x84, nvram + 0xff7);
39
40 /* wait for the watchdog to go off */
41 mdelay(100+(1000/16));
42
43 /* if the watchdog fails for some reason, let people know */
44 printk(KERN_NOTICE "Watchdog reset failed\n");
45}
46
47void momenco_ocelot_halt(void)
48{
49 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
50 while (1)
51 __asm__(".set\tmips3\n\t"
52 "wait\n\t"
53 ".set\tmips0");
54}
55
56void momenco_ocelot_power_off(void)
57{
58 momenco_ocelot_halt();
59}
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c
new file mode 100644
index 000000000000..ce2efcbab7aa
--- /dev/null
+++ b/arch/mips/momentum/ocelot_3/setup.c
@@ -0,0 +1,398 @@
1/*
2 * setup.c
3 *
4 * BRIEF MODULE DESCRIPTION
5 * Momentum Computer Ocelot-3 board dependent boot routines
6 *
7 * Copyright (C) 1996, 1997, 01, 05 Ralf Baechle
8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Copyright (C) 2001 Red Hat, Inc.
10 * Copyright (C) 2002 Momentum Computer
11 *
12 * Author: Matthew Dharm, Momentum Computer
13 * mdharm@momenco.com
14 *
15 * Louis Hamilton, Red Hat, Inc.
16 * hamilton@redhat.com [MIPS64 modifications]
17 *
18 * Author: RidgeRun, Inc.
19 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
20 *
21 * Copyright 2001 MontaVista Software Inc.
22 * Author: jsun@mvista.com or jsun@junsun.net
23 *
24 * Copyright 2004 PMC-Sierra
25 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
26 *
27 * Copyright (C) 2004 MontaVista Software Inc.
28 * Author: Manish Lachwani, mlachwani@mvista.com
29 *
30 * This program is free software; you can redistribute it and/or modify it
31 * under the terms of the GNU General Public License as published by the
32 * Free Software Foundation; either version 2 of the License, or (at your
33 * option) any later version.
34 *
35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
37 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
38 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
39 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
40 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
41 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
42 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
43 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
44 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 *
46 * You should have received a copy of the GNU General Public License along
47 * with this program; if not, write to the Free Software Foundation, Inc.,
48 * 675 Mass Ave, Cambridge, MA 02139, USA.
49 */
50#include <linux/init.h>
51#include <linux/kernel.h>
52#include <linux/types.h>
53#include <linux/mc146818rtc.h>
54#include <linux/ioport.h>
55#include <linux/interrupt.h>
56#include <linux/pci.h>
57#include <linux/timex.h>
58#include <linux/bootmem.h>
59#include <linux/mv643xx.h>
60#include <asm/time.h>
61#include <asm/page.h>
62#include <asm/bootinfo.h>
63#include <asm/io.h>
64#include <asm/irq.h>
65#include <asm/pci.h>
66#include <asm/processor.h>
67#include <asm/ptrace.h>
68#include <asm/reboot.h>
69#include <asm/mc146818rtc.h>
70#include <asm/tlbflush.h>
71#include "ocelot_3_fpga.h"
72
73/* Marvell Discovery Register Base */
74unsigned long marvell_base = (signed)0xf4000000;
75
76/* CPU clock */
77unsigned long cpu_clock;
78
79/* RTC/NVRAM */
80unsigned char* rtc_base = (unsigned char*)(signed)0xfc800000;
81
82/* FPGA Base */
83unsigned long ocelot_fpga_base = (signed)0xfc000000;
84
85/* Serial base */
86unsigned long uart_base = (signed)0xfd000000;
87
88/*
89 * Marvell Discovery SRAM. This is one place where Ethernet
90 * Tx and Rx descriptors can be placed to improve performance
91 */
92extern unsigned long mv64340_sram_base;
93
94/* These functions are used for rebooting or halting the machine*/
95extern void momenco_ocelot_restart(char *command);
96extern void momenco_ocelot_halt(void);
97extern void momenco_ocelot_power_off(void);
98
99void momenco_time_init(void);
100static char reset_reason;
101
102void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
103 unsigned long entryhi, unsigned long pagemask);
104
105static inline unsigned long ENTRYLO(unsigned long paddr)
106{
107 return ((paddr & PAGE_MASK) |
108 (_PAGE_PRESENT | __READABLE | __WRITEABLE | _PAGE_GLOBAL |
109 _CACHE_UNCACHED)) >> 6;
110}
111
112void __init bus_error_init(void)
113{
114 /* nothing */
115}
116
117/*
118 * setup code for a handoff from a version 2 PMON 2000 PROM
119 */
120void setup_wired_tlb_entries(void)
121{
122 write_c0_wired(0);
123 local_flush_tlb_all();
124
125 /* marvell and extra space */
126 add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xf4010000), (signed)0xf4000000, PM_64K);
127
128 /* fpga, rtc, and uart */
129 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), (signed)0xfc000000, PM_16M);
130}
131
132#define CONV_BCD_TO_BIN(val) (((val) & 0xf) + (((val) >> 4) * 10))
133#define CONV_BIN_TO_BCD(val) (((val) % 10) + (((val) / 10) << 4))
134
135unsigned long m48t37y_get_time(void)
136{
137 unsigned int year, month, day, hour, min, sec;
138
139 /* stop the update */
140 rtc_base[0x7ff8] = 0x40;
141
142 year = CONV_BCD_TO_BIN(rtc_base[0x7fff]);
143 year += CONV_BCD_TO_BIN(rtc_base[0x7ff1]) * 100;
144
145 month = CONV_BCD_TO_BIN(rtc_base[0x7ffe]);
146
147 day = CONV_BCD_TO_BIN(rtc_base[0x7ffd]);
148
149 hour = CONV_BCD_TO_BIN(rtc_base[0x7ffb]);
150 min = CONV_BCD_TO_BIN(rtc_base[0x7ffa]);
151 sec = CONV_BCD_TO_BIN(rtc_base[0x7ff9]);
152
153 /* start the update */
154 rtc_base[0x7ff8] = 0x00;
155
156 return mktime(year, month, day, hour, min, sec);
157}
158
159int m48t37y_set_time(unsigned long sec)
160{
161 struct rtc_time tm;
162
163 /* convert to a more useful format -- note months count from 0 */
164 to_tm(sec, &tm);
165 tm.tm_mon += 1;
166
167 /* enable writing */
168 rtc_base[0x7ff8] = 0x80;
169
170 /* year */
171 rtc_base[0x7fff] = CONV_BIN_TO_BCD(tm.tm_year % 100);
172 rtc_base[0x7ff1] = CONV_BIN_TO_BCD(tm.tm_year / 100);
173
174 /* month */
175 rtc_base[0x7ffe] = CONV_BIN_TO_BCD(tm.tm_mon);
176
177 /* day */
178 rtc_base[0x7ffd] = CONV_BIN_TO_BCD(tm.tm_mday);
179
180 /* hour/min/sec */
181 rtc_base[0x7ffb] = CONV_BIN_TO_BCD(tm.tm_hour);
182 rtc_base[0x7ffa] = CONV_BIN_TO_BCD(tm.tm_min);
183 rtc_base[0x7ff9] = CONV_BIN_TO_BCD(tm.tm_sec);
184
185 /* day of week -- not really used, but let's keep it up-to-date */
186 rtc_base[0x7ffc] = CONV_BIN_TO_BCD(tm.tm_wday + 1);
187
188 /* disable writing */
189 rtc_base[0x7ff8] = 0x00;
190
191 return 0;
192}
193
194void momenco_timer_setup(struct irqaction *irq)
195{
196 setup_irq(7, irq); /* Timer interrupt, unmask status IM7 */
197}
198
199void momenco_time_init(void)
200{
201 setup_wired_tlb_entries();
202
203 /*
204 * Ocelot-3 board has been built with both
205 * the Rm7900 and the Rm7065C
206 */
207 mips_hpt_frequency = cpu_clock / 2;
208 board_timer_setup = momenco_timer_setup;
209
210 rtc_get_time = m48t37y_get_time;
211 rtc_set_time = m48t37y_set_time;
212}
213
214/*
215 * PCI Support for Ocelot-3
216 */
217
218/* Bus #0 IO and MEM space */
219#define OCELOT_3_PCI_IO_0_START 0xe0000000
220#define OCELOT_3_PCI_IO_0_SIZE 0x08000000
221#define OCELOT_3_PCI_MEM_0_START 0xc0000000
222#define OCELOT_3_PCI_MEM_0_SIZE 0x10000000
223
224/* Bus #1 IO and MEM space */
225#define OCELOT_3_PCI_IO_1_START 0xe8000000
226#define OCELOT_3_PCI_IO_1_SIZE 0x08000000
227#define OCELOT_3_PCI_MEM_1_START 0xd0000000
228#define OCELOT_3_PCI_MEM_1_SIZE 0x10000000
229
230static struct resource mv_pci_io_mem0_resource = {
231 .name = "MV64340 PCI0 IO MEM",
232 .start = OCELOT_3_PCI_IO_0_START,
233 .end = OCELOT_3_PCI_IO_0_START + OCELOT_3_PCI_IO_0_SIZE - 1,
234 .flags = IORESOURCE_IO,
235};
236
237static struct resource mv_pci_io_mem1_resource = {
238 .name = "MV64340 PCI1 IO MEM",
239 .start = OCELOT_3_PCI_IO_1_START,
240 .end = OCELOT_3_PCI_IO_1_START + OCELOT_3_PCI_IO_1_SIZE - 1,
241 .flags = IORESOURCE_IO,
242};
243
244static struct resource mv_pci_mem0_resource = {
245 .name = "MV64340 PCI0 MEM",
246 .start = OCELOT_3_PCI_MEM_0_START,
247 .end = OCELOT_3_PCI_MEM_0_START + OCELOT_3_PCI_MEM_0_SIZE - 1,
248 .flags = IORESOURCE_MEM,
249};
250
251static struct resource mv_pci_mem1_resource = {
252 .name = "MV64340 PCI1 MEM",
253 .start = OCELOT_3_PCI_MEM_1_START,
254 .end = OCELOT_3_PCI_MEM_1_START + OCELOT_3_PCI_MEM_1_SIZE - 1,
255 .flags = IORESOURCE_MEM,
256};
257
258static struct mv_pci_controller mv_bus0_controller = {
259 .pcic = {
260 .pci_ops = &mv_pci_ops,
261 .mem_resource = &mv_pci_mem0_resource,
262 .io_resource = &mv_pci_io_mem0_resource,
263 },
264 .config_addr = MV64340_PCI_0_CONFIG_ADDR,
265 .config_vreg = MV64340_PCI_0_CONFIG_DATA_VIRTUAL_REG,
266};
267
268static struct mv_pci_controller mv_bus1_controller = {
269 .pcic = {
270 .pci_ops = &mv_pci_ops,
271 .mem_resource = &mv_pci_mem1_resource,
272 .io_resource = &mv_pci_io_mem1_resource,
273 },
274 .config_addr = MV64340_PCI_1_CONFIG_ADDR,
275 .config_vreg = MV64340_PCI_1_CONFIG_DATA_VIRTUAL_REG,
276};
277
278static __init int __init ja_pci_init(void)
279{
280 uint32_t enable;
281 extern int pci_probe_only;
282
283 /* PMON will assign PCI resources */
284 pci_probe_only = 1;
285
286 enable = ~MV_READ(MV64340_BASE_ADDR_ENABLE);
287 /*
288 * We require at least one enabled I/O or PCI memory window or we
289 * will ignore this PCI bus. We ignore PCI windows 1, 2 and 3.
290 */
291 if (enable & (0x01 << 9) || enable & (0x01 << 10))
292 register_pci_controller(&mv_bus0_controller.pcic);
293
294 if (enable & (0x01 << 14) || enable & (0x01 << 15))
295 register_pci_controller(&mv_bus1_controller.pcic);
296
297 ioport_resource.end = OCELOT_3_PCI_IO_0_START + OCELOT_3_PCI_IO_0_SIZE +
298 OCELOT_3_PCI_IO_1_SIZE - 1;
299
300 iomem_resource.end = OCELOT_3_PCI_MEM_0_START + OCELOT_3_PCI_MEM_0_SIZE +
301 OCELOT_3_PCI_MEM_1_SIZE - 1;
302
303 set_io_port_base(OCELOT_3_PCI_IO_0_START); /* mips_io_port_base */
304
305 return 0;
306}
307
308arch_initcall(ja_pci_init);
309
310static int __init momenco_ocelot_3_setup(void)
311{
312 unsigned int tmpword;
313
314 board_time_init = momenco_time_init;
315
316 _machine_restart = momenco_ocelot_restart;
317 _machine_halt = momenco_ocelot_halt;
318 _machine_power_off = momenco_ocelot_power_off;
319
320 /* Wired TLB entries */
321 setup_wired_tlb_entries();
322
323 /* shut down ethernet ports, just to be sure our memory doesn't get
324 * corrupted by random ethernet traffic.
325 */
326 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0), 0xff << 8);
327 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1), 0xff << 8);
328 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0), 0xff << 8);
329 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1), 0xff << 8);
330 do {}
331 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0)) & 0xff);
332 do {}
333 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1)) & 0xff);
334 do {}
335 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0)) & 0xff);
336 do {}
337 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1)) & 0xff);
338 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0),
339 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0)) & ~1);
340 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1),
341 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1)) & ~1);
342
343 /* Turn off the Bit-Error LED */
344 OCELOT_FPGA_WRITE(0x80, CLR);
345
346 tmpword = OCELOT_FPGA_READ(BOARDREV);
347 if (tmpword < 26)
348 printk("Momenco Ocelot-3: Board Assembly Rev. %c\n",
349 'A'+tmpword);
350 else
351 printk("Momenco Ocelot-3: Board Assembly Revision #0x%x\n",
352 tmpword);
353
354 tmpword = OCELOT_FPGA_READ(FPGA_REV);
355 printk("FPGA Rev: %d.%d\n", tmpword>>4, tmpword&15);
356 tmpword = OCELOT_FPGA_READ(RESET_STATUS);
357 printk("Reset reason: 0x%x\n", tmpword);
358 switch (tmpword) {
359 case 0x1:
360 printk(" - Power-up reset\n");
361 break;
362 case 0x2:
363 printk(" - Push-button reset\n");
364 break;
365 case 0x4:
366 printk(" - cPCI bus reset\n");
367 break;
368 case 0x8:
369 printk(" - Watchdog reset\n");
370 break;
371 case 0x10:
372 printk(" - Software reset\n");
373 break;
374 default:
375 printk(" - Unknown reset cause\n");
376 }
377 reset_reason = tmpword;
378 OCELOT_FPGA_WRITE(0xff, RESET_STATUS);
379
380 tmpword = OCELOT_FPGA_READ(CPCI_ID);
381 printk("cPCI ID register: 0x%02x\n", tmpword);
382 printk(" - Slot number: %d\n", tmpword & 0x1f);
383 printk(" - PCI bus present: %s\n", tmpword & 0x40 ? "yes" : "no");
384 printk(" - System Slot: %s\n", tmpword & 0x20 ? "yes" : "no");
385
386 tmpword = OCELOT_FPGA_READ(BOARD_STATUS);
387 printk("Board Status register: 0x%02x\n", tmpword);
388 printk(" - User jumper: %s\n", (tmpword & 0x80)?"installed":"absent");
389 printk(" - Boot flash write jumper: %s\n", (tmpword&0x40)?"installed":"absent");
390 printk(" - L3 cache size: %d MB\n", (1<<((tmpword&12) >> 2))&~1);
391
392 /* Support for 128 MB memory */
393 add_memory_region(0x0, 0x08000000, BOOT_MEM_RAM);
394
395 return 0;
396}
397
398early_initcall(momenco_ocelot_3_setup);
diff --git a/arch/mips/momentum/ocelot_c/Makefile b/arch/mips/momentum/ocelot_c/Makefile
new file mode 100644
index 000000000000..91240777f978
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for Momentum Computer's Ocelot-C and -CS boards.
3#
4
5obj-y += cpci-irq.o int-handler.o irq.o prom.o reset.o \
6 setup.o uart-irq.o
7
8obj-$(CONFIG_KGDB) += dbg_io.o
diff --git a/arch/mips/momentum/ocelot_c/cpci-irq.c b/arch/mips/momentum/ocelot_c/cpci-irq.c
new file mode 100644
index 000000000000..dea48b3ad687
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/cpci-irq.c
@@ -0,0 +1,153 @@
1/*
2 * Copyright 2002 Momentum Computer
3 * Author: mdharm@momenco.com
4 *
5 * arch/mips/momentum/ocelot_c/cpci-irq.c
6 * Interrupt routines for cpci. Interrupt numbers are assigned from
7 * CPCI_IRQ_BASE to CPCI_IRQ_BASE+8 (8 interrupt sources).
8 *
9 * Note that the high-level software will need to be careful about using
10 * these interrupts. If this board is asserting a cPCI interrupt, it will
11 * also see the asserted interrupt. Care must be taken to avoid an
12 * interrupt flood.
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version.
18 */
19
20#include <linux/module.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/kernel.h>
24#include <asm/ptrace.h>
25#include <linux/sched.h>
26#include <linux/kernel_stat.h>
27#include <asm/io.h>
28#include "ocelot_c_fpga.h"
29
30#define CPCI_IRQ_BASE 8
31
32static inline int ls1bit8(unsigned int x)
33{
34 int b = 7, s;
35
36 s = 4; if (((unsigned char)(x << 4)) == 0) s = 0; b -= s; x <<= s;
37 s = 2; if (((unsigned char)(x << 2)) == 0) s = 0; b -= s; x <<= s;
38 s = 1; if (((unsigned char)(x << 1)) == 0) s = 0; b -= s;
39
40 return b;
41}
42
43/* mask off an interrupt -- 0 is enable, 1 is disable */
44static inline void mask_cpci_irq(unsigned int irq)
45{
46 uint32_t value;
47
48 value = OCELOT_FPGA_READ(INTMASK);
49 value |= 1 << (irq - CPCI_IRQ_BASE);
50 OCELOT_FPGA_WRITE(value, INTMASK);
51
52 /* read the value back to assure that it's really been written */
53 value = OCELOT_FPGA_READ(INTMASK);
54}
55
56/* unmask an interrupt -- 0 is enable, 1 is disable */
57static inline void unmask_cpci_irq(unsigned int irq)
58{
59 uint32_t value;
60
61 value = OCELOT_FPGA_READ(INTMASK);
62 value &= ~(1 << (irq - CPCI_IRQ_BASE));
63 OCELOT_FPGA_WRITE(value, INTMASK);
64
65 /* read the value back to assure that it's really been written */
66 value = OCELOT_FPGA_READ(INTMASK);
67}
68
69/*
70 * Enables the IRQ in the FPGA
71 */
72static void enable_cpci_irq(unsigned int irq)
73{
74 unmask_cpci_irq(irq);
75}
76
77/*
78 * Initialize the IRQ in the FPGA
79 */
80static unsigned int startup_cpci_irq(unsigned int irq)
81{
82 unmask_cpci_irq(irq);
83 return 0;
84}
85
86/*
87 * Disables the IRQ in the FPGA
88 */
89static void disable_cpci_irq(unsigned int irq)
90{
91 mask_cpci_irq(irq);
92}
93
94/*
95 * Masks and ACKs an IRQ
96 */
97static void mask_and_ack_cpci_irq(unsigned int irq)
98{
99 mask_cpci_irq(irq);
100}
101
102/*
103 * End IRQ processing
104 */
105static void end_cpci_irq(unsigned int irq)
106{
107 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
108 unmask_cpci_irq(irq);
109}
110
111/*
112 * Interrupt handler for interrupts coming from the FPGA chip.
113 * It could be built in ethernet ports etc...
114 */
115void ll_cpci_irq(struct pt_regs *regs)
116{
117 unsigned int irq_src, irq_mask;
118
119 /* read the interrupt status registers */
120 irq_src = OCELOT_FPGA_READ(INTSTAT);
121 irq_mask = OCELOT_FPGA_READ(INTMASK);
122
123 /* mask for just the interrupts we want */
124 irq_src &= ~irq_mask;
125
126 do_IRQ(ls1bit8(irq_src) + CPCI_IRQ_BASE, regs);
127}
128
129#define shutdown_cpci_irq disable_cpci_irq
130
131struct hw_interrupt_type cpci_irq_type = {
132 "CPCI/FPGA",
133 startup_cpci_irq,
134 shutdown_cpci_irq,
135 enable_cpci_irq,
136 disable_cpci_irq,
137 mask_and_ack_cpci_irq,
138 end_cpci_irq,
139 NULL
140};
141
142void cpci_irq_init(void)
143{
144 int i;
145
146 /* Reset irq handlers pointers to NULL */
147 for (i = CPCI_IRQ_BASE; i < (CPCI_IRQ_BASE + 8); i++) {
148 irq_desc[i].status = IRQ_DISABLED;
149 irq_desc[i].action = 0;
150 irq_desc[i].depth = 2;
151 irq_desc[i].handler = &cpci_irq_type;
152 }
153}
diff --git a/arch/mips/momentum/ocelot_c/dbg_io.c b/arch/mips/momentum/ocelot_c/dbg_io.c
new file mode 100644
index 000000000000..8720bccfdea2
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/dbg_io.c
@@ -0,0 +1,126 @@
1#include <linux/config.h>
2
3#ifdef CONFIG_KGDB
4
5#include <asm/serial.h> /* For the serial port location and base baud */
6
7/* --- CONFIG --- */
8
9typedef unsigned char uint8;
10typedef unsigned int uint32;
11
12/* --- END OF CONFIG --- */
13
14#define UART16550_BAUD_2400 2400
15#define UART16550_BAUD_4800 4800
16#define UART16550_BAUD_9600 9600
17#define UART16550_BAUD_19200 19200
18#define UART16550_BAUD_38400 38400
19#define UART16550_BAUD_57600 57600
20#define UART16550_BAUD_115200 115200
21
22#define UART16550_PARITY_NONE 0
23#define UART16550_PARITY_ODD 0x08
24#define UART16550_PARITY_EVEN 0x18
25#define UART16550_PARITY_MARK 0x28
26#define UART16550_PARITY_SPACE 0x38
27
28#define UART16550_DATA_5BIT 0x0
29#define UART16550_DATA_6BIT 0x1
30#define UART16550_DATA_7BIT 0x2
31#define UART16550_DATA_8BIT 0x3
32
33#define UART16550_STOP_1BIT 0x0
34#define UART16550_STOP_2BIT 0x4
35
36/* ----------------------------------------------------- */
37
38/* === CONFIG === */
39
40/* [jsun] we use the second serial port for kdb */
41#define BASE OCELOT_SERIAL1_BASE
42#define MAX_BAUD OCELOT_BASE_BAUD
43
44/* === END OF CONFIG === */
45
46#define REG_OFFSET 4
47
48/* register offset */
49#define OFS_RCV_BUFFER 0
50#define OFS_TRANS_HOLD 0
51#define OFS_SEND_BUFFER 0
52#define OFS_INTR_ENABLE (1*REG_OFFSET)
53#define OFS_INTR_ID (2*REG_OFFSET)
54#define OFS_DATA_FORMAT (3*REG_OFFSET)
55#define OFS_LINE_CONTROL (3*REG_OFFSET)
56#define OFS_MODEM_CONTROL (4*REG_OFFSET)
57#define OFS_RS232_OUTPUT (4*REG_OFFSET)
58#define OFS_LINE_STATUS (5*REG_OFFSET)
59#define OFS_MODEM_STATUS (6*REG_OFFSET)
60#define OFS_RS232_INPUT (6*REG_OFFSET)
61#define OFS_SCRATCH_PAD (7*REG_OFFSET)
62
63#define OFS_DIVISOR_LSB (0*REG_OFFSET)
64#define OFS_DIVISOR_MSB (1*REG_OFFSET)
65
66
67/* memory-mapped read/write of the port */
68#define UART16550_READ(y) (*((volatile uint8*)(BASE + y)))
69#define UART16550_WRITE(y, z) ((*((volatile uint8*)(BASE + y))) = z)
70
71void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
72{
73 /* disable interrupts */
74 UART16550_WRITE(OFS_INTR_ENABLE, 0);
75
76 /* set up buad rate */
77 {
78 uint32 divisor;
79
80 /* set DIAB bit */
81 UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
82
83 /* set divisor */
84 divisor = MAX_BAUD / baud;
85 UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
86 UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
87
88 /* clear DIAB bit */
89 UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
90 }
91
92 /* set data format */
93 UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
94}
95
96static int remoteDebugInitialized = 0;
97
98uint8 getDebugChar(void)
99{
100 if (!remoteDebugInitialized) {
101 remoteDebugInitialized = 1;
102 debugInit(UART16550_BAUD_38400,
103 UART16550_DATA_8BIT,
104 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
105 }
106
107 while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
108 return UART16550_READ(OFS_RCV_BUFFER);
109}
110
111
112int putDebugChar(uint8 byte)
113{
114 if (!remoteDebugInitialized) {
115 remoteDebugInitialized = 1;
116 debugInit(UART16550_BAUD_38400,
117 UART16550_DATA_8BIT,
118 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
119 }
120
121 while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
122 UART16550_WRITE(OFS_SEND_BUFFER, byte);
123 return 1;
124}
125
126#endif
diff --git a/arch/mips/momentum/ocelot_c/int-handler.S b/arch/mips/momentum/ocelot_c/int-handler.S
new file mode 100644
index 000000000000..2f2430648abc
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/int-handler.S
@@ -0,0 +1,102 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: jsun@mvista.com or jsun@junsun.net
7 *
8 * First-level interrupt dispatcher for Ocelot-CS board.
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#include <asm/asm.h>
16#include <asm/mipsregs.h>
17#include <asm/addrspace.h>
18#include <asm/regdef.h>
19#include <asm/stackframe.h>
20#include "ocelot_c_fpga.h"
21
22/*
23 * First level interrupt dispatcher for Ocelot-CS board
24 */
25 .align 5
26 NESTED(ocelot_handle_int, PT_SIZE, sp)
27 SAVE_ALL
28 CLI
29 .set at
30 mfc0 t0, CP0_CAUSE
31 mfc0 t2, CP0_STATUS
32
33 and t0, t2
34
35 andi t1, t0, STATUSF_IP0 /* sw0 software interrupt */
36 bnez t1, ll_sw0_irq
37 andi t1, t0, STATUSF_IP1 /* sw1 software interrupt */
38 bnez t1, ll_sw1_irq
39 andi t1, t0, STATUSF_IP2 /* int0 hardware line */
40 bnez t1, ll_scsi_irq
41 andi t1, t0, STATUSF_IP3 /* int1 hardware line */
42 bnez t1, ll_uart_decode_irq
43 andi t1, t0, STATUSF_IP4 /* int2 hardware line */
44 bnez t1, ll_pmc_irq
45 andi t1, t0, STATUSF_IP5 /* int3 hardware line */
46 bnez t1, ll_cpci_decode_irq
47 andi t1, t0, STATUSF_IP6 /* int4 hardware line */
48 bnez t1, ll_mv64340_decode_irq
49 andi t1, t0, STATUSF_IP7 /* cpu timer */
50 bnez t1, ll_cputimer_irq
51
52 .set reorder
53
54 /* wrong alarm or masked ... */
55 j spurious_interrupt
56 nop
57 END(ocelot_handle_int)
58
59 .align 5
60ll_sw0_irq:
61 li a0, 0
62 move a1, sp
63 jal do_IRQ
64 j ret_from_irq
65ll_sw1_irq:
66 li a0, 1
67 move a1, sp
68 jal do_IRQ
69 j ret_from_irq
70ll_scsi_irq:
71 li a0, 2
72 move a1, sp
73 jal do_IRQ
74 j ret_from_irq
75
76ll_uart_decode_irq:
77 move a0, sp
78 jal ll_uart_irq
79 j ret_from_irq
80
81ll_pmc_irq:
82 li a0, 4
83 move a1, sp
84 jal do_IRQ
85 j ret_from_irq
86
87ll_cpci_decode_irq:
88 move a0, sp
89 jal ll_cpci_irq
90 j ret_from_irq
91
92ll_mv64340_decode_irq:
93 move a0, sp
94 jal ll_mv64340_irq
95 j ret_from_irq
96
97ll_cputimer_irq:
98 li a0, 7
99 move a1, sp
100 jal do_IRQ
101 j ret_from_irq
102
diff --git a/arch/mips/momentum/ocelot_c/irq.c b/arch/mips/momentum/ocelot_c/irq.c
new file mode 100644
index 000000000000..300fe8e4fbe8
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/irq.c
@@ -0,0 +1,83 @@
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, 01, 05 Ralf Baechle (ralf@linux-mips.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_cpu.h>
47#include <asm/mipsregs.h>
48#include <asm/mv64340.h>
49#include <asm/system.h>
50
51extern asmlinkage void ocelot_handle_int(void);
52extern void uart_irq_init(void);
53extern void cpci_irq_init(void);
54
55static struct irqaction cascade_fpga = {
56 no_action, SA_INTERRUPT, CPU_MASK_NONE, "cascade via FPGA", NULL, NULL
57};
58
59static struct irqaction cascade_mv64340 = {
60 no_action, SA_INTERRUPT, CPU_MASK_NONE, "cascade via MV64340", NULL, NULL
61};
62
63void __init arch_init_irq(void)
64{
65 /*
66 * Clear all of the interrupts while we change the able around a bit.
67 * int-handler is not on bootstrap
68 */
69 clear_c0_status(ST0_IM);
70
71 /* Sets the first-level interrupt dispatcher. */
72 set_except_vector(0, ocelot_handle_int);
73 mips_cpu_irq_init(0);
74
75 /* set up the cascading interrupts */
76 setup_irq(3, &cascade_fpga);
77 setup_irq(5, &cascade_fpga);
78 setup_irq(6, &cascade_mv64340);
79
80 mv64340_irq_init(16);
81 uart_irq_init();
82 cpci_irq_init();
83}
diff --git a/arch/mips/momentum/ocelot_c/ocelot_c_fpga.h b/arch/mips/momentum/ocelot_c/ocelot_c_fpga.h
new file mode 100644
index 000000000000..a6cf7a7959b3
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/ocelot_c_fpga.h
@@ -0,0 +1,60 @@
1/*
2 * Ocelot-C Board Register Definitions
3 *
4 * (C) 2002 Momentum Computer Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 * Louis Hamilton, Red Hat, Inc.
27 * hamilton@redhat.com [MIPS64 modifications]
28 */
29
30#ifndef __OCELOT_C_FPGA_H__
31#define __OCELOT_C_FPGA_H__
32
33#include <linux/config.h>
34
35#ifdef CONFIG_MIPS64
36#define OCELOT_C_CS0_ADDR (0xfffffffffc000000)
37#else
38#define OCELOT_C_CS0_ADDR (0xfc000000)
39#endif
40
41#define OCELOT_C_REG_BOARDREV 0x0
42#define OCELOT_C_REG_FPGA_REV 0x1
43#define OCELOT_C_REG_FPGA_TYPE 0x2
44#define OCELOT_C_REG_RESET_STATUS 0x3
45#define OCELOT_C_REG_BOARD_STATUS 0x4
46#define OCELOT_C_REG_CPCI_ID 0x5
47#define OCELOT_C_REG_SET 0x6
48#define OCELOT_C_REG_CLR 0x7
49#define OCELOT_C_REG_EEPROM_MODE 0x9
50#define OCELOT_C_REG_INTMASK 0xa
51#define OCELOT_C_REG_INTSTAT 0xb
52#define OCELOT_C_REG_UART_INTMASK 0xc
53#define OCELOT_C_REG_UART_INTSTAT 0xd
54#define OCELOT_C_REG_INTSET 0xe
55#define OCELOT_C_REG_INTCLR 0xf
56
57#define OCELOT_FPGA_WRITE(x, y) writeb(x, OCELOT_C_CS0_ADDR + OCELOT_C_REG_##y)
58#define OCELOT_FPGA_READ(x) readb(OCELOT_C_CS0_ADDR + OCELOT_C_REG_##x)
59
60#endif
diff --git a/arch/mips/momentum/ocelot_c/prom.c b/arch/mips/momentum/ocelot_c/prom.c
new file mode 100644
index 000000000000..49ac302d8901
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/prom.c
@@ -0,0 +1,243 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Louis Hamilton, Red Hat, Inc.
6 * hamilton@redhat.com [MIPS64 modifications]
7 *
8 * Based on Ocelot Linux port, which is
9 * Copyright 2001 MontaVista Software Inc.
10 * Author: jsun@mvista.com or jsun@junsun.net
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#include <linux/config.h>
18#include <linux/init.h>
19#include <linux/mm.h>
20#include <linux/sched.h>
21#include <linux/bootmem.h>
22
23#include <asm/addrspace.h>
24#include <asm/bootinfo.h>
25#include <asm/mv64340.h>
26#include <asm/pmon.h>
27
28#include "ocelot_c_fpga.h"
29
30struct callvectors* debug_vectors;
31
32extern unsigned long marvell_base;
33extern unsigned long cpu_clock;
34
35#ifdef CONFIG_MV643XX_ETH
36extern unsigned char prom_mac_addr_base[6];
37#endif
38
39const char *get_system_type(void)
40{
41#ifdef CONFIG_CPU_SR71000
42 return "Momentum Ocelot-CS";
43#else
44 return "Momentum Ocelot-C";
45#endif
46}
47
48#ifdef CONFIG_MV643XX_ETH
49static void burn_clocks(void)
50{
51 int i;
52
53 /* this loop should burn at least 1us -- this should be plenty */
54 for (i = 0; i < 0x10000; i++)
55 ;
56}
57
58static u8 exchange_bit(u8 val, u8 cs)
59{
60 /* place the data */
61 OCELOT_FPGA_WRITE((val << 2) | cs, EEPROM_MODE);
62 burn_clocks();
63
64 /* turn the clock on */
65 OCELOT_FPGA_WRITE((val << 2) | cs | 0x2, EEPROM_MODE);
66 burn_clocks();
67
68 /* turn the clock off and read-strobe */
69 OCELOT_FPGA_WRITE((val << 2) | cs | 0x10, EEPROM_MODE);
70
71 /* return the data */
72 return ((OCELOT_FPGA_READ(EEPROM_MODE) >> 3) & 0x1);
73}
74
75void get_mac(char dest[6])
76{
77 u8 read_opcode[12] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
78 int i,j;
79
80 for (i = 0; i < 12; i++)
81 exchange_bit(read_opcode[i], 1);
82
83 for (j = 0; j < 6; j++) {
84 dest[j] = 0;
85 for (i = 0; i < 8; i++) {
86 dest[j] <<= 1;
87 dest[j] |= exchange_bit(0, 1);
88 }
89 }
90
91 /* turn off CS */
92 exchange_bit(0,0);
93}
94#endif
95
96
97#ifdef CONFIG_MIPS64
98
99unsigned long signext(unsigned long addr)
100{
101 addr &= 0xffffffff;
102 return (unsigned long)((int)addr);
103}
104
105void *get_arg(unsigned long args, int arc)
106{
107 unsigned long ul;
108 unsigned char *puc, uc;
109
110 args += (arc * 4);
111 ul = (unsigned long)signext(args);
112 puc = (unsigned char *)ul;
113 if (puc == 0)
114 return (void *)0;
115
116#ifdef CONFIG_CPU_LITTLE_ENDIAN
117 uc = *puc++;
118 ul = (unsigned long)uc;
119 uc = *puc++;
120 ul |= (((unsigned long)uc) << 8);
121 uc = *puc++;
122 ul |= (((unsigned long)uc) << 16);
123 uc = *puc++;
124 ul |= (((unsigned long)uc) << 24);
125#else /* CONFIG_CPU_LITTLE_ENDIAN */
126 uc = *puc++;
127 ul = ((unsigned long)uc) << 24;
128 uc = *puc++;
129 ul |= (((unsigned long)uc) << 16);
130 uc = *puc++;
131 ul |= (((unsigned long)uc) << 8);
132 uc = *puc++;
133 ul |= ((unsigned long)uc);
134#endif /* CONFIG_CPU_LITTLE_ENDIAN */
135 ul = signext(ul);
136 return (void *)ul;
137}
138
139char *arg64(unsigned long addrin, int arg_index)
140{
141 unsigned long args;
142 char *p;
143 args = signext(addrin);
144 p = (char *)get_arg(args, arg_index);
145 return p;
146}
147#endif /* CONFIG_MIPS64 */
148
149
150void __init prom_init(void)
151{
152 int argc = fw_arg0;
153 char **arg = (char **) fw_arg1;
154 char **env = (char **) fw_arg2;
155 struct callvectors *cv = (struct callvectors *) fw_arg3;
156 int i;
157
158#ifdef CONFIG_MIPS64
159 char *ptr;
160
161 printk("prom_init - MIPS64\n");
162 /* save the PROM vectors for debugging use */
163 debug_vectors = (struct callvectors *)signext((unsigned long)cv);
164
165 /* arg[0] is "g", the rest is boot parameters */
166 arcs_cmdline[0] = '\0';
167
168 for (i = 1; i < argc; i++) {
169 ptr = (char *)arg64((unsigned long)arg, i);
170 if ((strlen(arcs_cmdline) + strlen(ptr) + 1) >=
171 sizeof(arcs_cmdline))
172 break;
173 strcat(arcs_cmdline, ptr);
174 strcat(arcs_cmdline, " ");
175 }
176 i = 0;
177 while (1) {
178 ptr = (char *)arg64((unsigned long)env, i);
179 if (! ptr)
180 break;
181
182 if (strncmp("gtbase", ptr, strlen("gtbase")) == 0) {
183 marvell_base = simple_strtol(ptr + strlen("gtbase="),
184 NULL, 16);
185
186 if ((marvell_base & 0xffffffff00000000) == 0)
187 marvell_base |= 0xffffffff00000000;
188
189 printk("marvell_base set to 0x%016lx\n", marvell_base);
190 }
191 if (strncmp("cpuclock", ptr, strlen("cpuclock")) == 0) {
192 cpu_clock = simple_strtol(ptr + strlen("cpuclock="),
193 NULL, 10);
194 printk("cpu_clock set to %d\n", cpu_clock);
195 }
196 i++;
197 }
198 printk("arcs_cmdline: %s\n", arcs_cmdline);
199
200#else /* CONFIG_MIPS64 */
201 /* save the PROM vectors for debugging use */
202 debug_vectors = cv;
203
204 /* arg[0] is "g", the rest is boot parameters */
205 arcs_cmdline[0] = '\0';
206 for (i = 1; i < argc; i++) {
207 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
208 >= sizeof(arcs_cmdline))
209 break;
210 strcat(arcs_cmdline, arg[i]);
211 strcat(arcs_cmdline, " ");
212 }
213
214 while (*env) {
215 if (strncmp("gtbase", *env, strlen("gtbase")) == 0) {
216 marvell_base = simple_strtol(*env + strlen("gtbase="),
217 NULL, 16);
218 }
219 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0) {
220 cpu_clock = simple_strtol(*env + strlen("cpuclock="),
221 NULL, 10);
222 }
223 env++;
224 }
225#endif /* CONFIG_MIPS64 */
226
227 mips_machgroup = MACH_GROUP_MOMENCO;
228 mips_machtype = MACH_MOMENCO_OCELOT_C;
229
230#ifdef CONFIG_MV643XX_ETH
231 /* get the base MAC address for on-board ethernet ports */
232 get_mac(prom_mac_addr_base);
233#endif
234
235#ifndef CONFIG_MIPS64
236 debug_vectors->printf("Booting Linux kernel...\n");
237#endif
238}
239
240unsigned long __init prom_free_prom_memory(void)
241{
242 return 0;
243}
diff --git a/arch/mips/momentum/ocelot_c/reset.c b/arch/mips/momentum/ocelot_c/reset.c
new file mode 100644
index 000000000000..1f2b4263cc8c
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/reset.c
@@ -0,0 +1,59 @@
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 * Copyright (C) 2002 Momentum Computer Inc.
12 * Author: Matthew Dharm <mdharm@momenco.com>
13 *
14 * Louis Hamilton, Red Hat, Inc.
15 * hamilton@redhat.com [MIPS64 modifications]
16 */
17#include <linux/config.h>
18#include <linux/sched.h>
19#include <linux/mm.h>
20#include <asm/io.h>
21#include <asm/pgtable.h>
22#include <asm/processor.h>
23#include <asm/reboot.h>
24#include <asm/system.h>
25#include <linux/delay.h>
26
27void momenco_ocelot_restart(char *command)
28{
29 /* base address of timekeeper portion of part */
30 void *nvram = (void *)
31#ifdef CONFIG_MIPS64
32 0xfffffffffc807000;
33#else
34 0xfc807000;
35#endif
36
37 /* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */
38 writeb(0x84, nvram + 0xff7);
39
40 /* wait for the watchdog to go off */
41 mdelay(100+(1000/16));
42
43 /* if the watchdog fails for some reason, let people know */
44 printk(KERN_NOTICE "Watchdog reset failed\n");
45}
46
47void momenco_ocelot_halt(void)
48{
49 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
50 while (1)
51 __asm__(".set\tmips3\n\t"
52 "wait\n\t"
53 ".set\tmips0");
54}
55
56void momenco_ocelot_power_off(void)
57{
58 momenco_ocelot_halt();
59}
diff --git a/arch/mips/momentum/ocelot_c/setup.c b/arch/mips/momentum/ocelot_c/setup.c
new file mode 100644
index 000000000000..021c00e3c07c
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/setup.c
@@ -0,0 +1,363 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Momentum Computer Ocelot-C and -CS board dependent boot routines
4 *
5 * Copyright (C) 1996, 1997, 2001 Ralf Baechle
6 * Copyright (C) 2000 RidgeRun, Inc.
7 * Copyright (C) 2001 Red Hat, Inc.
8 * Copyright (C) 2002 Momentum Computer
9 *
10 * Author: Matthew Dharm, Momentum Computer
11 * mdharm@momenco.com
12 *
13 * Louis Hamilton, Red Hat, Inc.
14 * hamilton@redhat.com [MIPS64 modifications]
15 *
16 * Author: RidgeRun, Inc.
17 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
18 *
19 * Copyright 2001 MontaVista Software Inc.
20 * Author: jsun@mvista.com or jsun@junsun.net
21 *
22 * This program is free software; you can redistribute it and/or modify it
23 * under the terms of the GNU General Public License as published by the
24 * Free Software Foundation; either version 2 of the License, or (at your
25 * option) any later version.
26 *
27 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
28 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
29 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
30 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
33 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
34 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 * You should have received a copy of the GNU General Public License along
39 * with this program; if not, write to the Free Software Foundation, Inc.,
40 * 675 Mass Ave, Cambridge, MA 02139, USA.
41 *
42 */
43#include <linux/config.h>
44#include <linux/bcd.h>
45#include <linux/init.h>
46#include <linux/kernel.h>
47#include <linux/types.h>
48#include <linux/mm.h>
49#include <linux/swap.h>
50#include <linux/ioport.h>
51#include <linux/sched.h>
52#include <linux/interrupt.h>
53#include <linux/pci.h>
54#include <linux/timex.h>
55#include <linux/vmalloc.h>
56#include <asm/time.h>
57#include <asm/bootinfo.h>
58#include <asm/page.h>
59#include <asm/io.h>
60#include <asm/irq.h>
61#include <asm/pci.h>
62#include <asm/processor.h>
63#include <asm/ptrace.h>
64#include <asm/reboot.h>
65#include <linux/bootmem.h>
66#include <linux/blkdev.h>
67#include <asm/mv64340.h>
68#include "ocelot_c_fpga.h"
69
70unsigned long marvell_base;
71extern unsigned long mv64340_sram_base;
72unsigned long cpu_clock;
73
74/* These functions are used for rebooting or halting the machine*/
75extern void momenco_ocelot_restart(char *command);
76extern void momenco_ocelot_halt(void);
77extern void momenco_ocelot_power_off(void);
78
79void momenco_time_init(void);
80
81static char reset_reason;
82
83void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1, unsigned long entryhi, unsigned long pagemask);
84
85static unsigned long ENTRYLO(unsigned long paddr)
86{
87 return ((paddr & PAGE_MASK) |
88 (_PAGE_PRESENT | __READABLE | __WRITEABLE | _PAGE_GLOBAL |
89 _CACHE_UNCACHED)) >> 6;
90}
91
92/* setup code for a handoff from a version 2 PMON 2000 PROM */
93void PMON_v2_setup(void)
94{
95 /* Some wired TLB entries for the MV64340 and perhiperals. The
96 MV64340 is going to be hit on every IRQ anyway - there's
97 absolutely no point in letting it be a random TLB entry, as
98 it'll just cause needless churning of the TLB. And we use
99 the other half for the serial port, which is just a PITA
100 otherwise :)
101
102 Device Physical Virtual
103 MV64340 Internal Regs 0xf4000000 0xf4000000
104 Ocelot-C[S] PLD (CS0) 0xfc000000 0xfc000000
105 NVRAM (CS1) 0xfc800000 0xfc800000
106 UARTs (CS2) 0xfd000000 0xfd000000
107 Internal SRAM 0xfe000000 0xfe000000
108 M-Systems DOC (CS3) 0xff000000 0xff000000
109 */
110 printk("PMON_v2_setup\n");
111
112#ifdef CONFIG_MIPS64
113 /* marvell and extra space */
114 add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xf4010000), 0xfffffffff4000000, PM_64K);
115 /* fpga, rtc, and uart */
116 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), 0xfffffffffc000000, PM_16M);
117 /* m-sys and internal SRAM */
118 add_wired_entry(ENTRYLO(0xfe000000), ENTRYLO(0xff000000), 0xfffffffffe000000, PM_16M);
119
120 marvell_base = 0xfffffffff4000000;
121 mv64340_sram_base = 0xfffffffffe000000;
122#else
123 /* marvell and extra space */
124 add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xf4010000), 0xf4000000, PM_64K);
125 /* fpga, rtc, and uart */
126 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), 0xfc000000, PM_16M);
127 /* m-sys and internal SRAM */
128 add_wired_entry(ENTRYLO(0xfe000000), ENTRYLO(0xff000000), 0xfe000000, PM_16M);
129
130 marvell_base = 0xf4000000;
131 mv64340_sram_base = 0xfe000000;
132#endif
133}
134
135unsigned long m48t37y_get_time(void)
136{
137#ifdef CONFIG_MIPS64
138 unsigned char *rtc_base = (unsigned char*)0xfffffffffc800000;
139#else
140 unsigned char* rtc_base = (unsigned char*)0xfc800000;
141#endif
142 unsigned int year, month, day, hour, min, sec;
143
144 /* stop the update */
145 rtc_base[0x7ff8] = 0x40;
146
147 year = BCD2BIN(rtc_base[0x7fff]);
148 year += BCD2BIN(rtc_base[0x7ff1]) * 100;
149
150 month = BCD2BIN(rtc_base[0x7ffe]);
151
152 day = BCD2BIN(rtc_base[0x7ffd]);
153
154 hour = BCD2BIN(rtc_base[0x7ffb]);
155 min = BCD2BIN(rtc_base[0x7ffa]);
156 sec = BCD2BIN(rtc_base[0x7ff9]);
157
158 /* start the update */
159 rtc_base[0x7ff8] = 0x00;
160
161 return mktime(year, month, day, hour, min, sec);
162}
163
164int m48t37y_set_time(unsigned long sec)
165{
166#ifdef CONFIG_MIPS64
167 unsigned char* rtc_base = (unsigned char*)0xfffffffffc800000;
168#else
169 unsigned char* rtc_base = (unsigned char*)0xfc800000;
170#endif
171 struct rtc_time tm;
172
173 /* convert to a more useful format -- note months count from 0 */
174 to_tm(sec, &tm);
175 tm.tm_mon += 1;
176
177 /* enable writing */
178 rtc_base[0x7ff8] = 0x80;
179
180 /* year */
181 rtc_base[0x7fff] = BIN2BCD(tm.tm_year % 100);
182 rtc_base[0x7ff1] = BIN2BCD(tm.tm_year / 100);
183
184 /* month */
185 rtc_base[0x7ffe] = BIN2BCD(tm.tm_mon);
186
187 /* day */
188 rtc_base[0x7ffd] = BIN2BCD(tm.tm_mday);
189
190 /* hour/min/sec */
191 rtc_base[0x7ffb] = BIN2BCD(tm.tm_hour);
192 rtc_base[0x7ffa] = BIN2BCD(tm.tm_min);
193 rtc_base[0x7ff9] = BIN2BCD(tm.tm_sec);
194
195 /* day of week -- not really used, but let's keep it up-to-date */
196 rtc_base[0x7ffc] = BIN2BCD(tm.tm_wday + 1);
197
198 /* disable writing */
199 rtc_base[0x7ff8] = 0x00;
200
201 return 0;
202}
203
204void momenco_timer_setup(struct irqaction *irq)
205{
206 setup_irq(7, irq);
207}
208
209void momenco_time_init(void)
210{
211#ifdef CONFIG_CPU_SR71000
212 mips_hpt_frequency = cpu_clock;
213#elif defined(CONFIG_CPU_RM7000)
214 mips_hpt_frequency = cpu_clock / 2;
215#else
216#error Unknown CPU for this board
217#endif
218 printk("momenco_time_init cpu_clock=%d\n", cpu_clock);
219 board_timer_setup = momenco_timer_setup;
220
221 rtc_get_time = m48t37y_get_time;
222 rtc_set_time = m48t37y_set_time;
223}
224
225static void __init momenco_ocelot_c_setup(void)
226{
227 unsigned int tmpword;
228
229 board_time_init = momenco_time_init;
230
231 _machine_restart = momenco_ocelot_restart;
232 _machine_halt = momenco_ocelot_halt;
233 _machine_power_off = momenco_ocelot_power_off;
234
235 /*
236 * initrd_start = (ulong)ocelot_initrd_start;
237 * initrd_end = (ulong)ocelot_initrd_start + (ulong)ocelot_initrd_size;
238 * initrd_below_start_ok = 1;
239 */
240
241 /* do handoff reconfiguration */
242 PMON_v2_setup();
243
244 /* shut down ethernet ports, just to be sure our memory doesn't get
245 * corrupted by random ethernet traffic.
246 */
247 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0), 0xff << 8);
248 MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1), 0xff << 8);
249 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0), 0xff << 8);
250 MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1), 0xff << 8);
251 do {}
252 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(0)) & 0xff);
253 do {}
254 while (MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(1)) & 0xff);
255 do {}
256 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(0)) & 0xff);
257 do {}
258 while (MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(1)) & 0xff);
259 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0),
260 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(0)) & ~1);
261 MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1),
262 MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(1)) & ~1);
263
264 /* Turn off the Bit-Error LED */
265 OCELOT_FPGA_WRITE(0x80, CLR);
266
267 tmpword = OCELOT_FPGA_READ(BOARDREV);
268#ifdef CONFIG_CPU_SR71000
269 if (tmpword < 26)
270 printk("Momenco Ocelot-CS: Board Assembly Rev. %c\n",
271 'A'+tmpword);
272 else
273 printk("Momenco Ocelot-CS: Board Assembly Revision #0x%x\n",
274 tmpword);
275#else
276 if (tmpword < 26)
277 printk("Momenco Ocelot-C: Board Assembly Rev. %c\n",
278 'A'+tmpword);
279 else
280 printk("Momenco Ocelot-C: Board Assembly Revision #0x%x\n",
281 tmpword);
282#endif
283
284 tmpword = OCELOT_FPGA_READ(FPGA_REV);
285 printk("FPGA Rev: %d.%d\n", tmpword>>4, tmpword&15);
286 tmpword = OCELOT_FPGA_READ(RESET_STATUS);
287 printk("Reset reason: 0x%x\n", tmpword);
288 switch (tmpword) {
289 case 0x1:
290 printk(" - Power-up reset\n");
291 break;
292 case 0x2:
293 printk(" - Push-button reset\n");
294 break;
295 case 0x4:
296 printk(" - cPCI bus reset\n");
297 break;
298 case 0x8:
299 printk(" - Watchdog reset\n");
300 break;
301 case 0x10:
302 printk(" - Software reset\n");
303 break;
304 default:
305 printk(" - Unknown reset cause\n");
306 }
307 reset_reason = tmpword;
308 OCELOT_FPGA_WRITE(0xff, RESET_STATUS);
309
310 tmpword = OCELOT_FPGA_READ(CPCI_ID);
311 printk("cPCI ID register: 0x%02x\n", tmpword);
312 printk(" - Slot number: %d\n", tmpword & 0x1f);
313 printk(" - PCI bus present: %s\n", tmpword & 0x40 ? "yes" : "no");
314 printk(" - System Slot: %s\n", tmpword & 0x20 ? "yes" : "no");
315
316 tmpword = OCELOT_FPGA_READ(BOARD_STATUS);
317 printk("Board Status register: 0x%02x\n", tmpword);
318 printk(" - User jumper: %s\n", (tmpword & 0x80)?"installed":"absent");
319 printk(" - Boot flash write jumper: %s\n", (tmpword&0x40)?"installed":"absent");
320 printk(" - L3 Cache size: %d MiB\n", (1<<((tmpword&12) >> 2))&~1);
321 printk(" - SDRAM size: %d MiB\n", 1<<(6+(tmpword&3)));
322
323 switch(tmpword &3) {
324 case 3:
325 /* 512MiB */
326 add_memory_region(0x0, 0x200<<20, BOOT_MEM_RAM);
327 break;
328 case 2:
329 /* 256MiB */
330 add_memory_region(0x0, 0x100<<20, BOOT_MEM_RAM);
331 break;
332 case 1:
333 /* 128MiB */
334 add_memory_region(0x0, 0x80<<20, BOOT_MEM_RAM);
335 break;
336 case 0:
337 /* 1GiB -- needs CONFIG_HIGHMEM */
338 add_memory_region(0x0, 0x400<<20, BOOT_MEM_RAM);
339 break;
340 }
341}
342
343early_initcall(momenco_ocelot_c_setup);
344
345#ifndef CONFIG_MIPS64
346/* This needs to be one of the first initcalls, because no I/O port access
347 can work before this */
348static int io_base_ioremap(void)
349{
350 /* we're mapping PCI accesses from 0xc0000000 to 0xf0000000 */
351 void *io_remap_range = ioremap(0xc0000000, 0x30000000);
352
353 if (!io_remap_range) {
354 panic("Could not ioremap I/O port range");
355 }
356 printk("io_remap_range set at 0x%08x\n", (uint32_t)io_remap_range);
357 set_io_port_base(io_remap_range - 0xc0000000);
358
359 return 0;
360}
361
362module_init(io_base_ioremap);
363#endif
diff --git a/arch/mips/momentum/ocelot_c/uart-irq.c b/arch/mips/momentum/ocelot_c/uart-irq.c
new file mode 100644
index 000000000000..ebe1507b17df
--- /dev/null
+++ b/arch/mips/momentum/ocelot_c/uart-irq.c
@@ -0,0 +1,147 @@
1/*
2 * Copyright 2002 Momentum Computer
3 * Author: mdharm@momenco.com
4 *
5 * arch/mips/momentum/ocelot_c/uart-irq.c
6 * Interrupt routines for UARTs. Interrupt numbers are assigned from
7 * 80 to 81 (2 interrupt sources).
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#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/irq.h>
18#include <linux/kernel.h>
19#include <asm/ptrace.h>
20#include <linux/sched.h>
21#include <linux/kernel_stat.h>
22#include <asm/io.h>
23#include <asm/irq.h>
24#include "ocelot_c_fpga.h"
25
26static inline int ls1bit8(unsigned int x)
27{
28 int b = 7, s;
29
30 s = 4; if (((unsigned char)(x << 4)) == 0) s = 0; b -= s; x <<= s;
31 s = 2; if (((unsigned char)(x << 2)) == 0) s = 0; b -= s; x <<= s;
32 s = 1; if (((unsigned char)(x << 1)) == 0) s = 0; b -= s;
33
34 return b;
35}
36
37/* mask off an interrupt -- 0 is enable, 1 is disable */
38static inline void mask_uart_irq(unsigned int irq)
39{
40 uint8_t value;
41
42 value = OCELOT_FPGA_READ(UART_INTMASK);
43 value |= 1 << (irq - 74);
44 OCELOT_FPGA_WRITE(value, UART_INTMASK);
45
46 /* read the value back to assure that it's really been written */
47 value = OCELOT_FPGA_READ(UART_INTMASK);
48}
49
50/* unmask an interrupt -- 0 is enable, 1 is disable */
51static inline void unmask_uart_irq(unsigned int irq)
52{
53 uint8_t value;
54
55 value = OCELOT_FPGA_READ(UART_INTMASK);
56 value &= ~(1 << (irq - 74));
57 OCELOT_FPGA_WRITE(value, UART_INTMASK);
58
59 /* read the value back to assure that it's really been written */
60 value = OCELOT_FPGA_READ(UART_INTMASK);
61}
62
63/*
64 * Enables the IRQ in the FPGA
65 */
66static void enable_uart_irq(unsigned int irq)
67{
68 unmask_uart_irq(irq);
69}
70
71/*
72 * Initialize the IRQ in the FPGA
73 */
74static unsigned int startup_uart_irq(unsigned int irq)
75{
76 unmask_uart_irq(irq);
77 return 0;
78}
79
80/*
81 * Disables the IRQ in the FPGA
82 */
83static void disable_uart_irq(unsigned int irq)
84{
85 mask_uart_irq(irq);
86}
87
88/*
89 * Masks and ACKs an IRQ
90 */
91static void mask_and_ack_uart_irq(unsigned int irq)
92{
93 mask_uart_irq(irq);
94}
95
96/*
97 * End IRQ processing
98 */
99static void end_uart_irq(unsigned int irq)
100{
101 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
102 unmask_uart_irq(irq);
103}
104
105/*
106 * Interrupt handler for interrupts coming from the FPGA chip.
107 */
108void ll_uart_irq(struct pt_regs *regs)
109{
110 unsigned int irq_src, irq_mask;
111
112 /* read the interrupt status registers */
113 irq_src = OCELOT_FPGA_READ(UART_INTSTAT);
114 irq_mask = OCELOT_FPGA_READ(UART_INTMASK);
115
116 /* mask for just the interrupts we want */
117 irq_src &= ~irq_mask;
118
119 do_IRQ(ls1bit8(irq_src) + 74, regs);
120}
121
122#define shutdown_uart_irq disable_uart_irq
123
124struct hw_interrupt_type uart_irq_type = {
125 "UART/FPGA",
126 startup_uart_irq,
127 shutdown_uart_irq,
128 enable_uart_irq,
129 disable_uart_irq,
130 mask_and_ack_uart_irq,
131 end_uart_irq,
132 NULL
133};
134
135void uart_irq_init(void)
136{
137 /* Reset irq handlers pointers to NULL */
138 irq_desc[80].status = IRQ_DISABLED;
139 irq_desc[80].action = 0;
140 irq_desc[80].depth = 2;
141 irq_desc[80].handler = &uart_irq_type;
142
143 irq_desc[81].status = IRQ_DISABLED;
144 irq_desc[81].action = 0;
145 irq_desc[81].depth = 2;
146 irq_desc[81].handler = &uart_irq_type;
147}
diff --git a/arch/mips/momentum/ocelot_g/Makefile b/arch/mips/momentum/ocelot_g/Makefile
new file mode 100644
index 000000000000..e5f1cb086973
--- /dev/null
+++ b/arch/mips/momentum/ocelot_g/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for Momentum Computer's Ocelot-G board.
3#
4
5obj-y += int-handler.o irq.o gt-irq.o prom.o reset.o setup.o
6obj-$(CONFIG_KGDB) += dbg_io.o
7
8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/momentum/ocelot_g/dbg_io.c b/arch/mips/momentum/ocelot_g/dbg_io.c
new file mode 100644
index 000000000000..8720bccfdea2
--- /dev/null
+++ b/arch/mips/momentum/ocelot_g/dbg_io.c
@@ -0,0 +1,126 @@
1#include <linux/config.h>
2
3#ifdef CONFIG_KGDB
4
5#include <asm/serial.h> /* For the serial port location and base baud */
6
7/* --- CONFIG --- */
8
9typedef unsigned char uint8;
10typedef unsigned int uint32;
11
12/* --- END OF CONFIG --- */
13
14#define UART16550_BAUD_2400 2400
15#define UART16550_BAUD_4800 4800
16#define UART16550_BAUD_9600 9600
17#define UART16550_BAUD_19200 19200
18#define UART16550_BAUD_38400 38400
19#define UART16550_BAUD_57600 57600
20#define UART16550_BAUD_115200 115200
21
22#define UART16550_PARITY_NONE 0
23#define UART16550_PARITY_ODD 0x08
24#define UART16550_PARITY_EVEN 0x18
25#define UART16550_PARITY_MARK 0x28
26#define UART16550_PARITY_SPACE 0x38
27
28#define UART16550_DATA_5BIT 0x0
29#define UART16550_DATA_6BIT 0x1
30#define UART16550_DATA_7BIT 0x2
31#define UART16550_DATA_8BIT 0x3
32
33#define UART16550_STOP_1BIT 0x0
34#define UART16550_STOP_2BIT 0x4
35
36/* ----------------------------------------------------- */
37
38/* === CONFIG === */
39
40/* [jsun] we use the second serial port for kdb */
41#define BASE OCELOT_SERIAL1_BASE
42#define MAX_BAUD OCELOT_BASE_BAUD
43
44/* === END OF CONFIG === */
45
46#define REG_OFFSET 4
47
48/* register offset */
49#define OFS_RCV_BUFFER 0
50#define OFS_TRANS_HOLD 0
51#define OFS_SEND_BUFFER 0
52#define OFS_INTR_ENABLE (1*REG_OFFSET)
53#define OFS_INTR_ID (2*REG_OFFSET)
54#define OFS_DATA_FORMAT (3*REG_OFFSET)
55#define OFS_LINE_CONTROL (3*REG_OFFSET)
56#define OFS_MODEM_CONTROL (4*REG_OFFSET)
57#define OFS_RS232_OUTPUT (4*REG_OFFSET)
58#define OFS_LINE_STATUS (5*REG_OFFSET)
59#define OFS_MODEM_STATUS (6*REG_OFFSET)
60#define OFS_RS232_INPUT (6*REG_OFFSET)
61#define OFS_SCRATCH_PAD (7*REG_OFFSET)
62
63#define OFS_DIVISOR_LSB (0*REG_OFFSET)
64#define OFS_DIVISOR_MSB (1*REG_OFFSET)
65
66
67/* memory-mapped read/write of the port */
68#define UART16550_READ(y) (*((volatile uint8*)(BASE + y)))
69#define UART16550_WRITE(y, z) ((*((volatile uint8*)(BASE + y))) = z)
70
71void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
72{
73 /* disable interrupts */
74 UART16550_WRITE(OFS_INTR_ENABLE, 0);
75
76 /* set up buad rate */
77 {
78 uint32 divisor;
79
80 /* set DIAB bit */
81 UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
82
83 /* set divisor */
84 divisor = MAX_BAUD / baud;
85 UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
86 UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
87
88 /* clear DIAB bit */
89 UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
90 }
91
92 /* set data format */
93 UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
94}
95
96static int remoteDebugInitialized = 0;
97
98uint8 getDebugChar(void)
99{
100 if (!remoteDebugInitialized) {
101 remoteDebugInitialized = 1;
102 debugInit(UART16550_BAUD_38400,
103 UART16550_DATA_8BIT,
104 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
105 }
106
107 while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
108 return UART16550_READ(OFS_RCV_BUFFER);
109}
110
111
112int putDebugChar(uint8 byte)
113{
114 if (!remoteDebugInitialized) {
115 remoteDebugInitialized = 1;
116 debugInit(UART16550_BAUD_38400,
117 UART16550_DATA_8BIT,
118 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
119 }
120
121 while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
122 UART16550_WRITE(OFS_SEND_BUFFER, byte);
123 return 1;
124}
125
126#endif
diff --git a/arch/mips/momentum/ocelot_g/gt-irq.c b/arch/mips/momentum/ocelot_g/gt-irq.c
new file mode 100644
index 000000000000..d0b5c9dd0ea4
--- /dev/null
+++ b/arch/mips/momentum/ocelot_g/gt-irq.c
@@ -0,0 +1,214 @@
1/*
2 *
3 * Copyright 2002 Momentum Computer
4 * Author: mdharm@momenco.com
5 *
6 * arch/mips/momentum/ocelot_g/gt_irq.c
7 * Interrupt routines for gt64240. Currently it only handles timer irq.
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/config.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/kernel.h>
18#include <asm/ptrace.h>
19#include <linux/sched.h>
20#include <linux/kernel_stat.h>
21#include <asm/gt64240.h>
22#include <asm/io.h>
23
24unsigned long bus_clock;
25
26/*
27 * These are interrupt handlers for the GT on-chip interrupts. They
28 * all come in to the MIPS on a single interrupt line, and have to
29 * be handled and ack'ed differently than other MIPS interrupts.
30 */
31
32#if CURRENTLY_UNUSED
33
34struct tq_struct irq_handlers[MAX_CAUSE_REGS][MAX_CAUSE_REG_WIDTH];
35void hook_irq_handler(int int_cause, int bit_num, void *isr_ptr);
36
37/*
38 * Hooks IRQ handler to the system. When the system is interrupted
39 * the interrupt service routine is called.
40 *
41 * Inputs :
42 * int_cause - The interrupt cause number. In EVB64120 two parameters
43 * are declared, INT_CAUSE_MAIN and INT_CAUSE_HIGH.
44 * bit_num - Indicates which bit number in the cause register
45 * isr_ptr - Pointer to the interrupt service routine
46 */
47void hook_irq_handler(int int_cause, int bit_num, void *isr_ptr)
48{
49 irq_handlers[int_cause][bit_num].routine = isr_ptr;
50}
51
52
53/*
54 * Enables the IRQ on Galileo Chip
55 *
56 * Inputs :
57 * int_cause - The interrupt cause number. In EVB64120 two parameters
58 * are declared, INT_CAUSE_MAIN and INT_CAUSE_HIGH.
59 * bit_num - Indicates which bit number in the cause register
60 *
61 * Outputs :
62 * 1 if succesful, 0 if failure
63 */
64int enable_galileo_irq(int int_cause, int bit_num)
65{
66 if (int_cause == INT_CAUSE_MAIN)
67 SET_REG_BITS(CPU_INTERRUPT_MASK_REGISTER, (1 << bit_num));
68 else if (int_cause == INT_CAUSE_HIGH)
69 SET_REG_BITS(CPU_HIGH_INTERRUPT_MASK_REGISTER,
70 (1 << bit_num));
71 else
72 return 0;
73
74 return 1;
75}
76
77/*
78 * Disables the IRQ on Galileo Chip
79 *
80 * Inputs :
81 * int_cause - The interrupt cause number. In EVB64120 two parameters
82 * are declared, INT_CAUSE_MAIN and INT_CAUSE_HIGH.
83 * bit_num - Indicates which bit number in the cause register
84 *
85 * Outputs :
86 * 1 if succesful, 0 if failure
87 */
88int disable_galileo_irq(int int_cause, int bit_num)
89{
90 if (int_cause == INT_CAUSE_MAIN)
91 RESET_REG_BITS(CPU_INTERRUPT_MASK_REGISTER,
92 (1 << bit_num));
93 else if (int_cause == INT_CAUSE_HIGH)
94 RESET_REG_BITS(CPU_HIGH_INTERRUPT_MASK_REGISTER,
95 (1 << bit_num));
96 else
97 return 0;
98 return 1;
99}
100#endif /* UNUSED */
101
102/*
103 * Interrupt handler for interrupts coming from the Galileo chip via P0_INT#.
104 *
105 * We route the timer interrupt to P0_INT# (IRQ 6), and that's all this
106 * routine can handle, for now.
107 *
108 * In the future, we'll route more interrupts to this pin, and that's why
109 * we keep this particular structure in the function.
110 */
111
112static irqreturn_t gt64240_p0int_irq(int irq, void *dev, struct pt_regs *regs)
113{
114 uint32_t irq_src, irq_src_mask;
115 int handled;
116
117 /* get the low interrupt cause register */
118 irq_src = MV_READ(LOW_INTERRUPT_CAUSE_REGISTER);
119
120 /* get the mask register for this pin */
121 irq_src_mask = MV_READ(PCI_0INTERRUPT_CAUSE_MASK_REGISTER_LOW);
122
123 /* mask off only the interrupts we're interested in */
124 irq_src = irq_src & irq_src_mask;
125
126 handled = IRQ_NONE;
127
128 /* Check for timer interrupt */
129 if (irq_src & 0x00000100) {
130 handled = IRQ_HANDLED;
131 irq_src &= ~0x00000100;
132
133 /* Clear any pending cause bits */
134 MV_WRITE(TIMER_COUNTER_0_3_INTERRUPT_CAUSE, 0x0);
135
136 /* handle the timer call */
137 do_timer(regs);
138#ifndef CONFIG_SMP
139 update_process_times(user_mode(regs));
140#endif
141 }
142
143 if (irq_src) {
144 printk(KERN_INFO
145 "UNKNOWN P0_INT# interrupt received, irq_src=0x%x\n",
146 irq_src);
147 }
148
149 return handled;
150}
151
152/*
153 * Initializes timer using galileo's built in timer.
154 */
155
156/*
157 * This will ignore the standard MIPS timer interrupt handler
158 * that is passed in as *irq (=irq0 in ../kernel/time.c).
159 * We will do our own timer interrupt handling.
160 */
161void gt64240_time_init(void)
162{
163 static struct irqaction timer;
164
165 /* Stop the timer -- we'll use timer #0 */
166 MV_WRITE(TIMER_COUNTER_0_3_CONTROL, 0x0);
167
168 /* Load timer value for 100 Hz */
169 MV_WRITE(TIMER_COUNTER0, bus_clock / 100);
170
171 /*
172 * Create the IRQ structure entry for the timer. Since we're too early
173 * in the boot process to use the "request_irq()" call, we'll hard-code
174 * the values to the correct interrupt line.
175 */
176 timer.handler = &gt64240_p0int_irq;
177 timer.flags = SA_SHIRQ | SA_INTERRUPT;
178 timer.name = "timer";
179 timer.dev_id = NULL;
180 timer.next = NULL;
181 timer.mask = 0;
182 irq_desc[6].action = &timer;
183
184 enable_irq(6);
185
186 /* Clear any pending cause bits */
187 MV_WRITE(TIMER_COUNTER_0_3_INTERRUPT_CAUSE, 0x0);
188
189 /* Enable the interrupt for timer 0 */
190 MV_WRITE(TIMER_COUNTER_0_3_INTERRUPT_MASK, 0x1);
191
192 /* Enable the timer interrupt for GT-64240 pin P0_INT# */
193 MV_WRITE (PCI_0INTERRUPT_CAUSE_MASK_REGISTER_LOW, 0x100);
194
195 /* Configure and start the timer */
196 MV_WRITE(TIMER_COUNTER_0_3_CONTROL, 0x3);
197}
198
199void gt64240_irq_init(void)
200{
201#if CURRENTLY_UNUSED
202 int i, j;
203
204 /* Reset irq handlers pointers to NULL */
205 for (i = 0; i < MAX_CAUSE_REGS; i++) {
206 for (j = 0; j < MAX_CAUSE_REG_WIDTH; j++) {
207 irq_handlers[i][j].next = NULL;
208 irq_handlers[i][j].sync = 0;
209 irq_handlers[i][j].routine = NULL;
210 irq_handlers[i][j].data = NULL;
211 }
212 }
213#endif
214}
diff --git a/arch/mips/momentum/ocelot_g/int-handler.S b/arch/mips/momentum/ocelot_g/int-handler.S
new file mode 100644
index 000000000000..772e8f713176
--- /dev/null
+++ b/arch/mips/momentum/ocelot_g/int-handler.S
@@ -0,0 +1,131 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * First-level interrupt dispatcher for ocelot board.
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#include <asm/asm.h>
13#include <asm/mipsregs.h>
14#include <asm/addrspace.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17
18/*
19 * first level interrupt dispatcher for ocelot board -
20 * We check for the timer first, then check PCI ints A and D.
21 * Then check for serial IRQ and fall through.
22 */
23 .align 5
24 NESTED(ocelot_handle_int, PT_SIZE, sp)
25 SAVE_ALL
26 CLI
27 .set at
28 mfc0 t0, CP0_CAUSE
29 mfc0 t2, CP0_STATUS
30
31 and t0, t2
32
33 andi t1, t0, STATUSF_IP2 /* int0 hardware line */
34 bnez t1, ll_pri_enet_irq
35 andi t1, t0, STATUSF_IP3 /* int1 hardware line */
36 bnez t1, ll_sec_enet_irq
37 andi t1, t0, STATUSF_IP4 /* int2 hardware line */
38 bnez t1, ll_uart_irq
39 andi t1, t0, STATUSF_IP5 /* int3 hardware line */
40 bnez t1, ll_cpci_irq
41 andi t1, t0, STATUSF_IP6 /* int4 hardware line */
42 bnez t1, ll_galileo_p0_irq
43 andi t1, t0, STATUSF_IP7 /* cpu timer */
44 bnez t1, ll_cputimer_irq
45
46 /* now look at the extended interrupts */
47 mfc0 t0, CP0_CAUSE
48 cfc0 t1, CP0_S1_INTCONTROL
49
50 /* shift the mask 8 bits left to line up the bits */
51 sll t2, t1, 8
52
53 and t0, t2
54 srl t0, t0, 16
55
56 andi t1, t0, STATUSF_IP8 /* int6 hardware line */
57 bnez t1, ll_galileo_p1_irq
58 andi t1, t0, STATUSF_IP9 /* int7 hardware line */
59 bnez t1, ll_pmc_irq
60 andi t1, t0, STATUSF_IP10 /* int8 hardware line */
61 bnez t1, ll_cpci_abcd_irq
62 andi t1, t0, STATUSF_IP11 /* int9 hardware line */
63 bnez t1, ll_testpoint_irq
64
65 .set reorder
66
67 /* wrong alarm or masked ... */
68 j spurious_interrupt
69 nop
70 END(ocelot_handle_int)
71
72 .align 5
73ll_pri_enet_irq:
74 li a0, 2
75 move a1, sp
76 jal do_IRQ
77 j ret_from_irq
78
79ll_sec_enet_irq:
80 li a0, 3
81 move a1, sp
82 jal do_IRQ
83 j ret_from_irq
84
85ll_uart_irq:
86 li a0, 4
87 move a1, sp
88 jal do_IRQ
89 j ret_from_irq
90
91ll_cpci_irq:
92 li a0, 5
93 move a1, sp
94 jal do_IRQ
95 j ret_from_irq
96
97ll_galileo_p0_irq:
98 li a0, 6
99 move a1, sp
100 jal do_IRQ
101 j ret_from_irq
102
103ll_cputimer_irq:
104 li a0, 7
105 move a1, sp
106 jal do_IRQ
107 j ret_from_irq
108
109ll_galileo_p1_irq:
110 li a0, 8
111 move a1, sp
112 jal do_IRQ
113 j ret_from_irq
114
115ll_pmc_irq:
116 li a0, 9
117 move a1, sp
118 jal do_IRQ
119 j ret_from_irq
120
121ll_cpci_abcd_irq:
122 li a0, 10
123 move a1, sp
124 jal do_IRQ
125 j ret_from_irq
126
127ll_testpoint_irq:
128 li a0, 11
129 move a1, sp
130 jal do_IRQ
131 j ret_from_irq
diff --git a/arch/mips/momentum/ocelot_g/irq.c b/arch/mips/momentum/ocelot_g/irq.c
new file mode 100644
index 000000000000..5eb85b164205
--- /dev/null
+++ b/arch/mips/momentum/ocelot_g/irq.c
@@ -0,0 +1,69 @@
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, 01, 05 Ralf Baechle (ralf@linux-mips.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
51extern asmlinkage void ocelot_handle_int(void);
52extern void gt64240_irq_init(void);
53
54void __init arch_init_irq(void)
55{
56 /*
57 * Clear all of the interrupts while we change the able around a bit.
58 * int-handler is not on bootstrap
59 */
60 clear_c0_status(ST0_IM);
61 local_irq_disable();
62
63 /* Sets the first-level interrupt dispatcher. */
64 set_except_vector(0, ocelot_handle_int);
65 mips_cpu_irq_init(0);
66 rm7k_cpu_irq_init(8);
67
68 gt64240_irq_init();
69}
diff --git a/arch/mips/momentum/ocelot_g/ocelot_pld.h b/arch/mips/momentum/ocelot_g/ocelot_pld.h
new file mode 100644
index 000000000000..fcb8275e219d
--- /dev/null
+++ b/arch/mips/momentum/ocelot_g/ocelot_pld.h
@@ -0,0 +1,30 @@
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 (0xfc000000)
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/momentum/ocelot_g/prom.c b/arch/mips/momentum/ocelot_g/prom.c
new file mode 100644
index 000000000000..6b4f577c2757
--- /dev/null
+++ b/arch/mips/momentum/ocelot_g/prom.c
@@ -0,0 +1,86 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Based on Ocelot Linux port, which is
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: 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#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/mm.h>
17#include <linux/sched.h>
18#include <linux/bootmem.h>
19
20#include <asm/addrspace.h>
21#include <asm/bootinfo.h>
22#include <asm/pmon.h>
23#include <asm/gt64240.h>
24
25#include "ocelot_pld.h"
26
27struct callvectors* debug_vectors;
28
29extern unsigned long marvell_base;
30extern unsigned long bus_clock;
31
32#ifdef CONFIG_GALILLEO_GT64240_ETH
33extern unsigned char prom_mac_addr_base[6];
34#endif
35
36const char *get_system_type(void)
37{
38 return "Momentum Ocelot";
39}
40
41void __init prom_init(void)
42{
43 int argc = fw_arg0;
44 char **arg = (char **) fw_arg1;
45 char **env = (char **) fw_arg2;
46 struct callvectors *cv = (struct callvectors *) fw_arg3;
47 int i;
48
49 /* save the PROM vectors for debugging use */
50 debug_vectors = cv;
51
52 /* arg[0] is "g", the rest is boot parameters */
53 arcs_cmdline[0] = '\0';
54 for (i = 1; i < argc; i++) {
55 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
56 >= sizeof(arcs_cmdline))
57 break;
58 strcat(arcs_cmdline, arg[i]);
59 strcat(arcs_cmdline, " ");
60 }
61
62 mips_machgroup = MACH_GROUP_MOMENCO;
63 mips_machtype = MACH_MOMENCO_OCELOT_G;
64
65#ifdef CONFIG_GALILLEO_GT64240_ETH
66 /* get the base MAC address for on-board ethernet ports */
67 memcpy(prom_mac_addr_base, (void*)0xfc807cf2, 6);
68#endif
69
70 while (*env) {
71 if (strncmp("gtbase", *env, strlen("gtbase")) == 0) {
72 marvell_base = simple_strtol(*env + strlen("gtbase="),
73 NULL, 16);
74 }
75 if (strncmp("busclock", *env, strlen("busclock")) == 0) {
76 bus_clock = simple_strtol(*env + strlen("busclock="),
77 NULL, 10);
78 }
79 env++;
80 }
81}
82
83unsigned long __init prom_free_prom_memory(void)
84{
85 return 0;
86}
diff --git a/arch/mips/momentum/ocelot_g/reset.c b/arch/mips/momentum/ocelot_g/reset.c
new file mode 100644
index 000000000000..3fd499adf4cf
--- /dev/null
+++ b/arch/mips/momentum/ocelot_g/reset.c
@@ -0,0 +1,47 @@
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/momentum/ocelot_g/setup.c b/arch/mips/momentum/ocelot_g/setup.c
new file mode 100644
index 000000000000..38a78ab8c830
--- /dev/null
+++ b/arch/mips/momentum/ocelot_g/setup.c
@@ -0,0 +1,266 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Momentum Computer Ocelot-G (CP7000G) - board dependent boot routines
4 *
5 * Copyright (C) 1996, 1997, 2001 Ralf Baechle
6 * Copyright (C) 2000 RidgeRun, Inc.
7 * Copyright (C) 2001 Red Hat, Inc.
8 * Copyright (C) 2002 Momentum Computer
9 *
10 * Author: Matthew Dharm, Momentum Computer
11 * mdharm@momenco.com
12 *
13 * Author: RidgeRun, Inc.
14 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
15 *
16 * Copyright 2001 MontaVista Software Inc.
17 * Author: jsun@mvista.com or jsun@junsun.net
18 *
19 * This program is free software; you can redistribute it and/or modify it
20 * under the terms of the GNU General Public License as published by the
21 * Free Software Foundation; either version 2 of the License, or (at your
22 * option) any later version.
23 *
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
27 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 * You should have received a copy of the GNU General Public License along
36 * with this program; if not, write to the Free Software Foundation, Inc.,
37 * 675 Mass Ave, Cambridge, MA 02139, USA.
38 *
39 */
40#include <linux/config.h>
41#include <linux/init.h>
42#include <linux/kernel.h>
43#include <linux/types.h>
44#include <linux/mm.h>
45#include <linux/swap.h>
46#include <linux/ioport.h>
47#include <linux/sched.h>
48#include <linux/interrupt.h>
49#include <linux/pci.h>
50#include <linux/timex.h>
51#include <linux/vmalloc.h>
52#include <asm/time.h>
53#include <asm/bootinfo.h>
54#include <asm/page.h>
55#include <asm/io.h>
56#include <asm/gt64240.h>
57#include <asm/irq.h>
58#include <asm/pci.h>
59#include <asm/processor.h>
60#include <asm/ptrace.h>
61#include <asm/reboot.h>
62#include <linux/bootmem.h>
63
64#include "ocelot_pld.h"
65
66#ifdef CONFIG_GALILLEO_GT64240_ETH
67extern unsigned char prom_mac_addr_base[6];
68#endif
69
70unsigned long marvell_base;
71
72/* These functions are used for rebooting or halting the machine*/
73extern void momenco_ocelot_restart(char *command);
74extern void momenco_ocelot_halt(void);
75extern void momenco_ocelot_power_off(void);
76
77extern void gt64240_time_init(void);
78extern void momenco_ocelot_irq_setup(void);
79
80static char reset_reason;
81
82static unsigned long ENTRYLO(unsigned long paddr)
83{
84 return ((paddr & PAGE_MASK) |
85 (_PAGE_PRESENT | __READABLE | __WRITEABLE | _PAGE_GLOBAL |
86 _CACHE_UNCACHED)) >> 6;
87}
88
89/* setup code for a handoff from a version 2 PMON 2000 PROM */
90void PMON_v2_setup(void)
91{
92 /* A wired TLB entry for the GT64240 and the serial port. The
93 GT64240 is going to be hit on every IRQ anyway - there's
94 absolutely no point in letting it be a random TLB entry, as
95 it'll just cause needless churning of the TLB. And we use
96 the other half for the serial port, which is just a PITA
97 otherwise :)
98
99 Device Physical Virtual
100 GT64240 Internal Regs 0xf4000000 0xe0000000
101 UARTs (CS2) 0xfd000000 0xe0001000
102 */
103 add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xf4010000),
104 0xf4000000, PM_64K);
105 add_wired_entry(ENTRYLO(0xfd000000), ENTRYLO(0xfd001000),
106 0xfd000000, PM_4K);
107
108 /* Also a temporary entry to let us talk to the Ocelot PLD and NVRAM
109 in the CS[012] region. We can't use ioremap() yet. The NVRAM
110 is a ST M48T37Y, which includes NVRAM, RTC, and Watchdog functions.
111
112 Ocelot PLD (CS0) 0xfc000000 0xe0020000
113 NVRAM (CS1) 0xfc800000 0xe0030000
114 */
115 add_temporary_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfc010000),
116 0xfc000000, PM_64K);
117 add_temporary_entry(ENTRYLO(0xfc800000), ENTRYLO(0xfc810000),
118 0xfc800000, PM_64K);
119
120 marvell_base = 0xf4000000;
121}
122
123extern int rm7k_tcache_enabled;
124
125/*
126 * This runs in KSEG1. See the verbiage in rm7k.c::probe_scache()
127 */
128#define Page_Invalidate_T 0x16
129static void __init setup_l3cache(unsigned long size)
130{
131 int register i;
132
133 printk("Enabling L3 cache...");
134
135 /* Enable the L3 cache in the GT64120A's CPU Configuration register */
136 MV_WRITE(0, MV_READ(0) | (1<<14));
137
138 /* Enable the L3 cache in the CPU */
139 set_c0_config(1<<12 /* CONF_TE */);
140
141 /* Clear the cache */
142 write_c0_taglo(0);
143 write_c0_taghi(0);
144
145 for (i=0; i < size; i+= 4096) {
146 __asm__ __volatile__ (
147 ".set noreorder\n\t"
148 ".set mips3\n\t"
149 "cache %1, (%0)\n\t"
150 ".set mips0\n\t"
151 ".set reorder"
152 :
153 : "r" (KSEG0ADDR(i)),
154 "i" (Page_Invalidate_T));
155 }
156
157 /* Let the RM7000 MM code know that the tertiary cache is enabled */
158 rm7k_tcache_enabled = 1;
159
160 printk("Done\n");
161}
162
163static int __init momenco_ocelot_g_setup(void)
164{
165 void (*l3func)(unsigned long) = (void *) KSEG1ADDR(setup_l3cache);
166 unsigned int tmpword;
167
168 board_time_init = gt64240_time_init;
169
170 _machine_restart = momenco_ocelot_restart;
171 _machine_halt = momenco_ocelot_halt;
172 _machine_power_off = momenco_ocelot_power_off;
173
174 /*
175 * initrd_start = (ulong)ocelot_initrd_start;
176 * initrd_end = (ulong)ocelot_initrd_start + (ulong)ocelot_initrd_size;
177 * initrd_below_start_ok = 1;
178 */
179
180 /* do handoff reconfiguration */
181 PMON_v2_setup();
182
183#ifdef CONFIG_GALILLEO_GT64240_ETH
184 /* get the mac addr */
185 memcpy(prom_mac_addr_base, (void*)0xfc807cf2, 6);
186#endif
187
188 /* Turn off the Bit-Error LED */
189 OCELOT_PLD_WRITE(0x80, INTCLR);
190
191 tmpword = OCELOT_PLD_READ(BOARDREV);
192 if (tmpword < 26)
193 printk("Momenco Ocelot-G: Board Assembly Rev. %c\n", 'A'+tmpword);
194 else
195 printk("Momenco Ocelot-G: Board Assembly Revision #0x%x\n", tmpword);
196
197 tmpword = OCELOT_PLD_READ(PLD1_ID);
198 printk("PLD 1 ID: %d.%d\n", tmpword>>4, tmpword&15);
199 tmpword = OCELOT_PLD_READ(PLD2_ID);
200 printk("PLD 2 ID: %d.%d\n", tmpword>>4, tmpword&15);
201 tmpword = OCELOT_PLD_READ(RESET_STATUS);
202 printk("Reset reason: 0x%x\n", tmpword);
203 reset_reason = tmpword;
204 OCELOT_PLD_WRITE(0xff, RESET_STATUS);
205
206 tmpword = OCELOT_PLD_READ(BOARD_STATUS);
207 printk("Board Status register: 0x%02x\n", tmpword);
208 printk(" - User jumper: %s\n", (tmpword & 0x80)?"installed":"absent");
209 printk(" - Boot flash write jumper: %s\n", (tmpword&0x40)?"installed":"absent");
210 printk(" - Tulip PHY %s connected\n", (tmpword&0x10)?"is":"not");
211 printk(" - L3 Cache size: %d MiB\n", (1<<((tmpword&12) >> 2))&~1);
212 printk(" - SDRAM size: %d MiB\n", 1<<(6+(tmpword&3)));
213
214 if (tmpword&12)
215 l3func((1<<(((tmpword&12) >> 2)+20)));
216
217 switch(tmpword &3) {
218 case 3:
219 /* 512MiB -- two banks of 256MiB */
220 add_memory_region( 0x0<<20, 0x100<<20, BOOT_MEM_RAM);
221/*
222 add_memory_region(0x100<<20, 0x100<<20, BOOT_MEM_RAM);
223*/
224 break;
225 case 2:
226 /* 256MiB -- two banks of 128MiB */
227 add_memory_region( 0x0<<20, 0x80<<20, BOOT_MEM_RAM);
228 add_memory_region(0x80<<20, 0x80<<20, BOOT_MEM_RAM);
229 break;
230 case 1:
231 /* 128MiB -- 64MiB per bank */
232 add_memory_region( 0x0<<20, 0x40<<20, BOOT_MEM_RAM);
233 add_memory_region(0x40<<20, 0x40<<20, BOOT_MEM_RAM);
234 break;
235 case 0:
236 /* 64MiB */
237 add_memory_region( 0x0<<20, 0x40<<20, BOOT_MEM_RAM);
238 break;
239 }
240
241 /* FIXME: Fix up the DiskOnChip mapping */
242 MV_WRITE(0x468, 0xfef73);
243
244 return 0;
245}
246
247early_initcall(momenco_ocelot_g_setup);
248
249/* This needs to be one of the first initcalls, because no I/O port access
250 can work before this */
251
252static int io_base_ioremap(void)
253{
254 /* we're mapping PCI accesses from 0xc0000000 to 0xf0000000 */
255 unsigned long io_remap_range;
256
257 io_remap_range = (unsigned long) ioremap(0xc0000000, 0x30000000);
258 if (!io_remap_range)
259 panic("Could not ioremap I/O port range");
260
261 set_io_port_base(io_remap_range - 0xc0000000);
262
263 return 0;
264}
265
266module_init(io_base_ioremap);
diff --git a/arch/mips/oprofile/Kconfig b/arch/mips/oprofile/Kconfig
new file mode 100644
index 000000000000..19d37730b664
--- /dev/null
+++ b/arch/mips/oprofile/Kconfig
@@ -0,0 +1,23 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING
6 bool "Profiling support (EXPERIMENTAL)"
7 help
8 Say Y here to enable the extended profiling support mechanisms used
9 by profilers such as OProfile.
10
11
12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING
15 help
16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries,
18 and applications.
19
20 If unsure, say N.
21
22endmenu
23
diff --git a/arch/mips/oprofile/Makefile b/arch/mips/oprofile/Makefile
new file mode 100644
index 000000000000..354261d37d62
--- /dev/null
+++ b/arch/mips/oprofile/Makefile
@@ -0,0 +1,15 @@
1EXTRA_CFLAGS := -Werror
2
3obj-$(CONFIG_OPROFILE) += oprofile.o
4
5DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
6 oprof.o cpu_buffer.o buffer_sync.o \
7 event_buffer.o oprofile_files.o \
8 oprofilefs.o oprofile_stats.o \
9 timer_int.o )
10
11oprofile-y := $(DRIVER_OBJS) common.o
12
13oprofile-$(CONFIG_CPU_MIPS32) += op_model_mipsxx.o
14oprofile-$(CONFIG_CPU_MIPS64) += op_model_mipsxx.o
15oprofile-$(CONFIG_CPU_RM9000) += op_model_rm9000.o
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
new file mode 100644
index 000000000000..ab65ce3d471a
--- /dev/null
+++ b/arch/mips/oprofile/common.c
@@ -0,0 +1,106 @@
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) 2004 by Ralf Baechle
7 */
8#include <linux/errno.h>
9#include <linux/init.h>
10#include <linux/oprofile.h>
11#include <linux/smp.h>
12#include <asm/cpu-info.h>
13
14#include "op_impl.h"
15
16extern struct op_mips_model op_model_mipsxx __attribute__((weak));
17extern struct op_mips_model op_model_rm9000 __attribute__((weak));
18
19static struct op_mips_model *model;
20
21static struct op_counter_config ctr[20];
22
23static int op_mips_setup(void)
24{
25 /* Pre-compute the values to stuff in the hardware registers. */
26 model->reg_setup(ctr);
27
28 /* Configure the registers on all cpus. */
29 on_each_cpu(model->cpu_setup, 0, 0, 1);
30
31 return 0;
32}
33
34static int op_mips_create_files(struct super_block * sb, struct dentry * root)
35{
36 int i;
37
38 for (i = 0; i < model->num_counters; ++i) {
39 struct dentry *dir;
40 char buf[3];
41
42 snprintf(buf, sizeof buf, "%d", i);
43 dir = oprofilefs_mkdir(sb, root, buf);
44
45 oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled);
46 oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event);
47 oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count);
48 /* Dummies. */
49 oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel);
50 oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user);
51 oprofilefs_create_ulong(sb, dir, "exl", &ctr[i].exl);
52 oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask);
53 }
54
55 return 0;
56}
57
58static int op_mips_start(void)
59{
60 on_each_cpu(model->cpu_start, NULL, 0, 1);
61
62 return 0;
63}
64
65static void op_mips_stop(void)
66{
67 /* Disable performance monitoring for all counters. */
68 on_each_cpu(model->cpu_stop, NULL, 0, 1);
69}
70
71void __init oprofile_arch_init(struct oprofile_operations *ops)
72{
73 struct op_mips_model *lmodel = NULL;
74
75 switch (current_cpu_data.cputype) {
76 case CPU_24K:
77 lmodel = &op_model_mipsxx;
78 break;
79
80 case CPU_RM9000:
81 lmodel = &op_model_rm9000;
82 break;
83 };
84
85 if (!lmodel)
86 return;
87
88 if (lmodel->init())
89 return;
90
91 model = lmodel;
92
93 ops->create_files = op_mips_create_files;
94 ops->setup = op_mips_setup;
95 ops->start = op_mips_start;
96 ops->stop = op_mips_stop;
97 ops->cpu_type = lmodel->cpu_type;
98
99 printk(KERN_INFO "oprofile: using %s performance monitoring.\n",
100 lmodel->cpu_type);
101}
102
103void oprofile_arch_exit(void)
104{
105 model->exit();
106}
diff --git a/arch/mips/oprofile/op_impl.h b/arch/mips/oprofile/op_impl.h
new file mode 100644
index 000000000000..9f5cdff041be
--- /dev/null
+++ b/arch/mips/oprofile/op_impl.h
@@ -0,0 +1,37 @@
1/**
2 * @file arch/alpha/oprofile/op_impl.h
3 *
4 * @remark Copyright 2002 OProfile authors
5 * @remark Read the file COPYING
6 *
7 * @author Richard Henderson <rth@twiddle.net>
8 */
9
10#ifndef OP_IMPL_H
11#define OP_IMPL_H 1
12
13/* Per-counter configuration as set via oprofilefs. */
14struct op_counter_config {
15 unsigned long enabled;
16 unsigned long event;
17 unsigned long count;
18 /* Dummies because I am too lazy to hack the userspace tools. */
19 unsigned long kernel;
20 unsigned long user;
21 unsigned long exl;
22 unsigned long unit_mask;
23};
24
25/* Per-architecture configury and hooks. */
26struct op_mips_model {
27 void (*reg_setup) (struct op_counter_config *);
28 void (*cpu_setup) (void * dummy);
29 int (*init)(void);
30 void (*exit)(void);
31 void (*cpu_start)(void *args);
32 void (*cpu_stop)(void *args);
33 char *cpu_type;
34 unsigned char num_counters;
35};
36
37#endif
diff --git a/arch/mips/oprofile/op_model_rm9000.c b/arch/mips/oprofile/op_model_rm9000.c
new file mode 100644
index 000000000000..bee47793cb1a
--- /dev/null
+++ b/arch/mips/oprofile/op_model_rm9000.c
@@ -0,0 +1,137 @@
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) 2004 by Ralf Baechle
7 */
8#include <linux/oprofile.h>
9#include <linux/interrupt.h>
10#include <linux/smp.h>
11
12#include "op_impl.h"
13
14#define RM9K_COUNTER1_EVENT(event) ((event) << 0)
15#define RM9K_COUNTER1_SUPERVISOR (1ULL << 7)
16#define RM9K_COUNTER1_KERNEL (1ULL << 8)
17#define RM9K_COUNTER1_USER (1ULL << 9)
18#define RM9K_COUNTER1_ENABLE (1ULL << 10)
19#define RM9K_COUNTER1_OVERFLOW (1ULL << 15)
20
21#define RM9K_COUNTER2_EVENT(event) ((event) << 16)
22#define RM9K_COUNTER2_SUPERVISOR (1ULL << 23)
23#define RM9K_COUNTER2_KERNEL (1ULL << 24)
24#define RM9K_COUNTER2_USER (1ULL << 25)
25#define RM9K_COUNTER2_ENABLE (1ULL << 26)
26#define RM9K_COUNTER2_OVERFLOW (1ULL << 31)
27
28extern unsigned int rm9000_perfcount_irq;
29
30static struct rm9k_register_config {
31 unsigned int control;
32 unsigned int reset_counter1;
33 unsigned int reset_counter2;
34} reg;
35
36/* Compute all of the registers in preparation for enabling profiling. */
37
38static void rm9000_reg_setup(struct op_counter_config *ctr)
39{
40 unsigned int control = 0;
41
42 /* Compute the performance counter control word. */
43 /* For now count kernel and user mode */
44 if (ctr[0].enabled)
45 control |= RM9K_COUNTER1_EVENT(ctr[0].event) |
46 RM9K_COUNTER1_KERNEL |
47 RM9K_COUNTER1_USER |
48 RM9K_COUNTER1_ENABLE;
49 if (ctr[1].enabled)
50 control |= RM9K_COUNTER2_EVENT(ctr[1].event) |
51 RM9K_COUNTER2_KERNEL |
52 RM9K_COUNTER2_USER |
53 RM9K_COUNTER2_ENABLE;
54 reg.control = control;
55
56 reg.reset_counter1 = 0x80000000 - ctr[0].count;
57 reg.reset_counter2 = 0x80000000 - ctr[1].count;
58}
59
60/* Program all of the registers in preparation for enabling profiling. */
61
62static void rm9000_cpu_setup (void *args)
63{
64 uint64_t perfcount;
65
66 perfcount = ((uint64_t) reg.reset_counter2 << 32) | reg.reset_counter1;
67 write_c0_perfcount(perfcount);
68}
69
70static void rm9000_cpu_start(void *args)
71{
72 /* Start all counters on current CPU */
73 write_c0_perfcontrol(reg.control);
74}
75
76static void rm9000_cpu_stop(void *args)
77{
78 /* Stop all counters on current CPU */
79 write_c0_perfcontrol(0);
80}
81
82static irqreturn_t rm9000_perfcount_handler(int irq, void * dev_id,
83 struct pt_regs *regs)
84{
85 unsigned int control = read_c0_perfcontrol();
86 uint32_t counter1, counter2;
87 uint64_t counters;
88
89 /*
90 * RM9000 combines two 32-bit performance counters into a single
91 * 64-bit coprocessor zero register. To avoid a race updating the
92 * registers we need to stop the counters while we're messing with
93 * them ...
94 */
95 write_c0_perfcontrol(0);
96
97 counters = read_c0_perfcount();
98 counter1 = counters;
99 counter2 = counters >> 32;
100
101 if (control & RM9K_COUNTER1_OVERFLOW) {
102 oprofile_add_sample(regs, 0);
103 counter1 = reg.reset_counter1;
104 }
105 if (control & RM9K_COUNTER2_OVERFLOW) {
106 oprofile_add_sample(regs, 1);
107 counter2 = reg.reset_counter2;
108 }
109
110 counters = ((uint64_t)counter2 << 32) | counter1;
111 write_c0_perfcount(counters);
112 write_c0_perfcontrol(reg.control);
113
114 return IRQ_HANDLED;
115}
116
117static int rm9000_init(void)
118{
119 return request_irq(rm9000_perfcount_irq, rm9000_perfcount_handler,
120 0, "Perfcounter", NULL);
121}
122
123static void rm9000_exit(void)
124{
125 free_irq(rm9000_perfcount_irq, NULL);
126}
127
128struct op_mips_model op_model_rm9000 = {
129 .reg_setup = rm9000_reg_setup,
130 .cpu_setup = rm9000_cpu_setup,
131 .init = rm9000_init,
132 .exit = rm9000_exit,
133 .cpu_start = rm9000_cpu_start,
134 .cpu_stop = rm9000_cpu_stop,
135 .cpu_type = "mips/rm9000",
136 .num_counters = 2
137};
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
new file mode 100644
index 000000000000..c53e4cb359ba
--- /dev/null
+++ b/arch/mips/pci/Makefile
@@ -0,0 +1,54 @@
1#
2# Makefile for the PCI specific kernel interface routines under Linux.
3#
4
5obj-y += pci.o
6
7#
8# PCI bus host bridge specific code
9#
10obj-$(CONFIG_ITE_BOARD_GEN) += ops-it8172.o
11obj-$(CONFIG_MIPS_BONITO64) += ops-bonito64.o
12obj-$(CONFIG_MIPS_GT64111) += ops-gt64111.o
13obj-$(CONFIG_MIPS_GT64120) += ops-gt64120.o
14obj-$(CONFIG_MIPS_GT96100) += ops-gt96100.o
15obj-$(CONFIG_PCI_MARVELL) += ops-marvell.o
16obj-$(CONFIG_MIPS_MSC) += ops-msc.o
17obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o
18obj-$(CONFIG_MIPS_TX3927) += ops-jmr3927.o
19obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
20obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o
21
22#
23# These are still pretty much in the old state, watch, go blind.
24#
25obj-$(CONFIG_DDB5074) += fixup-ddb5074.o pci-ddb5074.o ops-ddb5074.o
26obj-$(CONFIG_DDB5476) += ops-ddb5476.o pci-ddb5476.o
27obj-$(CONFIG_DDB5477) += fixup-ddb5477.o pci-ddb5477.o ops-ddb5477.o
28obj-$(CONFIG_LASAT) += pci-lasat.o
29obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o
30obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o
31obj-$(CONFIG_MIPS_EV96100) += fixup-ev64120.o
32obj-$(CONFIG_MIPS_EV96100) += fixup-ev96100.o pci-ev96100.o
33obj-$(CONFIG_MIPS_ITE8172) += fixup-ite8172g.o
34obj-$(CONFIG_MIPS_IVR) += fixup-ivr.o
35obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o
36obj-$(CONFIG_SOC_AU1550) += fixup-au1000.o ops-au1000.o
37obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o
38obj-$(CONFIG_MOMENCO_JAGUAR_ATX)+= fixup-jaguar.o
39obj-$(CONFIG_MOMENCO_OCELOT) += fixup-ocelot.o pci-ocelot.o
40obj-$(CONFIG_MOMENCO_OCELOT_3) += fixup-ocelot3.o
41obj-$(CONFIG_MOMENCO_OCELOT_C) += fixup-ocelot-c.o pci-ocelot-c.o
42obj-$(CONFIG_MOMENCO_OCELOT_G) += fixup-ocelot-g.o pci-ocelot-g.o
43obj-$(CONFIG_PMC_YOSEMITE) += fixup-yosemite.o ops-titan.o ops-titan-ht.o \
44 pci-yosemite.o
45obj-$(CONFIG_SGI_IP27) += pci-ip27.o
46obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o
47obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o
48obj-$(CONFIG_SNI_RM200_PCI) += fixup-sni.o ops-sni.o
49obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
50obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o
51obj-$(CONFIG_TOSHIBA_JMR3927) += fixup-jmr3927.o pci-jmr3927.o
52obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o ops-tx4927.o
53obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o
54obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o
diff --git a/arch/mips/pci/fixup-atlas.c b/arch/mips/pci/fixup-atlas.c
new file mode 100644
index 000000000000..2406835833d6
--- /dev/null
+++ b/arch/mips/pci/fixup-atlas.c
@@ -0,0 +1,69 @@
1#include <linux/config.h>
2#include <linux/init.h>
3#include <linux/pci.h>
4#include <asm/mips-boards/atlasint.h>
5
6#define INTD ATLASINT_INTD
7#define INTC ATLASINT_INTC
8#define INTB ATLASINT_INTB
9#define INTA ATLASINT_INTA
10#define SCSI ATLASINT_SCSI
11#define ETH ATLASINT_ETH
12
13static char irq_tab[][5] __initdata = {
14 /* INTA INTB INTC INTD */
15 {0, 0, 0, 0, 0 }, /* 0: Unused */
16 {0, 0, 0, 0, 0 }, /* 1: Unused */
17 {0, 0, 0, 0, 0 }, /* 2: Unused */
18 {0, 0, 0, 0, 0 }, /* 3: Unused */
19 {0, 0, 0, 0, 0 }, /* 4: Unused */
20 {0, 0, 0, 0, 0 }, /* 5: Unused */
21 {0, 0, 0, 0, 0 }, /* 6: Unused */
22 {0, 0, 0, 0, 0 }, /* 7: Unused */
23 {0, 0, 0, 0, 0 }, /* 8: Unused */
24 {0, 0, 0, 0, 0 }, /* 9: Unused */
25 {0, 0, 0, 0, 0 }, /* 10: Unused */
26 {0, 0, 0, 0, 0 }, /* 11: Unused */
27 {0, 0, 0, 0, 0 }, /* 12: Unused */
28 {0, 0, 0, 0, 0 }, /* 13: Unused */
29 {0, 0, 0, 0, 0 }, /* 14: Unused */
30 {0, 0, 0, 0, 0 }, /* 15: Unused */
31 {0, SCSI, 0, 0, 0 }, /* 16: SYM53C810A SCSI */
32 {0, 0, 0, 0, 0 }, /* 17: Core */
33 {0, INTA, INTB, INTC, INTD }, /* 18: PCI Slot 1 */
34 {0, ETH, 0, 0, 0 }, /* 19: SAA9730 Ethernet */
35 {0, 0, 0, 0, 0 }, /* 20: PCI Slot 3 */
36 {0, 0, 0, 0, 0 } /* 21: PCI Slot 4 */
37};
38
39int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
40{
41 return irq_tab[slot][pin];
42}
43
44/* Do platform specific device initialization at pci_enable_device() time */
45int pcibios_plat_dev_init(struct pci_dev *dev)
46{
47 return 0;
48}
49
50#ifdef CONFIG_KGDB
51/*
52 * The PCI scan may have moved the saa9730 I/O address, so reread
53 * the address here.
54 * This does mean that it's not possible to debug the PCI bus configuration
55 * code, but it is better than nothing...
56 */
57
58static void atlas_saa9730_base_fixup (struct pci_dev *pdev)
59{
60 extern void *saa9730_base;
61 if (pdev->bus == 0 && PCI_SLOT(pdev->devfn) == 19)
62 (void) pci_read_config_dword (pdev, 0x14, (u32 *)&saa9730_base);
63 printk ("saa9730_base = %x\n", saa9730_base);
64}
65
66DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA9730,
67 atlas_saa9730_base_fixup);
68
69#endif
diff --git a/arch/mips/pci/fixup-au1000.c b/arch/mips/pci/fixup-au1000.c
new file mode 100644
index 000000000000..39fe2b16fcec
--- /dev/null
+++ b/arch/mips/pci/fixup-au1000.c
@@ -0,0 +1,123 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Board specific pci fixups.
4 *
5 * Copyright 2001-2003 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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#include <linux/config.h>
30#include <linux/types.h>
31#include <linux/pci.h>
32#include <linux/kernel.h>
33#include <linux/init.h>
34
35#include <asm/mach-au1x00/au1000.h>
36
37/*
38 * Shortcut
39 */
40#ifdef CONFIG_SOC_AU1500
41#define INTA AU1000_PCI_INTA
42#define INTB AU1000_PCI_INTB
43#define INTC AU1000_PCI_INTC
44#define INTD AU1000_PCI_INTD
45#endif
46
47#ifdef CONFIG_SOC_AU1550
48#define INTA AU1550_PCI_INTA
49#define INTB AU1550_PCI_INTB
50#define INTC AU1550_PCI_INTC
51#define INTD AU1550_PCI_INTD
52#endif
53
54#define INTX 0xFF /* not valid */
55
56#ifdef CONFIG_MIPS_DB1500
57static char irq_tab_alchemy[][5] __initdata = {
58 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - HPT371 */
59 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */
60};
61#endif
62
63#ifdef CONFIG_MIPS_BOSPORUS
64static char irq_tab_alchemy[][5] __initdata = {
65 [11] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 11 - miniPCI */
66 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - SN1741 */
67 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */
68};
69#endif
70
71#ifdef CONFIG_MIPS_MIRAGE
72static char irq_tab_alchemy[][5] __initdata = {
73 [11] = { -1, INTD, INTX, INTX, INTX}, /* IDSEL 11 - SMI VGX */
74 [12] = { -1, INTX, INTX, INTC, INTX}, /* IDSEL 12 - PNX1300 */
75 [13] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 13 - miniPCI */
76};
77#endif
78
79#ifdef CONFIG_MIPS_DB1550
80static char irq_tab_alchemy[][5] __initdata = {
81 [11] = { -1, INTC, INTX, INTX, INTX}, /* IDSEL 11 - on-board HPT371 */
82 [12] = { -1, INTB, INTC, INTD, INTA}, /* IDSEL 12 - PCI slot 2 (left) */
83 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */
84};
85#endif
86
87#ifdef CONFIG_MIPS_PB1500
88static char irq_tab_alchemy[][5] __initdata = {
89 [12] = { -1, INTA, INTX, INTX, INTX}, /* IDSEL 12 - HPT370 */
90 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot */
91};
92#endif
93
94#ifdef CONFIG_MIPS_PB1550
95static char irq_tab_alchemy[][5] __initdata = {
96 [12] = { -1, INTB, INTC, INTD, INTA}, /* IDSEL 12 - PCI slot 2 (left) */
97 [13] = { -1, INTA, INTB, INTC, INTD}, /* IDSEL 13 - PCI slot 1 (right) */
98};
99#endif
100
101#ifdef CONFIG_MIPS_MTX1
102static char irq_tab_alchemy[][5] __initdata = {
103 [0] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 00 - AdapterA-Slot0 (top) */
104 [1] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 01 - AdapterA-Slot1 (bottom) */
105 [2] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 02 - AdapterB-Slot0 (top) */
106 [3] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 03 - AdapterB-Slot1 (bottom) */
107 [4] = { -1, INTA, INTB, INTX, INTX}, /* IDSEL 04 - AdapterC-Slot0 (top) */
108 [5] = { -1, INTB, INTA, INTX, INTX}, /* IDSEL 05 - AdapterC-Slot1 (bottom) */
109 [6] = { -1, INTC, INTD, INTX, INTX}, /* IDSEL 06 - AdapterD-Slot0 (top) */
110 [7] = { -1, INTD, INTC, INTX, INTX}, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
111};
112#endif
113
114int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
115{
116 return irq_tab_alchemy[slot][pin];
117}
118
119/* Do platform specific device initialization at pci_enable_device() time */
120int pcibios_plat_dev_init(struct pci_dev *dev)
121{
122 return 0;
123}
diff --git a/arch/mips/pci/fixup-capcella.c b/arch/mips/pci/fixup-capcella.c
new file mode 100644
index 000000000000..f2fc82c1c7c5
--- /dev/null
+++ b/arch/mips/pci/fixup-capcella.c
@@ -0,0 +1,50 @@
1/*
2 * fixup-cappcela.c, The ZAO Networks Capcella specific PCI fixups.
3 *
4 * Copyright (C) 2002,2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/pci.h>
22
23#include <asm/vr41xx/capcella.h>
24
25/*
26 * Shortcuts
27 */
28#define INT1 RTL8139_1_IRQ
29#define INT2 RTL8139_2_IRQ
30#define INTA PC104PLUS_INTA_IRQ
31#define INTB PC104PLUS_INTB_IRQ
32#define INTC PC104PLUS_INTC_IRQ
33#define INTD PC104PLUS_INTD_IRQ
34
35static char irq_tab_capcella[][5] __initdata = {
36 [11] = { -1, INT1, INT1, INT1, INT1 },
37 [12] = { -1, INT2, INT2, INT2, INT2 },
38 [14] = { -1, INTA, INTB, INTC, INTD }
39};
40
41int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
42{
43 return irq_tab_capcella[slot][pin];
44}
45
46/* Do platform specific device initialization at pci_enable_device() time */
47int pcibios_plat_dev_init(struct pci_dev *dev)
48{
49 return 0;
50}
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c
new file mode 100644
index 000000000000..57e1ca2116bb
--- /dev/null
+++ b/arch/mips/pci/fixup-cobalt.c
@@ -0,0 +1,112 @@
1/*
2 * Cobalt Qube/Raq PCI support
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995, 1996, 1997, 2002, 2003 by Ralf Baechle
9 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
10 */
11#include <linux/types.h>
12#include <linux/pci.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15
16#include <asm/pci.h>
17#include <asm/io.h>
18#include <asm/gt64120.h>
19
20#include <asm/cobalt/cobalt.h>
21
22extern int cobalt_board_id;
23
24static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev)
25{
26 unsigned short cfgword;
27 unsigned char lt;
28
29 /* Enable Bus Mastering and fast back to back. */
30 pci_read_config_word(dev, PCI_COMMAND, &cfgword);
31 cfgword |= (PCI_COMMAND_FAST_BACK | PCI_COMMAND_MASTER);
32 pci_write_config_word(dev, PCI_COMMAND, cfgword);
33
34 /* Enable both ide interfaces. ROM only enables primary one. */
35 pci_write_config_byte(dev, 0x40, 0xb);
36
37 /* Set latency timer to reasonable value. */
38 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lt);
39 if (lt < 64)
40 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
41 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 7);
42}
43
44DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1,
45 qube_raq_via_bmIDE_fixup);
46
47static void qube_raq_galileo_fixup(struct pci_dev *dev)
48{
49 unsigned short galileo_id;
50
51 /* Fix PCI latency-timer and cache-line-size values in Galileo
52 * host bridge.
53 */
54 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
55 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 7);
56
57 /*
58 * On all machines prior to Q2, we had the STOP line disconnected
59 * from Galileo to VIA on PCI. The new Galileo does not function
60 * correctly unless we have it connected.
61 *
62 * Therefore we must set the disconnect/retry cycle values to
63 * something sensible when using the new Galileo.
64 */
65 pci_read_config_word(dev, PCI_REVISION_ID, &galileo_id);
66 galileo_id &= 0xff; /* mask off class info */
67 if (galileo_id >= 0x10) {
68 /* New Galileo, assumes PCI stop line to VIA is connected. */
69 GALILEO_OUTL(0x4020, GT_PCI0_TOR_OFS);
70 } else if (galileo_id == 0x1 || galileo_id == 0x2) {
71 signed int timeo;
72 /* XXX WE MUST DO THIS ELSE GALILEO LOCKS UP! -DaveM */
73 timeo = GALILEO_INL(GT_PCI0_TOR_OFS);
74 /* Old Galileo, assumes PCI STOP line to VIA is disconnected. */
75 GALILEO_OUTL(0xffff, GT_PCI0_TOR_OFS);
76 }
77}
78
79DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_GALILEO, PCI_ANY_ID,
80 qube_raq_galileo_fixup);
81
82static char irq_tab_cobalt[] __initdata = {
83 [COBALT_PCICONF_CPU] = 0,
84 [COBALT_PCICONF_ETH0] = COBALT_ETH0_IRQ,
85 [COBALT_PCICONF_RAQSCSI] = COBALT_SCSI_IRQ,
86 [COBALT_PCICONF_VIA] = 0,
87 [COBALT_PCICONF_PCISLOT] = COBALT_QUBE_SLOT_IRQ,
88 [COBALT_PCICONF_ETH1] = COBALT_ETH1_IRQ
89};
90
91static char irq_tab_raq2[] __initdata = {
92 [COBALT_PCICONF_CPU] = 0,
93 [COBALT_PCICONF_ETH0] = COBALT_ETH0_IRQ,
94 [COBALT_PCICONF_RAQSCSI] = COBALT_RAQ_SCSI_IRQ,
95 [COBALT_PCICONF_VIA] = 0,
96 [COBALT_PCICONF_PCISLOT] = COBALT_QUBE_SLOT_IRQ,
97 [COBALT_PCICONF_ETH1] = COBALT_ETH1_IRQ
98};
99
100int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
101{
102 if (cobalt_board_id == COBALT_BRD_ID_RAQ2)
103 return irq_tab_raq2[slot];
104
105 return irq_tab_cobalt[slot];
106}
107
108/* Do platform specific device initialization at pci_enable_device() time */
109int pcibios_plat_dev_init(struct pci_dev *dev)
110{
111 return 0;
112}
diff --git a/arch/mips/pci/fixup-ddb5074.c b/arch/mips/pci/fixup-ddb5074.c
new file mode 100644
index 000000000000..b345e528a53c
--- /dev/null
+++ b/arch/mips/pci/fixup-ddb5074.c
@@ -0,0 +1,21 @@
1/*
2 * It's nice to have the LEDs on the GPIO pins available for debugging
3 */
4static void ddb5074_fixup(struct pci_dev *dev)
5{
6 extern struct pci_dev *pci_pmu;
7 u8 t8;
8
9 pci_pmu = dev; /* for LEDs D2 and D3 */
10 /* Program the lines for LEDs D2 and D3 to output */
11 pci_read_config_byte(dev, 0x7d, &t8);
12 t8 |= 0xc0;
13 pci_write_config_byte(dev, 0x7d, t8);
14 /* Turn LEDs D2 and D3 off */
15 pci_read_config_byte(dev, 0x7e, &t8);
16 t8 |= 0xc0;
17 pci_write_config_byte(dev, 0x7e, t8);
18}
19
20DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,
21 ddb5074_fixup);
diff --git a/arch/mips/pci/fixup-ddb5477.c b/arch/mips/pci/fixup-ddb5477.c
new file mode 100644
index 000000000000..6abdc88bab1e
--- /dev/null
+++ b/arch/mips/pci/fixup-ddb5477.c
@@ -0,0 +1,78 @@
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-ev64120.c b/arch/mips/pci/fixup-ev64120.c
new file mode 100644
index 000000000000..8dbb90d63f0a
--- /dev/null
+++ b/arch/mips/pci/fixup-ev64120.c
@@ -0,0 +1,34 @@
1#include <linux/pci.h>
2#include <linux/init.h>
3
4int pci_range_ck(unsigned char bus, unsigned char dev)
5{
6 if (((bus == 0) || (bus == 1)) && (dev >= 6) && (dev <= 8))
7 return 0;
8
9 return -1;
10}
11
12/*
13 * After detecting all agents over the PCI , this function is called
14 * in order to give an interrupt number for each PCI device starting
15 * from IRQ 20. It does also enables master for each device.
16 */
17void __devinit pcibios_fixup_bus(struct pci_bus *bus)
18{
19 unsigned int irq = 20;
20 struct pci_bus *current_bus = bus;
21 struct pci_dev *dev;
22 struct list_head *devices_link;
23
24 list_for_each(devices_link, &(current_bus->devices)) {
25 dev = pci_dev_b(devices_link);
26 if (dev != NULL) {
27 dev->irq = irq++;
28
29 /* Assign an interrupt number for the device */
30 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
31 pcibios_set_master(dev);
32 }
33 }
34}
diff --git a/arch/mips/pci/fixup-ev96100.c b/arch/mips/pci/fixup-ev96100.c
new file mode 100644
index 000000000000..e2bc977b6d58
--- /dev/null
+++ b/arch/mips/pci/fixup-ev96100.c
@@ -0,0 +1,48 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * EV96100 Board specific pci fixups.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/init.h>
31#include <linux/types.h>
32#include <linux/pci.h>
33
34static char irq_tab_ev96100[][5] __initdata = {
35 [8] = { 0, 5, 5, 5, 5 },
36 [9] = { 0, 2, 2, 2, 2 }
37};
38
39int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
40{
41 return irq_tab_ev96100[slot][pin];
42}
43
44/* Do platform specific device initialization at pci_enable_device() time */
45int pcibios_plat_dev_init(struct pci_dev *dev)
46{
47 return 0;
48}
diff --git a/arch/mips/pci/fixup-ip32.c b/arch/mips/pci/fixup-ip32.c
new file mode 100644
index 000000000000..3e66b0aa63ca
--- /dev/null
+++ b/arch/mips/pci/fixup-ip32.c
@@ -0,0 +1,51 @@
1#include <linux/init.h>
2#include <linux/kernel.h>
3#include <linux/pci.h>
4#include <asm/ip32/ip32_ints.h>
5/*
6 * O2 has up to 5 PCI devices connected into the MACE bridge. The device
7 * map looks like this:
8 *
9 * 0 aic7xxx 0
10 * 1 aic7xxx 1
11 * 2 expansion slot
12 * 3 N/C
13 * 4 N/C
14 */
15
16#define SCSI0 MACEPCI_SCSI0_IRQ
17#define SCSI1 MACEPCI_SCSI1_IRQ
18#define INTA0 MACEPCI_SLOT0_IRQ
19#define INTA1 MACEPCI_SLOT1_IRQ
20#define INTA2 MACEPCI_SLOT2_IRQ
21#define INTB MACEPCI_SHARED0_IRQ
22#define INTC MACEPCI_SHARED1_IRQ
23#define INTD MACEPCI_SHARED2_IRQ
24static char irq_tab_mace[][5] __initdata = {
25 /* Dummy INT#A INT#B INT#C INT#D */
26 {0, 0, 0, 0, 0}, /* This is placeholder row - never used */
27 {0, SCSI0, SCSI0, SCSI0, SCSI0},
28 {0, SCSI1, SCSI1, SCSI1, SCSI1},
29 {0, INTA0, INTB, INTC, INTD},
30 {0, INTA1, INTC, INTD, INTB},
31 {0, INTA2, INTD, INTB, INTC},
32};
33
34
35/*
36 * Given a PCI slot number (a la PCI_SLOT(...)) and the interrupt pin of
37 * the device (1-4 => A-D), tell what irq to use. Note that we don't
38 * in theory have slots 4 and 5, and we never normally use the shared
39 * irqs. I suppose a device without a pin A will thank us for doing it
40 * right if there exists such a broken piece of crap.
41 */
42int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
43{
44 return irq_tab_mace[slot][pin];
45}
46
47/* Do platform specific device initialization at pci_enable_device() time */
48int pcibios_plat_dev_init(struct pci_dev *dev)
49{
50 return 0;
51}
diff --git a/arch/mips/pci/fixup-ite8172g.c b/arch/mips/pci/fixup-ite8172g.c
new file mode 100644
index 000000000000..2290ea4228dd
--- /dev/null
+++ b/arch/mips/pci/fixup-ite8172g.c
@@ -0,0 +1,80 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Board specific pci fixups.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
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#include <linux/types.h>
30#include <linux/pci.h>
31#include <linux/kernel.h>
32#include <linux/init.h>
33
34#include <asm/it8172/it8172.h>
35#include <asm/it8172/it8172_pci.h>
36#include <asm/it8172/it8172_int.h>
37
38/*
39 * Shortcuts
40 */
41#define INTA IT8172_PCI_INTA_IRQ
42#define INTB IT8172_PCI_INTB_IRQ
43#define INTC IT8172_PCI_INTC_IRQ
44#define INTD IT8172_PCI_INTD_IRQ
45
46static const int internal_func_irqs[7] __initdata = {
47 IT8172_AC97_IRQ,
48 IT8172_DMA_IRQ,
49 IT8172_CDMA_IRQ,
50 IT8172_USB_IRQ,
51 IT8172_BRIDGE_MASTER_IRQ,
52 IT8172_IDE_IRQ,
53 IT8172_MC68K_IRQ
54};
55
56static char irq_tab_ite8172g[][5] __initdata = {
57 [0x10] = { 0, INTA, INTB, INTC, INTD },
58 [0x11] = { 0, INTA, INTB, INTC, INTD },
59 [0x12] = { 0, INTB, INTC, INTD, INTA },
60 [0x13] = { 0, INTC, INTD, INTA, INTB },
61 [0x14] = { 0, INTD, INTA, INTB, INTC },
62};
63
64int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
65{
66 /*
67 * Internal device 1 is actually 7 different internal devices on the
68 * IT8172G (a multifunction device).
69 */
70 if (slot == 1)
71 return internal_func_irqs[PCI_FUNC(dev->devfn)];
72
73 return irq_tab_ite8172g[slot][pin];
74}
75
76/* Do platform specific device initialization at pci_enable_device() time */
77int pcibios_plat_dev_init(struct pci_dev *dev)
78{
79 return 0;
80}
diff --git a/arch/mips/pci/fixup-ivr.c b/arch/mips/pci/fixup-ivr.c
new file mode 100644
index 000000000000..0c7c16464c11
--- /dev/null
+++ b/arch/mips/pci/fixup-ivr.c
@@ -0,0 +1,75 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Globespan IVR board-specific pci fixups.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/types.h>
31#include <linux/pci.h>
32#include <linux/kernel.h>
33#include <linux/init.h>
34
35#include <asm/it8172/it8172.h>
36#include <asm/it8172/it8172_pci.h>
37#include <asm/it8172/it8172_int.h>
38
39/*
40 * Shortcuts
41 */
42#define INTA IT8172_PCI_INTA_IRQ
43#define INTB IT8172_PCI_INTB_IRQ
44#define INTC IT8172_PCI_INTC_IRQ
45#define INTD IT8172_PCI_INTD_IRQ
46
47static const int internal_func_irqs[7] __initdata = {
48 IT8172_AC97_IRQ,
49 IT8172_DMA_IRQ,
50 IT8172_CDMA_IRQ,
51 IT8172_USB_IRQ,
52 IT8172_BRIDGE_MASTER_IRQ,
53 IT8172_IDE_IRQ,
54 IT8172_MC68K_IRQ
55};
56
57static char irq_tab_ivr[][5] __initdata = {
58 [0x11] = { INTC, INTC, INTD, INTA, INTB }, /* Realtek RTL-8139 */
59 [0x12] = { INTB, INTB, INTB, INTC, INTC }, /* IVR slot */
60 [0x13] = { INTA, INTA, INTB, INTC, INTD } /* Expansion slot */
61};
62
63int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
64{
65 if (slot == 1)
66 return internal_func_irqs[PCI_FUNC(dev->devfn)];
67
68 return irq_tab_ivr[slot][pin];
69}
70
71/* Do platform specific device initialization at pci_enable_device() time */
72int pcibios_plat_dev_init(struct pci_dev *dev)
73{
74 return 0;
75}
diff --git a/arch/mips/pci/fixup-jaguar.c b/arch/mips/pci/fixup-jaguar.c
new file mode 100644
index 000000000000..6c5e1d47179c
--- /dev/null
+++ b/arch/mips/pci/fixup-jaguar.c
@@ -0,0 +1,43 @@
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 * Marvell MV64340 interrupt fixup code.
7 *
8 * Marvell wants an NDA for their docs so this was written without
9 * documentation. You've been warned.
10 *
11 * Copyright (C) 2004 Ralf Baechle (ralf@linux-mips.org)
12 */
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/pci.h>
16
17#include <asm/mipsregs.h>
18
19/*
20 * WARNING: Example of how _NOT_ to do it.
21 */
22int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
23{
24 int bus = dev->bus->number;
25
26 if (bus == 0 && slot == 1)
27 return 3; /* PCI-X A */
28 if (bus == 0 && slot == 2)
29 return 4; /* PCI-X B */
30 if (bus == 1 && slot == 1)
31 return 5; /* PCI A */
32 if (bus == 1 && slot == 2)
33 return 6; /* PCI B */
34
35return 0;
36 panic("Whooops in pcibios_map_irq");
37}
38
39/* Do platform specific device initialization at pci_enable_device() time */
40int pcibios_plat_dev_init(struct pci_dev *dev)
41{
42 return 0;
43}
diff --git a/arch/mips/pci/fixup-jmr3927.c b/arch/mips/pci/fixup-jmr3927.c
new file mode 100644
index 000000000000..f8696081c5b1
--- /dev/null
+++ b/arch/mips/pci/fixup-jmr3927.c
@@ -0,0 +1,105 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Board specific pci fixups.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
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#include <linux/types.h>
31#include <linux/pci.h>
32#include <linux/kernel.h>
33#include <linux/init.h>
34
35#include <asm/jmr3927/jmr3927.h>
36
37int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
38{
39 unsigned char irq = pin;
40
41 /* IRQ rotation (PICMG) */
42 irq--; /* 0-3 */
43 if (dev->bus->parent == NULL &&
44 slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(23)) {
45 /* PCI CardSlot (IDSEL=A23, DevNu=12) */
46 /* PCIA => PCIC (IDSEL=A23) */
47 /* NOTE: JMR3927 JP1 must be set to OPEN */
48 irq = (irq + 2) % 4;
49 } else if (dev->bus->parent == NULL &&
50 slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(22)) {
51 /* PCI CardSlot (IDSEL=A22, DevNu=11) */
52 /* PCIA => PCIA (IDSEL=A22) */
53 /* NOTE: JMR3927 JP1 must be set to OPEN */
54 irq = (irq + 0) % 4;
55 } else {
56 /* PCI Backplane */
57 irq = (irq + 3 + slot) % 4;
58 }
59 irq++; /* 1-4 */
60
61 switch (irq) {
62 case 1:
63 irq = JMR3927_IRQ_IOC_PCIA;
64 break;
65 case 2:
66 // wrong for backplane irq = JMR3927_IRQ_IOC_PCIB;
67 irq = JMR3927_IRQ_IOC_PCID;
68 break;
69 case 3:
70 irq = JMR3927_IRQ_IOC_PCIC;
71 break;
72 case 4:
73 // wrong for backplane irq = JMR3927_IRQ_IOC_PCID;
74 irq = JMR3927_IRQ_IOC_PCIB;
75 break;
76 }
77
78 /* Check OnBoard Ethernet (IDSEL=A24, DevNu=13) */
79 if (dev->bus->parent == NULL &&
80 slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(24)) {
81 extern int jmr3927_ether1_irq;
82 /* check this irq line was reserved for ether1 */
83 if (jmr3927_ether1_irq != JMR3927_IRQ_ETHER0)
84 irq = JMR3927_IRQ_ETHER0;
85 else
86 irq = 0; /* disable */
87 }
88 return irq;
89}
90
91/* Do platform specific device initialization at pci_enable_device() time */
92int pcibios_plat_dev_init(struct pci_dev *dev)
93{
94 return 0;
95}
96
97int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
98{
99 /* SMSC SLC90E66 IDE uses irq 14, 15 (default) */
100 if (!(dev->vendor == PCI_VENDOR_ID_EFAR &&
101 dev->device == PCI_DEVICE_ID_EFAR_SLC90E66_1))
102 return pci_get_irq(dev, pin);
103
104 dev->irq = irq;
105}
diff --git a/arch/mips/pci/fixup-malta.c b/arch/mips/pci/fixup-malta.c
new file mode 100644
index 000000000000..b9296d9942b3
--- /dev/null
+++ b/arch/mips/pci/fixup-malta.c
@@ -0,0 +1,103 @@
1#include <linux/init.h>
2#include <linux/pci.h>
3
4/* PCI interrupt pins */
5#define PCIA 1
6#define PCIB 2
7#define PCIC 3
8#define PCID 4
9
10/* This table is filled in by interrogating the PIIX4 chip */
11static char pci_irq[5] __initdata;
12
13static char irq_tab[][5] __initdata = {
14 /* INTA INTB INTC INTD */
15 {0, 0, 0, 0, 0 }, /* 0: GT64120 PCI bridge */
16 {0, 0, 0, 0, 0 }, /* 1: Unused */
17 {0, 0, 0, 0, 0 }, /* 2: Unused */
18 {0, 0, 0, 0, 0 }, /* 3: Unused */
19 {0, 0, 0, 0, 0 }, /* 4: Unused */
20 {0, 0, 0, 0, 0 }, /* 5: Unused */
21 {0, 0, 0, 0, 0 }, /* 6: Unused */
22 {0, 0, 0, 0, 0 }, /* 7: Unused */
23 {0, 0, 0, 0, 0 }, /* 8: Unused */
24 {0, 0, 0, 0, 0 }, /* 9: Unused */
25 {0, 0, 0, 0, PCID }, /* 10: PIIX4 USB */
26 {0, PCIB, 0, 0, 0 }, /* 11: AMD 79C973 Ethernet */
27 {0, PCIC, 0, 0, 0 }, /* 12: Crystal 4281 Sound */
28 {0, 0, 0, 0, 0 }, /* 13: Unused */
29 {0, 0, 0, 0, 0 }, /* 14: Unused */
30 {0, 0, 0, 0, 0 }, /* 15: Unused */
31 {0, 0, 0, 0, 0 }, /* 16: Unused */
32 {0, 0, 0, 0, 0 }, /* 17: Bonito/SOC-it PCI Bridge*/
33 {0, PCIA, PCIB, PCIC, PCID }, /* 18: PCI Slot 1 */
34 {0, PCIB, PCIC, PCID, PCIA }, /* 19: PCI Slot 2 */
35 {0, PCIC, PCID, PCIA, PCIB }, /* 20: PCI Slot 3 */
36 {0, PCID, PCIA, PCIB, PCIC } /* 21: PCI Slot 4 */
37};
38
39int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
40{
41 int virq;
42 virq = irq_tab[slot][pin];
43 return pci_irq[virq];
44}
45
46/* Do platform specific device initialization at pci_enable_device() time */
47int pcibios_plat_dev_init(struct pci_dev *dev)
48{
49 return 0;
50}
51
52static void __init malta_piix_func0_fixup(struct pci_dev *pdev)
53{
54 unsigned char reg_val;
55 static int piixirqmap[16] __initdata = { /* PIIX PIRQC[A:D] irq mappings */
56 0, 0, 0, 3,
57 4, 5, 6, 7,
58 0, 9, 10, 11,
59 12, 0, 14, 15
60 };
61 int i;
62
63 /* Interrogate PIIX4 to get PCI IRQ mapping */
64 for (i = 0; i <= 3; i++) {
65 pci_read_config_byte(pdev, 0x60+i, &reg_val);
66 if (reg_val & 0x80)
67 pci_irq[PCIA+i] = 0; /* Disabled */
68 else
69 pci_irq[PCIA+i] = piixirqmap[reg_val & 15];
70 }
71
72 /* Done by YAMON 2.00 onwards */
73 if (PCI_SLOT(pdev->devfn) == 10) {
74 /*
75 * Set top of main memory accessible by ISA or DMA
76 * devices to 16 Mb.
77 */
78 pci_read_config_byte(pdev, 0x69, &reg_val);
79 pci_write_config_byte(pdev, 0x69, reg_val | 0xf0);
80 }
81}
82
83DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
84 malta_piix_func0_fixup);
85
86static void __init malta_piix_func1_fixup(struct pci_dev *pdev)
87{
88 unsigned char reg_val;
89
90 /* Done by YAMON 2.02 onwards */
91 if (PCI_SLOT(pdev->devfn) == 10) {
92 /*
93 * IDE Decode enable.
94 */
95 pci_read_config_byte(pdev, 0x41, &reg_val);
96 pci_write_config_byte(pdev, 0x41, reg_val|0x80);
97 pci_read_config_byte(pdev, 0x43, &reg_val);
98 pci_write_config_byte(pdev, 0x43, reg_val|0x80);
99 }
100}
101
102DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB,
103 malta_piix_func1_fixup);
diff --git a/arch/mips/pci/fixup-mpc30x.c b/arch/mips/pci/fixup-mpc30x.c
new file mode 100644
index 000000000000..4975846da75a
--- /dev/null
+++ b/arch/mips/pci/fixup-mpc30x.c
@@ -0,0 +1,50 @@
1/*
2 * fixup-mpc30x.c, The Victor MP-C303/304 specific PCI fixups.
3 *
4 * Copyright (C) 2002,2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/pci.h>
22
23#include <asm/vr41xx/mpc30x.h>
24#include <asm/vr41xx/vrc4173.h>
25
26static const int internal_func_irqs[] __initdata = {
27 VRC4173_CASCADE_IRQ,
28 VRC4173_AC97_IRQ,
29 VRC4173_USB_IRQ,
30};
31
32static const int irq_tab_mpc30x[] __initdata = {
33 [12] = VRC4173_PCMCIA1_IRQ,
34 [13] = VRC4173_PCMCIA2_IRQ,
35 [29] = MQ200_IRQ,
36};
37
38int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
39{
40 if (slot == 30)
41 return internal_func_irqs[PCI_FUNC(dev->devfn)];
42
43 return irq_tab_mpc30x[slot];
44}
45
46/* Do platform specific device initialization at pci_enable_device() time */
47int pcibios_plat_dev_init(struct pci_dev *dev)
48{
49 return 0;
50}
diff --git a/arch/mips/pci/fixup-ocelot-c.c b/arch/mips/pci/fixup-ocelot-c.c
new file mode 100644
index 000000000000..d45494807a33
--- /dev/null
+++ b/arch/mips/pci/fixup-ocelot-c.c
@@ -0,0 +1,41 @@
1/*
2 * Copyright 2002 Momentum Computer Inc.
3 * Author: Matthew Dharm <mdharm@momenco.com>
4 *
5 * Based on work for the Linux port to the Ocelot board, which is
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
8 *
9 * arch/mips/momentum/ocelot_g/pci.c
10 * Board-specific PCI routines for mv64340 controller.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#include <linux/types.h>
18#include <linux/pci.h>
19#include <linux/kernel.h>
20#include <linux/init.h>
21
22int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
23{
24 int bus = dev->bus->number;
25
26 if (bus == 0 && slot == 1)
27 return 2; /* PCI-X A */
28 if (bus == 1 && slot == 1)
29 return 12; /* PCI-X B */
30 if (bus == 1 && slot == 2)
31 return 4; /* PCI B */
32
33return 0;
34 panic("Whooops in pcibios_map_irq");
35}
36
37/* Do platform specific device initialization at pci_enable_device() time */
38int pcibios_plat_dev_init(struct pci_dev *dev)
39{
40 return 0;
41}
diff --git a/arch/mips/pci/fixup-ocelot-g.c b/arch/mips/pci/fixup-ocelot-g.c
new file mode 100644
index 000000000000..d7a652e326c5
--- /dev/null
+++ b/arch/mips/pci/fixup-ocelot-g.c
@@ -0,0 +1,37 @@
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) 2004 Ralf Baechle (ralf@linux-mips.org)
8 */
9#include <linux/types.h>
10#include <linux/pci.h>
11#include <linux/kernel.h>
12#include <linux/init.h>
13
14int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
15{
16 int bus = dev->bus->number;
17
18 if (bus == 0 && slot == 1) /* Intel 82543 Gigabit MAC */
19 return 2; /* irq_nr is 2 for INT0 */
20
21 if (bus == 0 && slot == 2) /* Intel 82543 Gigabit MAC */
22 return 3; /* irq_nr is 3 for INT1 */
23
24 if (bus == 1 && slot == 3) /* Intel 21555 bridge */
25 return 5; /* irq_nr is 8 for INT6 */
26
27 if (bus == 1 && slot == 4) /* PMC Slot */
28 return 9; /* irq_nr is 9 for INT7 */
29
30 return -1;
31}
32
33/* Do platform specific device initialization at pci_enable_device() time */
34int pcibios_plat_dev_init(struct pci_dev *dev)
35{
36 return 0;
37}
diff --git a/arch/mips/pci/fixup-ocelot.c b/arch/mips/pci/fixup-ocelot.c
new file mode 100644
index 000000000000..99629bd047ce
--- /dev/null
+++ b/arch/mips/pci/fixup-ocelot.c
@@ -0,0 +1,75 @@
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-ocelot3.c b/arch/mips/pci/fixup-ocelot3.c
new file mode 100644
index 000000000000..ececc03ec620
--- /dev/null
+++ b/arch/mips/pci/fixup-ocelot3.c
@@ -0,0 +1,41 @@
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) 2004 Montavista Software Inc.
7 * Author: Manish Lachwani (mlachwani@mvista.com)
8 *
9 * Looking at the schematics for the Ocelot-3 board, there are
10 * two PCI busses and each bus has two PCI slots.
11 */
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/pci.h>
15#include <asm/mipsregs.h>
16
17/*
18 * Do platform specific device initialization at
19 * pci_enable_device() time
20 */
21int pcibios_plat_dev_init(struct pci_dev *dev)
22{
23 return 0;
24}
25
26int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
27{
28 int bus = dev->bus->number;
29
30 if (bus == 0 && slot == 1)
31 return 2; /* PCI-X A */
32 if (bus == 0 && slot == 2)
33 return 3; /* PCI-X B */
34 if (bus == 1 && slot == 1)
35 return 4; /* PCI A */
36 if (bus == 1 && slot == 2)
37 return 5; /* PCI B */
38
39return 0;
40 panic("Whooops in pcibios_map_irq");
41}
diff --git a/arch/mips/pci/fixup-rbtx4927.c b/arch/mips/pci/fixup-rbtx4927.c
new file mode 100644
index 000000000000..de4e443da208
--- /dev/null
+++ b/arch/mips/pci/fixup-rbtx4927.c
@@ -0,0 +1,140 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Board specific pci fixups for the Toshiba rbtx4927
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * Copyright (C) 2000-2001 Toshiba Corporation
11 *
12 * Copyright (C) 2004 MontaVista Software Inc.
13 * Author: Manish Lachwani (mlachwani@mvista.com)
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35#include <linux/types.h>
36#include <linux/pci.h>
37#include <linux/kernel.h>
38#include <linux/init.h>
39
40#include <asm/tx4927/tx4927.h>
41#include <asm/tx4927/tx4927_pci.h>
42
43#undef DEBUG
44#ifdef DEBUG
45#define DBG(x...) printk(x)
46#else
47#define DBG(x...)
48#endif
49
50/* look up table for backplane pci irq for slots 17-20 by pin # */
51static unsigned char backplane_pci_irq[4][4] = {
52 /* PJ6 SLOT: 17, PIN: 1 */ {TX4927_IRQ_IOC_PCIA,
53 /* PJ6 SLOT: 17, PIN: 2 */
54 TX4927_IRQ_IOC_PCIB,
55 /* PJ6 SLOT: 17, PIN: 3 */
56 TX4927_IRQ_IOC_PCIC,
57 /* PJ6 SLOT: 17, PIN: 4 */
58 TX4927_IRQ_IOC_PCID},
59 /* SB SLOT: 18, PIN: 1 */ {TX4927_IRQ_IOC_PCIB,
60 /* SB SLOT: 18, PIN: 2 */
61 TX4927_IRQ_IOC_PCIC,
62 /* SB SLOT: 18, PIN: 3 */
63 TX4927_IRQ_IOC_PCID,
64 /* SB SLOT: 18, PIN: 4 */
65 TX4927_IRQ_IOC_PCIA},
66 /* PJ5 SLOT: 19, PIN: 1 */ {TX4927_IRQ_IOC_PCIC,
67 /* PJ5 SLOT: 19, PIN: 2 */
68 TX4927_IRQ_IOC_PCID,
69 /* PJ5 SLOT: 19, PIN: 3 */
70 TX4927_IRQ_IOC_PCIA,
71 /* PJ5 SLOT: 19, PIN: 4 */
72 TX4927_IRQ_IOC_PCIB},
73 /* PJ4 SLOT: 20, PIN: 1 */ {TX4927_IRQ_IOC_PCID,
74 /* PJ4 SLOT: 20, PIN: 2 */
75 TX4927_IRQ_IOC_PCIA,
76 /* PJ4 SLOT: 20, PIN: 3 */
77 TX4927_IRQ_IOC_PCIB,
78 /* PJ4 SLOT: 20, PIN: 4 */
79 TX4927_IRQ_IOC_PCIC}
80};
81
82int pci_get_irq(struct pci_dev *dev, int pin)
83{
84 unsigned char irq = pin;
85
86 DBG("pci_get_irq: pin is %d\n", pin);
87 /* IRQ rotation */
88 irq--; /* 0-3 */
89 if (dev->bus->parent == NULL &&
90 PCI_SLOT(dev->devfn) == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) {
91 printk("Onboard PCI_SLOT(dev->devfn) is %d\n",
92 PCI_SLOT(dev->devfn));
93 /* IDSEL=A23 is tx4927 onboard pci slot */
94 irq = (irq + PCI_SLOT(dev->devfn)) % 4;
95 irq++; /* 1-4 */
96 DBG("irq is now %d\n", irq);
97
98 switch (irq) {
99 case 1:
100 irq = TX4927_IRQ_IOC_PCIA;
101 break;
102 case 2:
103 irq = TX4927_IRQ_IOC_PCIB;
104 break;
105 case 3:
106 irq = TX4927_IRQ_IOC_PCIC;
107 break;
108 case 4:
109 irq = TX4927_IRQ_IOC_PCID;
110 break;
111 }
112 } else {
113 /* PCI Backplane */
114 DBG("PCI Backplane PCI_SLOT(dev->devfn) is %d\n",
115 PCI_SLOT(dev->devfn));
116 irq = backplane_pci_irq[PCI_SLOT(dev->devfn) - 17][irq];
117 }
118 DBG("assigned irq %d\n", irq);
119 return irq;
120}
121
122int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
123{
124 unsigned char irq;
125
126 printk("PCI Setup for pin %d \n", pin);
127
128 if (dev->device == 0x9130) /* IDE */
129 irq = 14;
130 else
131 irq = pci_get_irq(dev, pin);
132
133 return irq;
134}
135
136/* Do platform specific device initialization at pci_enable_device() time */
137int pcibios_plat_dev_init(struct pci_dev *dev)
138{
139 return 0;
140}
diff --git a/arch/mips/pci/fixup-sb1250.c b/arch/mips/pci/fixup-sb1250.c
new file mode 100644
index 000000000000..13791b78e598
--- /dev/null
+++ b/arch/mips/pci/fixup-sb1250.c
@@ -0,0 +1,24 @@
1/*
2 * arch/mips/pci/fixup-sb1250.c
3 *
4 * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved.
5 * Author: Maciej W. Rozycki <macro@mips.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/init.h>
14#include <linux/pci.h>
15
16/*
17 * The BCM1250, etc. PCI/HT bridge reports as a host bridge.
18 */
19static void __init quirk_sb1250_ht(struct pci_dev *dev)
20{
21 dev->class = PCI_CLASS_BRIDGE_PCI << 8;
22}
23DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_HT,
24 quirk_sb1250_ht);
diff --git a/arch/mips/pci/fixup-sni.c b/arch/mips/pci/fixup-sni.c
new file mode 100644
index 000000000000..c8ef01a017cc
--- /dev/null
+++ b/arch/mips/pci/fixup-sni.c
@@ -0,0 +1,89 @@
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 * SNI specific PCI support for RM200/RM300.
7 *
8 * Copyright (C) 1997 - 2000, 2003, 04 Ralf Baechle (ralf@linux-mips.org)
9 */
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/pci.h>
13
14#include <asm/mipsregs.h>
15#include <asm/sni.h>
16
17/*
18 * Shortcuts ...
19 */
20#define SCSI PCIMT_IRQ_SCSI
21#define ETH PCIMT_IRQ_ETHERNET
22#define INTA PCIMT_IRQ_INTA
23#define INTB PCIMT_IRQ_INTB
24#define INTC PCIMT_IRQ_INTC
25#define INTD PCIMT_IRQ_INTD
26
27/*
28 * Device 0: PCI EISA Bridge (directly routed)
29 * Device 1: NCR53c810 SCSI (directly routed)
30 * Device 2: PCnet32 Ethernet (directly routed)
31 * Device 3: VGA (routed to INTB)
32 * Device 4: Unused
33 * Device 5: Slot 2
34 * Device 6: Slot 3
35 * Device 7: Slot 4
36 *
37 * Documentation says the VGA is device 5 and device 3 is unused but that
38 * seem to be a documentation error. At least on my RM200C the Cirrus
39 * Logic CL-GD5434 VGA is device 3.
40 */
41static char irq_tab_rm200[8][5] __initdata = {
42 /* INTA INTB INTC INTD */
43 { 0, 0, 0, 0, 0 }, /* EISA bridge */
44 { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */
45 { ETH, ETH, ETH, ETH, ETH }, /* Ethernet */
46 { INTB, INTB, INTB, INTB, INTB }, /* VGA */
47 { 0, 0, 0, 0, 0 }, /* Unused */
48 { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */
49 { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */
50 { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */
51};
52
53/*
54 * In Revision D of the RM300 Device 2 has become a normal purpose Slot 1
55 *
56 * The VGA card is optional for RM300 systems.
57 */
58static char irq_tab_rm300d[8][5] __initdata = {
59 /* INTA INTB INTC INTD */
60 { 0, 0, 0, 0, 0 }, /* EISA bridge */
61 { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */
62 { 0, INTC, INTD, INTA, INTB }, /* Slot 1 */
63 { INTB, INTB, INTB, INTB, INTB }, /* VGA */
64 { 0, 0, 0, 0, 0 }, /* Unused */
65 { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */
66 { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */
67 { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */
68};
69
70static inline int is_rm300_revd(void)
71{
72 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
73
74 return (csmsr & 0xa0) == 0x20;
75}
76
77int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
78{
79 if (is_rm300_revd())
80 return irq_tab_rm300d[slot][pin];
81
82 return irq_tab_rm200[slot][pin];
83}
84
85/* Do platform specific device initialization at pci_enable_device() time */
86int pcibios_plat_dev_init(struct pci_dev *dev)
87{
88 return 0;
89}
diff --git a/arch/mips/pci/fixup-tb0219.c b/arch/mips/pci/fixup-tb0219.c
new file mode 100644
index 000000000000..850a900f0eb4
--- /dev/null
+++ b/arch/mips/pci/fixup-tb0219.c
@@ -0,0 +1,66 @@
1/*
2 * fixup-tb0219.c, The TANBAC TB0219 specific PCI fixups.
3 *
4 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp>
5 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/init.h>
22#include <linux/pci.h>
23
24#include <asm/vr41xx/tb0219.h>
25
26int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
27{
28 int irq = -1;
29
30 switch (slot) {
31 case 12:
32 vr41xx_set_irq_trigger(TB0219_PCI_SLOT1_PIN,
33 TRIGGER_LEVEL,
34 SIGNAL_THROUGH);
35 vr41xx_set_irq_level(TB0219_PCI_SLOT1_PIN,
36 LEVEL_LOW);
37 irq = TB0219_PCI_SLOT1_IRQ;
38 break;
39 case 13:
40 vr41xx_set_irq_trigger(TB0219_PCI_SLOT2_PIN,
41 TRIGGER_LEVEL,
42 SIGNAL_THROUGH);
43 vr41xx_set_irq_level(TB0219_PCI_SLOT2_PIN,
44 LEVEL_LOW);
45 irq = TB0219_PCI_SLOT2_IRQ;
46 break;
47 case 14:
48 vr41xx_set_irq_trigger(TB0219_PCI_SLOT3_PIN,
49 TRIGGER_LEVEL,
50 SIGNAL_THROUGH);
51 vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN,
52 LEVEL_LOW);
53 irq = TB0219_PCI_SLOT3_IRQ;
54 break;
55 default:
56 break;
57 }
58
59 return irq;
60}
61
62/* Do platform specific device initialization at pci_enable_device() time */
63int pcibios_plat_dev_init(struct pci_dev *dev)
64{
65 return 0;
66}
diff --git a/arch/mips/pci/fixup-tb0226.c b/arch/mips/pci/fixup-tb0226.c
new file mode 100644
index 000000000000..61513d5d97da
--- /dev/null
+++ b/arch/mips/pci/fixup-tb0226.c
@@ -0,0 +1,85 @@
1/*
2 * fixup-tb0226.c, The TANBAC TB0226 specific PCI fixups.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/pci.h>
22
23#include <asm/vr41xx/tb0226.h>
24
25int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
26{
27 int irq = -1;
28
29 switch (slot) {
30 case 12:
31 vr41xx_set_irq_trigger(GD82559_1_PIN,
32 TRIGGER_LEVEL,
33 SIGNAL_THROUGH);
34 vr41xx_set_irq_level(GD82559_1_PIN, LEVEL_LOW);
35 irq = GD82559_1_IRQ;
36 break;
37 case 13:
38 vr41xx_set_irq_trigger(GD82559_2_PIN,
39 TRIGGER_LEVEL,
40 SIGNAL_THROUGH);
41 vr41xx_set_irq_level(GD82559_2_PIN, LEVEL_LOW);
42 irq = GD82559_2_IRQ;
43 break;
44 case 14:
45 switch (pin) {
46 case 1:
47 vr41xx_set_irq_trigger(UPD720100_INTA_PIN,
48 TRIGGER_LEVEL,
49 SIGNAL_THROUGH);
50 vr41xx_set_irq_level(UPD720100_INTA_PIN,
51 LEVEL_LOW);
52 irq = UPD720100_INTA_IRQ;
53 break;
54 case 2:
55 vr41xx_set_irq_trigger(UPD720100_INTB_PIN,
56 TRIGGER_LEVEL,
57 SIGNAL_THROUGH);
58 vr41xx_set_irq_level(UPD720100_INTB_PIN,
59 LEVEL_LOW);
60 irq = UPD720100_INTB_IRQ;
61 break;
62 case 3:
63 vr41xx_set_irq_trigger(UPD720100_INTC_PIN,
64 TRIGGER_LEVEL,
65 SIGNAL_THROUGH);
66 vr41xx_set_irq_level(UPD720100_INTC_PIN,
67 LEVEL_LOW);
68 irq = UPD720100_INTC_IRQ;
69 break;
70 default:
71 break;
72 }
73 break;
74 default:
75 break;
76 }
77
78 return irq;
79}
80
81/* Do platform specific device initialization at pci_enable_device() time */
82int pcibios_plat_dev_init(struct pci_dev *dev)
83{
84 return 0;
85}
diff --git a/arch/mips/pci/fixup-vr4133.c b/arch/mips/pci/fixup-vr4133.c
new file mode 100644
index 000000000000..03a0ff2fc993
--- /dev/null
+++ b/arch/mips/pci/fixup-vr4133.c
@@ -0,0 +1,204 @@
1/*
2 * arch/mips/vr41xx/nec-cmbvr4133/pci_fixup.c
3 *
4 * The NEC CMB-VR4133 Board specific PCI fixups.
5 *
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and
7 * Alex Sapkov <asapkov@ru.mvista.com>
8 *
9 * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 *
14 * Modified for support in 2.6
15 * Author: Manish Lachwani (mlachwani@mvista.com)
16 *
17 */
18#include <linux/config.h>
19#include <linux/init.h>
20#include <linux/pci.h>
21
22#include <asm/io.h>
23#include <asm/vr41xx/cmbvr4133.h>
24
25extern int vr4133_rockhopper;
26extern void ali_m1535plus_init(struct pci_dev *dev);
27extern void ali_m5229_init(struct pci_dev *dev);
28
29/* Do platform specific device initialization at pci_enable_device() time */
30int pcibios_plat_dev_init(struct pci_dev *dev)
31{
32 /*
33 * We have to reset AMD PCnet adapter on Rockhopper since
34 * PMON leaves it enabled and generating interrupts. This leads
35 * to a lock if some PCI device driver later enables the IRQ line
36 * shared with PCnet and there is no AMD PCnet driver to catch its
37 * interrupts.
38 */
39#ifdef CONFIG_ROCKHOPPER
40 if (dev->vendor == PCI_VENDOR_ID_AMD &&
41 dev->device == PCI_DEVICE_ID_AMD_LANCE) {
42 inl(pci_resource_start(dev, 0) + 0x18);
43 }
44#endif
45
46 /*
47 * we have to open the bridges' windows down to 0 because otherwise
48 * we cannot access ISA south bridge I/O registers that get mapped from
49 * 0. for example, 8259 PIC would be unaccessible without that
50 */
51 if(dev->vendor == PCI_VENDOR_ID_INTEL && dev->device == PCI_DEVICE_ID_INTEL_S21152BB) {
52 pci_write_config_byte(dev, PCI_IO_BASE, 0);
53 if(dev->bus->number == 0) {
54 pci_write_config_word(dev, PCI_IO_BASE_UPPER16, 0);
55 } else {
56 pci_write_config_word(dev, PCI_IO_BASE_UPPER16, 1);
57 }
58 }
59
60 return 0;
61}
62
63/*
64 * M1535 IRQ mapping
65 * Feel free to change this, although it shouldn't be needed
66 */
67#define M1535_IRQ_INTA 7
68#define M1535_IRQ_INTB 9
69#define M1535_IRQ_INTC 10
70#define M1535_IRQ_INTD 11
71
72#define M1535_IRQ_USB 9
73#define M1535_IRQ_IDE 14
74#define M1535_IRQ_IDE2 15
75#define M1535_IRQ_PS2 12
76#define M1535_IRQ_RTC 8
77#define M1535_IRQ_FDC 6
78#define M1535_IRQ_AUDIO 5
79#define M1535_IRQ_COM1 4
80#define M1535_IRQ_COM2 4
81#define M1535_IRQ_IRDA 3
82#define M1535_IRQ_KBD 1
83#define M1535_IRQ_TMR 0
84
85/* Rockhopper "slots" assignment; this is hard-coded ... */
86#define ROCKHOPPER_M5451_SLOT 1
87#define ROCKHOPPER_M1535_SLOT 2
88#define ROCKHOPPER_M5229_SLOT 11
89#define ROCKHOPPER_M5237_SLOT 15
90#define ROCKHOPPER_PMU_SLOT 12
91/* ... and hard-wired. */
92#define ROCKHOPPER_PCI1_SLOT 3
93#define ROCKHOPPER_PCI2_SLOT 4
94#define ROCKHOPPER_PCI3_SLOT 5
95#define ROCKHOPPER_PCI4_SLOT 6
96#define ROCKHOPPER_PCNET_SLOT 1
97
98#define M1535_IRQ_MASK(n) (1 << (n))
99
100#define M1535_IRQ_EDGE (M1535_IRQ_MASK(M1535_IRQ_TMR) | \
101 M1535_IRQ_MASK(M1535_IRQ_KBD) | \
102 M1535_IRQ_MASK(M1535_IRQ_COM1) | \
103 M1535_IRQ_MASK(M1535_IRQ_COM2) | \
104 M1535_IRQ_MASK(M1535_IRQ_IRDA) | \
105 M1535_IRQ_MASK(M1535_IRQ_RTC) | \
106 M1535_IRQ_MASK(M1535_IRQ_FDC) | \
107 M1535_IRQ_MASK(M1535_IRQ_PS2))
108
109#define M1535_IRQ_LEVEL (M1535_IRQ_MASK(M1535_IRQ_IDE) | \
110 M1535_IRQ_MASK(M1535_IRQ_USB) | \
111 M1535_IRQ_MASK(M1535_IRQ_INTA) | \
112 M1535_IRQ_MASK(M1535_IRQ_INTB) | \
113 M1535_IRQ_MASK(M1535_IRQ_INTC) | \
114 M1535_IRQ_MASK(M1535_IRQ_INTD))
115
116struct irq_map_entry {
117 u16 bus;
118 u8 slot;
119 u8 irq;
120};
121static struct irq_map_entry int_map[] = {
122 {1, ROCKHOPPER_M5451_SLOT, M1535_IRQ_AUDIO}, /* Audio controller */
123 {1, ROCKHOPPER_PCI1_SLOT, M1535_IRQ_INTD}, /* PCI slot #1 */
124 {1, ROCKHOPPER_PCI2_SLOT, M1535_IRQ_INTC}, /* PCI slot #2 */
125 {1, ROCKHOPPER_M5237_SLOT, M1535_IRQ_USB}, /* USB host controller */
126 {1, ROCKHOPPER_M5229_SLOT, IDE_PRIMARY_IRQ}, /* IDE controller */
127 {2, ROCKHOPPER_PCNET_SLOT, M1535_IRQ_INTD}, /* AMD Am79c973 on-board
128 ethernet */
129 {2, ROCKHOPPER_PCI3_SLOT, M1535_IRQ_INTB}, /* PCI slot #3 */
130 {2, ROCKHOPPER_PCI4_SLOT, M1535_IRQ_INTC} /* PCI slot #4 */
131};
132
133static int pci_intlines[] =
134 { M1535_IRQ_INTA, M1535_IRQ_INTB, M1535_IRQ_INTC, M1535_IRQ_INTD };
135
136/* Determine the Rockhopper IRQ line number for the PCI device */
137int rockhopper_get_irq(struct pci_dev *dev, u8 pin, u8 slot)
138{
139 struct pci_bus *bus;
140 int i;
141
142 bus = dev->bus;
143 if (bus == NULL)
144 return -1;
145
146 for (i = 0; i < sizeof (int_map) / sizeof (int_map[0]); i++) {
147 if (int_map[i].bus == bus->number && int_map[i].slot == slot) {
148 int line;
149 for (line = 0; line < 4; line++)
150 if (pci_intlines[line] == int_map[i].irq)
151 break;
152 if (line < 4)
153 return pci_intlines[(line + (pin - 1)) % 4];
154 else
155 return int_map[i].irq;
156 }
157 }
158 return -1;
159}
160
161#ifdef CONFIG_ROCKHOPPER
162void i8259_init(void)
163{
164 outb(0x11, 0x20); /* Master ICW1 */
165 outb(I8259_IRQ_BASE, 0x21); /* Master ICW2 */
166 outb(0x04, 0x21); /* Master ICW3 */
167 outb(0x01, 0x21); /* Master ICW4 */
168 outb(0xff, 0x21); /* Master IMW */
169
170 outb(0x11, 0xa0); /* Slave ICW1 */
171 outb(I8259_IRQ_BASE + 8, 0xa1); /* Slave ICW2 */
172 outb(0x02, 0xa1); /* Slave ICW3 */
173 outb(0x01, 0xa1); /* Slave ICW4 */
174 outb(0xff, 0xa1); /* Slave IMW */
175
176 outb(0x00, 0x4d0);
177 outb(0x02, 0x4d1); /* USB IRQ9 is level */
178}
179#endif
180
181int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
182{
183 extern int pci_probe_only;
184 pci_probe_only = 1;
185
186#ifdef CONFIG_ROCKHOPPER
187 if( dev->bus->number == 1 && vr4133_rockhopper ) {
188 if(slot == ROCKHOPPER_PCI1_SLOT || slot == ROCKHOPPER_PCI2_SLOT)
189 dev->irq = CMBVR41XX_INTA_IRQ;
190 else
191 dev->irq = rockhopper_get_irq(dev, pin, slot);
192 } else
193 dev->irq = CMBVR41XX_INTA_IRQ;
194#else
195 dev->irq = CMBVR41XX_INTA_IRQ;
196#endif
197
198 return dev->irq;
199}
200
201DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, ali_m1535plus_init);
202DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5229, ali_m5229_init);
203
204
diff --git a/arch/mips/pci/fixup-yosemite.c b/arch/mips/pci/fixup-yosemite.c
new file mode 100644
index 000000000000..81d77a587a51
--- /dev/null
+++ b/arch/mips/pci/fixup-yosemite.c
@@ -0,0 +1,41 @@
1/*
2 * Copyright 2003 PMC-Sierra
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#include <linux/kernel.h>
26#include <linux/init.h>
27#include <linux/pci.h>
28
29int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
30{
31 if (pin == 0)
32 return -1;
33
34 return 3; /* Everything goes to one irq bit */
35}
36
37/* Do platform specific device initialization at pci_enable_device() time */
38int pcibios_plat_dev_init(struct pci_dev *dev)
39{
40 return 0;
41}
diff --git a/arch/mips/pci/ops-au1000.c b/arch/mips/pci/ops-au1000.c
new file mode 100644
index 000000000000..c1c91ca0f9c2
--- /dev/null
+++ b/arch/mips/pci/ops-au1000.c
@@ -0,0 +1,325 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 pci support.
4 *
5 * Copyright 2001,2002,2003 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * Support for all devices (greater than 16) added by David Gathright.
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31#include <linux/config.h>
32#include <linux/types.h>
33#include <linux/pci.h>
34#include <linux/kernel.h>
35#include <linux/init.h>
36#include <linux/vmalloc.h>
37
38#include <asm/mach-au1x00/au1000.h>
39
40#undef DEBUG
41#ifdef DEBUG
42#define DBG(x...) printk(x)
43#else
44#define DBG(x...)
45#endif
46
47#define PCI_ACCESS_READ 0
48#define PCI_ACCESS_WRITE 1
49
50
51int (*board_pci_idsel)(unsigned int devsel, int assert);
52
53/* CP0 hazard avoidance. */
54#define BARRIER __asm__ __volatile__(".set noreorder\n\t" \
55 "nop; nop; nop; nop;\t" \
56 ".set reorder\n\t")
57
58void mod_wired_entry(int entry, unsigned long entrylo0,
59 unsigned long entrylo1, unsigned long entryhi,
60 unsigned long pagemask)
61{
62 unsigned long old_pagemask;
63 unsigned long old_ctx;
64
65 /* Save old context and create impossible VPN2 value */
66 old_ctx = read_c0_entryhi() & 0xff;
67 old_pagemask = read_c0_pagemask();
68 write_c0_index(entry);
69 BARRIER;
70 write_c0_pagemask(pagemask);
71 write_c0_entryhi(entryhi);
72 write_c0_entrylo0(entrylo0);
73 write_c0_entrylo1(entrylo1);
74 BARRIER;
75 tlb_write_indexed();
76 BARRIER;
77 write_c0_entryhi(old_ctx);
78 BARRIER;
79 write_c0_pagemask(old_pagemask);
80}
81
82struct vm_struct *pci_cfg_vm;
83static int pci_cfg_wired_entry;
84static int first_cfg = 1;
85unsigned long last_entryLo0, last_entryLo1;
86
87static int config_access(unsigned char access_type, struct pci_bus *bus,
88 unsigned int dev_fn, unsigned char where,
89 u32 * data)
90{
91#if defined( CONFIG_SOC_AU1500 ) || defined( CONFIG_SOC_AU1550 )
92 unsigned int device = PCI_SLOT(dev_fn);
93 unsigned int function = PCI_FUNC(dev_fn);
94 unsigned long offset, status;
95 unsigned long cfg_base;
96 unsigned long flags;
97 int error = PCIBIOS_SUCCESSFUL;
98 unsigned long entryLo0, entryLo1;
99
100 if (device > 19) {
101 *data = 0xffffffff;
102 return -1;
103 }
104
105 local_irq_save(flags);
106 au_writel(((0x2000 << 16) | (au_readl(Au1500_PCI_STATCMD) & 0xffff)),
107 Au1500_PCI_STATCMD);
108 au_sync_udelay(1);
109
110 /*
111 * We can't ioremap the entire pci config space because it's
112 * too large. Nor can we call ioremap dynamically because some
113 * device drivers use the pci config routines from within
114 * interrupt handlers and that becomes a problem in get_vm_area().
115 * We use one wired tlb to handle all config accesses for all
116 * busses. To improve performance, if the current device
117 * is the same as the last device accessed, we don't touch the
118 * tlb.
119 */
120 if (first_cfg) {
121 /* reserve a wired entry for pci config accesses */
122 first_cfg = 0;
123 pci_cfg_vm = get_vm_area(0x2000, 0);
124 if (!pci_cfg_vm)
125 panic (KERN_ERR "PCI unable to get vm area\n");
126 pci_cfg_wired_entry = read_c0_wired();
127 add_wired_entry(0, 0, (unsigned long)pci_cfg_vm->addr, PM_4K);
128 last_entryLo0 = last_entryLo1 = 0xffffffff;
129 }
130
131 /* Since the Au1xxx doesn't do the idsel timing exactly to spec,
132 * many board vendors implement their own off-chip idsel, so call
133 * it now. If it doesn't succeed, may as well bail out at this point.
134 */
135 if (board_pci_idsel) {
136 if (board_pci_idsel(device, 1) == 0) {
137 *data = 0xffffffff;
138 local_irq_restore(flags);
139 return -1;
140 }
141 }
142
143 /* setup the config window */
144 if (bus->number == 0) {
145 cfg_base = ((1<<device)<<11);
146 } else {
147 cfg_base = 0x80000000 | (bus->number<<16) | (device<<11);
148 }
149
150 /* setup the lower bits of the 36 bit address */
151 offset = (function << 8) | (where & ~0x3);
152 /* pick up any address that falls below the page mask */
153 offset |= cfg_base & ~PAGE_MASK;
154
155 /* page boundary */
156 cfg_base = cfg_base & PAGE_MASK;
157
158 entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7;
159 entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7;
160
161 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) {
162 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1,
163 (unsigned long)pci_cfg_vm->addr, PM_4K);
164 last_entryLo0 = entryLo0;
165 last_entryLo1 = entryLo1;
166 }
167
168 if (access_type == PCI_ACCESS_WRITE) {
169 au_writel(*data, (int)(pci_cfg_vm->addr + offset));
170 } else {
171 *data = au_readl((int)(pci_cfg_vm->addr + offset));
172 }
173 au_sync_udelay(2);
174
175 DBG("cfg_access %d bus->number %d dev %d at %x *data %x conf %x\n",
176 access_type, bus->number, device, where, *data, offset);
177
178 /* check master abort */
179 status = au_readl(Au1500_PCI_STATCMD);
180
181 if (status & (1<<29)) {
182 *data = 0xffffffff;
183 error = -1;
184 DBG("Au1x Master Abort\n");
185 } else if ((status >> 28) & 0xf) {
186 DBG("PCI ERR detected: status %x\n", status);
187 *data = 0xffffffff;
188 error = -1;
189 }
190
191 /* Take away the idsel.
192 */
193 if (board_pci_idsel) {
194 (void)board_pci_idsel(device, 0);
195 }
196
197 local_irq_restore(flags);
198 return error;
199#endif
200}
201
202static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
203 int where, u8 * val)
204{
205 u32 data;
206 int ret;
207
208 ret = config_access(PCI_ACCESS_READ, bus, devfn, where, &data);
209 if (where & 1)
210 data >>= 8;
211 if (where & 2)
212 data >>= 16;
213 *val = data & 0xff;
214 return ret;
215}
216
217
218static int read_config_word(struct pci_bus *bus, unsigned int devfn,
219 int where, u16 * val)
220{
221 u32 data;
222 int ret;
223
224 ret = config_access(PCI_ACCESS_READ, bus, devfn, where, &data);
225 if (where & 2)
226 data >>= 16;
227 *val = data & 0xffff;
228 return ret;
229}
230
231static int read_config_dword(struct pci_bus *bus, unsigned int devfn,
232 int where, u32 * val)
233{
234 int ret;
235
236 ret = config_access(PCI_ACCESS_READ, bus, devfn, where, val);
237 return ret;
238}
239
240static int
241write_config_byte(struct pci_bus *bus, unsigned int devfn, int where,
242 u8 val)
243{
244 u32 data = 0;
245
246 if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
247 return -1;
248
249 data = (data & ~(0xff << ((where & 3) << 3))) |
250 (val << ((where & 3) << 3));
251
252 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
253 return -1;
254
255 return PCIBIOS_SUCCESSFUL;
256}
257
258static int
259write_config_word(struct pci_bus *bus, unsigned int devfn, int where,
260 u16 val)
261{
262 u32 data = 0;
263
264 if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
265 return -1;
266
267 data = (data & ~(0xffff << ((where & 3) << 3))) |
268 (val << ((where & 3) << 3));
269
270 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
271 return -1;
272
273
274 return PCIBIOS_SUCCESSFUL;
275}
276
277static int
278write_config_dword(struct pci_bus *bus, unsigned int devfn, int where,
279 u32 val)
280{
281 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val))
282 return -1;
283
284 return PCIBIOS_SUCCESSFUL;
285}
286
287static int config_read(struct pci_bus *bus, unsigned int devfn,
288 int where, int size, u32 * val)
289{
290 switch (size) {
291 case 1: {
292 u8 _val;
293 int rc = read_config_byte(bus, devfn, where, &_val);
294 *val = _val;
295 return rc;
296 }
297 case 2: {
298 u16 _val;
299 int rc = read_config_word(bus, devfn, where, &_val);
300 *val = _val;
301 return rc;
302 }
303 default:
304 return read_config_dword(bus, devfn, where, val);
305 }
306}
307
308static int config_write(struct pci_bus *bus, unsigned int devfn,
309 int where, int size, u32 val)
310{
311 switch (size) {
312 case 1:
313 return write_config_byte(bus, devfn, where, (u8) val);
314 case 2:
315 return write_config_word(bus, devfn, where, (u16) val);
316 default:
317 return write_config_dword(bus, devfn, where, val);
318 }
319}
320
321
322struct pci_ops au1x_pci_ops = {
323 config_read,
324 config_write
325};
diff --git a/arch/mips/pci/ops-bonito64.c b/arch/mips/pci/ops-bonito64.c
new file mode 100644
index 000000000000..4b4e086a7eb1
--- /dev/null
+++ b/arch/mips/pci/ops-bonito64.c
@@ -0,0 +1,196 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * MIPS boards specific PCI support.
19 */
20#include <linux/config.h>
21#include <linux/types.h>
22#include <linux/pci.h>
23#include <linux/kernel.h>
24#include <linux/init.h>
25
26#include <asm/mips-boards/bonito64.h>
27
28#define PCI_ACCESS_READ 0
29#define PCI_ACCESS_WRITE 1
30
31/*
32 * PCI configuration cycle AD bus definition
33 */
34/* Type 0 */
35#define PCI_CFG_TYPE0_REG_SHF 0
36#define PCI_CFG_TYPE0_FUNC_SHF 8
37
38/* Type 1 */
39#define PCI_CFG_TYPE1_REG_SHF 0
40#define PCI_CFG_TYPE1_FUNC_SHF 8
41#define PCI_CFG_TYPE1_DEV_SHF 11
42#define PCI_CFG_TYPE1_BUS_SHF 16
43
44static int bonito64_pcibios_config_access(unsigned char access_type,
45 struct pci_bus *bus,
46 unsigned int devfn, int where,
47 u32 * data)
48{
49 unsigned char busnum = bus->number;
50 u32 dummy;
51 u64 pci_addr;
52
53 /* Algorithmics Bonito64 system controller. */
54
55 if ((busnum == 0) && (PCI_SLOT(devfn) > 21)) {
56 /* We number bus 0 devices from 0..21 */
57 return -1;
58 }
59
60#ifdef CONFIG_MIPS_BOARDS_GEN
61 if ((busnum == 0) && (PCI_SLOT(devfn) == 17)) {
62 /* MIPS Core boards have Bonito connected as device 17 */
63 return -1;
64 }
65#endif
66
67 /* Clear cause register bits */
68 BONITO_PCICMD |= (BONITO_PCICMD_MABORT_CLR |
69 BONITO_PCICMD_MTABORT_CLR);
70
71 /*
72 * Setup pattern to be used as PCI "address" for
73 * Type 0 cycle
74 */
75 if (busnum == 0) {
76 /* IDSEL */
77 pci_addr = (u64) 1 << (PCI_SLOT(devfn) + 10);
78 } else {
79 /* Bus number */
80 pci_addr = busnum << PCI_CFG_TYPE1_BUS_SHF;
81
82 /* Device number */
83 pci_addr |=
84 PCI_SLOT(devfn) << PCI_CFG_TYPE1_DEV_SHF;
85 }
86
87 /* Function (same for Type 0/1) */
88 pci_addr |= PCI_FUNC(devfn) << PCI_CFG_TYPE0_FUNC_SHF;
89
90 /* Register number (same for Type 0/1) */
91 pci_addr |= (where & ~0x3) << PCI_CFG_TYPE0_REG_SHF;
92
93 if (busnum == 0) {
94 /* Type 0 */
95 BONITO_PCIMAP_CFG = pci_addr >> 16;
96 } else {
97 /* Type 1 */
98 BONITO_PCIMAP_CFG = (pci_addr >> 16) | 0x10000;
99 }
100
101 pci_addr &= 0xffff;
102
103 /* Flush Bonito register block */
104 dummy = BONITO_PCIMAP_CFG;
105 iob(); /* sync */
106
107 /* Perform access */
108 if (access_type == PCI_ACCESS_WRITE) {
109 *(volatile u32 *) (_pcictrl_bonito_pcicfg + (u32)pci_addr) = *(u32 *) data;
110
111 /* Wait till done */
112 while (BONITO_PCIMSTAT & 0xF);
113 } else {
114 *(u32 *) data = *(volatile u32 *) (_pcictrl_bonito_pcicfg + (u32)pci_addr);
115 }
116
117 /* Detect Master/Target abort */
118 if (BONITO_PCICMD & (BONITO_PCICMD_MABORT_CLR |
119 BONITO_PCICMD_MTABORT_CLR)) {
120 /* Error occurred */
121
122 /* Clear bits */
123 BONITO_PCICMD |= (BONITO_PCICMD_MABORT_CLR |
124 BONITO_PCICMD_MTABORT_CLR);
125
126 return -1;
127 }
128
129 return 0;
130}
131
132
133/*
134 * We can't address 8 and 16 bit words directly. Instead we have to
135 * read/write a 32bit word and mask/modify the data we actually want.
136 */
137static int bonito64_pcibios_read(struct pci_bus *bus, unsigned int devfn,
138 int where, int size, u32 * val)
139{
140 u32 data = 0;
141
142 if ((size == 2) && (where & 1))
143 return PCIBIOS_BAD_REGISTER_NUMBER;
144 else if ((size == 4) && (where & 3))
145 return PCIBIOS_BAD_REGISTER_NUMBER;
146
147 if (bonito64_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where,
148 &data))
149 return -1;
150
151 if (size == 1)
152 *val = (data >> ((where & 3) << 3)) & 0xff;
153 else if (size == 2)
154 *val = (data >> ((where & 3) << 3)) & 0xffff;
155 else
156 *val = data;
157
158 return PCIBIOS_SUCCESSFUL;
159}
160
161static int bonito64_pcibios_write(struct pci_bus *bus, unsigned int devfn,
162 int where, int size, u32 val)
163{
164 u32 data = 0;
165
166 if ((size == 2) && (where & 1))
167 return PCIBIOS_BAD_REGISTER_NUMBER;
168 else if ((size == 4) && (where & 3))
169 return PCIBIOS_BAD_REGISTER_NUMBER;
170
171 if (size == 4)
172 data = val;
173 else {
174 if (bonito64_pcibios_config_access(PCI_ACCESS_READ, bus, devfn,
175 where, &data))
176 return -1;
177
178 if (size == 1)
179 data = (data & ~(0xff << ((where & 3) << 3))) |
180 (val << ((where & 3) << 3));
181 else if (size == 2)
182 data = (data & ~(0xffff << ((where & 3) << 3))) |
183 (val << ((where & 3) << 3));
184 }
185
186 if (bonito64_pcibios_config_access(PCI_ACCESS_WRITE, bus, devfn, where,
187 &data))
188 return -1;
189
190 return PCIBIOS_SUCCESSFUL;
191}
192
193struct pci_ops bonito64_pci_ops = {
194 .read = bonito64_pcibios_read,
195 .write = bonito64_pcibios_write
196};
diff --git a/arch/mips/pci/ops-ddb5074.c b/arch/mips/pci/ops-ddb5074.c
new file mode 100644
index 000000000000..89f97bef4fc4
--- /dev/null
+++ b/arch/mips/pci/ops-ddb5074.c
@@ -0,0 +1,271 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/ddb5xxx/ddb5476/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#include <linux/pci.h>
18#include <linux/kernel.h>
19#include <linux/types.h>
20
21#include <asm/addrspace.h>
22#include <asm/debug.h>
23
24#include <asm/ddb5xxx/ddb5xxx.h>
25
26/*
27 * config_swap structure records what set of pdar/pmr are used
28 * to access pci config space. It also provides a place hold the
29 * original values for future restoring.
30 */
31struct pci_config_swap {
32 u32 pdar;
33 u32 pmr;
34 u32 config_base;
35 u32 config_size;
36 u32 pdar_backup;
37 u32 pmr_backup;
38};
39
40/*
41 * On DDB5476, we have one set of swap registers
42 */
43struct pci_config_swap ext_pci_swap = {
44 DDB_PCIW0,
45 DDB_PCIINIT0,
46 DDB_PCI_CONFIG_BASE,
47 DDB_PCI_CONFIG_SIZE
48};
49
50static int pci_config_workaround = 1;
51
52/*
53 * access config space
54 */
55static inline u32 ddb_access_config_base(struct pci_config_swap *swap, u32 bus, /* 0 means top level bus */
56 u32 slot_num)
57{
58 u32 pci_addr = 0;
59 u32 pciinit_offset = 0;
60 u32 virt_addr = swap->config_base;
61 u32 option;
62
63 if (pci_config_workaround) {
64 if (slot_num == 5)
65 slot_num = 14;
66 } else {
67 if (slot_num == 5)
68 return DDB_BASE + DDB_PCI_BASE;
69 }
70
71 /* minimum pdar (window) size is 2MB */
72 db_assert(swap->config_size >= (2 << 20));
73
74 db_assert(slot_num < (1 << 5));
75 db_assert(bus < (1 << 8));
76
77 /* backup registers */
78 swap->pdar_backup = ddb_in32(swap->pdar);
79 swap->pmr_backup = ddb_in32(swap->pmr);
80
81 /* set the pdar (pci window) register */
82 ddb_set_pdar(swap->pdar, swap->config_base, swap->config_size, 32, /* 32 bit wide */
83 0, /* not on local memory bus */
84 0); /* not visible from PCI bus (N/A) */
85
86 /*
87 * calcuate the absolute pci config addr;
88 * according to the spec, we start scanning from adr:11 (0x800)
89 */
90 if (bus == 0) {
91 /* type 0 config */
92 pci_addr = 0x00040000 << slot_num;
93 } else {
94 /* type 1 config */
95 pci_addr = 0x00040000 << slot_num;
96 panic
97 ("ddb_access_config_base: we don't support type 1 config Yet");
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_dev *dev, u32 where, u32 * val)
131{
132 u32 bus, slot_num, func_num;
133 u32 base;
134
135 db_assert((where & 3) == 0);
136 db_assert(where < (1 << 8));
137
138 /* check if the bus is top-level */
139 if (dev->bus->parent != NULL) {
140 bus = dev->bus->number;
141 db_assert(bus != 0);
142 } else {
143 bus = 0;
144 }
145
146 slot_num = PCI_SLOT(dev->devfn);
147 func_num = PCI_FUNC(dev->devfn);
148 base = ddb_access_config_base(swap, bus, slot_num);
149 *val = *(volatile u32 *) (base + (func_num << 8) + where);
150 ddb_close_config_base(swap);
151 return PCIBIOS_SUCCESSFUL;
152}
153
154static int read_config_word(struct pci_config_swap *swap,
155 struct pci_dev *dev, u32 where, u16 * val)
156{
157 int status;
158 u32 result;
159
160 db_assert((where & 1) == 0);
161
162 status = read_config_dword(swap, dev, where & ~3, &result);
163 if (where & 2)
164 result >>= 16;
165 *val = result & 0xffff;
166 return status;
167}
168
169static int read_config_byte(struct pci_config_swap *swap,
170 struct pci_dev *dev, u32 where, u8 * val)
171{
172 int status;
173 u32 result;
174
175 status = read_config_dword(swap, dev, where & ~3, &result);
176 if (where & 1)
177 result >>= 8;
178 if (where & 2)
179 result >>= 16;
180 *val = result & 0xff;
181 return status;
182}
183
184static int write_config_dword(struct pci_config_swap *swap,
185 struct pci_dev *dev, u32 where, u32 val)
186{
187 u32 bus, slot_num, func_num;
188 u32 base;
189
190 db_assert((where & 3) == 0);
191 db_assert(where < (1 << 8));
192
193 /* check if the bus is top-level */
194 if (dev->bus->parent != NULL) {
195 bus = dev->bus->number;
196 db_assert(bus != 0);
197 } else {
198 bus = 0;
199 }
200
201 slot_num = PCI_SLOT(dev->devfn);
202 func_num = PCI_FUNC(dev->devfn);
203 base = ddb_access_config_base(swap, bus, slot_num);
204 *(volatile u32 *) (base + (func_num << 8) + where) = val;
205 ddb_close_config_base(swap);
206 return PCIBIOS_SUCCESSFUL;
207}
208
209static int write_config_word(struct pci_config_swap *swap,
210 struct pci_dev *dev, u32 where, u16 val)
211{
212 int status, shift = 0;
213 u32 result;
214
215 db_assert((where & 1) == 0);
216
217 status = read_config_dword(swap, dev, where & ~3, &result);
218 if (status != PCIBIOS_SUCCESSFUL)
219 return status;
220
221 if (where & 2)
222 shift += 16;
223 result &= ~(0xffff << shift);
224 result |= val << shift;
225 return write_config_dword(swap, dev, where & ~3, result);
226}
227
228static int write_config_byte(struct pci_config_swap *swap,
229 struct pci_dev *dev, u32 where, u8 val)
230{
231 int status, shift = 0;
232 u32 result;
233
234 status = read_config_dword(swap, dev, where & ~3, &result);
235 if (status != PCIBIOS_SUCCESSFUL)
236 return status;
237
238 if (where & 2)
239 shift += 16;
240 if (where & 1)
241 shift += 8;
242 result &= ~(0xff << shift);
243 result |= val << shift;
244 return write_config_dword(swap, dev, where & ~3, result);
245}
246
247#define MAKE_PCI_OPS(prefix, rw, unitname, unittype, pciswap) \
248static int prefix##_##rw##_config_##unitname(struct pci_dev *dev, int where, unittype val) \
249{ \
250 return rw##_config_##unitname(pciswap, \
251 dev, \
252 where, \
253 val); \
254}
255
256MAKE_PCI_OPS(extpci, read, byte, u8 *, &ext_pci_swap)
257 MAKE_PCI_OPS(extpci, read, word, u16 *, &ext_pci_swap)
258 MAKE_PCI_OPS(extpci, read, dword, u32 *, &ext_pci_swap)
259
260 MAKE_PCI_OPS(extpci, write, byte, u8, &ext_pci_swap)
261 MAKE_PCI_OPS(extpci, write, word, u16, &ext_pci_swap)
262 MAKE_PCI_OPS(extpci, write, dword, u32, &ext_pci_swap)
263
264struct pci_ops ddb5476_ext_pci_ops = {
265 extpci_read_config_byte,
266 extpci_read_config_word,
267 extpci_read_config_dword,
268 extpci_write_config_byte,
269 extpci_write_config_word,
270 extpci_write_config_dword
271};
diff --git a/arch/mips/pci/ops-ddb5476.c b/arch/mips/pci/ops-ddb5476.c
new file mode 100644
index 000000000000..12da58e75ec7
--- /dev/null
+++ b/arch/mips/pci/ops-ddb5476.c
@@ -0,0 +1,286 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/ddb5xxx/ddb5476/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#include <linux/pci.h>
18#include <linux/kernel.h>
19#include <linux/types.h>
20
21#include <asm/addrspace.h>
22#include <asm/debug.h>
23
24#include <asm/ddb5xxx/ddb5xxx.h>
25
26/*
27 * config_swap structure records what set of pdar/pmr are used
28 * to access pci config space. It also provides a place hold the
29 * original values for future restoring.
30 */
31struct pci_config_swap {
32 u32 pdar;
33 u32 pmr;
34 u32 config_base;
35 u32 config_size;
36 u32 pdar_backup;
37 u32 pmr_backup;
38};
39
40/*
41 * On DDB5476, we have one set of swap registers
42 */
43struct pci_config_swap ext_pci_swap = {
44 DDB_PCIW0,
45 DDB_PCIINIT0,
46 DDB_PCI_CONFIG_BASE,
47 DDB_PCI_CONFIG_SIZE
48};
49
50static int pci_config_workaround = 1;
51
52/*
53 * access config space
54 */
55static inline u32 ddb_access_config_base(struct pci_config_swap *swap, u32 bus, /* 0 means top level bus */
56 u32 slot_num)
57{
58 u32 pci_addr = 0;
59 u32 pciinit_offset = 0;
60 u32 virt_addr = swap->config_base;
61 u32 option;
62
63 if (pci_config_workaround) {
64 /* [jsun] work around Vrc5476 controller itself, returnning
65 * slot 0 essentially makes vrc5476 invisible
66 */
67 if (slot_num == 12)
68 slot_num = 0;
69
70#if 0
71 /* BUG : skip P2P bridge for now */
72 if (slot_num == 5)
73 slot_num = 0;
74#endif
75
76 } else {
77 /* now we have to be hornest, returning the true
78 * PCI config headers for vrc5476
79 */
80 if (slot_num == 12) {
81 swap->pdar_backup = ddb_in32(swap->pdar);
82 swap->pmr_backup = ddb_in32(swap->pmr);
83 return DDB_BASE + DDB_PCI_BASE;
84 }
85 }
86
87 /* minimum pdar (window) size is 2MB */
88 db_assert(swap->config_size >= (2 << 20));
89
90 db_assert(slot_num < (1 << 5));
91 db_assert(bus < (1 << 8));
92
93 /* backup registers */
94 swap->pdar_backup = ddb_in32(swap->pdar);
95 swap->pmr_backup = ddb_in32(swap->pmr);
96
97 /* set the pdar (pci window) register */
98 ddb_set_pdar(swap->pdar, swap->config_base, swap->config_size, 32, /* 32 bit wide */
99 0, /* not on local memory bus */
100 0); /* not visible from PCI bus (N/A) */
101
102 /*
103 * calcuate the absolute pci config addr;
104 * according to the spec, we start scanning from adr:11 (0x800)
105 */
106 if (bus == 0) {
107 /* type 0 config */
108 pci_addr = 0x800 << slot_num;
109 } else {
110 /* type 1 config */
111 pci_addr = (bus << 16) | (slot_num << 11);
112 /* panic("ddb_access_config_base: we don't support type 1 config Yet"); */
113 }
114
115 /*
116 * if pci_addr is less than pci config window size, we set
117 * pciinit_offset to 0 and adjust the virt_address.
118 * Otherwise we will try to adjust pciinit_offset.
119 */
120 if (pci_addr < swap->config_size) {
121 virt_addr = KSEG1ADDR(swap->config_base + pci_addr);
122 pciinit_offset = 0;
123 } else {
124 db_assert((pci_addr & (swap->config_size - 1)) == 0);
125 virt_addr = KSEG1ADDR(swap->config_base);
126 pciinit_offset = pci_addr;
127 }
128
129 /* set the pmr register */
130 option = DDB_PCI_ACCESS_32;
131 if (bus != 0)
132 option |= DDB_PCI_CFGTYPE1;
133 ddb_set_pmr(swap->pmr, DDB_PCICMD_CFG, pciinit_offset, option);
134
135 return virt_addr;
136}
137
138static inline void ddb_close_config_base(struct pci_config_swap *swap)
139{
140 ddb_out32(swap->pdar, swap->pdar_backup);
141 ddb_out32(swap->pmr, swap->pmr_backup);
142}
143
144static int read_config_dword(struct pci_config_swap *swap,
145 struct pci_dev *dev, u32 where, u32 * val)
146{
147 u32 bus, slot_num, func_num;
148 u32 base;
149
150 db_assert((where & 3) == 0);
151 db_assert(where < (1 << 8));
152
153 /* check if the bus is top-level */
154 if (dev->bus->parent != NULL) {
155 bus = dev->bus->number;
156 db_assert(bus != 0);
157 } else {
158 bus = 0;
159 }
160
161 slot_num = PCI_SLOT(dev->devfn);
162 func_num = PCI_FUNC(dev->devfn);
163 base = ddb_access_config_base(swap, bus, slot_num);
164 *val = *(volatile u32 *) (base + (func_num << 8) + where);
165 ddb_close_config_base(swap);
166 return PCIBIOS_SUCCESSFUL;
167}
168
169static int read_config_word(struct pci_config_swap *swap,
170 struct pci_dev *dev, u32 where, u16 * val)
171{
172 int status;
173 u32 result;
174
175 db_assert((where & 1) == 0);
176
177 status = read_config_dword(swap, dev, where & ~3, &result);
178 if (where & 2)
179 result >>= 16;
180 *val = result & 0xffff;
181 return status;
182}
183
184static int read_config_byte(struct pci_config_swap *swap,
185 struct pci_dev *dev, u32 where, u8 * val)
186{
187 int status;
188 u32 result;
189
190 status = read_config_dword(swap, dev, where & ~3, &result);
191 if (where & 1)
192 result >>= 8;
193 if (where & 2)
194 result >>= 16;
195 *val = result & 0xff;
196 return status;
197}
198
199static int write_config_dword(struct pci_config_swap *swap,
200 struct pci_dev *dev, u32 where, u32 val)
201{
202 u32 bus, slot_num, func_num;
203 u32 base;
204
205 db_assert((where & 3) == 0);
206 db_assert(where < (1 << 8));
207
208 /* check if the bus is top-level */
209 if (dev->bus->parent != NULL) {
210 bus = dev->bus->number;
211 db_assert(bus != 0);
212 } else {
213 bus = 0;
214 }
215
216 slot_num = PCI_SLOT(dev->devfn);
217 func_num = PCI_FUNC(dev->devfn);
218 base = ddb_access_config_base(swap, bus, slot_num);
219 *(volatile u32 *) (base + (func_num << 8) + where) = val;
220 ddb_close_config_base(swap);
221 return PCIBIOS_SUCCESSFUL;
222}
223
224static int write_config_word(struct pci_config_swap *swap,
225 struct pci_dev *dev, u32 where, u16 val)
226{
227 int status, shift = 0;
228 u32 result;
229
230 db_assert((where & 1) == 0);
231
232 status = read_config_dword(swap, dev, where & ~3, &result);
233 if (status != PCIBIOS_SUCCESSFUL)
234 return status;
235
236 if (where & 2)
237 shift += 16;
238 result &= ~(0xffff << shift);
239 result |= val << shift;
240 return write_config_dword(swap, dev, where & ~3, result);
241}
242
243static int write_config_byte(struct pci_config_swap *swap,
244 struct pci_dev *dev, u32 where, u8 val)
245{
246 int status, shift = 0;
247 u32 result;
248
249 status = read_config_dword(swap, dev, where & ~3, &result);
250 if (status != PCIBIOS_SUCCESSFUL)
251 return status;
252
253 if (where & 2)
254 shift += 16;
255 if (where & 1)
256 shift += 8;
257 result &= ~(0xff << shift);
258 result |= val << shift;
259 return write_config_dword(swap, dev, where & ~3, result);
260}
261
262#define MAKE_PCI_OPS(prefix, rw, unitname, unittype, pciswap) \
263static int prefix##_##rw##_config_##unitname(struct pci_dev *dev, int where, unittype val) \
264{ \
265 return rw##_config_##unitname(pciswap, \
266 dev, \
267 where, \
268 val); \
269}
270
271MAKE_PCI_OPS(extpci, read, byte, u8 *, &ext_pci_swap)
272 MAKE_PCI_OPS(extpci, read, word, u16 *, &ext_pci_swap)
273 MAKE_PCI_OPS(extpci, read, dword, u32 *, &ext_pci_swap)
274
275 MAKE_PCI_OPS(extpci, write, byte, u8, &ext_pci_swap)
276 MAKE_PCI_OPS(extpci, write, word, u16, &ext_pci_swap)
277 MAKE_PCI_OPS(extpci, write, dword, u32, &ext_pci_swap)
278
279struct pci_ops ddb5476_ext_pci_ops = {
280 extpci_read_config_byte,
281 extpci_read_config_word,
282 extpci_read_config_dword,
283 extpci_write_config_byte,
284 extpci_write_config_word,
285 extpci_write_config_dword
286};
diff --git a/arch/mips/pci/ops-ddb5477.c b/arch/mips/pci/ops-ddb5477.c
new file mode 100644
index 000000000000..e955443fedf9
--- /dev/null
+++ b/arch/mips/pci/ops-ddb5477.c
@@ -0,0 +1,278 @@
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-gt64111.c b/arch/mips/pci/ops-gt64111.c
new file mode 100644
index 000000000000..c5b0fc184c2a
--- /dev/null
+++ b/arch/mips/pci/ops-gt64111.c
@@ -0,0 +1,100 @@
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) 1995, 1996, 1997, 2002 by Ralf Baechle
7 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
8 */
9#include <linux/types.h>
10#include <linux/pci.h>
11#include <linux/kernel.h>
12#include <linux/init.h>
13
14#include <asm/pci.h>
15#include <asm/io.h>
16#include <asm/gt64120.h>
17
18#include <asm/cobalt/cobalt.h>
19
20/*
21 * Accessing device 31 hangs the GT64120. Not sure if this will also hang
22 * the GT64111, let's be paranoid for now.
23 */
24static inline int pci_range_ck(struct pci_bus *bus, unsigned int devfn)
25{
26 if (bus->number == 0 && devfn == PCI_DEVFN(31, 0))
27 return -1;
28
29 return 0;
30}
31
32static int gt64111_pci_read_config(struct pci_bus *bus, unsigned int devfn,
33 int where, int size, u32 * val)
34{
35 if (pci_range_ck(bus, devfn))
36 return PCIBIOS_DEVICE_NOT_FOUND;
37
38 switch (size) {
39 case 4:
40 PCI_CFG_SET(devfn, where);
41 *val = GALILEO_INL(GT_PCI0_CFGDATA_OFS);
42 return PCIBIOS_SUCCESSFUL;
43
44 case 2:
45 PCI_CFG_SET(devfn, (where & ~0x3));
46 *val = GALILEO_INL(GT_PCI0_CFGDATA_OFS)
47 >> ((where & 3) * 8);
48 return PCIBIOS_SUCCESSFUL;
49
50 case 1:
51 PCI_CFG_SET(devfn, (where & ~0x3));
52 *val = GALILEO_INL(GT_PCI0_CFGDATA_OFS)
53 >> ((where & 3) * 8);
54 return PCIBIOS_SUCCESSFUL;
55 }
56
57 return PCIBIOS_BAD_REGISTER_NUMBER;
58}
59
60static int gt64111_pci_write_config(struct pci_bus *bus, unsigned int devfn,
61 int where, int size, u32 val)
62{
63 u32 tmp;
64
65 if (pci_range_ck(bus, devfn))
66 return PCIBIOS_DEVICE_NOT_FOUND;
67
68 switch (size) {
69 case 4:
70 PCI_CFG_SET(devfn, where);
71 GALILEO_OUTL(val, GT_PCI0_CFGDATA_OFS);
72
73 return PCIBIOS_SUCCESSFUL;
74
75 case 2:
76 PCI_CFG_SET(devfn, (where & ~0x3));
77 tmp = GALILEO_INL(GT_PCI0_CFGDATA_OFS);
78 tmp &= ~(0xffff << ((where & 0x3) * 8));
79 tmp |= (val << ((where & 0x3) * 8));
80 GALILEO_OUTL(tmp, GT_PCI0_CFGDATA_OFS);
81
82 return PCIBIOS_SUCCESSFUL;
83
84 case 1:
85 PCI_CFG_SET(devfn, (where & ~0x3));
86 tmp = GALILEO_INL(GT_PCI0_CFGDATA_OFS);
87 tmp &= ~(0xff << ((where & 0x3) * 8));
88 tmp |= (val << ((where & 0x3) * 8));
89 GALILEO_OUTL(tmp, GT_PCI0_CFGDATA_OFS);
90
91 return PCIBIOS_SUCCESSFUL;
92 }
93
94 return PCIBIOS_BAD_REGISTER_NUMBER;
95}
96
97struct pci_ops gt64111_pci_ops = {
98 .read = gt64111_pci_read_config,
99 .write = gt64111_pci_write_config,
100};
diff --git a/arch/mips/pci/ops-gt64120.c b/arch/mips/pci/ops-gt64120.c
new file mode 100644
index 000000000000..7b99dfa33dfc
--- /dev/null
+++ b/arch/mips/pci/ops-gt64120.c
@@ -0,0 +1,154 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 */
18#include <linux/types.h>
19#include <linux/pci.h>
20#include <linux/kernel.h>
21
22#include <asm/gt64120.h>
23
24#define PCI_ACCESS_READ 0
25#define PCI_ACCESS_WRITE 1
26
27/*
28 * PCI configuration cycle AD bus definition
29 */
30/* Type 0 */
31#define PCI_CFG_TYPE0_REG_SHF 0
32#define PCI_CFG_TYPE0_FUNC_SHF 8
33
34/* Type 1 */
35#define PCI_CFG_TYPE1_REG_SHF 0
36#define PCI_CFG_TYPE1_FUNC_SHF 8
37#define PCI_CFG_TYPE1_DEV_SHF 11
38#define PCI_CFG_TYPE1_BUS_SHF 16
39
40static int gt64120_pcibios_config_access(unsigned char access_type,
41 struct pci_bus *bus, unsigned int devfn, int where, u32 * data)
42{
43 unsigned char busnum = bus->number;
44 u32 intr;
45
46 if ((busnum == 0) && (PCI_SLOT(devfn) == 0))
47 /* Galileo itself is devfn 0, don't move it around */
48 return -1;
49
50 if ((busnum == 0) && (devfn >= PCI_DEVFN(31, 0)))
51 return -1; /* Because of a bug in the galileo (for slot 31). */
52
53 /* Clear cause register bits */
54 GT_WRITE(GT_INTRCAUSE_OFS, ~(GT_INTRCAUSE_MASABORT0_BIT |
55 GT_INTRCAUSE_TARABORT0_BIT));
56
57 /* Setup address */
58 GT_WRITE(GT_PCI0_CFGADDR_OFS,
59 (busnum << GT_PCI0_CFGADDR_BUSNUM_SHF) |
60 (devfn << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
61 ((where / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
62 GT_PCI0_CFGADDR_CONFIGEN_BIT);
63
64 if (access_type == PCI_ACCESS_WRITE) {
65 if (busnum == 0 && PCI_SLOT(devfn) == 0) {
66 /*
67 * The Galileo system controller is acting
68 * differently than other devices.
69 */
70 GT_WRITE(GT_PCI0_CFGDATA_OFS, *data);
71 } else
72 __GT_WRITE(GT_PCI0_CFGDATA_OFS, *data);
73 } else {
74 if (busnum == 0 && PCI_SLOT(devfn) == 0) {
75 /*
76 * The Galileo system controller is acting
77 * differently than other devices.
78 */
79 *data = GT_READ(GT_PCI0_CFGDATA_OFS);
80 } else
81 *data = __GT_READ(GT_PCI0_CFGDATA_OFS);
82 }
83
84 /* Check for master or target abort */
85 intr = GT_READ(GT_INTRCAUSE_OFS);
86
87 if (intr & (GT_INTRCAUSE_MASABORT0_BIT | GT_INTRCAUSE_TARABORT0_BIT)) {
88 /* Error occurred */
89
90 /* Clear bits */
91 GT_WRITE(GT_INTRCAUSE_OFS, ~(GT_INTRCAUSE_MASABORT0_BIT |
92 GT_INTRCAUSE_TARABORT0_BIT));
93
94 return -1;
95 }
96
97 return 0;
98}
99
100
101/*
102 * We can't address 8 and 16 bit words directly. Instead we have to
103 * read/write a 32bit word and mask/modify the data we actually want.
104 */
105static int gt64120_pcibios_read(struct pci_bus *bus, unsigned int devfn,
106 int where, int size, u32 * val)
107{
108 u32 data = 0;
109
110 if (gt64120_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where,
111 &data))
112 return PCIBIOS_DEVICE_NOT_FOUND;
113
114 if (size == 1)
115 *val = (data >> ((where & 3) << 3)) & 0xff;
116 else if (size == 2)
117 *val = (data >> ((where & 3) << 3)) & 0xffff;
118 else
119 *val = data;
120
121 return PCIBIOS_SUCCESSFUL;
122}
123
124static int gt64120_pcibios_write(struct pci_bus *bus, unsigned int devfn,
125 int where, int size, u32 val)
126{
127 u32 data = 0;
128
129 if (size == 4)
130 data = val;
131 else {
132 if (gt64120_pcibios_config_access(PCI_ACCESS_READ, bus, devfn,
133 where, &data))
134 return PCIBIOS_DEVICE_NOT_FOUND;
135
136 if (size == 1)
137 data = (data & ~(0xff << ((where & 3) << 3))) |
138 (val << ((where & 3) << 3));
139 else if (size == 2)
140 data = (data & ~(0xffff << ((where & 3) << 3))) |
141 (val << ((where & 3) << 3));
142 }
143
144 if (gt64120_pcibios_config_access(PCI_ACCESS_WRITE, bus, devfn, where,
145 &data))
146 return PCIBIOS_DEVICE_NOT_FOUND;
147
148 return PCIBIOS_SUCCESSFUL;
149}
150
151struct pci_ops gt64120_pci_ops = {
152 .read = gt64120_pcibios_read,
153 .write = gt64120_pcibios_write
154};
diff --git a/arch/mips/pci/ops-gt96100.c b/arch/mips/pci/ops-gt96100.c
new file mode 100644
index 000000000000..9e4ea6627e21
--- /dev/null
+++ b/arch/mips/pci/ops-gt96100.c
@@ -0,0 +1,169 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Galileo EV96100 board specific pci support.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This file was derived from Carsten Langgaard's
11 * arch/mips/mips-boards/generic/pci.c
12 *
13 * Carsten Langgaard, carstenl@mips.com
14 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version.
20 *
21 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * You should have received a copy of the GNU General Public License along
33 * with this program; if not, write to the Free Software Foundation, Inc.,
34 * 675 Mass Ave, Cambridge, MA 02139, USA.
35 */
36#include <linux/types.h>
37#include <linux/pci.h>
38#include <linux/kernel.h>
39#include <linux/init.h>
40
41#include <asm/delay.h>
42#include <asm/gt64120.h>
43#include <asm/galileo-boards/ev96100.h>
44
45#define PCI_ACCESS_READ 0
46#define PCI_ACCESS_WRITE 1
47
48static int static gt96100_config_access(unsigned char access_type,
49 struct pci_bus *bus, unsigned int devfn, int where, u32 * data)
50{
51 unsigned char bus = bus->number;
52 u32 intr;
53
54 /*
55 * Because of a bug in the galileo (for slot 31).
56 */
57 if (bus == 0 && devfn >= PCI_DEVFN(31, 0))
58 return PCIBIOS_DEVICE_NOT_FOUND;
59
60 /* Clear cause register bits */
61 GT_WRITE(GT_INTRCAUSE_OFS, ~(GT_INTRCAUSE_MASABORT0_BIT |
62 GT_INTRCAUSE_TARABORT0_BIT));
63
64 /* Setup address */
65 GT_WRITE(GT_PCI0_CFGADDR_OFS,
66 (bus << GT_PCI0_CFGADDR_BUSNUM_SHF) |
67 (devfn << GT_PCI0_CFGADDR_FUNCTNUM_SHF) |
68 ((where / 4) << GT_PCI0_CFGADDR_REGNUM_SHF) |
69 GT_PCI0_CFGADDR_CONFIGEN_BIT);
70 udelay(2);
71
72
73 if (access_type == PCI_ACCESS_WRITE) {
74 if (devfn != 0)
75 *data = le32_to_cpu(*data);
76 GT_WRITE(GT_PCI0_CFGDATA_OFS, *data);
77 } else {
78 *data = GT_READ(GT_PCI0_CFGDATA_OFS);
79 if (devfn != 0)
80 *data = le32_to_cpu(*data);
81 }
82
83 udelay(2);
84
85 /* Check for master or target abort */
86 intr = GT_READ(GT_INTRCAUSE_OFS);
87
88 if (intr & (GT_INTRCAUSE_MASABORT0_BIT | GT_INTRCAUSE_TARABORT0_BIT)) {
89 /* Error occured */
90
91 /* Clear bits */
92 GT_WRITE(GT_INTRCAUSE_OFS, ~(GT_INTRCAUSE_MASABORT0_BIT |
93 GT_INTRCAUSE_TARABORT0_BIT));
94 return -1;
95 }
96 return 0;
97}
98
99/*
100 * We can't address 8 and 16 bit words directly. Instead we have to
101 * read/write a 32bit word and mask/modify the data we actually want.
102 */
103static int gt96100_pcibios_read(struct pci_bus *bus, unsigned int devfn,
104 int where, int size, u32 * val)
105{
106 u32 data = 0;
107
108 if (gt96100_config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
109 return PCIBIOS_DEVICE_NOT_FOUND;
110
111 switch (size) {
112 case 1:
113 *val = (data >> ((where & 3) << 3)) & 0xff;
114 break;
115
116 case 2:
117 *val = (data >> ((where & 3) << 3)) & 0xffff;
118 break;
119
120 case 4:
121 *val = data;
122 break;
123 }
124 return PCIBIOS_SUCCESSFUL;
125}
126
127static int gt96100_pcibios_write(struct pci_bus *bus, unsigned int devfn,
128 int where, int size, u32 val)
129{
130 u32 data = 0;
131
132 switch (size) {
133 case 1:
134 if (gt96100_config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
135 return -1;
136
137 data = (data & ~(0xff << ((where & 3) << 3))) |
138 (val << ((where & 3) << 3));
139
140 if (gt96100_config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
141 return -1;
142
143 return PCIBIOS_SUCCESSFUL;
144
145 case 2:
146 if (gt96100_config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
147 return -1;
148
149 data = (data & ~(0xffff << ((where & 3) << 3))) |
150 (val << ((where & 3) << 3));
151
152 if (gt96100_config_access(PCI_ACCESS_WRITE, dev, where, &data))
153 return -1;
154
155
156 return PCIBIOS_SUCCESSFUL;
157
158 case 4:
159 if (gt96100_config_access(PCI_ACCESS_WRITE, dev, where, &val))
160 return -1;
161
162 return PCIBIOS_SUCCESSFUL;
163 }
164}
165
166struct pci_ops gt96100_pci_ops = {
167 .read = gt96100_pcibios_read,
168 .write = gt96100_pcibios_write
169};
diff --git a/arch/mips/pci/ops-it8172.c b/arch/mips/pci/ops-it8172.c
new file mode 100644
index 000000000000..b7a8b9a6f9db
--- /dev/null
+++ b/arch/mips/pci/ops-it8172.c
@@ -0,0 +1,215 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 system controller specific pci support.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32#include <linux/types.h>
33#include <linux/pci.h>
34#include <linux/kernel.h>
35#include <linux/init.h>
36
37#include <asm/it8172/it8172.h>
38#include <asm/it8172/it8172_pci.h>
39
40#define PCI_ACCESS_READ 0
41#define PCI_ACCESS_WRITE 1
42
43#undef DEBUG
44#ifdef DEBUG
45#define DBG(x...) printk(x)
46#else
47#define DBG(x...)
48#endif
49
50static struct resource pci_mem_resource_1;
51
52static struct resource pci_io_resource = {
53 "io pci IO space",
54 0x14018000,
55 0x17FFFFFF,
56 IORESOURCE_IO
57};
58
59static struct resource pci_mem_resource_0 = {
60 "ext pci memory space 0/1",
61 0x10101000,
62 0x13FFFFFF,
63 IORESOURCE_MEM,
64 &pci_mem_resource_0,
65 NULL,
66 &pci_mem_resource_1
67};
68
69static struct resource pci_mem_resource_1 = {
70 "ext pci memory space 2/3",
71 0x1A000000,
72 0x1FBFFFFF,
73 IORESOURCE_MEM,
74 &pci_mem_resource_0,
75 NULL,
76 NULL
77};
78
79extern struct pci_ops it8172_pci_ops;
80
81struct pci_controller it8172_controller = {
82 .pci_ops = &it8172_pci_ops,
83 .io_resource = &pci_io_resource,
84 .mem_resource = &pci_mem_resource_0,
85};
86
87static int it8172_pcibios_config_access(unsigned char access_type,
88 struct pci_bus *bus,
89 unsigned int devfn, int where,
90 u32 * data)
91{
92 /*
93 * config cycles are on 4 byte boundary only
94 */
95
96 /* Setup address */
97 IT_WRITE(IT_CONFADDR, (bus->number << IT_BUSNUM_SHF) |
98 (devfn << IT_FUNCNUM_SHF) | (where & ~0x3));
99
100 if (access_type == PCI_ACCESS_WRITE) {
101 IT_WRITE(IT_CONFDATA, *data);
102 } else {
103 IT_READ(IT_CONFDATA, *data);
104 }
105
106 /*
107 * Revisit: check for master or target abort.
108 */
109 return 0;
110}
111
112
113/*
114 * We can't address 8 and 16 bit words directly. Instead we have to
115 * read/write a 32bit word and mask/modify the data we actually want.
116 */
117static write_config(struct pci_bus *bus, unsigned int devfn, int where,
118 int size, u32 val)
119{
120 u32 data = 0;
121
122 switch (size) {
123 case 1:
124 if (it8172_pcibios_config_access
125 (PCI_ACCESS_READ, dev, where, &data))
126 return -1;
127
128 *val = (data >> ((where & 3) << 3)) & 0xff;
129
130 return PCIBIOS_SUCCESSFUL;
131
132 case 2:
133
134 if (where & 1)
135 return PCIBIOS_BAD_REGISTER_NUMBER;
136
137 if (it8172_pcibios_config_access
138 (PCI_ACCESS_READ, dev, where, &data))
139 return -1;
140
141 *val = (data >> ((where & 3) << 3)) & 0xffff;
142 DBG("cfg read word: bus %d dev_fn %x where %x: val %x\n",
143 dev->bus->number, dev->devfn, where, *val);
144
145 return PCIBIOS_SUCCESSFUL;
146
147 case 4:
148
149 if (where & 3)
150 return PCIBIOS_BAD_REGISTER_NUMBER;
151
152 if (it8172_pcibios_config_access
153 (PCI_ACCESS_READ, dev, where, &data))
154 return -1;
155
156 *val = data;
157
158 return PCIBIOS_SUCCESSFUL;
159 }
160}
161
162
163static write_config(struct pci_bus *bus, unsigned int devfn, int where,
164 int size, u32 val)
165{
166 u32 data = 0;
167
168 switch (size) {
169 case 1:
170 if (it8172_pcibios_config_access
171 (PCI_ACCESS_READ, dev, where, &data))
172 return -1;
173
174 data = (data & ~(0xff << ((where & 3) << 3))) |
175 (val << ((where & 3) << 3));
176
177 if (it8172_pcibios_config_access
178 (PCI_ACCESS_WRITE, dev, where, &data))
179 return -1;
180
181 return PCIBIOS_SUCCESSFUL;
182
183 case 2:
184 if (where & 1)
185 return PCIBIOS_BAD_REGISTER_NUMBER;
186
187 if (it8172_pcibios_config_access
188 (PCI_ACCESS_READ, dev, where, &data))
189 eturn - 1;
190
191 data = (data & ~(0xffff << ((where & 3) << 3))) |
192 (val << ((where & 3) << 3));
193
194 if (it8172_pcibios_config_access
195 (PCI_ACCESS_WRITE, dev, where, &data))
196 return -1;
197
198 return PCIBIOS_SUCCESSFUL;
199
200 case 4:
201 if (where & 3)
202 return PCIBIOS_BAD_REGISTER_NUMBER;
203
204 if (it8172_pcibios_config_access
205 (PCI_ACCESS_WRITE, dev, where, &val))
206 return -1;
207
208 return PCIBIOS_SUCCESSFUL;
209 }
210}
211
212struct pci_ops it8172_pci_ops = {
213 .read = read_config,
214 .write = write_config,
215};
diff --git a/arch/mips/pci/ops-mace.c b/arch/mips/pci/ops-mace.c
new file mode 100644
index 000000000000..8008e31c5e81
--- /dev/null
+++ b/arch/mips/pci/ops-mace.c
@@ -0,0 +1,91 @@
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) 2000, 2001 Keith M Wesolowski
7 */
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/pci.h>
11#include <linux/types.h>
12#include <asm/pci.h>
13#include <asm/ip32/mace.h>
14
15#if 0
16# define DPRINTK(args...) printk(args);
17#else
18# define DPRINTK(args...)
19#endif
20
21/*
22 * O2 has up to 5 PCI devices connected into the MACE bridge. The device
23 * map looks like this:
24 *
25 * 0 aic7xxx 0
26 * 1 aic7xxx 1
27 * 2 expansion slot
28 * 3 N/C
29 * 4 N/C
30 */
31
32#define chkslot(_bus,_devfn) \
33do { \
34 if ((_bus)->number > 0 || PCI_SLOT (_devfn) < 1 \
35 || PCI_SLOT (_devfn) > 3) \
36 return PCIBIOS_DEVICE_NOT_FOUND; \
37} while (0)
38
39#define mkaddr(_devfn, _reg) \
40((((_devfn) & 0xffUL) << 8) | ((_reg) & 0xfcUL))
41
42static int
43mace_pci_read_config(struct pci_bus *bus, unsigned int devfn,
44 int reg, int size, u32 *val)
45{
46 chkslot(bus, devfn);
47 mace->pci.config_addr = mkaddr(devfn, reg);
48 switch (size) {
49 case 1:
50 *val = mace->pci.config_data.b[(reg & 3) ^ 3];
51 break;
52 case 2:
53 *val = mace->pci.config_data.w[((reg >> 1) & 1) ^ 1];
54 break;
55 case 4:
56 *val = mace->pci.config_data.l;
57 break;
58 }
59
60 DPRINTK("read%d: reg=%08x,val=%02x\n", size * 8, reg, *val);
61
62 return PCIBIOS_SUCCESSFUL;
63}
64
65static int
66mace_pci_write_config(struct pci_bus *bus, unsigned int devfn,
67 int reg, int size, u32 val)
68{
69 chkslot(bus, devfn);
70 mace->pci.config_addr = mkaddr(devfn, reg);
71 switch (size) {
72 case 1:
73 mace->pci.config_data.b[(reg & 3) ^ 3] = val;
74 break;
75 case 2:
76 mace->pci.config_data.w[((reg >> 1) & 1) ^ 1] = val;
77 break;
78 case 4:
79 mace->pci.config_data.l = val;
80 break;
81 }
82
83 DPRINTK("write%d: reg=%08x,val=%02x\n", size * 8, reg, val);
84
85 return PCIBIOS_SUCCESSFUL;
86}
87
88struct pci_ops mace_pci_ops = {
89 .read = mace_pci_read_config,
90 .write = mace_pci_write_config,
91};
diff --git a/arch/mips/pci/ops-marvell.c b/arch/mips/pci/ops-marvell.c
new file mode 100644
index 000000000000..1ac5c59199d1
--- /dev/null
+++ b/arch/mips/pci/ops-marvell.c
@@ -0,0 +1,93 @@
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) 2003, 2004 Ralf Baechle (ralf@linux-mips.org)
7 */
8#include <linux/kernel.h>
9#include <linux/types.h>
10#include <linux/pci.h>
11
12#include <asm/marvell.h>
13
14static int mv_read_config(struct pci_bus *bus, unsigned int devfn,
15 int where, int size, u32 * val)
16{
17 struct mv_pci_controller *mvbc = bus->sysdata;
18 unsigned long address_reg, data_reg;
19 u32 address;
20
21 address_reg = mvbc->config_addr;
22 data_reg = mvbc->config_vreg;
23
24 /* Accessing device 31 crashes those Marvells. Since years.
25 Will they ever make sane controllers ... */
26 if (PCI_SLOT(devfn) == 31)
27 return PCIBIOS_DEVICE_NOT_FOUND;
28
29 address = (bus->number << 16) | (devfn << 8) |
30 (where & 0xfc) | 0x80000000;
31
32 /* start the configuration cycle */
33 MV_WRITE(address_reg, address);
34
35 switch (size) {
36 case 1:
37 *val = MV_READ_8(data_reg + (where & 0x3));
38 break;
39
40 case 2:
41 *val = MV_READ_16(data_reg + (where & 0x3));
42 break;
43
44 case 4:
45 *val = MV_READ(data_reg);
46 break;
47 }
48
49 return PCIBIOS_SUCCESSFUL;
50}
51
52static int mv_write_config(struct pci_bus *bus, unsigned int devfn,
53 int where, int size, u32 val)
54{
55 struct mv_pci_controller *mvbc = bus->sysdata;
56 unsigned long address_reg, data_reg;
57 u32 address;
58
59 address_reg = mvbc->config_addr;
60 data_reg = mvbc->config_vreg;
61
62 /* Accessing device 31 crashes those Marvells. Since years.
63 Will they ever make sane controllers ... */
64 if (PCI_SLOT(devfn) == 31)
65 return PCIBIOS_DEVICE_NOT_FOUND;
66
67 address = (bus->number << 16) | (devfn << 8) |
68 (where & 0xfc) | 0x80000000;
69
70 /* start the configuration cycle */
71 MV_WRITE(address_reg, address);
72
73 switch (size) {
74 case 1:
75 MV_WRITE_8(data_reg + (where & 0x3), val);
76 break;
77
78 case 2:
79 MV_WRITE_16(data_reg + (where & 0x3), val);
80 break;
81
82 case 4:
83 MV_WRITE(data_reg, val);
84 break;
85 }
86
87 return PCIBIOS_SUCCESSFUL;
88}
89
90struct pci_ops mv_pci_ops = {
91 .read = mv_read_config,
92 .write = mv_write_config
93};
diff --git a/arch/mips/pci/ops-msc.c b/arch/mips/pci/ops-msc.c
new file mode 100644
index 000000000000..7bc099643a9d
--- /dev/null
+++ b/arch/mips/pci/ops-msc.c
@@ -0,0 +1,169 @@
1/*
2 * Copyright (C) 1999, 2000, 2004, 2005 MIPS Technologies, Inc.
3 * All rights reserved.
4 * Authors: Carsten Langgaard <carstenl@mips.com>
5 * Maciej W. Rozycki <macro@mips.com>
6 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 *
21 * MIPS boards specific PCI support.
22 *
23 */
24#include <linux/config.h>
25#include <linux/types.h>
26#include <linux/pci.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29
30#include <asm/mips-boards/msc01_pci.h>
31
32#define PCI_ACCESS_READ 0
33#define PCI_ACCESS_WRITE 1
34
35/*
36 * PCI configuration cycle AD bus definition
37 */
38/* Type 0 */
39#define PCI_CFG_TYPE0_REG_SHF 0
40#define PCI_CFG_TYPE0_FUNC_SHF 8
41
42/* Type 1 */
43#define PCI_CFG_TYPE1_REG_SHF 0
44#define PCI_CFG_TYPE1_FUNC_SHF 8
45#define PCI_CFG_TYPE1_DEV_SHF 11
46#define PCI_CFG_TYPE1_BUS_SHF 16
47
48static int msc_pcibios_config_access(unsigned char access_type,
49 struct pci_bus *bus, unsigned int devfn, int where, u32 * data)
50{
51 unsigned char busnum = bus->number;
52 unsigned char type;
53 u32 intr;
54
55#ifdef CONFIG_MIPS_BOARDS_GEN
56 if ((busnum == 0) && (PCI_SLOT(devfn) == 17)) {
57 /* MIPS Core boards have SOCit connected as device 17 */
58 return -1;
59 }
60#endif
61
62 /* Clear status register bits. */
63 MSC_WRITE(MSC01_PCI_INTSTAT,
64 (MSC01_PCI_INTCFG_MA_BIT | MSC01_PCI_INTCFG_TA_BIT));
65
66 /* Setup address */
67 if (busnum == 0)
68 type = 0; /* Type 0 */
69 else
70 type = 1; /* Type 1 */
71
72 MSC_WRITE(MSC01_PCI_CFGADDR,
73 ((busnum << MSC01_PCI_CFGADDR_BNUM_SHF) |
74 (PCI_SLOT(devfn) << MSC01_PCI_CFGADDR_DNUM_SHF)
75 | (PCI_FUNC(devfn) <<
76 MSC01_PCI_CFGADDR_FNUM_SHF) | ((where /
77 4) <<
78 MSC01_PCI_CFGADDR_RNUM_SHF)
79 | (type)));
80
81 /* Perform access */
82 if (access_type == PCI_ACCESS_WRITE)
83 MSC_WRITE(MSC01_PCI_CFGDATA, *data);
84 else
85 MSC_READ(MSC01_PCI_CFGDATA, *data);
86
87 /* Detect Master/Target abort */
88 MSC_READ(MSC01_PCI_INTSTAT, intr);
89 if (intr & (MSC01_PCI_INTCFG_MA_BIT |
90 MSC01_PCI_INTCFG_TA_BIT)) {
91 /* Error occurred */
92
93 /* Clear bits */
94 MSC_READ(MSC01_PCI_INTSTAT, intr);
95 MSC_WRITE(MSC01_PCI_INTSTAT,
96 (MSC01_PCI_INTCFG_MA_BIT |
97 MSC01_PCI_INTCFG_TA_BIT));
98
99 return -1;
100 }
101
102 return 0;
103}
104
105
106/*
107 * We can't address 8 and 16 bit words directly. Instead we have to
108 * read/write a 32bit word and mask/modify the data we actually want.
109 */
110static int msc_pcibios_read(struct pci_bus *bus, unsigned int devfn,
111 int where, int size, u32 * val)
112{
113 u32 data = 0;
114
115 if ((size == 2) && (where & 1))
116 return PCIBIOS_BAD_REGISTER_NUMBER;
117 else if ((size == 4) && (where & 3))
118 return PCIBIOS_BAD_REGISTER_NUMBER;
119
120 if (msc_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where,
121 &data))
122 return -1;
123
124 if (size == 1)
125 *val = (data >> ((where & 3) << 3)) & 0xff;
126 else if (size == 2)
127 *val = (data >> ((where & 3) << 3)) & 0xffff;
128 else
129 *val = data;
130
131 return PCIBIOS_SUCCESSFUL;
132}
133
134static int msc_pcibios_write(struct pci_bus *bus, unsigned int devfn,
135 int where, int size, u32 val)
136{
137 u32 data = 0;
138
139 if ((size == 2) && (where & 1))
140 return PCIBIOS_BAD_REGISTER_NUMBER;
141 else if ((size == 4) && (where & 3))
142 return PCIBIOS_BAD_REGISTER_NUMBER;
143
144 if (size == 4)
145 data = val;
146 else {
147 if (msc_pcibios_config_access(PCI_ACCESS_READ, bus, devfn,
148 where, &data))
149 return -1;
150
151 if (size == 1)
152 data = (data & ~(0xff << ((where & 3) << 3))) |
153 (val << ((where & 3) << 3));
154 else if (size == 2)
155 data = (data & ~(0xffff << ((where & 3) << 3))) |
156 (val << ((where & 3) << 3));
157 }
158
159 if (msc_pcibios_config_access(PCI_ACCESS_WRITE, bus, devfn, where,
160 &data))
161 return -1;
162
163 return PCIBIOS_SUCCESSFUL;
164}
165
166struct pci_ops msc_pci_ops = {
167 .read = msc_pcibios_read,
168 .write = msc_pcibios_write
169};
diff --git a/arch/mips/pci/ops-nile4.c b/arch/mips/pci/ops-nile4.c
new file mode 100644
index 000000000000..a7169928b351
--- /dev/null
+++ b/arch/mips/pci/ops-nile4.c
@@ -0,0 +1,147 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/pci.h>
4#include <asm/bootinfo.h>
5
6#include <asm/lasat/lasat.h>
7#include <asm/gt64120.h>
8#include <asm/nile4.h>
9
10#define PCI_ACCESS_READ 0
11#define PCI_ACCESS_WRITE 1
12
13#define LO(reg) (reg / 4)
14#define HI(reg) (reg / 4 + 1)
15
16volatile unsigned long *const vrc_pciregs = (void *) Vrc5074_BASE;
17
18static spinlock_t nile4_pci_lock;
19
20static int nile4_pcibios_config_access(unsigned char access_type,
21 struct pci_bus *bus, unsigned int devfn, int where, u32 * val)
22{
23 unsigned char busnum = bus->number;
24 u32 adr, mask, err;
25
26 if ((busnum == 0) && (PCI_SLOT(devfn) > 8))
27 /* The addressing scheme chosen leaves room for just
28 * 8 devices on the first busnum (besides the PCI
29 * controller itself) */
30 return PCIBIOS_DEVICE_NOT_FOUND;
31
32 if ((busnum == 0) && (devfn == PCI_DEVFN(0, 0))) {
33 /* Access controller registers directly */
34 if (access_type == PCI_ACCESS_WRITE) {
35 vrc_pciregs[(0x200 + where) >> 2] = *val;
36 } else {
37 *val = vrc_pciregs[(0x200 + where) >> 2];
38 }
39 return PCIBIOS_SUCCESSFUL;
40 }
41
42 /* Temporarily map PCI Window 1 to config space */
43 mask = vrc_pciregs[LO(NILE4_PCIINIT1)];
44 vrc_pciregs[LO(NILE4_PCIINIT1)] = 0x0000001a | (busnum ? 0x200 : 0);
45
46 /* Clear PCI Error register. This also clears the Error Type
47 * bits in the Control register */
48 vrc_pciregs[LO(NILE4_PCIERR)] = 0;
49 vrc_pciregs[HI(NILE4_PCIERR)] = 0;
50
51 /* Setup address */
52 if (busnum == 0)
53 adr =
54 KSEG1ADDR(PCI_WINDOW1) +
55 ((1 << (PCI_SLOT(devfn) + 15)) | (PCI_FUNC(devfn) << 8)
56 | (where & ~3));
57 else
58 adr = KSEG1ADDR(PCI_WINDOW1) | (busnum << 16) | (devfn << 8) |
59 (where & ~3);
60
61 if (access_type == PCI_ACCESS_WRITE)
62 *(u32 *) adr = *val;
63 else
64 *val = *(u32 *) adr;
65
66 /* Check for master or target abort */
67 err = (vrc_pciregs[HI(NILE4_PCICTRL)] >> 5) & 0x7;
68
69 /* Restore PCI Window 1 */
70 vrc_pciregs[LO(NILE4_PCIINIT1)] = mask;
71
72 if (err)
73 return PCIBIOS_DEVICE_NOT_FOUND;
74
75 return PCIBIOS_SUCCESSFUL;
76}
77
78static int nile4_pcibios_read(struct pci_bus *bus, unsigned int devfn,
79 int where, int size, u32 * val)
80{
81 unsigned long flags;
82 u32 data = 0;
83 int err;
84
85 if ((size == 2) && (where & 1))
86 return PCIBIOS_BAD_REGISTER_NUMBER;
87 else if ((size == 4) && (where & 3))
88 return PCIBIOS_BAD_REGISTER_NUMBER;
89
90 spin_lock_irqsave(&nile4_pci_lock, flags);
91 err = nile4_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where,
92 &data);
93 spin_unlock_irqrestore(&nile4_pci_lock, flags);
94
95 if (err)
96 return err;
97
98 if (size == 1)
99 *val = (data >> ((where & 3) << 3)) & 0xff;
100 else if (size == 2)
101 *val = (data >> ((where & 3) << 3)) & 0xffff;
102 else
103 *val = data;
104
105 return PCIBIOS_SUCCESSFUL;
106}
107
108static int nile4_pcibios_write(struct pci_bus *bus, unsigned int devfn,
109 int where, int size, u32 val)
110{
111 unsigned long flags;
112 u32 data = 0;
113 int err;
114
115 if ((size == 2) && (where & 1))
116 return PCIBIOS_BAD_REGISTER_NUMBER;
117 else if ((size == 4) && (where & 3))
118 return PCIBIOS_BAD_REGISTER_NUMBER;
119
120 spin_lock_irqsave(&nile4_pci_lock, flags);
121 err = nile4_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where,
122 &data);
123 spin_unlock_irqrestore(&nile4_pci_lock, flags);
124
125 if (err)
126 return err;
127
128 if (size == 1)
129 data = (data & ~(0xff << ((where & 3) << 3))) |
130 (val << ((where & 3) << 3));
131 else if (size == 2)
132 data = (data & ~(0xffff << ((where & 3) << 3))) |
133 (val << ((where & 3) << 3));
134 else
135 data = val;
136
137 if (nile4_pcibios_config_access
138 (PCI_ACCESS_WRITE, bus, devfn, where, &data))
139 return -1;
140
141 return PCIBIOS_SUCCESSFUL;
142}
143
144struct pci_ops nile4_pci_ops = {
145 .read = nile4_pcibios_read,
146 .write = nile4_pcibios_write,
147};
diff --git a/arch/mips/pci/ops-sni.c b/arch/mips/pci/ops-sni.c
new file mode 100644
index 000000000000..62bdd19c7f8e
--- /dev/null
+++ b/arch/mips/pci/ops-sni.c
@@ -0,0 +1,89 @@
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 * SNI specific PCI support for RM200/RM300.
7 *
8 * Copyright (C) 1997 - 2000, 2003 Ralf Baechle <ralf@linux-mips.org>
9 */
10#include <linux/kernel.h>
11#include <linux/pci.h>
12#include <linux/types.h>
13#include <asm/sni.h>
14
15/*
16 * It seems that on the RM200 only lower 3 bits of the 5 bit PCI device
17 * address are decoded. We therefore manually have to reject attempts at
18 * reading outside this range. Being on the paranoid side we only do this
19 * test for bus 0 and hope forwarding and decoding work properly for any
20 * subordinated busses.
21 *
22 * ASIC PCI only supports type 1 config cycles.
23 */
24static int set_config_address(unsigned int busno, unsigned int devfn, int reg)
25{
26 if ((devfn > 255) || (reg > 255))
27 return PCIBIOS_BAD_REGISTER_NUMBER;
28
29 if (busno == 0 && devfn >= PCI_DEVFN(8, 0))
30 return PCIBIOS_DEVICE_NOT_FOUND;
31
32 *(volatile u32 *)PCIMT_CONFIG_ADDRESS =
33 ((busno & 0xff) << 16) |
34 ((devfn & 0xff) << 8) |
35 (reg & 0xfc);
36
37 return PCIBIOS_SUCCESSFUL;
38}
39
40static int pcimt_read(struct pci_bus *bus, unsigned int devfn, int reg,
41 int size, u32 * val)
42{
43 int res;
44
45 if ((res = set_config_address(bus->number, devfn, reg)))
46 return res;
47
48 switch (size) {
49 case 1:
50 *val = *(volatile u8 *) (PCIMT_CONFIG_DATA + (reg & 3));
51 break;
52 case 2:
53 *val = *(volatile u16 *) (PCIMT_CONFIG_DATA + (reg & 2));
54 break;
55 case 4:
56 *val = *(volatile u32 *) PCIMT_CONFIG_DATA;
57 break;
58 }
59
60 return 0;
61}
62
63static int pcimt_write(struct pci_bus *bus, unsigned int devfn, int reg,
64 int size, u32 val)
65{
66 int res;
67
68 if ((res = set_config_address(bus->number, devfn, reg)))
69 return res;
70
71 switch (size) {
72 case 1:
73 *(volatile u8 *) (PCIMT_CONFIG_DATA + (reg & 3)) = val;
74 break;
75 case 2:
76 *(volatile u16 *) (PCIMT_CONFIG_DATA + (reg & 2)) = val;
77 break;
78 case 4:
79 *(volatile u32 *) PCIMT_CONFIG_DATA = val;
80 break;
81 }
82
83 return 0;
84}
85
86struct pci_ops sni_pci_ops = {
87 .read = pcimt_read,
88 .write = pcimt_write,
89};
diff --git a/arch/mips/pci/ops-titan-ht.c b/arch/mips/pci/ops-titan-ht.c
new file mode 100644
index 000000000000..46c636c27e06
--- /dev/null
+++ b/arch/mips/pci/ops-titan-ht.c
@@ -0,0 +1,125 @@
1/*
2 * Copyright 2003 PMC-Sierra
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#include <linux/types.h>
27#include <linux/pci.h>
28#include <linux/kernel.h>
29#include <linux/slab.h>
30#include <linux/delay.h>
31#include <asm/io.h>
32
33#include <asm/titan_dep.h>
34
35static int titan_ht_config_read_dword(struct pci_bus *bus, unsigned int devfn,
36 int offset, u32 * val)
37{
38 volatile uint32_t address;
39 int busno;
40
41 busno = bus->number;
42
43 address = (busno << 16) | (devfn << 8) | (offset & 0xfc) | 0x80000000;
44 if (busno != 0)
45 address |= 1;
46
47 /*
48 * RM9000 HT Errata: Issue back to back HT config
49 * transcations. Issue a BIU sync before and
50 * after the HT cycle
51 */
52
53 *(volatile int32_t *) 0xfb0000f0 |= 0x2;
54
55 udelay(30);
56
57 *(volatile int32_t *) 0xfb0006f8 = address;
58 *(val) = *(volatile int32_t *) 0xfb0006fc;
59
60 udelay(30);
61
62 * (volatile int32_t *) 0xfb0000f0 |= 0x2;
63
64 return PCIBIOS_SUCCESSFUL;
65}
66
67static int titan_ht_config_read(struct pci_bus *bus, unsigned int devfn,
68 int offset, int size, u32 * val)
69{
70 uint32_t dword;
71
72 titan_ht_config_read_dword(bus, devfn, offset, &dword);
73
74 dword >>= ((offset & 3) << 3);
75 dword &= (0xffffffffU >> ((4 - size) << 8));
76
77 return PCIBIOS_SUCCESSFUL;
78}
79
80static inline int titan_ht_config_write_dword(struct pci_bus *bus,
81 unsigned int devfn, int offset, u32 val)
82{
83 volatile uint32_t address;
84 int busno;
85
86 busno = bus->number;
87
88 address = (busno << 16) | (devfn << 8) | (offset & 0xfc) | 0x80000000;
89 if (busno != 0)
90 address |= 1;
91
92 *(volatile int32_t *) 0xfb0000f0 |= 0x2;
93
94 udelay(30);
95
96 *(volatile int32_t *) 0xfb0006f8 = address;
97 *(volatile int32_t *) 0xfb0006fc = val;
98
99 udelay(30);
100
101 *(volatile int32_t *) 0xfb0000f0 |= 0x2;
102
103 return PCIBIOS_SUCCESSFUL;
104}
105
106static int titan_ht_config_write(struct pci_bus *bus, unsigned int devfn,
107 int offset, int size, u32 val)
108{
109 uint32_t val1, val2, mask;
110
111 titan_ht_config_read_dword(bus, devfn, offset, &val2);
112
113 val1 = val << ((offset & 3) << 3);
114 mask = ~(0xffffffffU >> ((4 - size) << 8));
115 val2 &= ~(mask << ((offset & 3) << 8));
116
117 titan_ht_config_write_dword(bus, devfn, offset, val1 | val2);
118
119 return PCIBIOS_SUCCESSFUL;
120}
121
122struct pci_ops titan_ht_pci_ops = {
123 .read = titan_ht_config_read,
124 .write = titan_ht_config_write,
125};
diff --git a/arch/mips/pci/ops-titan.c b/arch/mips/pci/ops-titan.c
new file mode 100644
index 000000000000..233ec6f2054d
--- /dev/null
+++ b/arch/mips/pci/ops-titan.c
@@ -0,0 +1,100 @@
1/*
2 * Copyright 2003 PMC-Sierra
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#include <linux/types.h>
26#include <linux/pci.h>
27#include <linux/kernel.h>
28
29#include <asm/titan_dep.h>
30
31static int titan_read_config(struct pci_bus *bus, unsigned int devfn, int reg,
32 int size, u32 * val)
33{
34 uint32_t address, tmp;
35 int dev, busno, func;
36
37 busno = bus->number;
38 dev = PCI_SLOT(devfn);
39 func = PCI_FUNC(devfn);
40
41 address = (busno << 16) | (dev << 11) | (func << 8) |
42 (reg & 0xfc) | 0x80000000;
43
44
45 /* start the configuration cycle */
46 TITAN_WRITE(TITAN_PCI_0_CONFIG_ADDRESS, address);
47 tmp = TITAN_READ(TITAN_PCI_0_CONFIG_DATA) >> ((reg & 3) << 3);
48
49 switch (size) {
50 case 1:
51 tmp &= 0xff;
52 case 2:
53 tmp &= 0xffff;
54 }
55 *val = tmp;
56
57 return PCIBIOS_SUCCESSFUL;
58}
59
60static int titan_write_config(struct pci_bus *bus, unsigned int devfn, int reg,
61 int size, u32 val)
62{
63 uint32_t address;
64 int dev, busno, func;
65
66 busno = bus->number;
67 dev = PCI_SLOT(devfn);
68 func = PCI_FUNC(devfn);
69
70 address = (busno << 16) | (dev << 11) | (func << 8) |
71 (reg & 0xfc) | 0x80000000;
72
73 /* start the configuration cycle */
74 TITAN_WRITE(TITAN_PCI_0_CONFIG_ADDRESS, address);
75
76 /* write the data */
77 switch (size) {
78 case 1:
79 TITAN_WRITE_8(TITAN_PCI_0_CONFIG_DATA + (~reg & 0x3), val);
80 break;
81
82 case 2:
83 TITAN_WRITE_16(TITAN_PCI_0_CONFIG_DATA + (~reg & 0x2), val);
84 break;
85
86 case 4:
87 TITAN_WRITE(TITAN_PCI_0_CONFIG_DATA, val);
88 break;
89 }
90
91 return PCIBIOS_SUCCESSFUL;
92}
93
94/*
95 * Titan PCI structure
96 */
97struct pci_ops titan_pci_ops = {
98 titan_read_config,
99 titan_write_config,
100};
diff --git a/arch/mips/pci/ops-tx3927.c b/arch/mips/pci/ops-tx3927.c
new file mode 100644
index 000000000000..0e0daadc303d
--- /dev/null
+++ b/arch/mips/pci/ops-tx3927.c
@@ -0,0 +1,391 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ahennessy@mvista.com
5 *
6 * Copyright (C) 2000-2001 Toshiba Corporation
7 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
8 *
9 * Based on arch/mips/ddb5xxx/ddb5477/pci_ops.c
10 *
11 * Define the pci_ops for JMR3927.
12 *
13 * Much of the code is derived from the original DDB5074 port by
14 * Geert Uytterhoeven <geert@sonycom.com>
15 *
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version.
20 *
21 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * You should have received a copy of the GNU General Public License along
33 * with this program; if not, write to the Free Software Foundation, Inc.,
34 * 675 Mass Ave, Cambridge, MA 02139, USA.
35 */
36#include <linux/types.h>
37#include <linux/pci.h>
38#include <linux/kernel.h>
39#include <linux/init.h>
40
41#include <asm/addrspace.h>
42#include <asm/jmr3927/jmr3927.h>
43#include <asm/debug.h>
44
45static inline int mkaddr(unsigned char bus, unsigned char dev_fn,
46 unsigned char where)
47{
48 if (bus == 0 && dev_fn >= PCI_DEVFN(TX3927_PCIC_MAX_DEVNU, 0))
49 return PCIBIOS_DEVICE_NOT_FOUND;
50
51 tx3927_pcicptr->ica = ((bus & 0xff) << 0x10) |
52 ((dev_fn & 0xff) << 0x08) |
53 (where & 0xfc);
54
55 /* clear M_ABORT and Disable M_ABORT Int. */
56 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT;
57 tx3927_pcicptr->pcistatim &= ~PCI_STATUS_REC_MASTER_ABORT;
58
59 return PCIBIOS_SUCCESSFUL;
60}
61
62static inline int check_abort(void)
63{
64 if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT)
65 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT;
66 tx3927_pcicptr->pcistatim |= PCI_STATUS_REC_MASTER_ABORT;
67 return PCIBIOS_DEVICE_NOT_FOUND;
68
69 return PCIBIOS_SUCCESSFUL;
70}
71
72static int jmr3927_pci_read_config(struct pci_bus *bus, unsigned int devfn,
73 int where, int size, u32 * val)
74{
75 int ret, busno;
76
77 /* check if the bus is top-level */
78 if (bus->parent != NULL)
79 busno = bus->number;
80
81 ret = mkaddr(busno, devfn, where);
82 if (ret)
83 return ret;
84
85 switch (size) {
86 case 1:
87 *val = *(volatile u8 *) ((unsigned long) & tx3927_pcicptr->icd | (where & 3));
88 break;
89
90 case 2:
91 *val = le16_to_cpu(*(volatile u16 *) ((unsigned long) & tx3927_pcicptr->icd | (where & 3)));
92 break;
93
94 case 4:
95 *val = le32_to_cpu(tx3927_pcicptr->icd);
96 break;
97 }
98
99 return check_abort();
100}
101
102static int jmr3927_pci_write_config(struct pci_bus *bus, unsigned int devfn,
103 int where, int size, u32 val)
104{
105 int ret, busno;
106
107 /* check if the bus is top-level */
108 if (bus->parent != NULL)
109 bus = bus->number;
110 else
111 bus = 0;
112
113 ret = mkaddr(busno, devfn, where);
114 if (ret)
115 return ret;
116
117 switch (size) {
118 case 1:
119 *(volatile u8 *) ((unsigned long) & tx3927_pcicptr->icd | (where & 3)) = val;
120 break;
121
122 case 2:
123 *(volatile u16 *) (unsigned longulong) & tx3927_pcicptr->icd | (where & 2)) =
124 cpu_to_le16(val);
125 break;
126
127 case 4:
128 tx3927_pcicptr->icd = cpu_to_le32(val);
129 }
130
131 if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT)
132 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT;
133 tx3927_pcicptr->pcistatim |= PCI_STATUS_REC_MASTER_ABORT;
134 return PCIBIOS_DEVICE_NOT_FOUND;
135
136 return check_abort();
137}
138
139struct pci_ops jmr3927_pci_ops = {
140 jmr3927_pcibios_read_config,
141 jmr3927_pcibios_write_config,
142};
143
144
145#ifndef JMR3927_INIT_INDIRECT_PCI
146
147inline unsigned long tc_readl(volatile __u32 * addr)
148{
149 return readl(addr);
150}
151
152inline void tc_writel(unsigned long data, volatile __u32 * addr)
153{
154 writel(data, addr);
155}
156#else
157
158unsigned long tc_readl(volatile __u32 * addr)
159{
160 unsigned long val;
161
162 addr = PHYSADDR(addr);
163 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipciaddr =
164 (unsigned long) addr;
165 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcibe =
166 (PCI_IPCIBE_ICMD_MEMREAD << PCI_IPCIBE_ICMD_SHIFT) |
167 PCI_IPCIBE_IBE_LONG;
168 while (!(tx3927_pcicptr->istat & PCI_ISTAT_IDICC));
169 val =
170 le32_to_cpu(*(volatile u32 *) (ulong) & tx3927_pcicptr->
171 ipcidata);
172 /* clear by setting */
173 tx3927_pcicptr->istat |= PCI_ISTAT_IDICC;
174 return val;
175}
176
177void tc_writel(unsigned long data, volatile __u32 * addr)
178{
179 addr = PHYSADDR(addr);
180 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcidata =
181 cpu_to_le32(data);
182 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipciaddr =
183 (unsigned long) addr;
184 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcibe =
185 (PCI_IPCIBE_ICMD_MEMWRITE << PCI_IPCIBE_ICMD_SHIFT) |
186 PCI_IPCIBE_IBE_LONG;
187 while (!(tx3927_pcicptr->istat & PCI_ISTAT_IDICC));
188 /* clear by setting */
189 tx3927_pcicptr->istat |= PCI_ISTAT_IDICC;
190}
191
192unsigned char tx_ioinb(unsigned char *addr)
193{
194 unsigned long val;
195 __u32 ioaddr;
196 int offset;
197 int byte;
198
199 ioaddr = (unsigned long) addr;
200 offset = ioaddr & 0x3;
201 if (offset == 0)
202 byte = 0x7;
203 else if (offset == 1)
204 byte = 0xb;
205 else if (offset == 2)
206 byte = 0xd;
207 else if (offset == 3)
208 byte = 0xe;
209 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipciaddr =
210 (unsigned long) ioaddr;
211 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcibe =
212 (PCI_IPCIBE_ICMD_IOREAD << PCI_IPCIBE_ICMD_SHIFT) | byte;
213 while (!(tx3927_pcicptr->istat & PCI_ISTAT_IDICC));
214 val =
215 le32_to_cpu(*(volatile u32 *) (ulong) & tx3927_pcicptr->
216 ipcidata);
217 val = val & 0xff;
218 /* clear by setting */
219 tx3927_pcicptr->istat |= PCI_ISTAT_IDICC;
220 return val;
221}
222
223void tx_iooutb(unsigned long data, unsigned char *addr)
224{
225 __u32 ioaddr;
226 int offset;
227 int byte;
228
229 data = data | (data << 8) | (data << 16) | (data << 24);
230 ioaddr = (unsigned long) addr;
231 offset = ioaddr & 0x3;
232 if (offset == 0)
233 byte = 0x7;
234 else if (offset == 1)
235 byte = 0xb;
236 else if (offset == 2)
237 byte = 0xd;
238 else if (offset == 3)
239 byte = 0xe;
240 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcidata = data;
241 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipciaddr =
242 (unsigned long) ioaddr;
243 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcibe =
244 (PCI_IPCIBE_ICMD_IOWRITE << PCI_IPCIBE_ICMD_SHIFT) | byte;
245 while (!(tx3927_pcicptr->istat & PCI_ISTAT_IDICC));
246 /* clear by setting */
247 tx3927_pcicptr->istat |= PCI_ISTAT_IDICC;
248}
249
250unsigned short tx_ioinw(unsigned short *addr)
251{
252 unsigned long val;
253 __u32 ioaddr;
254 int offset;
255 int byte;
256
257 ioaddr = (unsigned long) addr;
258 offset = ioaddr & 0x3;
259 if (offset == 0)
260 byte = 0x3;
261 else if (offset == 2)
262 byte = 0xc;
263 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipciaddr =
264 (unsigned long) ioaddr;
265 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcibe =
266 (PCI_IPCIBE_ICMD_IOREAD << PCI_IPCIBE_ICMD_SHIFT) | byte;
267 while (!(tx3927_pcicptr->istat & PCI_ISTAT_IDICC));
268 val =
269 le32_to_cpu(*(volatile u32 *) (ulong) & tx3927_pcicptr->
270 ipcidata);
271 val = val & 0xffff;
272 /* clear by setting */
273 tx3927_pcicptr->istat |= PCI_ISTAT_IDICC;
274 return val;
275
276}
277
278void tx_iooutw(unsigned long data, unsigned short *addr)
279{
280 __u32 ioaddr;
281 int offset;
282 int byte;
283
284 data = data | (data << 16);
285 ioaddr = (unsigned long) addr;
286 offset = ioaddr & 0x3;
287 if (offset == 0)
288 byte = 0x3;
289 else if (offset == 2)
290 byte = 0xc;
291 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcidata = data;
292 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipciaddr =
293 (unsigned long) ioaddr;
294 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcibe =
295 (PCI_IPCIBE_ICMD_IOWRITE << PCI_IPCIBE_ICMD_SHIFT) | byte;
296 while (!(tx3927_pcicptr->istat & PCI_ISTAT_IDICC));
297 /* clear by setting */
298 tx3927_pcicptr->istat |= PCI_ISTAT_IDICC;
299}
300
301unsigned long tx_ioinl(unsigned int *addr)
302{
303 unsigned long val;
304 __u32 ioaddr;
305
306 ioaddr = (unsigned long) addr;
307 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipciaddr =
308 (unsigned long) ioaddr;
309 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcibe =
310 (PCI_IPCIBE_ICMD_IOREAD << PCI_IPCIBE_ICMD_SHIFT) |
311 PCI_IPCIBE_IBE_LONG;
312 while (!(tx3927_pcicptr->istat & PCI_ISTAT_IDICC));
313 val =
314 le32_to_cpu(*(volatile u32 *) (ulong) & tx3927_pcicptr->
315 ipcidata);
316 /* clear by setting */
317 tx3927_pcicptr->istat |= PCI_ISTAT_IDICC;
318 return val;
319}
320
321void tx_iooutl(unsigned long data, unsigned int *addr)
322{
323 __u32 ioaddr;
324
325 ioaddr = (unsigned long) addr;
326 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcidata =
327 cpu_to_le32(data);
328 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipciaddr =
329 (unsigned long) ioaddr;
330 *(volatile u32 *) (ulong) & tx3927_pcicptr->ipcibe =
331 (PCI_IPCIBE_ICMD_IOWRITE << PCI_IPCIBE_ICMD_SHIFT) |
332 PCI_IPCIBE_IBE_LONG;
333 while (!(tx3927_pcicptr->istat & PCI_ISTAT_IDICC));
334 /* clear by setting */
335 tx3927_pcicptr->istat |= PCI_ISTAT_IDICC;
336}
337
338void tx_insbyte(unsigned char *addr, void *buffer, unsigned int count)
339{
340 unsigned char *ptr = (unsigned char *) buffer;
341
342 while (count--) {
343 *ptr++ = tx_ioinb(addr);
344 }
345}
346
347void tx_insword(unsigned short *addr, void *buffer, unsigned int count)
348{
349 unsigned short *ptr = (unsigned short *) buffer;
350
351 while (count--) {
352 *ptr++ = tx_ioinw(addr);
353 }
354}
355
356void tx_inslong(unsigned int *addr, void *buffer, unsigned int count)
357{
358 unsigned long *ptr = (unsigned long *) buffer;
359
360 while (count--) {
361 *ptr++ = tx_ioinl(addr);
362 }
363}
364
365void tx_outsbyte(unsigned char *addr, void *buffer, unsigned int count)
366{
367 unsigned char *ptr = (unsigned char *) buffer;
368
369 while (count--) {
370 tx_iooutb(*ptr++, addr);
371 }
372}
373
374void tx_outsword(unsigned short *addr, void *buffer, unsigned int count)
375{
376 unsigned short *ptr = (unsigned short *) buffer;
377
378 while (count--) {
379 tx_iooutw(*ptr++, addr);
380 }
381}
382
383void tx_outslong(unsigned int *addr, void *buffer, unsigned int count)
384{
385 unsigned long *ptr = (unsigned long *) buffer;
386
387 while (count--) {
388 tx_iooutl(*ptr++, addr);
389 }
390}
391#endif
diff --git a/arch/mips/pci/ops-tx4927.c b/arch/mips/pci/ops-tx4927.c
new file mode 100644
index 000000000000..2a9d7227fe87
--- /dev/null
+++ b/arch/mips/pci/ops-tx4927.c
@@ -0,0 +1,209 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ahennessy@mvista.com
5 *
6 * Copyright (C) 2000-2001 Toshiba Corporation
7 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
8 *
9 * Based on arch/mips/ddb5xxx/ddb5477/pci_ops.c
10 *
11 * Define the pci_ops for the Toshiba rbtx4927
12 *
13 * Much of the code is derived from the original DDB5074 port by
14 * Geert Uytterhoeven <geert@sonycom.com>
15 *
16 * Copyright 2004 MontaVista Software Inc.
17 * Author: Manish Lachwani (mlachwani@mvista.com)
18 *
19 * This program is free software; you can redistribute it and/or modify it
20 * under the terms of the GNU General Public License as published by the
21 * Free Software Foundation; either version 2 of the License, or (at your
22 * option) any later version.
23 *
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
27 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 * You should have received a copy of the GNU General Public License along
36 * with this program; if not, write to the Free Software Foundation, Inc.,
37 * 675 Mass Ave, Cambridge, MA 02139, USA.
38 */
39#include <linux/types.h>
40#include <linux/pci.h>
41#include <linux/kernel.h>
42#include <linux/init.h>
43
44#include <asm/addrspace.h>
45#include <asm/byteorder.h>
46#include <asm/tx4927/tx4927_pci.h>
47
48/* initialize in setup */
49struct resource pci_io_resource = {
50 .name = "TX4927 PCI IO SPACE",
51 .start = 0x1000,
52 .end = (0x1000 + (TX4927_PCIIO_SIZE)) - 1,
53 .flags = IORESOURCE_IO
54};
55
56/* initialize in setup */
57struct resource pci_mem_resource = {
58 .name = "TX4927 PCI MEM SPACE",
59 .start = TX4927_PCIMEM,
60 .end = TX4927_PCIMEM + TX4927_PCIMEM_SIZE - 1,
61 .flags = IORESOURCE_MEM
62};
63
64static int mkaddr(int bus, int dev_fn, int where, int *flagsp)
65{
66 if (bus > 0) {
67 /* Type 1 configuration */
68 tx4927_pcicptr->g2pcfgadrs = ((bus & 0xff) << 0x10) |
69 ((dev_fn & 0xff) << 0x08) | (where & 0xfc) | 1;
70 } else {
71 if (dev_fn >= PCI_DEVFN(TX4927_PCIC_MAX_DEVNU, 0))
72 return -1;
73
74 /* Type 0 configuration */
75 tx4927_pcicptr->g2pcfgadrs = ((bus & 0xff) << 0x10) |
76 ((dev_fn & 0xff) << 0x08) | (where & 0xfc);
77 }
78 /* clear M_ABORT and Disable M_ABORT Int. */
79 tx4927_pcicptr->pcistatus =
80 (tx4927_pcicptr->pcistatus & 0x0000ffff) |
81 (PCI_STATUS_REC_MASTER_ABORT << 16);
82 tx4927_pcicptr->pcimask &= ~PCI_STATUS_REC_MASTER_ABORT;
83 return 0;
84}
85
86static int check_abort(int flags)
87{
88 int code = PCIBIOS_SUCCESSFUL;
89 if (tx4927_pcicptr->
90 pcistatus & (PCI_STATUS_REC_MASTER_ABORT << 16)) {
91 tx4927_pcicptr->pcistatus =
92 (tx4927_pcicptr->
93 pcistatus & 0x0000ffff) | (PCI_STATUS_REC_MASTER_ABORT
94 << 16);
95 tx4927_pcicptr->pcimask |= PCI_STATUS_REC_MASTER_ABORT;
96 code = PCIBIOS_DEVICE_NOT_FOUND;
97 }
98 return code;
99}
100
101static int tx4927_pcibios_read_config(struct pci_bus *bus, unsigned int devfn, int where,
102 int size, u32 * val)
103{
104 int flags, retval, dev, busno, func;
105
106 busno = bus->number;
107 dev = PCI_SLOT(devfn);
108 func = PCI_FUNC(devfn);
109
110 /* check if the bus is top-level */
111 if (bus->parent != NULL) {
112 busno = bus->number;
113 } else {
114 busno = 0;
115 }
116
117 if (mkaddr(busno, devfn, where, &flags))
118 return -1;
119
120 switch (size) {
121 case 1:
122 *val = *(volatile u8 *) ((ulong) & tx4927_pcicptr->
123 g2pcfgdata |
124#ifdef __LITTLE_ENDIAN
125 (where & 3));
126#else
127 ((where & 0x3) ^ 0x3));
128#endif
129 break;
130 case 2:
131 *val = *(volatile u16 *) ((ulong) & tx4927_pcicptr->
132 g2pcfgdata |
133#ifdef __LITTLE_ENDIAN
134 (where & 3));
135#else
136 ((where & 0x3) ^ 0x2));
137#endif
138 break;
139 case 4:
140 *val = tx4927_pcicptr->g2pcfgdata;
141 break;
142 }
143
144 retval = check_abort(flags);
145 if (retval == PCIBIOS_DEVICE_NOT_FOUND)
146 *val = 0xffffffff;
147
148 return retval;
149}
150
151static int tx4927_pcibios_write_config(struct pci_bus *bus, unsigned int devfn, int where,
152 int size, u32 val)
153{
154 int flags, dev, busno, func;
155 busno = bus->number;
156 dev = PCI_SLOT(devfn);
157 func = PCI_FUNC(devfn);
158
159 /* check if the bus is top-level */
160 if (bus->parent != NULL) {
161 busno = bus->number;
162 } else {
163 busno = 0;
164 }
165
166 if (mkaddr(busno, devfn, where, &flags))
167 return -1;
168
169 switch (size) {
170 case 1:
171 *(volatile u8 *) ((ulong) & tx4927_pcicptr->
172 g2pcfgdata |
173#ifdef __LITTLE_ENDIAN
174 (where & 3)) = val;
175#else
176 ((where & 0x3) ^ 0x3)) = val;
177#endif
178 break;
179
180 case 2:
181 *(volatile u16 *) ((ulong) & tx4927_pcicptr->
182 g2pcfgdata |
183#ifdef __LITTLE_ENDIAN
184 (where & 3)) = val;
185#else
186 ((where & 0x3) ^ 0x2)) = val;
187#endif
188 break;
189 case 4:
190 tx4927_pcicptr->g2pcfgdata = val;
191 break;
192 }
193
194 return check_abort(flags);
195}
196
197struct pci_ops tx4927_pci_ops = {
198 tx4927_pcibios_read_config,
199 tx4927_pcibios_write_config
200};
201
202/*
203 * h/w only supports devices 0x00 to 0x14
204 */
205struct pci_controller tx4927_controller = {
206 .pci_ops = &tx4927_pci_ops,
207 .io_resource = &pci_io_resource,
208 .mem_resource = &pci_mem_resource,
209};
diff --git a/arch/mips/pci/ops-vr41xx.c b/arch/mips/pci/ops-vr41xx.c
new file mode 100644
index 000000000000..44654605e461
--- /dev/null
+++ b/arch/mips/pci/ops-vr41xx.c
@@ -0,0 +1,126 @@
1/*
2 * ops-vr41xx.c, PCI configuration routines for the PCIU of NEC VR4100 series.
3 *
4 * Copyright (C) 2001-2003 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22/*
23 * Changes:
24 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
25 * - New creation, NEC VR4122 and VR4131 are supported.
26 */
27#include <linux/pci.h>
28#include <linux/types.h>
29
30#include <asm/io.h>
31
32#define PCICONFDREG KSEG1ADDR(0x0f000c14)
33#define PCICONFAREG KSEG1ADDR(0x0f000c18)
34
35static inline int set_pci_configuration_address(unsigned char number,
36 unsigned int devfn, int where)
37{
38 if (number == 0) {
39 /*
40 * Type 0 configuration
41 */
42 if (PCI_SLOT(devfn) < 11 || where > 0xff)
43 return -EINVAL;
44
45 writel((1U << PCI_SLOT(devfn)) | (PCI_FUNC(devfn) << 8) |
46 (where & 0xfc), PCICONFAREG);
47 } else {
48 /*
49 * Type 1 configuration
50 */
51 if (where > 0xff)
52 return -EINVAL;
53
54 writel(((uint32_t)number << 16) | ((devfn & 0xff) << 8) |
55 (where & 0xfc) | 1U, PCICONFAREG);
56 }
57
58 return 0;
59}
60
61static int pci_config_read(struct pci_bus *bus, unsigned int devfn, int where,
62 int size, uint32_t *val)
63{
64 uint32_t data;
65
66 *val = 0xffffffffU;
67 if (set_pci_configuration_address(bus->number, devfn, where) < 0)
68 return PCIBIOS_DEVICE_NOT_FOUND;
69
70 data = readl(PCICONFDREG);
71
72 switch (size) {
73 case 1:
74 *val = (data >> ((where & 3) << 3)) & 0xffU;
75 break;
76 case 2:
77 *val = (data >> ((where & 2) << 3)) & 0xffffU;
78 break;
79 case 4:
80 *val = data;
81 break;
82 default:
83 return PCIBIOS_FUNC_NOT_SUPPORTED;
84 }
85
86 return PCIBIOS_SUCCESSFUL;
87}
88
89static int pci_config_write(struct pci_bus *bus, unsigned int devfn, int where,
90 int size, uint32_t val)
91{
92 uint32_t data;
93 int shift;
94
95 if (set_pci_configuration_address(bus->number, devfn, where) < 0)
96 return PCIBIOS_DEVICE_NOT_FOUND;
97
98 data = readl(PCICONFDREG);
99
100 switch (size) {
101 case 1:
102 shift = (where & 3) << 3;
103 data &= ~(0xffU << shift);
104 data |= ((val & 0xffU) << shift);
105 break;
106 case 2:
107 shift = (where & 2) << 3;
108 data &= ~(0xffffU << shift);
109 data |= ((val & 0xffffU) << shift);
110 break;
111 case 4:
112 data = val;
113 break;
114 default:
115 return PCIBIOS_FUNC_NOT_SUPPORTED;
116 }
117
118 writel(data, PCICONFDREG);
119
120 return PCIBIOS_SUCCESSFUL;
121}
122
123struct pci_ops vr41xx_pci_ops = {
124 .read = pci_config_read,
125 .write = pci_config_write,
126};
diff --git a/arch/mips/pci/pci-ddb5074.c b/arch/mips/pci/pci-ddb5074.c
new file mode 100644
index 000000000000..73f9ceeb2f55
--- /dev/null
+++ b/arch/mips/pci/pci-ddb5074.c
@@ -0,0 +1,79 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/types.h>
4#include <linux/pci.h>
5
6#include <asm/debug.h>
7
8#include <asm/ddb5xxx/ddb5xxx.h>
9
10static struct resource extpci_io_resource = {
11 "pci IO space",
12 0x1000, /* leave some room for ISA bus */
13 DDB_PCI_IO_SIZE - 1,
14 IORESOURCE_IO
15};
16
17static struct resource extpci_mem_resource = {
18 "pci memory space",
19 DDB_PCI_MEM_BASE + 0x00100000, /* leave 1 MB for RTC */
20 DDB_PCI_MEM_BASE + DDB_PCI_MEM_SIZE - 1,
21 IORESOURCE_MEM
22};
23
24extern struct pci_ops ddb5476_ext_pci_ops;
25
26struct pci_controller ddb5476_controller = {
27 .pci_ops = &ddb5476_ext_pci_ops,
28 .io_resource = &extpci_io_resource,
29 .mem_resource = &extpci_mem_resource,
30};
31
32#define PCI_EXT_INTA 8
33#define PCI_EXT_INTB 9
34#define PCI_EXT_INTC 10
35#define PCI_EXT_INTD 11
36#define PCI_EXT_INTE 12
37
38#define MAX_SLOT_NUM 14
39
40static unsigned char irq_map[MAX_SLOT_NUM] = {
41 [ 0] = nile4_to_irq(PCI_EXT_INTE),
42 [ 1] = nile4_to_irq(PCI_EXT_INTA),
43 [ 2] = nile4_to_irq(PCI_EXT_INTA),
44 [ 3] = nile4_to_irq(PCI_EXT_INTB),
45 [ 4] = nile4_to_irq(PCI_EXT_INTC),
46 [ 5] = nile4_to_irq(NILE4_INT_UART),
47 [10] = nile4_to_irq(PCI_EXT_INTE),
48 [13] = nile4_to_irq(PCI_EXT_INTE),
49};
50
51int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
52{
53 return irq_map[slot];
54}
55
56/* Do platform specific device initialization at pci_enable_device() time */
57int pcibios_plat_dev_init(struct pci_dev *dev)
58{
59 return 0;
60}
61
62void __init ddb_pci_reset_bus(void)
63{
64 u32 temp;
65
66 /*
67 * I am not sure about the "official" procedure, the following
68 * steps work as far as I know:
69 * We first set PCI cold reset bit (bit 31) in PCICTRL-H.
70 * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H.
71 * The same is true for both PCI channels.
72 */
73 temp = ddb_in32(DDB_PCICTRL + 4);
74 temp |= 0x80000000;
75 ddb_out32(DDB_PCICTRL + 4, temp);
76 temp &= ~0xc0000000;
77 ddb_out32(DDB_PCICTRL + 4, temp);
78
79}
diff --git a/arch/mips/pci/pci-ddb5476.c b/arch/mips/pci/pci-ddb5476.c
new file mode 100644
index 000000000000..90dd49509800
--- /dev/null
+++ b/arch/mips/pci/pci-ddb5476.c
@@ -0,0 +1,93 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/types.h>
4#include <linux/pci.h>
5
6#include <asm/debug.h>
7
8#include <asm/ddb5xxx/ddb5xxx.h>
9
10static struct resource extpci_io_resource = {
11 "pci IO space",
12 0x1000, /* leave some room for ISA bus */
13 DDB_PCI_IO_SIZE - 1,
14 IORESOURCE_IO
15};
16
17static struct resource extpci_mem_resource = {
18 "pci memory space",
19 DDB_PCI_MEM_BASE + 0x00100000, /* leave 1 MB for RTC */
20 DDB_PCI_MEM_BASE + DDB_PCI_MEM_SIZE - 1,
21 IORESOURCE_MEM
22};
23
24extern struct pci_ops ddb5476_ext_pci_ops;
25
26struct pci_controller ddb5476_controller = {
27 .pci_ops = &ddb5476_ext_pci_ops,
28 .io_resource = &extpci_io_resource,
29 .mem_resource = &extpci_mem_resource
30};
31
32
33/*
34 * we fix up irqs based on the slot number.
35 * The first entry is at AD:11.
36 *
37 * This does not work for devices on sub-buses yet.
38 */
39
40/*
41 * temporary
42 */
43
44#define PCI_EXT_INTA 8
45#define PCI_EXT_INTB 9
46#define PCI_EXT_INTC 10
47#define PCI_EXT_INTD 11
48#define PCI_EXT_INTE 12
49
50/*
51 * based on ddb5477 manual page 11
52 */
53#define MAX_SLOT_NUM 21
54static unsigned char irq_map[MAX_SLOT_NUM] = {
55 [ 2] = 9, /* AD:13 USB */
56 [ 3] = 10, /* AD:14 PMU */
57 [ 5] = 0, /* AD:16 P2P bridge */
58 [ 6] = nile4_to_irq(PCI_EXT_INTB), /* AD:17 */
59 [ 7] = nile4_to_irq(PCI_EXT_INTC), /* AD:18 */
60 [ 8] = nile4_to_irq(PCI_EXT_INTD), /* AD:19 */
61 [ 9] = nile4_to_irq(PCI_EXT_INTA), /* AD:20 */
62 [13] = 14, /* AD:24 HD controller, M5229 */
63};
64
65int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
66{
67 return irq_map[slot];
68}
69
70/* Do platform specific device initialization at pci_enable_device() time */
71int pcibios_plat_dev_init(struct pci_dev *dev)
72{
73 return 0;
74}
75
76void __init ddb_pci_reset_bus(void)
77{
78 u32 temp;
79
80 /*
81 * I am not sure about the "official" procedure, the following
82 * steps work as far as I know:
83 * We first set PCI cold reset bit (bit 31) in PCICTRL-H.
84 * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H.
85 * The same is true for both PCI channels.
86 */
87 temp = ddb_in32(DDB_PCICTRL + 4);
88 temp |= 0x80000000;
89 ddb_out32(DDB_PCICTRL + 4, temp);
90 temp &= ~0xc0000000;
91 ddb_out32(DDB_PCICTRL + 4, temp);
92
93}
diff --git a/arch/mips/pci/pci-ddb5477.c b/arch/mips/pci/pci-ddb5477.c
new file mode 100644
index 000000000000..4ddd53eaf656
--- /dev/null
+++ b/arch/mips/pci/pci-ddb5477.c
@@ -0,0 +1,207 @@
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 "ext pci IO space",
26 DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + 0x4000,
27 DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI0_IO_SIZE - 1,
28 IORESOURCE_IO
29};
30
31static struct resource extpci_mem_resource = {
32 "ext pci memory space",
33 DDB_PCI0_MEM_BASE + 0x100000,
34 DDB_PCI0_MEM_BASE + DDB_PCI0_MEM_SIZE - 1,
35 IORESOURCE_MEM
36};
37
38static struct resource iopci_io_resource = {
39 "io pci IO space",
40 DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE,
41 DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI1_IO_SIZE - 1,
42 IORESOURCE_IO
43};
44
45static struct resource iopci_mem_resource = {
46 "ext pci memory space",
47 DDB_PCI1_MEM_BASE,
48 DDB_PCI1_MEM_BASE + DDB_PCI1_MEM_SIZE - 1,
49 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(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-ev96100.c b/arch/mips/pci/pci-ev96100.c
new file mode 100644
index 000000000000..f9457ea00def
--- /dev/null
+++ b/arch/mips/pci/pci-ev96100.c
@@ -0,0 +1,63 @@
1/*
2 * Copyright 2000 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ppopov@mvista.com or source@mvista.com
5 *
6 * Carsten Langgaard, carstenl@mips.com
7 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
8 *
9 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31#include <linux/types.h>
32#include <linux/pci.h>
33#include <linux/kernel.h>
34#include <linux/init.h>
35
36static struct resource pci_io_resource = {
37 .name = "io pci IO space",
38 .start = 0x10000000,
39 .end = 0x11ffffff,
40 .flags = IORESOURCE_IO
41};
42
43static struct resource pci_mem_resource = {
44 .name = "ext pci memory space",
45 .start = 0x12000000,
46 .end = 0x13ffffff,
47 .flags = IORESOURCE_MEM
48};
49
50extern struct pci_ops gt96100_pci_ops;
51
52struct pci_controller ev96100_controller = {
53 .pci_ops = &gt96100_pci_ops,
54 .io_resource = &pci_io_resource,
55 .mem_resource = &pci_mem_resource,
56};
57
58static void ev96100_pci_init(void)
59{
60 register_pci_controller(&ev96100_controller);
61}
62
63arch_initcall(ev96100_pci_init);
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
new file mode 100644
index 000000000000..068e0e508e15
--- /dev/null
+++ b/arch/mips/pci/pci-ip27.c
@@ -0,0 +1,489 @@
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) 2003 Christoph Hellwig (hch@lst.de)
7 * Copyright (C) 1999, 2000, 04 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/pci.h>
13#include <asm/sn/arch.h>
14#include <asm/pci/bridge.h>
15#include <asm/paccess.h>
16#include <asm/sn/intr.h>
17#include <asm/sn/sn0/hub.h>
18
19extern unsigned int allocate_irqno(void);
20
21/*
22 * Max #PCI busses we can handle; ie, max #PCI bridges.
23 */
24#define MAX_PCI_BUSSES 40
25
26/*
27 * Max #PCI devices (like scsi controllers) we handle on a bus.
28 */
29#define MAX_DEVICES_PER_PCIBUS 8
30
31/*
32 * XXX: No kmalloc available when we do our crosstalk scan,
33 * we should try to move it later in the boot process.
34 */
35static struct bridge_controller bridges[MAX_PCI_BUSSES];
36
37/*
38 * Translate from irq to software PCI bus number and PCI slot.
39 */
40struct bridge_controller *irq_to_bridge[MAX_PCI_BUSSES * MAX_DEVICES_PER_PCIBUS];
41int irq_to_slot[MAX_PCI_BUSSES * MAX_DEVICES_PER_PCIBUS];
42
43/*
44 * The Bridge ASIC supports both type 0 and type 1 access. Type 1 is
45 * not really documented, so right now I can't write code which uses it.
46 * Therefore we use type 0 accesses for now even though they won't work
47 * correcly for PCI-to-PCI bridges.
48 *
49 * The function is complicated by the ultimate brokeness of the IOC3 chip
50 * which is used in SGI systems. The IOC3 can only handle 32-bit PCI
51 * accesses and does only decode parts of it's address space.
52 */
53
54static int pci_conf0_read_config(struct pci_bus *bus, unsigned int devfn,
55 int where, int size, u32 * value)
56{
57 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
58 bridge_t *bridge = bc->base;
59 int slot = PCI_SLOT(devfn);
60 int fn = PCI_FUNC(devfn);
61 volatile void *addr;
62 u32 cf, shift, mask;
63 int res;
64
65 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
66 if (get_dbe(cf, (u32 *) addr))
67 return PCIBIOS_DEVICE_NOT_FOUND;
68
69 /*
70 * IOC3 is fucked fucked beyond believe ... Don't even give the
71 * generic PCI code a chance to look at it for real ...
72 */
73 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
74 goto oh_my_gawd;
75
76 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
77
78 if (size == 1)
79 res = get_dbe(*value, (u8 *) addr);
80 else if (size == 2)
81 res = get_dbe(*value, (u16 *) addr);
82 else
83 res = get_dbe(*value, (u32 *) addr);
84
85 return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
86
87oh_my_gawd:
88
89 /*
90 * IOC3 is fucked fucked beyond believe ... Don't even give the
91 * generic PCI code a chance to look at the wrong register.
92 */
93 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
94 *value = 0;
95 return PCIBIOS_SUCCESSFUL;
96 }
97
98 /*
99 * IOC3 is fucked fucked beyond believe ... Don't try to access
100 * anything but 32-bit words ...
101 */
102 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
103
104 if (get_dbe(cf, (u32 *) addr))
105 return PCIBIOS_DEVICE_NOT_FOUND;
106
107 shift = ((where & 3) << 3);
108 mask = (0xffffffffU >> ((4 - size) << 3));
109 *value = (cf >> shift) & mask;
110
111 return PCIBIOS_SUCCESSFUL;
112}
113
114static int pci_conf1_read_config(struct pci_bus *bus, unsigned int devfn,
115 int where, int size, u32 * value)
116{
117 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
118 bridge_t *bridge = bc->base;
119 int busno = bus->number;
120 int slot = PCI_SLOT(devfn);
121 int fn = PCI_FUNC(devfn);
122 volatile void *addr;
123 u32 cf, shift, mask;
124 int res;
125
126 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
127 addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
128 if (get_dbe(cf, (u32 *) addr))
129 return PCIBIOS_DEVICE_NOT_FOUND;
130
131 /*
132 * IOC3 is fucked fucked beyond believe ... Don't even give the
133 * generic PCI code a chance to look at it for real ...
134 */
135 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
136 goto oh_my_gawd;
137
138 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
139 addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
140
141 if (size == 1)
142 res = get_dbe(*value, (u8 *) addr);
143 else if (size == 2)
144 res = get_dbe(*value, (u16 *) addr);
145 else
146 res = get_dbe(*value, (u32 *) addr);
147
148 return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
149
150oh_my_gawd:
151
152 /*
153 * IOC3 is fucked fucked beyond believe ... Don't even give the
154 * generic PCI code a chance to look at the wrong register.
155 */
156 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
157 *value = 0;
158 return PCIBIOS_SUCCESSFUL;
159 }
160
161 /*
162 * IOC3 is fucked fucked beyond believe ... Don't try to access
163 * anything but 32-bit words ...
164 */
165 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
166 addr = &bridge->b_type1_cfg.c[(fn << 8) | where];
167
168 if (get_dbe(cf, (u32 *) addr))
169 return PCIBIOS_DEVICE_NOT_FOUND;
170
171 shift = ((where & 3) << 3);
172 mask = (0xffffffffU >> ((4 - size) << 3));
173 *value = (cf >> shift) & mask;
174
175 return PCIBIOS_SUCCESSFUL;
176}
177
178static int pci_read_config(struct pci_bus *bus, unsigned int devfn,
179 int where, int size, u32 * value)
180{
181 if (bus->number > 0)
182 return pci_conf1_read_config(bus, devfn, where, size, value);
183
184 return pci_conf0_read_config(bus, devfn, where, size, value);
185}
186
187static int pci_conf0_write_config(struct pci_bus *bus, unsigned int devfn,
188 int where, int size, u32 value)
189{
190 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
191 bridge_t *bridge = bc->base;
192 int slot = PCI_SLOT(devfn);
193 int fn = PCI_FUNC(devfn);
194 volatile void *addr;
195 u32 cf, shift, mask, smask;
196 int res;
197
198 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
199 if (get_dbe(cf, (u32 *) addr))
200 return PCIBIOS_DEVICE_NOT_FOUND;
201
202 /*
203 * IOC3 is fucked fucked beyond believe ... Don't even give the
204 * generic PCI code a chance to look at it for real ...
205 */
206 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
207 goto oh_my_gawd;
208
209 addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
210
211 if (size == 1) {
212 res = put_dbe(value, (u8 *) addr);
213 } else if (size == 2) {
214 res = put_dbe(value, (u16 *) addr);
215 } else {
216 res = put_dbe(value, (u32 *) addr);
217 }
218
219 if (res)
220 return PCIBIOS_DEVICE_NOT_FOUND;
221
222 return PCIBIOS_SUCCESSFUL;
223
224oh_my_gawd:
225
226 /*
227 * IOC3 is fucked fucked beyond believe ... Don't even give the
228 * generic PCI code a chance to touch the wrong register.
229 */
230 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
231 return PCIBIOS_SUCCESSFUL;
232
233 /*
234 * IOC3 is fucked fucked beyond believe ... Don't try to access
235 * anything but 32-bit words ...
236 */
237 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
238
239 if (get_dbe(cf, (u32 *) addr))
240 return PCIBIOS_DEVICE_NOT_FOUND;
241
242 shift = ((where & 3) << 3);
243 mask = (0xffffffffU >> ((4 - size) << 3));
244 smask = mask << shift;
245
246 cf = (cf & ~smask) | ((value & mask) << shift);
247 if (put_dbe(cf, (u32 *) addr))
248 return PCIBIOS_DEVICE_NOT_FOUND;
249
250 return PCIBIOS_SUCCESSFUL;
251}
252
253static int pci_conf1_write_config(struct pci_bus *bus, unsigned int devfn,
254 int where, int size, u32 value)
255{
256 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
257 bridge_t *bridge = bc->base;
258 int slot = PCI_SLOT(devfn);
259 int fn = PCI_FUNC(devfn);
260 int busno = bus->number;
261 volatile void *addr;
262 u32 cf, shift, mask, smask;
263 int res;
264
265 bridge->b_pci_cfg = (busno << 16) | (slot << 11);
266 addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
267 if (get_dbe(cf, (u32 *) addr))
268 return PCIBIOS_DEVICE_NOT_FOUND;
269
270 /*
271 * IOC3 is fucked fucked beyond believe ... Don't even give the
272 * generic PCI code a chance to look at it for real ...
273 */
274 if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
275 goto oh_my_gawd;
276
277 addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
278
279 if (size == 1) {
280 res = put_dbe(value, (u8 *) addr);
281 } else if (size == 2) {
282 res = put_dbe(value, (u16 *) addr);
283 } else {
284 res = put_dbe(value, (u32 *) addr);
285 }
286
287 if (res)
288 return PCIBIOS_DEVICE_NOT_FOUND;
289
290 return PCIBIOS_SUCCESSFUL;
291
292oh_my_gawd:
293
294 /*
295 * IOC3 is fucked fucked beyond believe ... Don't even give the
296 * generic PCI code a chance to touch the wrong register.
297 */
298 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
299 return PCIBIOS_SUCCESSFUL;
300
301 /*
302 * IOC3 is fucked fucked beyond believe ... Don't try to access
303 * anything but 32-bit words ...
304 */
305 addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
306
307 if (get_dbe(cf, (u32 *) addr))
308 return PCIBIOS_DEVICE_NOT_FOUND;
309
310 shift = ((where & 3) << 3);
311 mask = (0xffffffffU >> ((4 - size) << 3));
312 smask = mask << shift;
313
314 cf = (cf & ~smask) | ((value & mask) << shift);
315 if (put_dbe(cf, (u32 *) addr))
316 return PCIBIOS_DEVICE_NOT_FOUND;
317
318 return PCIBIOS_SUCCESSFUL;
319}
320
321static int pci_write_config(struct pci_bus *bus, unsigned int devfn,
322 int where, int size, u32 value)
323{
324 if (bus->number > 0)
325 return pci_conf1_write_config(bus, devfn, where, size, value);
326
327 return pci_conf0_write_config(bus, devfn, where, size, value);
328}
329
330static struct pci_ops bridge_pci_ops = {
331 .read = pci_read_config,
332 .write = pci_write_config,
333};
334
335int __init bridge_probe(nasid_t nasid, int widget_id, int masterwid)
336{
337 unsigned long offset = NODE_OFFSET(nasid);
338 struct bridge_controller *bc;
339 static int num_bridges = 0;
340 bridge_t *bridge;
341 int slot;
342
343 printk("a bridge\n");
344
345 /* XXX: kludge alert.. */
346 if (!num_bridges)
347 ioport_resource.end = ~0UL;
348
349 bc = &bridges[num_bridges];
350
351 bc->pc.pci_ops = &bridge_pci_ops;
352 bc->pc.mem_resource = &bc->mem;
353 bc->pc.io_resource = &bc->io;
354
355 bc->pc.index = num_bridges;
356
357 bc->mem.name = "Bridge PCI MEM";
358 bc->pc.mem_offset = offset;
359 bc->mem.start = 0;
360 bc->mem.end = ~0UL;
361 bc->mem.flags = IORESOURCE_MEM;
362
363 bc->io.name = "Bridge IO MEM";
364 bc->pc.io_offset = offset;
365 bc->io.start = 0UL;
366 bc->io.end = ~0UL;
367 bc->io.flags = IORESOURCE_IO;
368
369 bc->irq_cpu = smp_processor_id();
370 bc->widget_id = widget_id;
371 bc->nasid = nasid;
372
373 bc->baddr = (u64)masterwid << 60;
374 bc->baddr |= (1UL << 56); /* Barrier set */
375
376 /*
377 * point to this bridge
378 */
379 bridge = (bridge_t *) RAW_NODE_SWIN_BASE(nasid, widget_id);
380
381 /*
382 * Clear all pending interrupts.
383 */
384 bridge->b_int_rst_stat = BRIDGE_IRR_ALL_CLR;
385
386 /*
387 * Until otherwise set up, assume all interrupts are from slot 0
388 */
389 bridge->b_int_device = 0x0;
390
391 /*
392 * swap pio's to pci mem and io space (big windows)
393 */
394 bridge->b_wid_control |= BRIDGE_CTRL_IO_SWAP |
395 BRIDGE_CTRL_MEM_SWAP;
396
397 /*
398 * Hmm... IRIX sets additional bits in the address which
399 * are documented as reserved in the bridge docs.
400 */
401 bridge->b_wid_int_upper = 0x8000 | (masterwid << 16);
402 bridge->b_wid_int_lower = 0x01800090; /* PI_INT_PEND_MOD off*/
403 bridge->b_dir_map = (masterwid << 20); /* DMA */
404 bridge->b_int_enable = 0;
405
406 for (slot = 0; slot < 8; slot ++) {
407 bridge->b_device[slot].reg |= BRIDGE_DEV_SWAP_DIR;
408 bc->pci_int[slot] = -1;
409 }
410 bridge->b_wid_tflush; /* wait until Bridge PIO complete */
411
412 bc->base = bridge;
413
414 register_pci_controller(&bc->pc);
415
416 num_bridges++;
417
418 return 0;
419}
420
421/*
422 * All observed requests have pin == 1. We could have a global here, that
423 * gets incremented and returned every time - unfortunately, pci_map_irq
424 * may be called on the same device over and over, and need to return the
425 * same value. On O2000, pin can be 0 or 1, and PCI slots can be [0..7].
426 *
427 * A given PCI device, in general, should be able to intr any of the cpus
428 * on any one of the hubs connected to its xbow.
429 */
430int __devinit pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
431{
432 struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
433 int irq = bc->pci_int[slot];
434
435 if (irq == -1) {
436 irq = bc->pci_int[slot] = request_bridge_irq(bc);
437 if (irq < 0)
438 panic("Can't allocate interrupt for PCI device %s\n",
439 pci_name(dev));
440 }
441
442 irq_to_bridge[irq] = bc;
443 irq_to_slot[irq] = slot;
444
445 return irq;
446}
447
448/* Do platform specific device initialization at pci_enable_device() time */
449int pcibios_plat_dev_init(struct pci_dev *dev)
450{
451 return 0;
452}
453
454/*
455 * Device might live on a subordinate PCI bus. XXX Walk up the chain of buses
456 * to find the slot number in sense of the bridge device register.
457 * XXX This also means multiple devices might rely on conflicting bridge
458 * settings.
459 */
460
461static inline void pci_disable_swapping(struct pci_dev *dev)
462{
463 struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
464 bridge_t *bridge = bc->base;
465 int slot = PCI_SLOT(dev->devfn);
466
467 /* Turn off byte swapping */
468 bridge->b_device[slot].reg &= ~BRIDGE_DEV_SWAP_DIR;
469 bridge->b_widget.w_tflush; /* Flush */
470}
471
472static inline void pci_enable_swapping(struct pci_dev *dev)
473{
474 struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
475 bridge_t *bridge = bc->base;
476 int slot = PCI_SLOT(dev->devfn);
477
478 /* Turn on byte swapping */
479 bridge->b_device[slot].reg |= BRIDGE_DEV_SWAP_DIR;
480 bridge->b_widget.w_tflush; /* Flush */
481}
482
483static void __init pci_fixup_ioc3(struct pci_dev *d)
484{
485 pci_disable_swapping(d);
486}
487
488DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
489 pci_fixup_ioc3);
diff --git a/arch/mips/pci/pci-ip32.c b/arch/mips/pci/pci-ip32.c
new file mode 100644
index 000000000000..1faeb034f06e
--- /dev/null
+++ b/arch/mips/pci/pci-ip32.c
@@ -0,0 +1,145 @@
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) 2000, 2001 Keith M Wesolowski
7 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
8 */
9#include <linux/config.h>
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/interrupt.h>
13#include <linux/pci.h>
14#include <linux/types.h>
15#include <asm/ip32/mace.h>
16#include <asm/ip32/ip32_ints.h>
17
18#undef DEBUG_MACE_PCI
19
20/*
21 * Handle errors from the bridge. This includes master and target aborts,
22 * various command and address errors, and the interrupt test. This gets
23 * registered on the bridge error irq. It's conceivable that some of these
24 * conditions warrant a panic. Anybody care to say which ones?
25 */
26static irqreturn_t macepci_error(int irq, void *dev, struct pt_regs *regs)
27{
28 char s;
29 unsigned int flags = mace->pci.error;
30 unsigned int addr = mace->pci.error_addr;
31
32 if (flags & MACEPCI_ERROR_MEMORY_ADDR)
33 s = 'M';
34 else if (flags & MACEPCI_ERROR_CONFIG_ADDR)
35 s = 'C';
36 else
37 s = 'X';
38
39 if (flags & MACEPCI_ERROR_MASTER_ABORT) {
40 printk("MACEPCI: Master abort at 0x%08x (%c)\n", addr, s);
41 flags &= ~MACEPCI_ERROR_MASTER_ABORT;
42 }
43 if (flags & MACEPCI_ERROR_TARGET_ABORT) {
44 printk("MACEPCI: Target abort at 0x%08x (%c)\n", addr, s);
45 flags &= ~MACEPCI_ERROR_TARGET_ABORT;
46 }
47 if (flags & MACEPCI_ERROR_DATA_PARITY_ERR) {
48 printk("MACEPCI: Data parity error at 0x%08x (%c)\n", addr, s);
49 flags &= ~MACEPCI_ERROR_DATA_PARITY_ERR;
50 }
51 if (flags & MACEPCI_ERROR_RETRY_ERR) {
52 printk("MACEPCI: Retry error at 0x%08x (%c)\n", addr, s);
53 flags &= ~MACEPCI_ERROR_RETRY_ERR;
54 }
55 if (flags & MACEPCI_ERROR_ILLEGAL_CMD) {
56 printk("MACEPCI: Illegal command at 0x%08x (%c)\n", addr, s);
57 flags &= ~MACEPCI_ERROR_ILLEGAL_CMD;
58 }
59 if (flags & MACEPCI_ERROR_SYSTEM_ERR) {
60 printk("MACEPCI: System error at 0x%08x (%c)\n", addr, s);
61 flags &= ~MACEPCI_ERROR_SYSTEM_ERR;
62 }
63 if (flags & MACEPCI_ERROR_PARITY_ERR) {
64 printk("MACEPCI: Parity error at 0x%08x (%c)\n", addr, s);
65 flags &= ~MACEPCI_ERROR_PARITY_ERR;
66 }
67 if (flags & MACEPCI_ERROR_OVERRUN) {
68 printk("MACEPCI: Overrun error at 0x%08x (%c)\n", addr, s);
69 flags &= ~MACEPCI_ERROR_OVERRUN;
70 }
71 if (flags & MACEPCI_ERROR_SIG_TABORT) {
72 printk("MACEPCI: Signaled target abort (clearing)\n");
73 flags &= ~MACEPCI_ERROR_SIG_TABORT;
74 }
75 if (flags & MACEPCI_ERROR_INTERRUPT_TEST) {
76 printk("MACEPCI: Interrupt test triggered (clearing)\n");
77 flags &= ~MACEPCI_ERROR_INTERRUPT_TEST;
78 }
79
80 mace->pci.error = flags;
81
82 return IRQ_HANDLED;
83}
84
85
86extern struct pci_ops mace_pci_ops;
87#ifdef CONFIG_MIPS64
88static struct resource mace_pci_mem_resource = {
89 .name = "SGI O2 PCI MEM",
90 .start = MACEPCI_HI_MEMORY,
91 .end = 0x2FFFFFFFFUL,
92 .flags = IORESOURCE_MEM,
93};
94static struct resource mace_pci_io_resource = {
95 .name = "SGI O2 PCI IO",
96 .start = 0x00000000UL,
97 .end = 0xffffffffUL,
98 .flags = IORESOURCE_IO,
99};
100#define MACE_PCI_MEM_OFFSET 0x200000000
101#else
102static struct resource mace_pci_mem_resource = {
103 .name = "SGI O2 PCI MEM",
104 .start = MACEPCI_LOW_MEMORY,
105 .end = MACEPCI_LOW_MEMORY + 0x2000000 - 1,
106 .flags = IORESOURCE_MEM,
107};
108static struct resource mace_pci_io_resource = {
109 .name = "SGI O2 PCI IO",
110 .start = 0x00000000,
111 .end = 0xFFFFFFFF,
112 .flags = IORESOURCE_IO,
113};
114#define MACE_PCI_MEM_OFFSET (MACEPCI_LOW_MEMORY - 0x80000000)
115#endif
116static struct pci_controller mace_pci_controller = {
117 .pci_ops = &mace_pci_ops,
118 .mem_resource = &mace_pci_mem_resource,
119 .io_resource = &mace_pci_io_resource,
120 .iommu = 0,
121 .mem_offset = MACE_PCI_MEM_OFFSET,
122 .io_offset = 0,
123};
124
125static int __init mace_init(void)
126{
127 PCIBIOS_MIN_IO = 0x1000;
128
129 /* Clear any outstanding errors and enable interrupts */
130 mace->pci.error_addr = 0;
131 mace->pci.error = 0;
132 mace->pci.control = 0xff008500;
133
134 printk("MACE PCI rev %d\n", mace->pci.rev);
135
136 BUG_ON(request_irq(MACE_PCI_BRIDGE_IRQ, macepci_error, 0,
137 "MACE PCI error", NULL));
138
139 ioport_resource.end = mace_pci_io_resource.end;
140 register_pci_controller(&mace_pci_controller);
141
142 return 0;
143}
144
145arch_initcall(mace_init);
diff --git a/arch/mips/pci/pci-jmr3927.c b/arch/mips/pci/pci-jmr3927.c
new file mode 100644
index 000000000000..95a028769e56
--- /dev/null
+++ b/arch/mips/pci/pci-jmr3927.c
@@ -0,0 +1,58 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: MontaVista Software, Inc.
4 * ahennessy@mvista.com
5 *
6 * Copyright (C) 2000-2001 Toshiba Corporation
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 * 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#include <linux/types.h>
30#include <linux/pci.h>
31#include <linux/kernel.h>
32#include <linux/init.h>
33
34#include <asm/jmr3927/jmr3927.h>
35#include <asm/debug.h>
36
37struct resource pci_io_resource = {
38 "IO MEM",
39 0x1000, /* reserve regacy I/O space */
40 0x1000 + JMR3927_PCIIO_SIZE - 1,
41 IORESOURCE_IO
42};
43
44struct resource pci_mem_resource = {
45 "PCI MEM",
46 JMR3927_PCIMEM,
47 JMR3927_PCIMEM + JMR3927_PCIMEM_SIZE - 1,
48 IORESOURCE_MEM
49};
50
51extern struct pci_ops jmr3927_pci_ops;
52
53struct pci_controller jmr3927_controller = {
54 .pci_ops = &jmr3927_pci_ops,
55 .io_resource = &pci_io_resource,
56 .mem_resource = &pci_mem_resource,
57 .mem_offset = JMR3927_PCIMEM;
58};
diff --git a/arch/mips/pci/pci-lasat.c b/arch/mips/pci/pci-lasat.c
new file mode 100644
index 000000000000..ae3cc4b254b5
--- /dev/null
+++ b/arch/mips/pci/pci-lasat.c
@@ -0,0 +1,95 @@
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) 2000, 2001, 04 Keith M Wesolowski
7 */
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/interrupt.h>
11#include <linux/pci.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/pci.h>
15#include <linux/delay.h>
16#include <asm/bootinfo.h>
17
18extern struct pci_ops nile4_pci_ops;
19extern struct pci_ops gt64120_pci_ops;
20static struct resource lasat_pci_mem_resource = {
21 .name = "LASAT PCI MEM",
22 .start = 0x18000000,
23 .end = 0x19FFFFFF,
24 .flags = IORESOURCE_MEM,
25};
26
27static struct resource lasat_pci_io_resource = {
28 .name = "LASAT PCI IO",
29 .start = 0x1a000000,
30 .end = 0x1bFFFFFF,
31 .flags = IORESOURCE_IO,
32};
33
34static struct pci_controller lasat_pci_controller = {
35 .mem_resource = &lasat_pci_mem_resource,
36 .io_resource = &lasat_pci_io_resource,
37};
38
39static int __init lasat_pci_setup(void)
40{
41 printk("PCI: starting\n");
42
43 switch (mips_machtype) {
44 case MACH_LASAT_100:
45 lasat_pci_controller.pci_ops = &gt64120_pci_ops;
46 break;
47 case MACH_LASAT_200:
48 lasat_pci_controller.pci_ops = &nile4_pci_ops;
49 break;
50 default:
51 panic("pcibios_init: mips_machtype incorrect");
52 }
53
54 register_pci_controller(&lasat_pci_controller);
55 return 0;
56}
57early_initcall(lasat_pci_setup);
58
59#define LASATINT_ETH1 0
60#define LASATINT_ETH0 1
61#define LASATINT_HDC 2
62#define LASATINT_COMP 3
63#define LASATINT_HDLC 4
64#define LASATINT_PCIA 5
65#define LASATINT_PCIB 6
66#define LASATINT_PCIC 7
67#define LASATINT_PCID 8
68
69int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
70{
71 switch (slot) {
72 case 1:
73 return LASATINT_PCIA; /* Expansion Module 0 */
74 case 2:
75 return LASATINT_PCIB; /* Expansion Module 1 */
76 case 3:
77 return LASATINT_PCIC; /* Expansion Module 2 */
78 case 4:
79 return LASATINT_ETH1; /* Ethernet 1 (LAN 2) */
80 case 5:
81 return LASATINT_ETH0; /* Ethernet 0 (LAN 1) */
82 case 6:
83 return LASATINT_HDC; /* IDE controller */
84 default:
85 return 0xff; /* Illegal */
86 }
87
88 return -1;
89}
90
91/* Do platform specific device initialization at pci_enable_device() time */
92int pcibios_plat_dev_init(struct pci_dev *dev)
93{
94 return 0;
95}
diff --git a/arch/mips/pci/pci-ocelot-c.c b/arch/mips/pci/pci-ocelot-c.c
new file mode 100644
index 000000000000..1d84d36e034d
--- /dev/null
+++ b/arch/mips/pci/pci-ocelot-c.c
@@ -0,0 +1,143 @@
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) 2004 by Ralf Baechle (ralf@linux-mips.org)
7 */
8
9#include <linux/types.h>
10#include <linux/pci.h>
11#include <asm/mv64340.h>
12
13#include <linux/init.h>
14
15/*
16 * We assume the address ranges have already been setup appropriately by
17 * the firmware. PMON in case of the Ocelot C does that.
18 */
19static struct resource mv_pci_io_mem0_resource = {
20 .name = "MV64340 PCI0 IO MEM",
21 .flags = IORESOURCE_IO
22};
23
24static struct resource mv_pci_mem0_resource = {
25 .name = "MV64340 PCI0 MEM",
26 .flags = IORESOURCE_MEM
27};
28
29static struct mv_pci_controller mv_bus0_controller = {
30 .pcic = {
31 .pci_ops = &mv_pci_ops,
32 .mem_resource = &mv_pci_mem0_resource,
33 .io_resource = &mv_pci_io_mem0_resource,
34 },
35 .config_addr = MV64340_PCI_0_CONFIG_ADDR,
36 .config_vreg = MV64340_PCI_0_CONFIG_DATA_VIRTUAL_REG,
37};
38
39static uint32_t mv_io_base, mv_io_size;
40
41static void mv64340_pci0_init(void)
42{
43 uint32_t mem0_base, mem0_size;
44 uint32_t io_base, io_size;
45
46 io_base = MV_READ(MV64340_PCI_0_IO_BASE_ADDR) << 16;
47 io_size = (MV_READ(MV64340_PCI_0_IO_SIZE) + 1) << 16;
48 mem0_base = MV_READ(MV64340_PCI_0_MEMORY0_BASE_ADDR) << 16;
49 mem0_size = (MV_READ(MV64340_PCI_0_MEMORY0_SIZE) + 1) << 16;
50
51 mv_pci_io_mem0_resource.start = 0;
52 mv_pci_io_mem0_resource.end = io_size - 1;
53 mv_pci_mem0_resource.start = mem0_base;
54 mv_pci_mem0_resource.end = mem0_base + mem0_size - 1;
55 mv_bus0_controller.pcic.mem_offset = mem0_base;
56 mv_bus0_controller.pcic.io_offset = 0;
57
58 ioport_resource.end = io_size - 1;
59
60 register_pci_controller(&mv_bus0_controller.pcic);
61
62 mv_io_base = io_base;
63 mv_io_size = io_size;
64}
65
66static struct resource mv_pci_io_mem1_resource = {
67 .name = "MV64340 PCI1 IO MEM",
68 .flags = IORESOURCE_IO
69};
70
71static struct resource mv_pci_mem1_resource = {
72 .name = "MV64340 PCI1 MEM",
73 .flags = IORESOURCE_MEM
74};
75
76static struct mv_pci_controller mv_bus1_controller = {
77 .pcic = {
78 .pci_ops = &mv_pci_ops,
79 .mem_resource = &mv_pci_mem1_resource,
80 .io_resource = &mv_pci_io_mem1_resource,
81 },
82 .config_addr = MV64340_PCI_1_CONFIG_ADDR,
83 .config_vreg = MV64340_PCI_1_CONFIG_DATA_VIRTUAL_REG,
84};
85
86static __init void mv64340_pci1_init(void)
87{
88 uint32_t mem0_base, mem0_size;
89 uint32_t io_base, io_size;
90
91 io_base = MV_READ(MV64340_PCI_1_IO_BASE_ADDR) << 16;
92 io_size = (MV_READ(MV64340_PCI_1_IO_SIZE) + 1) << 16;
93 mem0_base = MV_READ(MV64340_PCI_1_MEMORY0_BASE_ADDR) << 16;
94 mem0_size = (MV_READ(MV64340_PCI_1_MEMORY0_SIZE) + 1) << 16;
95
96 /*
97 * Here we assume the I/O window of second bus to be contiguous with
98 * the first. A gap is no problem but would waste address space for
99 * remapping the port space.
100 */
101 mv_pci_io_mem1_resource.start = mv_io_size;
102 mv_pci_io_mem1_resource.end = mv_io_size + io_size - 1;
103 mv_pci_mem1_resource.start = mem0_base;
104 mv_pci_mem1_resource.end = mem0_base + mem0_size - 1;
105 mv_bus1_controller.pcic.mem_offset = mem0_base;
106 mv_bus1_controller.pcic.io_offset = 0;
107
108 ioport_resource.end = io_base + io_size -mv_io_base - 1;
109
110 register_pci_controller(&mv_bus1_controller.pcic);
111
112 mv_io_size = io_base + io_size - mv_io_base;
113}
114
115static __init int __init ocelot_c_pci_init(void)
116{
117 unsigned long io_v_base;
118 uint32_t enable;
119
120 enable = ~MV_READ(MV64340_BASE_ADDR_ENABLE);
121
122 /*
123 * We require at least one enabled I/O or PCI memory window or we
124 * will ignore this PCI bus. We ignore PCI windows 1, 2 and 3.
125 */
126 if (enable & (0x01 << 9) || enable & (0x01 << 10))
127 mv64340_pci0_init();
128
129 if (enable & (0x01 << 14) || enable & (0x01 << 15))
130 mv64340_pci1_init();
131
132 if (mv_io_size) {
133 io_v_base = (unsigned long) ioremap(mv_io_base, mv_io_size);
134 if (!io_v_base)
135 panic("Could not ioremap I/O port range");
136
137 set_io_port_base(io_v_base);
138 }
139
140 return 0;
141}
142
143arch_initcall(ocelot_c_pci_init);
diff --git a/arch/mips/pci/pci-ocelot-g.c b/arch/mips/pci/pci-ocelot-g.c
new file mode 100644
index 000000000000..1e3430154fa0
--- /dev/null
+++ b/arch/mips/pci/pci-ocelot-g.c
@@ -0,0 +1,97 @@
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) 2004 by Ralf Baechle (ralf@linux-mips.org)
7 *
8 * This doesn't really fly - but I don't have a GT64240 system for testing.
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/pci.h>
14#include <asm/gt64240.h>
15
16/*
17 * We assume these address ranges have been programmed into the GT-64240 by
18 * the firmware. PMON in case of the Ocelot G does that. Note the size of
19 * the I/O range is completly stupid; I/O mappings are limited to at most
20 * 256 bytes by the PCI spec and deprecated; and just to make things worse
21 * apparently many devices don't decode more than 64k of I/O space.
22 */
23
24#define gt_io_size 0x20000000UL
25#define gt_io_base 0xe0000000UL
26
27static struct resource gt_pci_mem0_resource = {
28 .name = "MV64240 PCI0 MEM",
29 .start = 0xc0000000UL,
30 .end = 0xcfffffffUL,
31 .flags = IORESOURCE_MEM
32};
33
34static struct resource gt_pci_io_mem0_resource = {
35 .name = "MV64240 PCI0 IO MEM",
36 .start = 0xe0000000UL,
37 .end = 0xefffffffUL,
38 .flags = IORESOURCE_IO
39};
40
41static struct mv_pci_controller gt_bus0_controller = {
42 .pcic = {
43 .pci_ops = &mv_pci_ops,
44 .mem_resource = &gt_pci_mem0_resource,
45 .mem_offset = 0xc0000000UL,
46 .io_resource = &gt_pci_io_mem0_resource,
47 .io_offset = 0x00000000UL
48 },
49 .config_addr = PCI_0CONFIGURATION_ADDRESS,
50 .config_vreg = PCI_0CONFIGURATION_DATA_VIRTUAL_REGISTER,
51};
52
53static struct resource gt_pci_mem1_resource = {
54 .name = "MV64240 PCI1 MEM",
55 .start = 0xd0000000UL,
56 .end = 0xdfffffffUL,
57 .flags = IORESOURCE_MEM
58};
59
60static struct resource gt_pci_io_mem1_resource = {
61 .name = "MV64240 PCI1 IO MEM",
62 .start = 0xf0000000UL,
63 .end = 0xffffffffUL,
64 .flags = IORESOURCE_IO
65};
66
67static struct mv_pci_controller gt_bus1_controller = {
68 .pcic = {
69 .pci_ops = &mv_pci_ops,
70 .mem_resource = &gt_pci_mem1_resource,
71 .mem_offset = 0xd0000000UL,
72 .io_resource = &gt_pci_io_mem1_resource,
73 .io_offset = 0x10000000UL
74 },
75 .config_addr = PCI_1CONFIGURATION_ADDRESS,
76 .config_vreg = PCI_1CONFIGURATION_DATA_VIRTUAL_REGISTER,
77};
78
79static __init int __init ocelot_g_pci_init(void)
80{
81 unsigned long io_v_base;
82
83 if (gt_io_size) {
84 io_v_base = (unsigned long) ioremap(gt_io_base, gt_io_size);
85 if (!io_v_base)
86 panic("Could not ioremap I/O port range");
87
88 set_io_port_base(io_v_base);
89 }
90
91 register_pci_controller(&gt_bus0_controller.pcic);
92 register_pci_controller(&gt_bus1_controller.pcic);
93
94 return 0;
95}
96
97arch_initcall(ocelot_g_pci_init);
diff --git a/arch/mips/pci/pci-ocelot.c b/arch/mips/pci/pci-ocelot.c
new file mode 100644
index 000000000000..3da8a4ee6baa
--- /dev/null
+++ b/arch/mips/pci/pci-ocelot.c
@@ -0,0 +1,107 @@
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 iomem_resource.start = GT_PCI_MEM_BASE;
75 iomem_resource.end = GT_PCI_MEM_BASE + GT_PCI_MEM_BASE - 1;
76};
77
78static struct resource ocelot_io_resource = {
79 ioport_resource.start = GT_PCI_IO_BASE;
80 ioport_resource.end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1;
81};
82
83static struct pci_controller ocelot_pci_controller = {
84 .pci_ops = gt64120_pci_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/pci/pci-sb1250.c b/arch/mips/pci/pci-sb1250.c
new file mode 100644
index 000000000000..7cca3bde59b2
--- /dev/null
+++ b/arch/mips/pci/pci-sb1250.c
@@ -0,0 +1,292 @@
1/*
2 * Copyright (C) 2001,2002,2003 Broadcom Corporation
3 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20/*
21 * BCM1250-specific PCI support
22 *
23 * This module provides the glue between Linux's PCI subsystem
24 * and the hardware. We basically provide glue for accessing
25 * configuration space, and set up the translation for I/O
26 * space accesses.
27 *
28 * To access configuration space, we use ioremap. In the 32-bit
29 * kernel, this consumes either 4 or 8 page table pages, and 16MB of
30 * kernel mapped memory. Hopefully neither of these should be a huge
31 * problem.
32 */
33#include <linux/config.h>
34#include <linux/types.h>
35#include <linux/pci.h>
36#include <linux/kernel.h>
37#include <linux/init.h>
38#include <linux/mm.h>
39#include <linux/console.h>
40#include <linux/tty.h>
41
42#include <asm/io.h>
43
44#include <asm/sibyte/sb1250_defs.h>
45#include <asm/sibyte/sb1250_regs.h>
46#include <asm/sibyte/sb1250_scd.h>
47#include <asm/sibyte/board.h>
48
49/*
50 * Macros for calculating offsets into config space given a device
51 * structure or dev/fun/reg
52 */
53#define CFGOFFSET(bus,devfn,where) (((bus)<<16) + ((devfn)<<8) + (where))
54#define CFGADDR(bus,devfn,where) CFGOFFSET((bus)->number,(devfn),where)
55
56static void *cfg_space;
57
58#define PCI_BUS_ENABLED 1
59#define LDT_BUS_ENABLED 2
60#define PCI_DEVICE_MODE 4
61
62static int sb1250_bus_status = 0;
63
64#define PCI_BRIDGE_DEVICE 0
65#define LDT_BRIDGE_DEVICE 1
66
67#ifdef CONFIG_SIBYTE_HAS_LDT
68/*
69 * HT's level-sensitive interrupts require EOI, which is generated
70 * through a 4MB memory-mapped region
71 */
72unsigned long ldt_eoi_space;
73#endif
74
75/*
76 * Read/write 32-bit values in config space.
77 */
78static inline u32 READCFG32(u32 addr)
79{
80 return *(u32 *) (cfg_space + (addr & ~3));
81}
82
83static inline void WRITECFG32(u32 addr, u32 data)
84{
85 *(u32 *) (cfg_space + (addr & ~3)) = data;
86}
87
88int pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
89{
90 return dev->irq;
91}
92
93/* Do platform specific device initialization at pci_enable_device() time */
94int pcibios_plat_dev_init(struct pci_dev *dev)
95{
96 return 0;
97}
98
99/*
100 * Some checks before doing config cycles:
101 * In PCI Device Mode, hide everything on bus 0 except the LDT host
102 * bridge. Otherwise, access is controlled by bridge MasterEn bits.
103 */
104static int sb1250_pci_can_access(struct pci_bus *bus, int devfn)
105{
106 u32 devno;
107
108 if (!(sb1250_bus_status & (PCI_BUS_ENABLED | PCI_DEVICE_MODE)))
109 return 0;
110
111 if (bus->number == 0) {
112 devno = PCI_SLOT(devfn);
113 if (devno == LDT_BRIDGE_DEVICE)
114 return (sb1250_bus_status & LDT_BUS_ENABLED) != 0;
115 else if (sb1250_bus_status & PCI_DEVICE_MODE)
116 return 0;
117 else
118 return 1;
119 } else
120 return 1;
121}
122
123/*
124 * Read/write access functions for various sizes of values
125 * in config space. Return all 1's for disallowed accesses
126 * for a kludgy but adequate simulation of master aborts.
127 */
128
129static int sb1250_pcibios_read(struct pci_bus *bus, unsigned int devfn,
130 int where, int size, u32 * val)
131{
132 u32 data = 0;
133
134 if ((size == 2) && (where & 1))
135 return PCIBIOS_BAD_REGISTER_NUMBER;
136 else if ((size == 4) && (where & 3))
137 return PCIBIOS_BAD_REGISTER_NUMBER;
138
139 if (sb1250_pci_can_access(bus, devfn))
140 data = READCFG32(CFGADDR(bus, devfn, where));
141 else
142 data = 0xFFFFFFFF;
143
144 if (size == 1)
145 *val = (data >> ((where & 3) << 3)) & 0xff;
146 else if (size == 2)
147 *val = (data >> ((where & 3) << 3)) & 0xffff;
148 else
149 *val = data;
150
151 return PCIBIOS_SUCCESSFUL;
152}
153
154static int sb1250_pcibios_write(struct pci_bus *bus, unsigned int devfn,
155 int where, int size, u32 val)
156{
157 u32 cfgaddr = CFGADDR(bus, devfn, where);
158 u32 data = 0;
159
160 if ((size == 2) && (where & 1))
161 return PCIBIOS_BAD_REGISTER_NUMBER;
162 else if ((size == 4) && (where & 3))
163 return PCIBIOS_BAD_REGISTER_NUMBER;
164
165 if (!sb1250_pci_can_access(bus, devfn))
166 return PCIBIOS_BAD_REGISTER_NUMBER;
167
168 data = READCFG32(cfgaddr);
169
170 if (size == 1)
171 data = (data & ~(0xff << ((where & 3) << 3))) |
172 (val << ((where & 3) << 3));
173 else if (size == 2)
174 data = (data & ~(0xffff << ((where & 3) << 3))) |
175 (val << ((where & 3) << 3));
176 else
177 data = val;
178
179 WRITECFG32(cfgaddr, data);
180
181 return PCIBIOS_SUCCESSFUL;
182}
183
184struct pci_ops sb1250_pci_ops = {
185 .read = sb1250_pcibios_read,
186 .write = sb1250_pcibios_write,
187};
188
189static struct resource sb1250_mem_resource = {
190 .name = "SB1250 PCI MEM",
191 .start = 0x40000000UL,
192 .end = 0x5fffffffUL,
193 .flags = IORESOURCE_MEM,
194};
195
196static struct resource sb1250_io_resource = {
197 .name = "SB1250 PCI I/O",
198 .start = 0x00000000UL,
199 .end = 0x01ffffffUL,
200 .flags = IORESOURCE_IO,
201};
202
203struct pci_controller sb1250_controller = {
204 .pci_ops = &sb1250_pci_ops,
205 .mem_resource = &sb1250_mem_resource,
206 .io_resource = &sb1250_io_resource,
207};
208
209static int __init sb1250_pcibios_init(void)
210{
211 uint32_t cmdreg;
212 uint64_t reg;
213 extern int pci_probe_only;
214
215 /* CFE will assign PCI resources */
216 pci_probe_only = 1;
217
218 /* Avoid ISA compat ranges. */
219 PCIBIOS_MIN_IO = 0x00008000UL;
220 PCIBIOS_MIN_MEM = 0x01000000UL;
221
222 /* Set I/O resource limits. */
223 ioport_resource.end = 0x01ffffffUL; /* 32MB accessible by sb1250 */
224 iomem_resource.end = 0xffffffffUL; /* no HT support yet */
225
226 cfg_space =
227 ioremap(A_PHYS_LDTPCI_CFG_MATCH_BITS, 16 * 1024 * 1024);
228
229 /*
230 * See if the PCI bus has been configured by the firmware.
231 */
232 reg = *((volatile uint64_t *) IOADDR(A_SCD_SYSTEM_CFG));
233 if (!(reg & M_SYS_PCI_HOST)) {
234 sb1250_bus_status |= PCI_DEVICE_MODE;
235 } else {
236 cmdreg =
237 READCFG32(CFGOFFSET
238 (0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0),
239 PCI_COMMAND));
240 if (!(cmdreg & PCI_COMMAND_MASTER)) {
241 printk
242 ("PCI: Skipping PCI probe. Bus is not initialized.\n");
243 iounmap(cfg_space);
244 return 0;
245 }
246 sb1250_bus_status |= PCI_BUS_ENABLED;
247 }
248
249 /*
250 * Establish mappings in KSEG2 (kernel virtual) to PCI I/O
251 * space. Use "match bytes" policy to make everything look
252 * little-endian. So, you need to also set
253 * CONFIG_SWAP_IO_SPACE, but this is the combination that
254 * works correctly with most of Linux's drivers.
255 * XXX ehs: Should this happen in PCI Device mode?
256 */
257
258 set_io_port_base((unsigned long)
259 ioremap(A_PHYS_LDTPCI_IO_MATCH_BYTES, 65536));
260 isa_slot_offset = (unsigned long)
261 ioremap(A_PHYS_LDTPCI_IO_MATCH_BYTES_32, 1024 * 1024);
262
263#ifdef CONFIG_SIBYTE_HAS_LDT
264 /*
265 * Also check the LDT bridge's enable, just in case we didn't
266 * initialize that one.
267 */
268
269 cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(LDT_BRIDGE_DEVICE, 0),
270 PCI_COMMAND));
271 if (cmdreg & PCI_COMMAND_MASTER) {
272 sb1250_bus_status |= LDT_BUS_ENABLED;
273
274 /*
275 * Need bits 23:16 to convey vector number. Note that
276 * this consumes 4MB of kernel-mapped memory
277 * (Kseg2/Kseg3) for 32-bit kernel.
278 */
279 ldt_eoi_space = (unsigned long)
280 ioremap(A_PHYS_LDT_SPECIAL_MATCH_BYTES,
281 4 * 1024 * 1024);
282 }
283#endif
284
285 register_pci_controller(&sb1250_controller);
286
287#ifdef CONFIG_VGA_CONSOLE
288 take_over_console(&vga_con, 0, MAX_NR_CONSOLES - 1, 1);
289#endif
290 return 0;
291}
292arch_initcall(sb1250_pcibios_init);
diff --git a/arch/mips/pci/pci-vr41xx.c b/arch/mips/pci/pci-vr41xx.c
new file mode 100644
index 000000000000..f3ccbf7fada4
--- /dev/null
+++ b/arch/mips/pci/pci-vr41xx.c
@@ -0,0 +1,291 @@
1/*
2 * pci-vr41xx.c, PCI Control Unit routines for the NEC VR4100 series.
3 *
4 * Copyright (C) 2001-2003 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
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
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23/*
24 * Changes:
25 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
26 * - New creation, NEC VR4122 and VR4131 are supported.
27 */
28#include <linux/init.h>
29#include <linux/pci.h>
30#include <linux/types.h>
31
32#include <asm/cpu.h>
33#include <asm/io.h>
34#include <asm/vr41xx/vr41xx.h>
35
36#include "pci-vr41xx.h"
37
38extern struct pci_ops vr41xx_pci_ops;
39
40static struct pci_master_address_conversion pci_master_memory1 = {
41 .bus_base_address = PCI_MASTER_MEM1_BUS_BASE_ADDRESS,
42 .address_mask = PCI_MASTER_MEM1_ADDRESS_MASK,
43 .pci_base_address = PCI_MASTER_MEM1_PCI_BASE_ADDRESS,
44};
45
46static struct pci_target_address_conversion pci_target_memory1 = {
47 .address_mask = PCI_TARGET_MEM1_ADDRESS_MASK,
48 .bus_base_address = PCI_TARGET_MEM1_BUS_BASE_ADDRESS,
49};
50
51static struct pci_master_address_conversion pci_master_io = {
52 .bus_base_address = PCI_MASTER_IO_BUS_BASE_ADDRESS,
53 .address_mask = PCI_MASTER_IO_ADDRESS_MASK,
54 .pci_base_address = PCI_MASTER_IO_PCI_BASE_ADDRESS,
55};
56
57static struct pci_mailbox_address pci_mailbox = {
58 .base_address = PCI_MAILBOX_BASE_ADDRESS,
59};
60
61static struct pci_target_address_window pci_target_window1 = {
62 .base_address = PCI_TARGET_WINDOW1_BASE_ADDRESS,
63};
64
65static struct resource pci_mem_resource = {
66 .name = "PCI Memory resources",
67 .start = PCI_MEM_RESOURCE_START,
68 .end = PCI_MEM_RESOURCE_END,
69 .flags = IORESOURCE_MEM,
70};
71
72static struct resource pci_io_resource = {
73 .name = "PCI I/O resources",
74 .start = PCI_IO_RESOURCE_START,
75 .end = PCI_IO_RESOURCE_END,
76 .flags = IORESOURCE_IO,
77};
78
79static struct pci_controller_unit_setup vr41xx_pci_controller_unit_setup = {
80 .master_memory1 = &pci_master_memory1,
81 .target_memory1 = &pci_target_memory1,
82 .master_io = &pci_master_io,
83 .exclusive_access = CANNOT_LOCK_FROM_DEVICE,
84 .wait_time_limit_from_irdy_to_trdy = 0,
85 .mailbox = &pci_mailbox,
86 .target_window1 = &pci_target_window1,
87 .master_latency_timer = 0x80,
88 .retry_limit = 0,
89 .arbiter_priority_control = PCI_ARBITRATION_MODE_FAIR,
90 .take_away_gnt_mode = PCI_TAKE_AWAY_GNT_DISABLE,
91};
92
93static struct pci_controller vr41xx_pci_controller = {
94 .pci_ops = &vr41xx_pci_ops,
95 .mem_resource = &pci_mem_resource,
96 .io_resource = &pci_io_resource,
97};
98
99void __init vr41xx_pciu_setup(struct pci_controller_unit_setup *setup)
100{
101 vr41xx_pci_controller_unit_setup = *setup;
102}
103
104static int __init vr41xx_pciu_init(void)
105{
106 struct pci_controller_unit_setup *setup;
107 struct pci_master_address_conversion *master;
108 struct pci_target_address_conversion *target;
109 struct pci_mailbox_address *mailbox;
110 struct pci_target_address_window *window;
111 unsigned long vtclock, pci_clock_max;
112 uint32_t val;
113
114 setup = &vr41xx_pci_controller_unit_setup;
115
116 /* Disable PCI interrupt */
117 vr41xx_disable_pciint();
118
119 /* Supply VTClock to PCIU */
120 vr41xx_supply_clock(PCIU_CLOCK);
121
122 /* Dummy write, waiting for supply of VTClock. */
123 vr41xx_disable_pciint();
124
125 /* Select PCI clock */
126 if (setup->pci_clock_max != 0)
127 pci_clock_max = setup->pci_clock_max;
128 else
129 pci_clock_max = PCI_CLOCK_MAX;
130 vtclock = vr41xx_get_vtclock_frequency();
131 if (vtclock < pci_clock_max)
132 writel(EQUAL_VTCLOCK, PCICLKSELREG);
133 else if ((vtclock / 2) < pci_clock_max)
134 writel(HALF_VTCLOCK, PCICLKSELREG);
135 else if (current_cpu_data.processor_id >= PRID_VR4131_REV2_1 &&
136 (vtclock / 3) < pci_clock_max)
137 writel(ONE_THIRD_VTCLOCK, PCICLKSELREG);
138 else if ((vtclock / 4) < pci_clock_max)
139 writel(QUARTER_VTCLOCK, PCICLKSELREG);
140 else {
141 printk(KERN_ERR "PCI Clock is over 33MHz.\n");
142 return -EINVAL;
143 }
144
145 /* Supply PCI clock by PCI bus */
146 vr41xx_supply_clock(PCI_CLOCK);
147
148 if (setup->master_memory1 != NULL) {
149 master = setup->master_memory1;
150 val = IBA(master->bus_base_address) |
151 MASTER_MSK(master->address_mask) |
152 WINEN |
153 PCIA(master->pci_base_address);
154 writel(val, PCIMMAW1REG);
155 } else {
156 val = readl(PCIMMAW1REG);
157 val &= ~WINEN;
158 writel(val, PCIMMAW1REG);
159 }
160
161 if (setup->master_memory2 != NULL) {
162 master = setup->master_memory2;
163 val = IBA(master->bus_base_address) |
164 MASTER_MSK(master->address_mask) |
165 WINEN |
166 PCIA(master->pci_base_address);
167 writel(val, PCIMMAW2REG);
168 } else {
169 val = readl(PCIMMAW2REG);
170 val &= ~WINEN;
171 writel(val, PCIMMAW2REG);
172 }
173
174 if (setup->target_memory1 != NULL) {
175 target = setup->target_memory1;
176 val = TARGET_MSK(target->address_mask) |
177 WINEN |
178 ITA(target->bus_base_address);
179 writel(val, PCITAW1REG);
180 } else {
181 val = readl(PCITAW1REG);
182 val &= ~WINEN;
183 writel(val, PCITAW1REG);
184 }
185
186 if (setup->target_memory2 != NULL) {
187 target = setup->target_memory2;
188 val = TARGET_MSK(target->address_mask) |
189 WINEN |
190 ITA(target->bus_base_address);
191 writel(val, PCITAW2REG);
192 } else {
193 val = readl(PCITAW2REG);
194 val &= ~WINEN;
195 writel(val, PCITAW2REG);
196 }
197
198 if (setup->master_io != NULL) {
199 master = setup->master_io;
200 val = IBA(master->bus_base_address) |
201 MASTER_MSK(master->address_mask) |
202 WINEN |
203 PCIIA(master->pci_base_address);
204 writel(val, PCIMIOAWREG);
205 } else {
206 val = readl(PCIMIOAWREG);
207 val &= ~WINEN;
208 writel(val, PCIMIOAWREG);
209 }
210
211 if (setup->exclusive_access == CANNOT_LOCK_FROM_DEVICE)
212 writel(UNLOCK, PCIEXACCREG);
213 else
214 writel(0, PCIEXACCREG);
215
216 if (current_cpu_data.cputype == CPU_VR4122)
217 writel(TRDYV(setup->wait_time_limit_from_irdy_to_trdy), PCITRDYVREG);
218
219 writel(MLTIM(setup->master_latency_timer), LATTIMEREG);
220
221 if (setup->mailbox != NULL) {
222 mailbox = setup->mailbox;
223 val = MBADD(mailbox->base_address) | TYPE_32BITSPACE |
224 MSI_MEMORY | PREF_APPROVAL;
225 writel(val, MAILBAREG);
226 }
227
228 if (setup->target_window1) {
229 window = setup->target_window1;
230 val = PMBA(window->base_address) | TYPE_32BITSPACE |
231 MSI_MEMORY | PREF_APPROVAL;
232 writel(val, PCIMBA1REG);
233 }
234
235 if (setup->target_window2) {
236 window = setup->target_window2;
237 val = PMBA(window->base_address) | TYPE_32BITSPACE |
238 MSI_MEMORY | PREF_APPROVAL;
239 writel(val, PCIMBA2REG);
240 }
241
242 val = readl(RETVALREG);
243 val &= ~RTYVAL_MASK;
244 val |= RTYVAL(setup->retry_limit);
245 writel(val, RETVALREG);
246
247 val = readl(PCIAPCNTREG);
248 val &= ~(TKYGNT | PAPC);
249
250 switch (setup->arbiter_priority_control) {
251 case PCI_ARBITRATION_MODE_ALTERNATE_0:
252 val |= PAPC_ALTERNATE_0;
253 break;
254 case PCI_ARBITRATION_MODE_ALTERNATE_B:
255 val |= PAPC_ALTERNATE_B;
256 break;
257 default:
258 val |= PAPC_FAIR;
259 break;
260 }
261
262 if (setup->take_away_gnt_mode == PCI_TAKE_AWAY_GNT_ENABLE)
263 val |= TKYGNT_ENABLE;
264
265 writel(val, PCIAPCNTREG);
266
267 writel(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
268 PCI_COMMAND_PARITY | PCI_COMMAND_SERR, COMMANDREG);
269
270 /* Clear bus error */
271 readl(BUSERRADREG);
272
273 writel(BLOODY_CONFIG_DONE, PCIENREG);
274
275 if (setup->mem_resource != NULL)
276 vr41xx_pci_controller.mem_resource = setup->mem_resource;
277
278 if (setup->io_resource != NULL) {
279 vr41xx_pci_controller.io_resource = setup->io_resource;
280 } else {
281 set_io_port_base(IO_PORT_BASE);
282 ioport_resource.start = IO_PORT_RESOURCE_START;
283 ioport_resource.end = IO_PORT_RESOURCE_END;
284 }
285
286 register_pci_controller(&vr41xx_pci_controller);
287
288 return 0;
289}
290
291arch_initcall(vr41xx_pciu_init);
diff --git a/arch/mips/pci/pci-vr41xx.h b/arch/mips/pci/pci-vr41xx.h
new file mode 100644
index 000000000000..23815c8b903c
--- /dev/null
+++ b/arch/mips/pci/pci-vr41xx.h
@@ -0,0 +1,151 @@
1/*
2 * pci-vr41xx.h, Include file for PCI Control Unit of the NEC VR4100 series.
3 *
4 * Copyright (C) 2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __PCI_VR41XX_H
23#define __PCI_VR41XX_H
24
25#define PCIMMAW1REG KSEG1ADDR(0x0f000c00)
26#define PCIMMAW2REG KSEG1ADDR(0x0f000c04)
27#define PCITAW1REG KSEG1ADDR(0x0f000c08)
28#define PCITAW2REG KSEG1ADDR(0x0f000c0c)
29#define PCIMIOAWREG KSEG1ADDR(0x0f000c10)
30 #define IBA(addr) ((addr) & 0xff000000U)
31 #define MASTER_MSK(mask) (((mask) >> 11) & 0x000fe000U)
32 #define PCIA(addr) (((addr) >> 24) & 0x000000ffU)
33 #define TARGET_MSK(mask) (((mask) >> 8) & 0x000fe000U)
34 #define ITA(addr) (((addr) >> 24) & 0x000000ffU)
35 #define PCIIA(addr) (((addr) >> 24) & 0x000000ffU)
36 #define WINEN 0x1000U
37#define PCICONFDREG KSEG1ADDR(0x0f000c14)
38#define PCICONFAREG KSEG1ADDR(0x0f000c18)
39#define PCIMAILREG KSEG1ADDR(0x0f000c1c)
40#define BUSERRADREG KSEG1ADDR(0x0f000c24)
41 #define EA(reg) ((reg) &0xfffffffc)
42
43#define INTCNTSTAREG KSEG1ADDR(0x0f000c28)
44 #define MABTCLR 0x80000000U
45 #define TRDYCLR 0x40000000U
46 #define PARCLR 0x20000000U
47 #define MBCLR 0x10000000U
48 #define SERRCLR 0x08000000U
49 #define RTYCLR 0x04000000U
50 #define MABCLR 0x02000000U
51 #define TABCLR 0x01000000U
52 /* RFU */
53 #define MABTMSK 0x00008000U
54 #define TRDYMSK 0x00004000U
55 #define PARMSK 0x00002000U
56 #define MBMSK 0x00001000U
57 #define SERRMSK 0x00000800U
58 #define RTYMSK 0x00000400U
59 #define MABMSK 0x00000200U
60 #define TABMSK 0x00000100U
61 #define IBAMABT 0x00000080U
62 #define TRDYRCH 0x00000040U
63 #define PAR 0x00000020U
64 #define MB 0x00000010U
65 #define PCISERR 0x00000008U
66 #define RTYRCH 0x00000004U
67 #define MABORT 0x00000002U
68 #define TABORT 0x00000001U
69
70#define PCIEXACCREG KSEG1ADDR(0x0f000c2c)
71 #define UNLOCK 0x2U
72 #define EAREQ 0x1U
73#define PCIRECONTREG KSEG1ADDR(0x0f000c30)
74 #define RTRYCNT(reg) ((reg) & 0x000000ffU)
75#define PCIENREG KSEG1ADDR(0x0f000c34)
76 #define BLOODY_CONFIG_DONE 0x4U
77#define PCICLKSELREG KSEG1ADDR(0x0f000c38)
78 #define EQUAL_VTCLOCK 0x2U
79 #define HALF_VTCLOCK 0x0U
80 #define ONE_THIRD_VTCLOCK 0x3U
81 #define QUARTER_VTCLOCK 0x1U
82#define PCITRDYVREG KSEG1ADDR(0x0f000c3c)
83 #define TRDYV(val) ((uint32_t)(val) & 0xffU)
84#define PCICLKRUNREG KSEG1ADDR(0x0f000c60)
85
86#define VENDORIDREG KSEG1ADDR(0x0f000d00)
87#define DEVICEIDREG KSEG1ADDR(0x0f000d00)
88#define COMMANDREG KSEG1ADDR(0x0f000d04)
89#define STATUSREG KSEG1ADDR(0x0f000d04)
90#define REVIDREG KSEG1ADDR(0x0f000d08)
91#define CLASSREG KSEG1ADDR(0x0f000d08)
92#define CACHELSREG KSEG1ADDR(0x0f000d0c)
93#define LATTIMEREG KSEG1ADDR(0x0f000d0c)
94 #define MLTIM(val) (((uint32_t)(val) << 7) & 0xff00U)
95#define MAILBAREG KSEG1ADDR(0x0f000d10)
96#define PCIMBA1REG KSEG1ADDR(0x0f000d14)
97#define PCIMBA2REG KSEG1ADDR(0x0f000d18)
98 #define MBADD(base) ((base) & 0xfffff800U)
99 #define PMBA(base) ((base) & 0xffe00000U)
100 #define PREF 0x8U
101 #define PREF_APPROVAL 0x8U
102 #define PREF_DISAPPROVAL 0x0U
103 #define TYPE 0x6U
104 #define TYPE_32BITSPACE 0x0U
105 #define MSI 0x1U
106 #define MSI_MEMORY 0x0U
107#define INTLINEREG KSEG1ADDR(0x0f000d3c)
108#define INTPINREG KSEG1ADDR(0x0f000d3c)
109#define RETVALREG KSEG1ADDR(0x0f000d40)
110#define PCIAPCNTREG KSEG1ADDR(0x0f000d40)
111 #define TKYGNT 0x04000000U
112 #define TKYGNT_ENABLE 0x04000000U
113 #define TKYGNT_DISABLE 0x00000000U
114 #define PAPC 0x03000000U
115 #define PAPC_ALTERNATE_B 0x02000000U
116 #define PAPC_ALTERNATE_0 0x01000000U
117 #define PAPC_FAIR 0x00000000U
118 #define RTYVAL(val) (((uint32_t)(val) << 7) & 0xff00U)
119 #define RTYVAL_MASK 0xff00U
120
121#define PCI_CLOCK_MAX 33333333U
122
123/*
124 * Default setup
125 */
126#define PCI_MASTER_MEM1_BUS_BASE_ADDRESS 0x10000000U
127#define PCI_MASTER_MEM1_ADDRESS_MASK 0x7c000000U
128#define PCI_MASTER_MEM1_PCI_BASE_ADDRESS 0x10000000U
129
130#define PCI_TARGET_MEM1_ADDRESS_MASK 0x08000000U
131#define PCI_TARGET_MEM1_BUS_BASE_ADDRESS 0x00000000U
132
133#define PCI_MASTER_IO_BUS_BASE_ADDRESS 0x16000000U
134#define PCI_MASTER_IO_ADDRESS_MASK 0x7e000000U
135#define PCI_MASTER_IO_PCI_BASE_ADDRESS 0x00000000U
136
137#define PCI_MAILBOX_BASE_ADDRESS 0x00000000U
138
139#define PCI_TARGET_WINDOW1_BASE_ADDRESS 0x00000000U
140
141#define IO_PORT_BASE KSEG1ADDR(PCI_MASTER_IO_BUS_BASE_ADDRESS)
142#define IO_PORT_RESOURCE_START PCI_MASTER_IO_PCI_BASE_ADDRESS
143#define IO_PORT_RESOURCE_END (~PCI_MASTER_IO_ADDRESS_MASK & PCI_MASTER_ADDRESS_MASK)
144
145#define PCI_IO_RESOURCE_START 0x01000000UL
146#define PCI_IO_RESOURCE_END 0x01ffffffUL
147
148#define PCI_MEM_RESOURCE_START 0x11000000UL
149#define PCI_MEM_RESOURCE_END 0x13ffffffUL
150
151#endif /* __PCI_VR41XX_H */
diff --git a/arch/mips/pci/pci-yosemite.c b/arch/mips/pci/pci-yosemite.c
new file mode 100644
index 000000000000..dac9ed4b0ccf
--- /dev/null
+++ b/arch/mips/pci/pci-yosemite.c
@@ -0,0 +1,60 @@
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) 2004 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#include <linux/init.h>
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/pci.h>
12#include <asm/titan_dep.h>
13
14extern struct pci_ops titan_pci_ops;
15
16static struct resource py_mem_resource = {
17 "Titan PCI MEM", 0xe0000000UL, 0xe3ffffffUL, IORESOURCE_MEM
18};
19
20/*
21 * PMON really reserves 16MB of I/O port space but that's stupid, nothing
22 * needs that much since allocations are limited to 256 bytes per device
23 * anyway. So we just claim 64kB here.
24 */
25#define TITAN_IO_SIZE 0x0000ffffUL
26#define TITAN_IO_BASE 0xe8000000UL
27
28static struct resource py_io_resource = {
29 "Titan IO MEM", 0x00001000UL, TITAN_IO_SIZE - 1, IORESOURCE_IO,
30};
31
32static struct pci_controller py_controller = {
33 .pci_ops = &titan_pci_ops,
34 .mem_resource = &py_mem_resource,
35 .mem_offset = 0x00000000UL,
36 .io_resource = &py_io_resource,
37 .io_offset = 0x00000000UL
38};
39
40static char ioremap_failed[] __initdata = "Could not ioremap I/O port range";
41
42static int __init pmc_yosemite_setup(void)
43{
44 unsigned long io_v_base;
45
46 io_v_base = (unsigned long) ioremap(TITAN_IO_BASE, TITAN_IO_SIZE);
47 if (!io_v_base)
48 panic(ioremap_failed);
49
50 set_io_port_base(io_v_base);
51 TITAN_WRITE(RM9000x2_OCD_LKM7, TITAN_READ(RM9000x2_OCD_LKM7) | 1);
52
53 ioport_resource.end = TITAN_IO_SIZE - 1;
54
55 register_pci_controller(&py_controller);
56
57 return 0;
58}
59
60arch_initcall(pmc_yosemite_setup);
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
new file mode 100644
index 000000000000..8141dffac241
--- /dev/null
+++ b/arch/mips/pci/pci.c
@@ -0,0 +1,304 @@
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) 2003, 04 Ralf Baechle (ralf@linux-mips.org)
8 */
9#include <linux/config.h>
10#include <linux/kernel.h>
11#include <linux/mm.h>
12#include <linux/bootmem.h>
13#include <linux/init.h>
14#include <linux/types.h>
15#include <linux/pci.h>
16
17/*
18 * Indicate whether we respect the PCI setup left by the firmware.
19 *
20 * Make this long-lived so that we know when shutting down
21 * whether we probed only or not.
22 */
23int pci_probe_only;
24
25#define PCI_ASSIGN_ALL_BUSSES 1
26
27unsigned int pci_probe = PCI_ASSIGN_ALL_BUSSES;
28
29/*
30 * The PCI controller list.
31 */
32
33struct pci_controller *hose_head, **hose_tail = &hose_head;
34struct pci_controller *pci_isa_hose;
35
36unsigned long PCIBIOS_MIN_IO = 0x0000;
37unsigned long PCIBIOS_MIN_MEM = 0;
38
39/*
40 * We need to avoid collisions with `mirrored' VGA ports
41 * and other strange ISA hardware, so we always want the
42 * addresses to be allocated in the 0x000-0x0ff region
43 * modulo 0x400.
44 *
45 * Why? Because some silly external IO cards only decode
46 * the low 10 bits of the IO address. The 0x00-0xff region
47 * is reserved for motherboard devices that decode all 16
48 * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
49 * but we want to try to avoid allocating at 0x2900-0x2bff
50 * which might have be mirrored at 0x0100-0x03ff..
51 */
52void
53pcibios_align_resource(void *data, struct resource *res,
54 unsigned long size, unsigned long align)
55{
56 struct pci_dev *dev = data;
57 struct pci_controller *hose = dev->sysdata;
58 unsigned long start = res->start;
59
60 if (res->flags & IORESOURCE_IO) {
61 /* Make sure we start at our min on all hoses */
62 if (start < PCIBIOS_MIN_IO + hose->io_resource->start)
63 start = PCIBIOS_MIN_IO + hose->io_resource->start;
64
65 /*
66 * Put everything into 0x00-0xff region modulo 0x400
67 */
68 if (start & 0x300)
69 start = (start + 0x3ff) & ~0x3ff;
70 } else if (res->flags & IORESOURCE_MEM) {
71 /* Make sure we start at our min on all hoses */
72 if (start < PCIBIOS_MIN_MEM + hose->mem_resource->start)
73 start = PCIBIOS_MIN_MEM + hose->mem_resource->start;
74 }
75
76 res->start = start;
77}
78
79struct pci_controller * __init alloc_pci_controller(void)
80{
81 return alloc_bootmem(sizeof(struct pci_controller));
82}
83
84void __init register_pci_controller(struct pci_controller *hose)
85{
86 *hose_tail = hose;
87 hose_tail = &hose->next;
88}
89
90/* Most MIPS systems have straight-forward swizzling needs. */
91
92static inline u8 bridge_swizzle(u8 pin, u8 slot)
93{
94 return (((pin - 1) + slot) % 4) + 1;
95}
96
97static u8 __init common_swizzle(struct pci_dev *dev, u8 *pinp)
98{
99 u8 pin = *pinp;
100
101 while (dev->bus->parent) {
102 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
103 /* Move up the chain of bridges. */
104 dev = dev->bus->self;
105 }
106 *pinp = pin;
107
108 /* The slot is the slot of the last bridge. */
109 return PCI_SLOT(dev->devfn);
110}
111
112static int __init pcibios_init(void)
113{
114 struct pci_controller *hose;
115 struct pci_bus *bus;
116 int next_busno;
117 int need_domain_info = 0;
118
119 /* Scan all of the recorded PCI controllers. */
120 for (next_busno = 0, hose = hose_head; hose; hose = hose->next) {
121
122 if (request_resource(&iomem_resource, hose->mem_resource) < 0)
123 goto out;
124 if (request_resource(&ioport_resource, hose->io_resource) < 0)
125 goto out_free_mem_resource;
126
127 if (!hose->iommu)
128 PCI_DMA_BUS_IS_PHYS = 1;
129
130 bus = pci_scan_bus(next_busno, hose->pci_ops, hose);
131 hose->bus = bus;
132 hose->need_domain_info = need_domain_info;
133 next_busno = bus->subordinate + 1;
134 /* Don't allow 8-bit bus number overflow inside the hose -
135 reserve some space for bridges. */
136 if (next_busno > 224) {
137 next_busno = 0;
138 need_domain_info = 1;
139 }
140 continue;
141
142out_free_mem_resource:
143 release_resource(hose->mem_resource);
144
145out:
146 printk(KERN_WARNING
147 "Skipping PCI bus scan due to resource conflict\n");
148 }
149
150 if (!pci_probe_only)
151 pci_assign_unassigned_resources();
152 pci_fixup_irqs(common_swizzle, pcibios_map_irq);
153
154 return 0;
155}
156
157subsys_initcall(pcibios_init);
158
159static int pcibios_enable_resources(struct pci_dev *dev, int mask)
160{
161 u16 cmd, old_cmd;
162 int idx;
163 struct resource *r;
164
165 pci_read_config_word(dev, PCI_COMMAND, &cmd);
166 old_cmd = cmd;
167 for(idx=0; idx<6; idx++) {
168 /* Only set up the requested stuff */
169 if (!(mask & (1<<idx)))
170 continue;
171
172 r = &dev->resource[idx];
173 if (!r->start && r->end) {
174 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
175 return -EINVAL;
176 }
177 if (r->flags & IORESOURCE_IO)
178 cmd |= PCI_COMMAND_IO;
179 if (r->flags & IORESOURCE_MEM)
180 cmd |= PCI_COMMAND_MEMORY;
181 }
182 if (dev->resource[PCI_ROM_RESOURCE].start)
183 cmd |= PCI_COMMAND_MEMORY;
184 if (cmd != old_cmd) {
185 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
186 pci_write_config_word(dev, PCI_COMMAND, cmd);
187 }
188 return 0;
189}
190
191/*
192 * If we set up a device for bus mastering, we need to check the latency
193 * timer as certain crappy BIOSes forget to set it properly.
194 */
195unsigned int pcibios_max_latency = 255;
196
197void pcibios_set_master(struct pci_dev *dev)
198{
199 u8 lat;
200 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
201 if (lat < 16)
202 lat = (64 <= pcibios_max_latency) ? 64 : pcibios_max_latency;
203 else if (lat > pcibios_max_latency)
204 lat = pcibios_max_latency;
205 else
206 return;
207 printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n",
208 pci_name(dev), lat);
209 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
210}
211
212unsigned int pcibios_assign_all_busses(void)
213{
214 return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0;
215}
216
217int pcibios_enable_device(struct pci_dev *dev, int mask)
218{
219 int err;
220
221 if ((err = pcibios_enable_resources(dev, mask)) < 0)
222 return err;
223
224 return pcibios_plat_dev_init(dev);
225}
226
227static void __init pcibios_fixup_device_resources(struct pci_dev *dev,
228 struct pci_bus *bus)
229{
230 /* Update device resources. */
231 struct pci_controller *hose = (struct pci_controller *)bus->sysdata;
232 unsigned long offset = 0;
233 int i;
234
235 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
236 if (!dev->resource[i].start)
237 continue;
238 if (dev->resource[i].flags & IORESOURCE_IO)
239 offset = hose->io_offset;
240 else if (dev->resource[i].flags & IORESOURCE_MEM)
241 offset = hose->mem_offset;
242
243 dev->resource[i].start += offset;
244 dev->resource[i].end += offset;
245 }
246}
247
248void __devinit pcibios_fixup_bus(struct pci_bus *bus)
249{
250 /* Propagate hose info into the subordinate devices. */
251
252 struct pci_controller *hose = bus->sysdata;
253 struct list_head *ln;
254 struct pci_dev *dev = bus->self;
255
256 if (!dev) {
257 bus->resource[0] = hose->io_resource;
258 bus->resource[1] = hose->mem_resource;
259 } else if (pci_probe_only &&
260 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
261 pci_read_bridge_bases(bus);
262 pcibios_fixup_device_resources(dev, bus);
263 }
264
265 for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
266 struct pci_dev *dev = pci_dev_b(ln);
267
268 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
269 pcibios_fixup_device_resources(dev, bus);
270 }
271}
272
273void __init
274pcibios_update_irq(struct pci_dev *dev, int irq)
275{
276 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
277}
278
279void __devinit
280pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
281 struct resource *res)
282{
283 struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
284 unsigned long offset = 0;
285
286 if (res->flags & IORESOURCE_IO)
287 offset = hose->io_offset;
288 else if (res->flags & IORESOURCE_MEM)
289 offset = hose->mem_offset;
290
291 region->start = res->start - offset;
292 region->end = res->end - offset;
293}
294
295#ifdef CONFIG_HOTPLUG
296EXPORT_SYMBOL(pcibios_resource_to_bus);
297EXPORT_SYMBOL(PCIBIOS_MIN_IO);
298EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
299#endif
300
301char *pcibios_setup(char *str)
302{
303 return str;
304}
diff --git a/arch/mips/pmc-sierra/yosemite/Makefile b/arch/mips/pmc-sierra/yosemite/Makefile
new file mode 100644
index 000000000000..ae96a71a3089
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for the PMC-Sierra Titan
3#
4
5obj-y += irq-handler.o irq.o i2c-yosemite.o prom.o py-console.o setup.o
6
7obj-$(CONFIG_KGDB) += dbg_io.o
8obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
new file mode 100644
index 000000000000..b067988614c3
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
@@ -0,0 +1,171 @@
1/*
2 * arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
3 *
4 * Copyright (C) 2003 PMC-Sierra Inc.
5 * Author: Manish Lachwani (lachwani@pmc-sierra.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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28/*
29 * Description:
30 *
31 * This code reads the ATMEL 24CXX EEPROM. The PMC-Sierra Yosemite board uses the ATMEL
32 * 24C32/24C64 which uses two byte addressing as compared to 24C16. Note that this program
33 * uses the serial port like /dev/ttyS0, to communicate with the EEPROM. Hence, you are
34 * expected to have a connectivity from the EEPROM to the serial port. This program does
35 * __not__ communicate using the I2C protocol
36 */
37
38#include "atmel_read_eeprom.h"
39
40static void delay(int delay)
41{
42 while (delay--);
43}
44
45static void send_bit(unsigned char bit)
46{
47 scl_lo;
48 delay(TXX);
49 if (bit)
50 sda_hi;
51 else
52 sda_lo;
53
54 delay(TXX);
55 scl_hi;
56 delay(TXX);
57}
58
59static void send_ack(void)
60{
61 send_bit(0);
62}
63
64static void send_byte(unsigned char byte)
65{
66 int i = 0;
67
68 for (i = 7; i >= 0; i--)
69 send_bit((byte >> i) & 0x01);
70}
71
72static void send_start(void)
73{
74 sda_hi;
75 delay(TXX);
76 scl_hi;
77 delay(TXX);
78 sda_lo;
79 delay(TXX);
80}
81
82static void send_stop(void)
83{
84 sda_lo;
85 delay(TXX);
86 scl_hi;
87 delay(TXX);
88 sda_hi;
89 delay(TXX);
90}
91
92static void do_idle(void)
93{
94 sda_hi;
95 scl_hi;
96 vcc_off;
97}
98
99static int recv_bit(void)
100{
101 int status;
102
103 scl_lo;
104 delay(TXX);
105 sda_hi;
106 delay(TXX);
107 scl_hi;
108 delay(TXX);
109
110 return 1;
111}
112
113static unsigned char recv_byte(void) {
114 int i;
115 unsigned char byte=0;
116
117 for (i=7;i>=0;i--)
118 byte |= (recv_bit() << i);
119
120 return byte;
121}
122
123static int recv_ack(void)
124{
125 unsigned int ack;
126
127 ack = (unsigned int)recv_bit();
128 scl_lo;
129
130 if (ack) {
131 do_idle();
132 printk(KERN_ERR "Error reading the Atmel 24C32/24C64 EEPROM \n");
133 return -1;
134 }
135
136 return ack;
137}
138
139/*
140 * This function does the actual read of the EEPROM. It needs the buffer into which the
141 * read data is copied, the size of the EEPROM being read and the buffer size
142 */
143int read_eeprom(char *buffer, int eeprom_size, int size)
144{
145 int i = 0, err;
146
147 send_start();
148 send_byte(W_HEADER);
149 recv_ack();
150
151 /* EEPROM with size of more then 2K need two byte addressing */
152 if (eeprom_size > 2048) {
153 send_byte(0x00);
154 recv_ack();
155 }
156
157 send_start();
158 send_byte(R_HEADER);
159 err = recv_ack();
160 if (err == -1)
161 return err;
162
163 for (i = 0; i < size; i++) {
164 *buffer++ = recv_byte();
165 send_ack();
166 }
167
168 /* Note : We should do some check if the buffer contains correct information */
169
170 send_stop();
171}
diff --git a/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.h b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.h
new file mode 100644
index 000000000000..d27566d99ffc
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.h
@@ -0,0 +1,69 @@
1/*
2 * arch/mips/pmc-sierra/yosemite/atmel_read_eeprom.c
3 *
4 * Copyright (C) 2003 PMC-Sierra Inc.
5 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
6 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29/*
30 * Header file for atmel_read_eeprom.c
31 */
32
33#include <linux/types.h>
34#include <linux/pci.h>
35#include <linux/kernel.h>
36#include <linux/slab.h>
37#include <linux/version.h>
38#include <asm/pci.h>
39#include <asm/io.h>
40#include <linux/init.h>
41#include <asm/termios.h>
42#include <asm/ioctls.h>
43#include <linux/ioctl.h>
44#include <linux/fcntl.h>
45
46#define DEFAULT_PORT "/dev/ttyS0" /* Port to open */
47#define TXX 0 /* Dummy loop for spinning */
48
49#define BLOCK_SEL 0x00
50#define SLAVE_ADDR 0xa0
51#define READ_BIT 0x01
52#define WRITE_BIT 0x00
53#define R_HEADER SLAVE_ADDR + BLOCK_SEL + READ_BIT
54#define W_HEADER SLAVE_ADDR + BLOCK_SEL + WRITE_BIT
55
56/*
57 * Clock, Voltages and Data
58 */
59#define vcc_off (ioctl(fd, TIOCSBRK, 0))
60#define vcc_on (ioctl(fd, TIOCCBRK, 0))
61#define sda_hi (ioctl(fd, TIOCMBIS, &dtr))
62#define sda_lo (ioctl(fd, TIOCMBIC, &dtr))
63#define scl_lo (ioctl(fd, TIOCMBIC, &rts))
64#define scl_hi (ioctl(fd, TIOCMBIS, &rts))
65
66const char rts = TIOCM_RTS;
67const char dtr = TIOCM_DTR;
68int fd;
69
diff --git a/arch/mips/pmc-sierra/yosemite/dbg_io.c b/arch/mips/pmc-sierra/yosemite/dbg_io.c
new file mode 100644
index 000000000000..0f659c9106ac
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/dbg_io.c
@@ -0,0 +1,180 @@
1/*
2 * Copyright 2003 PMC-Sierra
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 * Support for KGDB for the Yosemite board. We make use of single serial
28 * port to be used for KGDB as well as console. The second serial port
29 * seems to be having a problem. Single IRQ is allocated for both the
30 * ports. Hence, the interrupt routing code needs to figure out whether
31 * the interrupt came from channel A or B.
32 */
33
34#include <asm/serial.h>
35
36/*
37 * Baud rate, Parity, Data and Stop bit settings for the
38 * serial port on the Yosemite. Note that the Early printk
39 * patch has been added. So, we should be all set to go
40 */
41#define YOSEMITE_BAUD_2400 2400
42#define YOSEMITE_BAUD_4800 4800
43#define YOSEMITE_BAUD_9600 9600
44#define YOSEMITE_BAUD_19200 19200
45#define YOSEMITE_BAUD_38400 38400
46#define YOSEMITE_BAUD_57600 57600
47#define YOSEMITE_BAUD_115200 115200
48
49#define YOSEMITE_PARITY_NONE 0
50#define YOSEMITE_PARITY_ODD 0x08
51#define YOSEMITE_PARITY_EVEN 0x18
52#define YOSEMITE_PARITY_MARK 0x28
53#define YOSEMITE_PARITY_SPACE 0x38
54
55#define YOSEMITE_DATA_5BIT 0x0
56#define YOSEMITE_DATA_6BIT 0x1
57#define YOSEMITE_DATA_7BIT 0x2
58#define YOSEMITE_DATA_8BIT 0x3
59
60#define YOSEMITE_STOP_1BIT 0x0
61#define YOSEMITE_STOP_2BIT 0x4
62
63/* This is crucial */
64#define SERIAL_REG_OFS 0x1
65
66#define SERIAL_RCV_BUFFER 0x0
67#define SERIAL_TRANS_HOLD 0x0
68#define SERIAL_SEND_BUFFER 0x0
69#define SERIAL_INTR_ENABLE (1 * SERIAL_REG_OFS)
70#define SERIAL_INTR_ID (2 * SERIAL_REG_OFS)
71#define SERIAL_DATA_FORMAT (3 * SERIAL_REG_OFS)
72#define SERIAL_LINE_CONTROL (3 * SERIAL_REG_OFS)
73#define SERIAL_MODEM_CONTROL (4 * SERIAL_REG_OFS)
74#define SERIAL_RS232_OUTPUT (4 * SERIAL_REG_OFS)
75#define SERIAL_LINE_STATUS (5 * SERIAL_REG_OFS)
76#define SERIAL_MODEM_STATUS (6 * SERIAL_REG_OFS)
77#define SERIAL_RS232_INPUT (6 * SERIAL_REG_OFS)
78#define SERIAL_SCRATCH_PAD (7 * SERIAL_REG_OFS)
79
80#define SERIAL_DIVISOR_LSB (0 * SERIAL_REG_OFS)
81#define SERIAL_DIVISOR_MSB (1 * SERIAL_REG_OFS)
82
83/*
84 * Functions to READ and WRITE to serial port 0
85 */
86#define SERIAL_READ(ofs) (*((volatile unsigned char*) \
87 (TITAN_SERIAL_BASE + ofs)))
88
89#define SERIAL_WRITE(ofs, val) ((*((volatile unsigned char*) \
90 (TITAN_SERIAL_BASE + ofs))) = val)
91
92/*
93 * Functions to READ and WRITE to serial port 1
94 */
95#define SERIAL_READ_1(ofs) (*((volatile unsigned char*) \
96 (TITAN_SERIAL_BASE_1 + ofs)
97
98#define SERIAL_WRITE_1(ofs, val) ((*((volatile unsigned char*) \
99 (TITAN_SERIAL_BASE_1 + ofs))) = val)
100
101/*
102 * Second serial port initialization
103 */
104void init_second_port(void)
105{
106 /* Disable Interrupts */
107 SERIAL_WRITE_1(SERIAL_LINE_CONTROL, 0x0);
108 SERIAL_WRITE_1(SERIAL_INTR_ENABLE, 0x0);
109
110 {
111 unsigned int divisor;
112
113 SERIAL_WRITE_1(SERIAL_LINE_CONTROL, 0x80);
114 divisor = TITAN_SERIAL_BASE_BAUD / YOSEMITE_BAUD_115200;
115 SERIAL_WRITE_1(SERIAL_DIVISOR_LSB, divisor & 0xff);
116
117 SERIAL_WRITE_1(SERIAL_DIVISOR_MSB,
118 (divisor & 0xff00) >> 8);
119 SERIAL_WRITE_1(SERIAL_LINE_CONTROL, 0x0);
120 }
121
122 SERIAL_WRITE_1(SERIAL_DATA_FORMAT, YOSEMITE_DATA_8BIT |
123 YOSEMITE_PARITY_NONE | YOSEMITE_STOP_1BIT);
124
125 /* Enable Interrupts */
126 SERIAL_WRITE_1(SERIAL_INTR_ENABLE, 0xf);
127}
128
129/* Initialize the serial port for KGDB debugging */
130void debugInit(unsigned int baud, unsigned char data, unsigned char parity,
131 unsigned char stop)
132{
133 /* Disable Interrupts */
134 SERIAL_WRITE(SERIAL_LINE_CONTROL, 0x0);
135 SERIAL_WRITE(SERIAL_INTR_ENABLE, 0x0);
136
137 {
138 unsigned int divisor;
139
140 SERIAL_WRITE(SERIAL_LINE_CONTROL, 0x80);
141
142 divisor = TITAN_SERIAL_BASE_BAUD / baud;
143 SERIAL_WRITE(SERIAL_DIVISOR_LSB, divisor & 0xff);
144
145 SERIAL_WRITE(SERIAL_DIVISOR_MSB, (divisor & 0xff00) >> 8);
146 SERIAL_WRITE(SERIAL_LINE_CONTROL, 0x0);
147 }
148
149 SERIAL_WRITE(SERIAL_DATA_FORMAT, data | parity | stop);
150}
151
152static int remoteDebugInitialized = 0;
153
154unsigned char getDebugChar(void)
155{
156 if (!remoteDebugInitialized) {
157 remoteDebugInitialized = 1;
158 debugInit(YOSEMITE_BAUD_115200,
159 YOSEMITE_DATA_8BIT,
160 YOSEMITE_PARITY_NONE, YOSEMITE_STOP_1BIT);
161 }
162
163 while ((SERIAL_READ(SERIAL_LINE_STATUS) & 0x1) == 0);
164 return SERIAL_READ(SERIAL_RCV_BUFFER);
165}
166
167int putDebugChar(unsigned char byte)
168{
169 if (!remoteDebugInitialized) {
170 remoteDebugInitialized = 1;
171 debugInit(YOSEMITE_BAUD_115200,
172 YOSEMITE_DATA_8BIT,
173 YOSEMITE_PARITY_NONE, YOSEMITE_STOP_1BIT);
174 }
175
176 while ((SERIAL_READ(SERIAL_LINE_STATUS) & 0x20) == 0);
177 SERIAL_WRITE(SERIAL_SEND_BUFFER, byte);
178
179 return 1;
180}
diff --git a/arch/mips/pmc-sierra/yosemite/ht-irq.c b/arch/mips/pmc-sierra/yosemite/ht-irq.c
new file mode 100644
index 000000000000..d22c9ffe4914
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/ht-irq.c
@@ -0,0 +1,53 @@
1/*
2 * Copyright 2003 PMC-Sierra
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#include <linux/types.h>
27#include <linux/pci.h>
28#include <linux/kernel.h>
29#include <linux/version.h>
30#include <linux/init.h>
31#include <asm/pci.h>
32
33/*
34 * HT Bus fixup for the Titan
35 * XXX IRQ values need to change based on the board layout
36 */
37void __init titan_ht_pcibios_fixup_bus(struct pci_bus *bus)
38{
39 struct pci_bus *current_bus = bus;
40 struct pci_dev *devices;
41 struct list_head *devices_link;
42
43 list_for_each(devices_link, &(current_bus->devices)) {
44 devices = pci_dev_b(devices_link);
45 if (devices == NULL)
46 continue;
47 }
48
49 /*
50 * PLX and SPKT related changes go here
51 */
52
53}
diff --git a/arch/mips/pmc-sierra/yosemite/ht.c b/arch/mips/pmc-sierra/yosemite/ht.c
new file mode 100644
index 000000000000..dad228d3a220
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/ht.c
@@ -0,0 +1,454 @@
1/*
2 * Copyright 2003 PMC-Sierra
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#include <linux/config.h>
27#include <linux/types.h>
28#include <linux/pci.h>
29#include <linux/kernel.h>
30#include <linux/slab.h>
31#include <linux/version.h>
32#include <asm/pci.h>
33#include <asm/io.h>
34
35#include <linux/init.h>
36#include <asm/titan_dep.h>
37
38#ifdef CONFIG_HYPERTRANSPORT
39
40
41/*
42 * This function check if the Hypertransport Link Initialization completed. If
43 * it did, then proceed further with scanning bus #2
44 */
45static __inline__ int check_titan_htlink(void)
46{
47 u32 val;
48
49 val = *(volatile uint32_t *)(RM9000x2_HTLINK_REG);
50 if (val & 0x00000020)
51 /* HT Link Initialization completed */
52 return 1;
53 else
54 return 0;
55}
56
57static int titan_ht_config_read_dword(struct pci_dev *device,
58 int offset, u32* val)
59{
60 int dev, bus, func;
61 uint32_t address_reg, data_reg;
62 uint32_t address;
63
64 bus = device->bus->number;
65 dev = PCI_SLOT(device->devfn);
66 func = PCI_FUNC(device->devfn);
67
68 /* XXX Need to change the Bus # */
69 if (bus > 2)
70 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
71 0x80000000 | 0x1;
72 else
73 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
74
75 address_reg = RM9000x2_OCD_HTCFGA;
76 data_reg = RM9000x2_OCD_HTCFGD;
77
78 RM9K_WRITE(address_reg, address);
79 RM9K_READ(data_reg, val);
80
81 return PCIBIOS_SUCCESSFUL;
82}
83
84
85static int titan_ht_config_read_word(struct pci_dev *device,
86 int offset, u16* val)
87{
88 int dev, bus, func;
89 uint32_t address_reg, data_reg;
90 uint32_t address;
91
92 bus = device->bus->number;
93 dev = PCI_SLOT(device->devfn);
94 func = PCI_FUNC(device->devfn);
95
96 /* XXX Need to change the Bus # */
97 if (bus > 2)
98 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
99 0x80000000 | 0x1;
100 else
101 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
102
103 address_reg = RM9000x2_OCD_HTCFGA;
104 data_reg = RM9000x2_OCD_HTCFGD;
105
106 if ((offset & 0x3) == 0)
107 offset = 0x2;
108 else
109 offset = 0x0;
110
111 RM9K_WRITE(address_reg, address);
112 RM9K_READ_16(data_reg + offset, val);
113
114 return PCIBIOS_SUCCESSFUL;
115}
116
117
118u32 longswap(unsigned long l)
119{
120 unsigned char b1,b2,b3,b4;
121
122 b1 = l&255;
123 b2 = (l>>8)&255;
124 b3 = (l>>16)&255;
125 b4 = (l>>24)&255;
126
127 return ((b1<<24) + (b2<<16) + (b3<<8) + b4);
128}
129
130
131static int titan_ht_config_read_byte(struct pci_dev *device,
132 int offset, u8* val)
133{
134 int dev, bus, func;
135 uint32_t address_reg, data_reg;
136 uint32_t address;
137 int offset1;
138
139 bus = device->bus->number;
140 dev = PCI_SLOT(device->devfn);
141 func = PCI_FUNC(device->devfn);
142
143 /* XXX Need to change the Bus # */
144 if (bus > 2)
145 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
146 0x80000000 | 0x1;
147 else
148 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
149
150 address_reg = RM9000x2_OCD_HTCFGA;
151 data_reg = RM9000x2_OCD_HTCFGD;
152
153 RM9K_WRITE(address_reg, address);
154
155 if ((offset & 0x3) == 0) {
156 offset1 = 0x3;
157 }
158 if ((offset & 0x3) == 1) {
159 offset1 = 0x2;
160 }
161 if ((offset & 0x3) == 2) {
162 offset1 = 0x1;
163 }
164 if ((offset & 0x3) == 3) {
165 offset1 = 0x0;
166 }
167 RM9K_READ_8(data_reg + offset1, val);
168
169 return PCIBIOS_SUCCESSFUL;
170}
171
172
173static int titan_ht_config_write_dword(struct pci_dev *device,
174 int offset, u8 val)
175{
176 int dev, bus, func;
177 uint32_t address_reg, data_reg;
178 uint32_t address;
179
180 bus = device->bus->number;
181 dev = PCI_SLOT(device->devfn);
182 func = PCI_FUNC(device->devfn);
183
184 /* XXX Need to change the Bus # */
185 if (bus > 2)
186 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
187 0x80000000 | 0x1;
188 else
189 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
190
191 address_reg = RM9000x2_OCD_HTCFGA;
192 data_reg = RM9000x2_OCD_HTCFGD;
193
194 RM9K_WRITE(address_reg, address);
195 RM9K_WRITE(data_reg, val);
196
197 return PCIBIOS_SUCCESSFUL;
198}
199
200static int titan_ht_config_write_word(struct pci_dev *device,
201 int offset, u8 val)
202{
203 int dev, bus, func;
204 uint32_t address_reg, data_reg;
205 uint32_t address;
206
207 bus = device->bus->number;
208 dev = PCI_SLOT(device->devfn);
209 func = PCI_FUNC(device->devfn);
210
211 /* XXX Need to change the Bus # */
212 if (bus > 2)
213 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
214 0x80000000 | 0x1;
215 else
216 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
217
218 address_reg = RM9000x2_OCD_HTCFGA;
219 data_reg = RM9000x2_OCD_HTCFGD;
220
221 if ((offset & 0x3) == 0)
222 offset = 0x2;
223 else
224 offset = 0x0;
225
226 RM9K_WRITE(address_reg, address);
227 RM9K_WRITE_16(data_reg + offset, val);
228
229 return PCIBIOS_SUCCESSFUL;
230}
231
232static int titan_ht_config_write_byte(struct pci_dev *device,
233 int offset, u8 val)
234{
235 int dev, bus, func;
236 uint32_t address_reg, data_reg;
237 uint32_t address;
238 int offset1;
239
240 bus = device->bus->number;
241 dev = PCI_SLOT(device->devfn);
242 func = PCI_FUNC(device->devfn);
243
244 /* XXX Need to change the Bus # */
245 if (bus > 2)
246 address = (bus << 16) | (dev << 11) | (func << 8) | (offset & 0xfc) |
247 0x80000000 | 0x1;
248 else
249 address = (dev << 11) | (func << 8) | (offset & 0xfc) | 0x80000000;
250
251 address_reg = RM9000x2_OCD_HTCFGA;
252 data_reg = RM9000x2_OCD_HTCFGD;
253
254 RM9K_WRITE(address_reg, address);
255
256 if ((offset & 0x3) == 0) {
257 offset1 = 0x3;
258 }
259 if ((offset & 0x3) == 1) {
260 offset1 = 0x2;
261 }
262 if ((offset & 0x3) == 2) {
263 offset1 = 0x1;
264 }
265 if ((offset & 0x3) == 3) {
266 offset1 = 0x0;
267 }
268
269 RM9K_WRITE_8(data_reg + offset1, val);
270 return PCIBIOS_SUCCESSFUL;
271}
272
273
274static void titan_pcibios_set_master(struct pci_dev *dev)
275{
276 u16 cmd;
277 int bus = dev->bus->number;
278
279 if (check_titan_htlink())
280 titan_ht_config_read_word(dev, PCI_COMMAND, &cmd);
281
282 cmd |= PCI_COMMAND_MASTER;
283
284 if (check_titan_htlink())
285 titan_ht_config_write_word(dev, PCI_COMMAND, cmd);
286}
287
288
289int pcibios_enable_resources(struct pci_dev *dev)
290{
291 u16 cmd, old_cmd;
292 u8 tmp1;
293 int idx;
294 struct resource *r;
295 int bus = dev->bus->number;
296
297 if (check_titan_htlink())
298 titan_ht_config_read_word(dev, PCI_COMMAND, &cmd);
299
300 old_cmd = cmd;
301 for (idx = 0; idx < 6; idx++) {
302 r = &dev->resource[idx];
303 if (!r->start && r->end) {
304 printk(KERN_ERR
305 "PCI: Device %s not available because of "
306 "resource collisions\n", pci_name(dev));
307 return -EINVAL;
308 }
309 if (r->flags & IORESOURCE_IO)
310 cmd |= PCI_COMMAND_IO;
311 if (r->flags & IORESOURCE_MEM)
312 cmd |= PCI_COMMAND_MEMORY;
313 }
314 if (cmd != old_cmd) {
315 if (check_titan_htlink())
316 titan_ht_config_write_word(dev, PCI_COMMAND, cmd);
317 }
318
319 if (check_titan_htlink())
320 titan_ht_config_read_byte(dev, PCI_CACHE_LINE_SIZE, &tmp1);
321
322 if (tmp1 != 8) {
323 printk(KERN_WARNING "PCI setting cache line size to 8 from "
324 "%d\n", tmp1);
325 }
326
327 if (check_titan_htlink())
328 titan_ht_config_write_byte(dev, PCI_CACHE_LINE_SIZE, 8);
329
330 if (check_titan_htlink())
331 titan_ht_config_read_byte(dev, PCI_LATENCY_TIMER, &tmp1);
332
333 if (tmp1 < 32 || tmp1 == 0xff) {
334 printk(KERN_WARNING "PCI setting latency timer to 32 from %d\n",
335 tmp1);
336 }
337
338 if (check_titan_htlink())
339 titan_ht_config_write_byte(dev, PCI_LATENCY_TIMER, 32);
340
341 return 0;
342}
343
344
345int pcibios_enable_device(struct pci_dev *dev, int mask)
346{
347 return pcibios_enable_resources(dev);
348}
349
350
351
352void pcibios_update_resource(struct pci_dev *dev, struct resource *root,
353 struct resource *res, int resource)
354{
355 u32 new, check;
356 int reg;
357
358 return;
359
360 new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
361 if (resource < 6) {
362 reg = PCI_BASE_ADDRESS_0 + 4 * resource;
363 } else if (resource == PCI_ROM_RESOURCE) {
364 res->flags |= IORESOURCE_ROM_ENABLE;
365 reg = dev->rom_base_reg;
366 } else {
367 /*
368 * Somebody might have asked allocation of a non-standard
369 * resource
370 */
371 return;
372 }
373
374 pci_write_config_dword(dev, reg, new);
375 pci_read_config_dword(dev, reg, &check);
376 if ((new ^ check) &
377 ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK :
378 PCI_BASE_ADDRESS_MEM_MASK)) {
379 printk(KERN_ERR "PCI: Error while updating region "
380 "%s/%d (%08x != %08x)\n", pci_name(dev), resource,
381 new, check);
382 }
383}
384
385
386void pcibios_align_resource(void *data, struct resource *res,
387 unsigned long size, unsigned long align)
388{
389 struct pci_dev *dev = data;
390
391 if (res->flags & IORESOURCE_IO) {
392 unsigned long start = res->start;
393
394 /* We need to avoid collisions with `mirrored' VGA ports
395 and other strange ISA hardware, so we always want the
396 addresses kilobyte aligned. */
397 if (size > 0x100) {
398 printk(KERN_ERR "PCI: I/O Region %s/%d too large"
399 " (%ld bytes)\n", pci_name(dev),
400 dev->resource - res, size);
401 }
402
403 start = (start + 1024 - 1) & ~(1024 - 1);
404 res->start = start;
405 }
406}
407
408struct pci_ops titan_pci_ops = {
409 titan_ht_config_read_byte,
410 titan_ht_config_read_word,
411 titan_ht_config_read_dword,
412 titan_ht_config_write_byte,
413 titan_ht_config_write_word,
414 titan_ht_config_write_dword
415};
416
417void __init pcibios_fixup_bus(struct pci_bus *c)
418{
419 titan_ht_pcibios_fixup_bus(c);
420}
421
422void __init pcibios_init(void)
423{
424
425 /* Reset PCI I/O and PCI MEM values */
426 /* XXX Need to add the proper values here */
427 ioport_resource.start = 0xe0000000;
428 ioport_resource.end = 0xe0000000 + 0x20000000 - 1;
429 iomem_resource.start = 0xc0000000;
430 iomem_resource.end = 0xc0000000 + 0x20000000 - 1;
431
432 /* XXX Need to add bus values */
433 pci_scan_bus(2, &titan_pci_ops, NULL);
434 pci_scan_bus(3, &titan_pci_ops, NULL);
435}
436
437/*
438 * for parsing "pci=" kernel boot arguments.
439 */
440char *pcibios_setup(char *str)
441{
442 printk(KERN_INFO "rr: pcibios_setup\n");
443 /* Nothing to do for now. */
444
445 return str;
446}
447
448unsigned __init int pcibios_assign_all_busses(void)
449{
450 /* We want to use the PCI bus detection done by PMON */
451 return 0;
452}
453
454#endif /* CONFIG_HYPERTRANSPORT */
diff --git a/arch/mips/pmc-sierra/yosemite/i2c-yosemite.c b/arch/mips/pmc-sierra/yosemite/i2c-yosemite.c
new file mode 100644
index 000000000000..416da22b3bf4
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/i2c-yosemite.c
@@ -0,0 +1,188 @@
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 = 0, bytes, 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/i2c-yosemite.h b/arch/mips/pmc-sierra/yosemite/i2c-yosemite.h
new file mode 100644
index 000000000000..31c5523276fa
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/i2c-yosemite.h
@@ -0,0 +1,96 @@
1/*
2 * arch/mips/pmc-sierra/yosemite/i2c-yosemite.h
3 *
4 * Copyright (C) 2003 PMC-Sierra Inc.
5 * Author: Manish Lachwani (lachwani@pmc-sierra.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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#ifndef __I2C_YOSEMITE_H
29#define __I2C_YOSEMITE_H
30
31/* Read and Write operations to the chip */
32
33#define TITAN_I2C_BASE 0xbb000000 /* XXX Needs to change */
34
35#define TITAN_I2C_WRITE(offset, data) \
36 *(volatile unsigned long *)(TITAN_I2C_BASE + offset) = data
37
38#define TITAN_I2C_READ(offset) *(volatile unsigned long *)(TITAN_I2C_BASE + offset)
39
40
41/* Local constansts*/
42#define TITAN_I2C_MAX_FILTER 15
43#define TITAN_I2C_MAX_CLK 1023
44#define TITAN_I2C_MAX_ARBF 15
45#define TITAN_I2C_MAX_NAK 15
46#define TITAN_I2C_MAX_MASTERCODE 7
47#define TITAN_I2C_MAX_WORDS_PER_RW 4
48#define TITAN_I2C_MAX_POLL 100
49
50/* Registers used for I2C work */
51#define TITAN_I2C_SCMB_CONTROL 0x0180 /* SCMB Control */
52#define TITAN_I2C_SCMB_CLOCK_A 0x0184 /* SCMB Clock A */
53#define TITAN_I2C_SCMB_CLOCK_B 0x0188 /* SCMB Clock B */
54#define TITAN_I2C_CONFIG 0x01A0 /* I2C Config */
55#define TITAN_I2C_COMMAND 0x01A4 /* I2C Command */
56#define TITAN_I2C_SLAVE_ADDRESS 0x01A8 /* I2C Slave Address */
57#define TITAN_I2C_DATA 0x01AC /* I2C Data [15:0] */
58#define TITAN_I2C_INTERRUPTS 0x01BC /* I2C Interrupts */
59
60/* Error */
61#define TITAN_I2C_ERR_ARB_LOST (-9220)
62#define TITAN_I2C_ERR_NO_RESP (-9221)
63#define TITAN_I2C_ERR_DATA_COLLISION (-9222)
64#define TITAN_I2C_ERR_TIMEOUT (-9223)
65#define TITAN_I2C_ERR_OK 0
66
67/* I2C Command Type */
68typedef enum {
69 TITAN_I2C_CMD_WRITE = 0,
70 TITAN_I2C_CMD_READ = 1,
71 TITAN_I2C_CMD_READ_WRITE = 2
72} titan_i2c_cmd_type;
73
74/* I2C structures */
75typedef struct {
76 int filtera; /* Register 0x0184, bits 15 - 12 */
77 int clka; /* Register 0x0184, bits 9 - 0 */
78 int filterb; /* Register 0x0188, bits 15 - 12 */
79 int clkb; /* Register 0x0188, bits 9 - 0 */
80} titan_i2c_config;
81
82/* I2C command type */
83typedef struct {
84 titan_i2c_cmd_type type; /* Type of command */
85 int num_arb; /* Register 0x01a0, bits 15 - 12 */
86 int num_nak; /* Register 0x01a0, bits 11 - 8 */
87 int addr_size; /* Register 0x01a0, bit 7 */
88 int mst_code; /* Register 0x01a0, bits 6 - 4 */
89 int arb_en; /* Register 0x01a0, bit 1 */
90 int speed; /* Register 0x01a0, bit 0 */
91 int slave_addr; /* Register 0x01a8 */
92 int write_size; /* Register 0x01a4, bits 10 - 8 */
93 unsigned int *data; /* Register 0x01ac */
94} titan_i2c_command;
95
96#endif /* __I2C_YOSEMITE_H */
diff --git a/arch/mips/pmc-sierra/yosemite/irq-handler.S b/arch/mips/pmc-sierra/yosemite/irq-handler.S
new file mode 100644
index 000000000000..33b9c40d4f5c
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/irq-handler.S
@@ -0,0 +1,93 @@
1/*
2 * Copyright 2003, 04 PMC-Sierra Inc.
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com
4 * Copyright 2004 Ralf Baechle (ralf@linux-mips.org)
5 *
6 * First-level interrupt router for the PMC-Sierra Titan board
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 * Titan supports Hypertransport or PCI but not both. Hence, one interrupt
14 * line is shared between the PCI slot A and Hypertransport. This is the
15 * Processor INTB #0.
16 */
17
18#include <linux/config.h>
19#include <asm/asm.h>
20#include <asm/mipsregs.h>
21#include <asm/addrspace.h>
22#include <asm/regdef.h>
23#include <asm/stackframe.h>
24
25 .align 5
26 NESTED(titan_handle_int, PT_SIZE, sp)
27 SAVE_ALL
28 CLI
29 .set at
30 .set noreorder
31 la ra, ret_from_irq
32 mfc0 t0, CP0_CAUSE
33 mfc0 t2, CP0_STATUS
34
35 and t0, t2
36
37 andi t2, t0, STATUSF_IP7 /* INTB5 hardware line */
38 bnez t2, ll_timer_irq /* Timer */
39 andi t1, t0, STATUSF_IP2 /* INTB0 hardware line */
40 bnez t1, ll_pcia_irq /* 64-bit PCI */
41 andi t2, t0, STATUSF_IP3 /* INTB1 hardware line */
42 bnez t2, ll_pcib_irq /* second 64-bit PCI slot */
43 andi t1, t0, STATUSF_IP4 /* INTB2 hardware line */
44 bnez t1, ll_duart_irq /* UART */
45 andi t2, t0, STATUSF_IP5 /* SMP inter-core interrupts */
46 bnez t2, ll_smp_irq
47 andi t1, t0, STATUSF_IP6
48 bnez t1, ll_ht_irq /* Hypertransport */
49
50 move a0, sp
51 j do_extended_irq
52 END(titan_handle_int)
53
54 .set reorder
55 .align 5
56
57ll_pcia_irq:
58 li a0, 2
59 move a1, sp
60#ifdef CONFIG_HYPERTRANSPORT
61 j ll_ht_smp_irq_handler
62#else
63 j do_IRQ
64#endif
65
66ll_pcib_irq:
67 li a0, 3
68 move a1, sp
69 j do_IRQ
70
71ll_duart_irq:
72 li a0, 4
73 move a1, sp
74 j do_IRQ
75
76ll_smp_irq:
77 li a0, 5
78 move a1, sp
79#ifdef CONFIG_SMP
80 j titan_mailbox_irq
81#else
82 j do_IRQ
83#endif
84
85ll_ht_irq:
86 li a0, 6
87 move a1, sp
88 j ll_ht_smp_irq_handler
89
90ll_timer_irq:
91 li a0, 7
92 move a1, sp
93 j do_IRQ
diff --git a/arch/mips/pmc-sierra/yosemite/irq.c b/arch/mips/pmc-sierra/yosemite/irq.c
new file mode 100644
index 000000000000..f4e2897d9bf7
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/irq.c
@@ -0,0 +1,167 @@
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 * Second level Interrupt handlers for the PMC-Sierra Titan/Yosemite board
26 */
27#include <linux/config.h>
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/kernel_stat.h>
31#include <linux/module.h>
32#include <linux/signal.h>
33#include <linux/sched.h>
34#include <linux/types.h>
35#include <linux/interrupt.h>
36#include <linux/ioport.h>
37#include <linux/irq.h>
38#include <linux/timex.h>
39#include <linux/slab.h>
40#include <linux/random.h>
41#include <linux/bitops.h>
42#include <asm/bootinfo.h>
43#include <asm/io.h>
44#include <asm/irq.h>
45#include <asm/irq_cpu.h>
46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/titan_dep.h>
49
50/* Hypertransport specific */
51#define IRQ_ACK_BITS 0x00000000 /* Ack bits */
52
53#define HYPERTRANSPORT_INTA 0x78 /* INTA# */
54#define HYPERTRANSPORT_INTB 0x79 /* INTB# */
55#define HYPERTRANSPORT_INTC 0x7a /* INTC# */
56#define HYPERTRANSPORT_INTD 0x7b /* INTD# */
57
58extern asmlinkage void titan_handle_int(void);
59extern void jaguar_mailbox_irq(struct pt_regs *);
60
61/*
62 * Handle hypertransport & SMP interrupts. The interrupt lines are scarce.
63 * For interprocessor interrupts, the best thing to do is to use the INTMSG
64 * register. We use the same external interrupt line, i.e. INTB3 and monitor
65 * another status bit
66 */
67asmlinkage void ll_ht_smp_irq_handler(int irq, struct pt_regs *regs)
68{
69 u32 status = OCD_READ(RM9000x2_OCD_INTP0STATUS4);
70
71 /* Ack all the bits that correspond to the interrupt sources */
72 if (status != 0)
73 OCD_WRITE(RM9000x2_OCD_INTP0STATUS4, IRQ_ACK_BITS);
74
75 status = OCD_READ(RM9000x2_OCD_INTP1STATUS4);
76 if (status != 0)
77 OCD_WRITE(RM9000x2_OCD_INTP1STATUS4, IRQ_ACK_BITS);
78
79#ifdef CONFIG_HT_LEVEL_TRIGGER
80 /*
81 * Level Trigger Mode only. Send the HT EOI message back to the source.
82 */
83 switch (status) {
84 case 0x1000000:
85 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA);
86 break;
87 case 0x2000000:
88 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB);
89 break;
90 case 0x4000000:
91 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC);
92 break;
93 case 0x8000000:
94 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD);
95 break;
96 case 0x0000001:
97 /* PLX */
98 OCD_WRITE(RM9000x2_OCD_HTEOI, 0x20);
99 OCD_WRITE(IRQ_CLEAR_REG, IRQ_ACK_BITS);
100 break;
101 case 0xf000000:
102 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA);
103 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB);
104 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC);
105 OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD);
106 break;
107 }
108#endif /* CONFIG_HT_LEVEL_TRIGGER */
109
110 do_IRQ(irq, regs);
111}
112
113asmlinkage void do_extended_irq(struct pt_regs *regs)
114{
115 unsigned int intcontrol = read_c0_intcontrol();
116 unsigned int cause = read_c0_cause();
117 unsigned int status = read_c0_status();
118 unsigned int pending_sr, pending_ic;
119
120 pending_sr = status & cause & 0xff00;
121 pending_ic = (cause >> 8) & intcontrol & 0xff00;
122
123 if (pending_ic & (1 << 13))
124 do_IRQ(13, regs);
125
126}
127
128#ifdef CONFIG_KGDB
129extern void init_second_port(void);
130#endif
131
132/*
133 * Initialize the next level interrupt handler
134 */
135void __init arch_init_irq(void)
136{
137 clear_c0_status(ST0_IM);
138
139 set_except_vector(0, titan_handle_int);
140 mips_cpu_irq_init(0);
141 rm7k_cpu_irq_init(8);
142 rm9k_cpu_irq_init(12);
143
144#ifdef CONFIG_KGDB
145 /* At this point, initialize the second serial port */
146 init_second_port();
147#endif
148
149#ifdef CONFIG_GDB_CONSOLE
150 register_gdb_console();
151#endif
152}
153
154#ifdef CONFIG_KGDB
155/*
156 * The 16550 DUART has two ports, but is allocated one IRQ
157 * for the serial console. Hence, a generic framework for
158 * serial IRQ routing in place. Currently, just calls the
159 * do_IRQ fuction. But, going in the future, need to check
160 * DUART registers for channel A and B, then decide the
161 * appropriate action
162 */
163asmlinkage void yosemite_kgdb_irq(int irq, struct pt_regs *regs)
164{
165 do_IRQ(irq, regs);
166}
167#endif
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c
new file mode 100644
index 000000000000..1fb3e697948d
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/prom.c
@@ -0,0 +1,141 @@
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) 2003, 2004 PMC-Sierra Inc.
8 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
9 * Copyright (C) 2004 Ralf Baechle
10 */
11#include <linux/config.h>
12#include <linux/init.h>
13#include <linux/sched.h>
14#include <linux/mm.h>
15#include <linux/delay.h>
16#include <linux/smp.h>
17
18#include <asm/io.h>
19#include <asm/pgtable.h>
20#include <asm/processor.h>
21#include <asm/reboot.h>
22#include <asm/system.h>
23#include <asm/bootinfo.h>
24#include <asm/pmon.h>
25
26#ifdef CONFIG_SMP
27extern void prom_grab_secondary(void);
28#else
29#define prom_grab_secondary() do { } while (0)
30#endif
31
32#include "setup.h"
33
34struct callvectors *debug_vectors;
35
36extern unsigned long yosemite_base;
37extern unsigned long cpu_clock;
38
39const char *get_system_type(void)
40{
41 return "PMC-Sierra Yosemite";
42}
43
44static void prom_cpu0_exit(void *arg)
45{
46 void *nvram = (void *) YOSEMITE_RTC_BASE;
47
48 /* Ask the NVRAM/RTC/watchdog chip to assert reset in 1/16 second */
49 writeb(0x84, nvram + 0xff7);
50
51 /* wait for the watchdog to go off */
52 mdelay(100 + (1000 / 16));
53
54 /* if the watchdog fails for some reason, let people know */
55 printk(KERN_NOTICE "Watchdog reset failed\n");
56}
57
58/*
59 * Reset the NVRAM over the local bus
60 */
61static void prom_exit(void)
62{
63#ifdef CONFIG_SMP
64 if (smp_processor_id())
65 /* CPU 1 */
66 smp_call_function(prom_cpu0_exit, NULL, 1, 1);
67#endif
68 prom_cpu0_exit(NULL);
69}
70
71/*
72 * Halt the system
73 */
74static void prom_halt(void)
75{
76 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
77 while (1)
78 __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0");
79}
80
81/*
82 * Init routine which accepts the variables from PMON
83 */
84void __init prom_init(void)
85{
86 int argc = fw_arg0;
87 char **arg = (char **) fw_arg1;
88 char **env = (char **) fw_arg2;
89 struct callvectors *cv = (struct callvectors *) fw_arg3;
90 int i = 0;
91
92 /* Callbacks for halt, restart */
93 _machine_restart = (void (*)(char *)) prom_exit;
94 _machine_halt = prom_halt;
95 _machine_power_off = prom_halt;
96
97 debug_vectors = cv;
98 arcs_cmdline[0] = '\0';
99
100 /* Get the boot parameters */
101 for (i = 1; i < argc; i++) {
102 if (strlen(arcs_cmdline) + strlen(arg[i] + 1) >=
103 sizeof(arcs_cmdline))
104 break;
105
106 strcat(arcs_cmdline, arg[i]);
107 strcat(arcs_cmdline, " ");
108 }
109
110#ifdef CONFIG_SERIAL_8250_CONSOLE
111 if ((strstr(arcs_cmdline, "console=ttyS")) == NULL)
112 strcat(arcs_cmdline, "console=ttyS0,115200");
113#endif
114
115 while (*env) {
116 if (strncmp("ocd_base", *env, strlen("ocd_base")) == 0)
117 yosemite_base =
118 simple_strtol(*env + strlen("ocd_base="), NULL,
119 16);
120
121 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0)
122 cpu_clock =
123 simple_strtol(*env + strlen("cpuclock="), NULL,
124 10);
125
126 env++;
127 }
128
129 mips_machgroup = MACH_GROUP_TITAN;
130 mips_machtype = MACH_TITAN_YOSEMITE;
131
132 prom_grab_secondary();
133}
134
135void __init prom_free_prom_memory(void)
136{
137}
138
139void __init prom_fixup_mem_map(unsigned long start, unsigned long end)
140{
141}
diff --git a/arch/mips/pmc-sierra/yosemite/py-console.c b/arch/mips/pmc-sierra/yosemite/py-console.c
new file mode 100644
index 000000000000..757e605693ff
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/py-console.c
@@ -0,0 +1,114 @@
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) 2001, 2002, 2004 Ralf Baechle
7 */
8#include <linux/init.h>
9#include <linux/console.h>
10#include <linux/kdev_t.h>
11#include <linux/major.h>
12#include <linux/termios.h>
13#include <linux/sched.h>
14#include <linux/tty.h>
15
16#include <linux/serial.h>
17#include <linux/serial_core.h>
18#include <asm/serial.h>
19#include <asm/io.h>
20
21/* SUPERIO uart register map */
22struct yo_uartregs {
23 union {
24 volatile u8 rbr; /* read only, DLAB == 0 */
25 volatile u8 thr; /* write only, DLAB == 0 */
26 volatile u8 dll; /* DLAB == 1 */
27 } u1;
28 union {
29 volatile u8 ier; /* DLAB == 0 */
30 volatile u8 dlm; /* DLAB == 1 */
31 } u2;
32 union {
33 volatile u8 iir; /* read only */
34 volatile u8 fcr; /* write only */
35 } u3;
36 volatile u8 iu_lcr;
37 volatile u8 iu_mcr;
38 volatile u8 iu_lsr;
39 volatile u8 iu_msr;
40 volatile u8 iu_scr;
41} yo_uregs_t;
42
43#define iu_rbr u1.rbr
44#define iu_thr u1.thr
45#define iu_dll u1.dll
46#define iu_ier u2.ier
47#define iu_dlm u2.dlm
48#define iu_iir u3.iir
49#define iu_fcr u3.fcr
50
51#define ssnop() __asm__ __volatile__("sll $0, $0, 1\n");
52#define ssnop_4() do { ssnop(); ssnop(); ssnop(); ssnop(); } while (0)
53
54#define IO_BASE_64 0x9000000000000000ULL
55
56static unsigned char readb_outer_space(unsigned long long phys)
57{
58 unsigned long long vaddr = IO_BASE_64 | phys;
59 unsigned char res;
60 unsigned int sr;
61
62 sr = read_c0_status();
63 write_c0_status((sr | ST0_KX) & ~ ST0_IE);
64 ssnop_4();
65
66 __asm__ __volatile__ (
67 " .set mips3 \n"
68 " ld %0, %1 \n"
69 " lbu %0, (%0) \n"
70 " .set mips0 \n"
71 : "=r" (res)
72 : "m" (vaddr));
73
74 write_c0_status(sr);
75 ssnop_4();
76
77 return res;
78}
79
80static void writeb_outer_space(unsigned long long phys, unsigned char c)
81{
82 unsigned long long vaddr = IO_BASE_64 | phys;
83 unsigned long tmp;
84 unsigned int sr;
85
86 sr = read_c0_status();
87 write_c0_status((sr | ST0_KX) & ~ ST0_IE);
88 ssnop_4();
89
90 __asm__ __volatile__ (
91 " .set mips3 \n"
92 " ld %0, %1 \n"
93 " sb %2, (%0) \n"
94 " .set mips0 \n"
95 : "=&r" (tmp)
96 : "m" (vaddr), "r" (c));
97
98 write_c0_status(sr);
99 ssnop_4();
100}
101
102void prom_putchar(char c)
103{
104 unsigned long lsr = 0xfd000008ULL + offsetof(struct yo_uartregs, iu_lsr);
105 unsigned long thr = 0xfd000008ULL + offsetof(struct yo_uartregs, iu_thr);
106
107 while ((readb_outer_space(lsr) & 0x20) == 0);
108 writeb_outer_space(thr, c);
109}
110
111char __init prom_getchar(void)
112{
113 return 0;
114}
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
new file mode 100644
index 000000000000..7225bbf20ce4
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -0,0 +1,235 @@
1/*
2 * Copyright (C) 2003 PMC-Sierra Inc.
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27#include <linux/bcd.h>
28#include <linux/init.h>
29#include <linux/kernel.h>
30#include <linux/types.h>
31#include <linux/mm.h>
32#include <linux/bootmem.h>
33#include <linux/swap.h>
34#include <linux/ioport.h>
35#include <linux/sched.h>
36#include <linux/interrupt.h>
37#include <linux/timex.h>
38#include <linux/termios.h>
39#include <linux/tty.h>
40#include <linux/serial.h>
41#include <linux/serial_core.h>
42
43#include <asm/time.h>
44#include <asm/bootinfo.h>
45#include <asm/page.h>
46#include <asm/io.h>
47#include <asm/irq.h>
48#include <asm/processor.h>
49#include <asm/ptrace.h>
50#include <asm/reboot.h>
51#include <asm/serial.h>
52#include <asm/titan_dep.h>
53#include <asm/m48t37.h>
54
55#include "setup.h"
56
57unsigned char titan_ge_mac_addr_base[6] = {
58 // 0x00, 0x03, 0xcc, 0x1d, 0x22, 0x00
59 0x00, 0xe0, 0x04, 0x00, 0x00, 0x21
60};
61
62unsigned long cpu_clock;
63unsigned long yosemite_base;
64
65static struct m48t37_rtc *m48t37_base;
66
67void __init bus_error_init(void)
68{
69 /* Do nothing */
70}
71
72
73unsigned long m48t37y_get_time(void)
74{
75 unsigned int year, month, day, hour, min, sec;
76
77 /* Stop the update to the time */
78 m48t37_base->control = 0x40;
79
80 year = BCD2BIN(m48t37_base->year);
81 year += BCD2BIN(m48t37_base->century) * 100;
82
83 month = BCD2BIN(m48t37_base->month);
84 day = BCD2BIN(m48t37_base->date);
85 hour = BCD2BIN(m48t37_base->hour);
86 min = BCD2BIN(m48t37_base->min);
87 sec = BCD2BIN(m48t37_base->sec);
88
89 /* Start the update to the time again */
90 m48t37_base->control = 0x00;
91
92 return mktime(year, month, day, hour, min, sec);
93}
94
95int m48t37y_set_time(unsigned long sec)
96{
97 struct rtc_time tm;
98
99 /* convert to a more useful format -- note months count from 0 */
100 to_tm(sec, &tm);
101 tm.tm_mon += 1;
102
103 /* enable writing */
104 m48t37_base->control = 0x80;
105
106 /* year */
107 m48t37_base->year = BIN2BCD(tm.tm_year % 100);
108 m48t37_base->century = BIN2BCD(tm.tm_year / 100);
109
110 /* month */
111 m48t37_base->month = BIN2BCD(tm.tm_mon);
112
113 /* day */
114 m48t37_base->date = BIN2BCD(tm.tm_mday);
115
116 /* hour/min/sec */
117 m48t37_base->hour = BIN2BCD(tm.tm_hour);
118 m48t37_base->min = BIN2BCD(tm.tm_min);
119 m48t37_base->sec = BIN2BCD(tm.tm_sec);
120
121 /* day of week -- not really used, but let's keep it up-to-date */
122 m48t37_base->day = BIN2BCD(tm.tm_wday + 1);
123
124 /* disable writing */
125 m48t37_base->control = 0x00;
126
127 return 0;
128}
129
130void yosemite_timer_setup(struct irqaction *irq)
131{
132 setup_irq(7, irq);
133}
134
135void yosemite_time_init(void)
136{
137 board_timer_setup = yosemite_timer_setup;
138 mips_hpt_frequency = cpu_clock / 2;
139mips_hpt_frequency = 33000000 * 3 * 5;
140}
141
142/* No other usable initialization hook than this ... */
143extern void (*late_time_init)(void);
144
145unsigned long ocd_base;
146
147EXPORT_SYMBOL(ocd_base);
148
149/*
150 * Common setup before any secondaries are started
151 */
152
153#define TITAN_UART_CLK 3686400
154#define TITAN_SERIAL_BASE_BAUD (TITAN_UART_CLK / 16)
155#define TITAN_SERIAL_IRQ 4
156#define TITAN_SERIAL_BASE 0xfd000008UL
157
158static void __init py_map_ocd(void)
159{
160 ocd_base = (unsigned long) ioremap(OCD_BASE, OCD_SIZE);
161 if (!ocd_base)
162 panic("Mapping OCD failed - game over. Your score is 0.");
163
164 /* Kludge for PMON bug ... */
165 OCD_WRITE(0x0710, 0x0ffff029);
166}
167
168static void __init py_uart_setup(void)
169{
170 struct uart_port up;
171
172 /*
173 * Register to interrupt zero because we share the interrupt with
174 * the serial driver which we don't properly support yet.
175 */
176 memset(&up, 0, sizeof(up));
177 up.membase = (unsigned char *) ioremap(TITAN_SERIAL_BASE, 8);
178 up.irq = TITAN_SERIAL_IRQ;
179 up.uartclk = TITAN_UART_CLK;
180 up.regshift = 0;
181 up.iotype = UPIO_MEM;
182 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
183 up.line = 0;
184
185 if (early_serial_setup(&up))
186 printk(KERN_ERR "Early serial init of port 0 failed\n");
187}
188
189static void __init py_rtc_setup(void)
190{
191 m48t37_base = ioremap(YOSEMITE_RTC_BASE, YOSEMITE_RTC_SIZE);
192 if (!m48t37_base)
193 printk(KERN_ERR "Mapping the RTC failed\n");
194
195 rtc_get_time = m48t37y_get_time;
196 rtc_set_time = m48t37y_set_time;
197
198 write_seqlock(&xtime_lock);
199 xtime.tv_sec = m48t37y_get_time();
200 xtime.tv_nsec = 0;
201
202 set_normalized_timespec(&wall_to_monotonic,
203 -xtime.tv_sec, -xtime.tv_nsec);
204 write_sequnlock(&xtime_lock);
205}
206
207/* Not only time init but that's what the hook it's called through is named */
208static void __init py_late_time_init(void)
209{
210 py_map_ocd();
211 py_uart_setup();
212 py_rtc_setup();
213}
214
215static int __init pmc_yosemite_setup(void)
216{
217 board_time_init = yosemite_time_init;
218 late_time_init = py_late_time_init;
219
220 /* Add memory regions */
221 add_memory_region(0x00000000, 0x10000000, BOOT_MEM_RAM);
222
223#if 0 /* XXX Crash ... */
224 OCD_WRITE(RM9000x2_OCD_HTSC,
225 OCD_READ(RM9000x2_OCD_HTSC) | HYPERTRANSPORT_ENABLE);
226
227 /* Set the BAR. Shifted mode */
228 OCD_WRITE(RM9000x2_OCD_HTBAR0, HYPERTRANSPORT_BAR0_ADDR);
229 OCD_WRITE(RM9000x2_OCD_HTMASK0, HYPERTRANSPORT_SIZE0);
230#endif
231
232 return 0;
233}
234
235early_initcall(pmc_yosemite_setup);
diff --git a/arch/mips/pmc-sierra/yosemite/setup.h b/arch/mips/pmc-sierra/yosemite/setup.h
new file mode 100644
index 000000000000..1a01abfc7d33
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/setup.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright 2003, 04 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 * Copyright 2004 Ralf Baechle <ralf@linux-mips.org>
5 *
6 * Board specific definititions for the PMC-Sierra Yosemite
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#ifndef __SETUP_H__
14#define __SETUP_H__
15
16/* M48T37 RTC + NVRAM */
17#define YOSEMITE_RTC_BASE 0xfc800000
18#define YOSEMITE_RTC_SIZE 0x00800000
19
20#define HYPERTRANSPORT_BAR0_ADDR 0x00000006
21#define HYPERTRANSPORT_SIZE0 0x0fffffff
22#define HYPERTRANSPORT_BAR0_ATTR 0x00002000
23
24#define HYPERTRANSPORT_ENABLE 0x6
25
26/*
27 * EEPROM Size
28 */
29#define TITAN_ATMEL_24C32_SIZE 32768
30#define TITAN_ATMEL_24C64_SIZE 65536
31
32#endif /* __SETUP_H__ */
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c
new file mode 100644
index 000000000000..1d3b0734c78c
--- /dev/null
+++ b/arch/mips/pmc-sierra/yosemite/smp.c
@@ -0,0 +1,172 @@
1#include <linux/linkage.h>
2#include <linux/sched.h>
3
4#include <asm/pmon.h>
5#include <asm/titan_dep.h>
6
7extern unsigned int (*mips_hpt_read)(void);
8extern void (*mips_hpt_init)(unsigned int);
9
10#define LAUNCHSTACK_SIZE 256
11
12static spinlock_t launch_lock __initdata;
13
14static unsigned long secondary_sp __initdata;
15static unsigned long secondary_gp __initdata;
16
17static unsigned char launchstack[LAUNCHSTACK_SIZE] __initdata
18 __attribute__((aligned(2 * sizeof(long))));
19
20static void __init prom_smp_bootstrap(void)
21{
22 local_irq_disable();
23
24 while (spin_is_locked(&launch_lock));
25
26 __asm__ __volatile__(
27 " move $sp, %0 \n"
28 " move $gp, %1 \n"
29 " j smp_bootstrap \n"
30 :
31 : "r" (secondary_sp), "r" (secondary_gp));
32}
33
34/*
35 * PMON is a fragile beast. It'll blow up once the mappings it's littering
36 * right into the middle of KSEG3 are blown away so we have to grab the slave
37 * core early and keep it in a waiting loop.
38 */
39void __init prom_grab_secondary(void)
40{
41 spin_lock(&launch_lock);
42
43 pmon_cpustart(1, &prom_smp_bootstrap,
44 launchstack + LAUNCHSTACK_SIZE, 0);
45}
46
47/*
48 * Detect available CPUs, populate phys_cpu_present_map before smp_init
49 *
50 * We don't want to start the secondary CPU yet nor do we have a nice probing
51 * feature in PMON so we just assume presence of the secondary core.
52 */
53static char maxcpus_string[] __initdata =
54 KERN_WARNING "max_cpus set to 0; using 1 instead\n";
55
56void __init prom_prepare_cpus(unsigned int max_cpus)
57{
58 int enabled = 0, i;
59
60 if (max_cpus == 0) {
61 printk(maxcpus_string);
62 max_cpus = 1;
63 }
64
65 cpus_clear(phys_cpu_present_map);
66
67 for (i = 0; i < 2; i++) {
68 if (i == max_cpus)
69 break;
70
71 /*
72 * The boot CPU
73 */
74 cpu_set(i, phys_cpu_present_map);
75 __cpu_number_map[i] = i;
76 __cpu_logical_map[i] = i;
77 enabled++;
78 }
79
80 /*
81 * Be paranoid. Enable the IPI only if we're really about to go SMP.
82 */
83 if (enabled > 1)
84 set_c0_status(STATUSF_IP5);
85}
86
87/*
88 * Firmware CPU startup hook
89 * Complicated by PMON's weird interface which tries to minimic the UNIX fork.
90 * It launches the next * available CPU and copies some information on the
91 * stack so the first thing we do is throw away that stuff and load useful
92 * values into the registers ...
93 */
94void prom_boot_secondary(int cpu, struct task_struct *idle)
95{
96 unsigned long gp = (unsigned long) idle->thread_info;
97 unsigned long sp = gp + THREAD_SIZE - 32;
98
99 secondary_sp = sp;
100 secondary_gp = gp;
101
102 spin_unlock(&launch_lock);
103}
104
105/* Hook for after all CPUs are online */
106void prom_cpus_done(void)
107{
108}
109
110/*
111 * After we've done initial boot, this function is called to allow the
112 * board code to clean up state, if needed
113 */
114void prom_init_secondary(void)
115{
116 mips_hpt_init(mips_hpt_read());
117
118 set_c0_status(ST0_CO | ST0_IE | ST0_IM);
119}
120
121void prom_smp_finish(void)
122{
123}
124
125asmlinkage void titan_mailbox_irq(struct pt_regs *regs)
126{
127 int cpu = smp_processor_id();
128 unsigned long status;
129
130 if (cpu == 0) {
131 status = OCD_READ(RM9000x2_OCD_INTP0STATUS3);
132 OCD_WRITE(RM9000x2_OCD_INTP0CLEAR3, status);
133 }
134
135 if (cpu == 1) {
136 status = OCD_READ(RM9000x2_OCD_INTP1STATUS3);
137 OCD_WRITE(RM9000x2_OCD_INTP1CLEAR3, status);
138 }
139
140 if (status & 0x2)
141 smp_call_function_interrupt();
142}
143
144/*
145 * Send inter-processor interrupt
146 */
147void core_send_ipi(int cpu, unsigned int action)
148{
149 /*
150 * Generate an INTMSG so that it can be sent over to the
151 * destination CPU. The INTMSG will put the STATUS bits
152 * based on the action desired. An alternative strategy
153 * is to write to the Interrupt Set register, read the
154 * Interrupt Status register and clear the Interrupt
155 * Clear register. The latter is preffered.
156 */
157 switch (action) {
158 case SMP_RESCHEDULE_YOURSELF:
159 if (cpu == 1)
160 OCD_WRITE(RM9000x2_OCD_INTP1SET3, 4);
161 else
162 OCD_WRITE(RM9000x2_OCD_INTP0SET3, 4);
163 break;
164
165 case SMP_CALL_FUNCTION:
166 if (cpu == 1)
167 OCD_WRITE(RM9000x2_OCD_INTP1SET3, 2);
168 else
169 OCD_WRITE(RM9000x2_OCD_INTP0SET3, 2);
170 break;
171 }
172}
diff --git a/arch/mips/sgi-ip22/Makefile b/arch/mips/sgi-ip22/Makefile
new file mode 100644
index 000000000000..eb0820fe50bd
--- /dev/null
+++ b/arch/mips/sgi-ip22/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the SGI specific kernel interface routines
3# under Linux.
4#
5
6obj-y += ip22-mc.o ip22-hpc.o ip22-int.o ip22-irq.o ip22-berr.o \
7 ip22-time.o ip22-nvram.o ip22-reset.o ip22-setup.o
8
9obj-$(CONFIG_EISA) += ip22-eisa.o
10
11EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/sgi-ip22/ip22-berr.c b/arch/mips/sgi-ip22/ip22-berr.c
new file mode 100644
index 000000000000..a28dc7800072
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-berr.c
@@ -0,0 +1,114 @@
1/*
2 * ip22-berr.c: Bus error handling.
3 *
4 * Copyright (C) 2002, 2003 Ladislav Michl (ladis@linux-mips.org)
5 */
6
7#include <linux/init.h>
8#include <linux/kernel.h>
9#include <linux/sched.h>
10
11#include <asm/addrspace.h>
12#include <asm/system.h>
13#include <asm/traps.h>
14#include <asm/branch.h>
15#include <asm/sgi/mc.h>
16#include <asm/sgi/hpc3.h>
17#include <asm/sgi/ioc.h>
18#include <asm/sgi/ip22.h>
19
20
21static unsigned int cpu_err_stat; /* Status reg for CPU */
22static unsigned int gio_err_stat; /* Status reg for GIO */
23static unsigned int cpu_err_addr; /* Error address reg for CPU */
24static unsigned int gio_err_addr; /* Error address reg for GIO */
25static unsigned int extio_stat;
26static unsigned int hpc3_berr_stat; /* Bus error interrupt status */
27
28static void save_and_clear_buserr(void)
29{
30 /* save status registers */
31 cpu_err_addr = sgimc->cerr;
32 cpu_err_stat = sgimc->cstat;
33 gio_err_addr = sgimc->gerr;
34 gio_err_stat = sgimc->gstat;
35 extio_stat = ip22_is_fullhouse() ? sgioc->extio : (sgint->errstat << 4);
36 hpc3_berr_stat = hpc3c0->bestat;
37
38 sgimc->cstat = sgimc->gstat = 0;
39}
40
41#define GIO_ERRMASK 0xff00
42#define CPU_ERRMASK 0x3f00
43
44static void print_buserr(void)
45{
46 if (extio_stat & EXTIO_MC_BUSERR)
47 printk(KERN_ERR "MC Bus Error\n");
48 if (extio_stat & EXTIO_HPC3_BUSERR)
49 printk(KERN_ERR "HPC3 Bus Error 0x%x:<id=0x%x,%s,lane=0x%x>\n",
50 hpc3_berr_stat,
51 (hpc3_berr_stat & HPC3_BESTAT_PIDMASK) >>
52 HPC3_BESTAT_PIDSHIFT,
53 (hpc3_berr_stat & HPC3_BESTAT_CTYPE) ? "PIO" : "DMA",
54 hpc3_berr_stat & HPC3_BESTAT_BLMASK);
55 if (extio_stat & EXTIO_EISA_BUSERR)
56 printk(KERN_ERR "EISA Bus Error\n");
57 if (cpu_err_stat & CPU_ERRMASK)
58 printk(KERN_ERR "CPU error 0x%x<%s%s%s%s%s%s> @ 0x%08x\n",
59 cpu_err_stat,
60 cpu_err_stat & SGIMC_CSTAT_RD ? "RD " : "",
61 cpu_err_stat & SGIMC_CSTAT_PAR ? "PAR " : "",
62 cpu_err_stat & SGIMC_CSTAT_ADDR ? "ADDR " : "",
63 cpu_err_stat & SGIMC_CSTAT_SYSAD_PAR ? "SYSAD " : "",
64 cpu_err_stat & SGIMC_CSTAT_SYSCMD_PAR ? "SYSCMD " : "",
65 cpu_err_stat & SGIMC_CSTAT_BAD_DATA ? "BAD_DATA " : "",
66 cpu_err_addr);
67 if (gio_err_stat & GIO_ERRMASK)
68 printk(KERN_ERR "GIO error 0x%x:<%s%s%s%s%s%s%s%s> @ 0x%08x\n",
69 gio_err_stat,
70 gio_err_stat & SGIMC_GSTAT_RD ? "RD " : "",
71 gio_err_stat & SGIMC_GSTAT_WR ? "WR " : "",
72 gio_err_stat & SGIMC_GSTAT_TIME ? "TIME " : "",
73 gio_err_stat & SGIMC_GSTAT_PROM ? "PROM " : "",
74 gio_err_stat & SGIMC_GSTAT_ADDR ? "ADDR " : "",
75 gio_err_stat & SGIMC_GSTAT_BC ? "BC " : "",
76 gio_err_stat & SGIMC_GSTAT_PIO_RD ? "PIO_RD " : "",
77 gio_err_stat & SGIMC_GSTAT_PIO_WR ? "PIO_WR " : "",
78 gio_err_addr);
79}
80
81/*
82 * MC sends an interrupt whenever bus or parity errors occur. In addition,
83 * if the error happened during a CPU read, it also asserts the bus error
84 * pin on the R4K. Code in bus error handler save the MC bus error registers
85 * and then clear the interrupt when this happens.
86 */
87
88void ip22_be_interrupt(int irq, struct pt_regs *regs)
89{
90 const int field = 2 * sizeof(unsigned long);
91
92 save_and_clear_buserr();
93 print_buserr();
94 printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n",
95 (regs->cp0_cause & 4) ? "Data" : "Instruction",
96 field, regs->cp0_epc, field, regs->regs[31]);
97 /* Assume it would be too dangerous to continue ... */
98 die_if_kernel("Oops", regs);
99 force_sig(SIGBUS, current);
100}
101
102static int ip22_be_handler(struct pt_regs *regs, int is_fixup)
103{
104 save_and_clear_buserr();
105 if (is_fixup)
106 return MIPS_BE_FIXUP;
107 print_buserr();
108 return MIPS_BE_FATAL;
109}
110
111void __init ip22_be_init(void)
112{
113 board_be_handler = ip22_be_handler;
114}
diff --git a/arch/mips/sgi-ip22/ip22-eisa.c b/arch/mips/sgi-ip22/ip22-eisa.c
new file mode 100644
index 000000000000..0ab4abf65d58
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-eisa.c
@@ -0,0 +1,308 @@
1/*
2 * Basic EISA bus support for the SGI Indigo-2.
3 *
4 * (C) 2002 Pascal Dameme <netinet@freesurf.fr>
5 * and Marc Zyngier <mzyngier@freesurf.fr>
6 *
7 * This code is released under both the GPL version 2 and BSD
8 * licenses. Either license may be used.
9 *
10 * This code offers a very basic support for this EISA bus present in
11 * the SGI Indigo-2. It currently only supports PIO (forget about DMA
12 * for the time being). This is enough for a low-end ethernet card,
13 * but forget about your favorite SCSI card...
14 *
15 * TODO :
16 * - Fix bugs...
17 * - Add ISA support
18 * - Add DMA (yeah, right...).
19 * - Fix more bugs.
20 */
21
22#include <linux/config.h>
23#include <linux/eisa.h>
24#include <linux/types.h>
25#include <linux/init.h>
26#include <linux/irq.h>
27#include <linux/kernel_stat.h>
28#include <linux/signal.h>
29#include <linux/sched.h>
30#include <linux/interrupt.h>
31#include <linux/delay.h>
32#include <asm/irq.h>
33#include <asm/mipsregs.h>
34#include <asm/addrspace.h>
35#include <asm/processor.h>
36#include <asm/sgi/ioc.h>
37#include <asm/sgi/mc.h>
38#include <asm/sgi/ip22.h>
39
40#define EISA_MAX_SLOTS 4
41#define EISA_MAX_IRQ 16
42
43#define EISA_TO_PHYS(x) (0x00080000 | (x))
44#define EISA_TO_KSEG1(x) ((void *) KSEG1ADDR(EISA_TO_PHYS((x))))
45
46#define EIU_MODE_REG 0x0009ffc0
47#define EIU_STAT_REG 0x0009ffc4
48#define EIU_PREMPT_REG 0x0009ffc8
49#define EIU_QUIET_REG 0x0009ffcc
50#define EIU_INTRPT_ACK 0x00090004
51
52#define EISA_DMA1_STATUS 8
53#define EISA_INT1_CTRL 0x20
54#define EISA_INT1_MASK 0x21
55#define EISA_INT2_CTRL 0xA0
56#define EISA_INT2_MASK 0xA1
57#define EISA_DMA2_STATUS 0xD0
58#define EISA_DMA2_WRITE_SINGLE 0xD4
59#define EISA_EXT_NMI_RESET_CTRL 0x461
60#define EISA_INT1_EDGE_LEVEL 0x4D0
61#define EISA_INT2_EDGE_LEVEL 0x4D1
62#define EISA_VENDOR_ID_OFFSET 0xC80
63
64#define EIU_WRITE_32(x,y) { *((u32 *) KSEG1ADDR(x)) = (u32) (y); mb(); }
65#define EIU_READ_8(x) *((u8 *) KSEG1ADDR(x))
66#define EISA_WRITE_8(x,y) { *((u8 *) EISA_TO_KSEG1(x)) = (u8) (y); mb(); }
67#define EISA_READ_8(x) *((u8 *) EISA_TO_KSEG1(x))
68
69static char *decode_eisa_sig(u8 * sig)
70{
71 static char sig_str[8];
72 u16 rev;
73
74 if (sig[0] & 0x80)
75 return NULL;
76
77 sig_str[0] = ((sig[0] >> 2) & 0x1f) + ('A' - 1);
78 sig_str[1] = (((sig[0] & 3) << 3) | (sig[1] >> 5)) + ('A' - 1);
79 sig_str[2] = (sig[1] & 0x1f) + ('A' - 1);
80 rev = (sig[2] << 8) | sig[3];
81 sprintf(sig_str + 3, "%04X", rev);
82
83 return sig_str;
84}
85
86static void ip22_eisa_intr(int irq, void *dev_id, struct pt_regs *regs)
87{
88 u8 eisa_irq;
89 u8 dma1, dma2;
90
91 eisa_irq = EIU_READ_8(EIU_INTRPT_ACK);
92 dma1 = EISA_READ_8(EISA_DMA1_STATUS);
93 dma2 = EISA_READ_8(EISA_DMA2_STATUS);
94
95 if (eisa_irq >= EISA_MAX_IRQ) {
96 /* Oops, Bad Stuff Happened... */
97 printk(KERN_ERR "eisa_irq %d out of bound\n", eisa_irq);
98
99 EISA_WRITE_8(EISA_INT2_CTRL, 0x20);
100 EISA_WRITE_8(EISA_INT1_CTRL, 0x20);
101 } else
102 do_IRQ(eisa_irq, regs);
103}
104
105static void enable_eisa1_irq(unsigned int irq)
106{
107 unsigned long flags;
108 u8 mask;
109
110 local_irq_save(flags);
111
112 mask = EISA_READ_8(EISA_INT1_MASK);
113 mask &= ~((u8) (1 << irq));
114 EISA_WRITE_8(EISA_INT1_MASK, mask);
115
116 local_irq_restore(flags);
117}
118
119static unsigned int startup_eisa1_irq(unsigned int irq)
120{
121 u8 edge;
122
123 /* Only use edge interrupts for EISA */
124
125 edge = EISA_READ_8(EISA_INT1_EDGE_LEVEL);
126 edge &= ~((u8) (1 << irq));
127 EISA_WRITE_8(EISA_INT1_EDGE_LEVEL, edge);
128
129 enable_eisa1_irq(irq);
130 return 0;
131}
132
133static void disable_eisa1_irq(unsigned int irq)
134{
135 u8 mask;
136
137 mask = EISA_READ_8(EISA_INT1_MASK);
138 mask |= ((u8) (1 << irq));
139 EISA_WRITE_8(EISA_INT1_MASK, mask);
140}
141
142#define shutdown_eisa1_irq disable_eisa1_irq
143
144static void mask_and_ack_eisa1_irq(unsigned int irq)
145{
146 disable_eisa1_irq(irq);
147
148 EISA_WRITE_8(EISA_INT1_CTRL, 0x20);
149}
150
151static void end_eisa1_irq(unsigned int irq)
152{
153 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
154 enable_eisa1_irq(irq);
155}
156
157static struct hw_interrupt_type ip22_eisa1_irq_type = {
158 .typename = "IP22 EISA",
159 .startup = startup_eisa1_irq,
160 .shutdown = shutdown_eisa1_irq,
161 .enable = enable_eisa1_irq,
162 .disable = disable_eisa1_irq,
163 .ack = mask_and_ack_eisa1_irq,
164 .end = end_eisa1_irq,
165};
166
167static void enable_eisa2_irq(unsigned int irq)
168{
169 unsigned long flags;
170 u8 mask;
171
172 local_irq_save(flags);
173
174 mask = EISA_READ_8(EISA_INT2_MASK);
175 mask &= ~((u8) (1 << (irq - 8)));
176 EISA_WRITE_8(EISA_INT2_MASK, mask);
177
178 local_irq_restore(flags);
179}
180
181static unsigned int startup_eisa2_irq(unsigned int irq)
182{
183 u8 edge;
184
185 /* Only use edge interrupts for EISA */
186
187 edge = EISA_READ_8(EISA_INT2_EDGE_LEVEL);
188 edge &= ~((u8) (1 << (irq - 8)));
189 EISA_WRITE_8(EISA_INT2_EDGE_LEVEL, edge);
190
191 enable_eisa2_irq(irq);
192 return 0;
193}
194
195static void disable_eisa2_irq(unsigned int irq)
196{
197 u8 mask;
198
199 mask = EISA_READ_8(EISA_INT2_MASK);
200 mask |= ((u8) (1 << (irq - 8)));
201 EISA_WRITE_8(EISA_INT2_MASK, mask);
202}
203
204#define shutdown_eisa2_irq disable_eisa2_irq
205
206static void mask_and_ack_eisa2_irq(unsigned int irq)
207{
208 disable_eisa2_irq(irq);
209
210 EISA_WRITE_8(EISA_INT2_CTRL, 0x20);
211 EISA_WRITE_8(EISA_INT1_CTRL, 0x20);
212}
213
214static void end_eisa2_irq(unsigned int irq)
215{
216 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
217 enable_eisa2_irq(irq);
218}
219
220static struct hw_interrupt_type ip22_eisa2_irq_type = {
221 .typename = "IP22 EISA",
222 .startup = startup_eisa2_irq,
223 .shutdown = shutdown_eisa2_irq,
224 .enable = enable_eisa2_irq,
225 .disable = disable_eisa2_irq,
226 .ack = mask_and_ack_eisa2_irq,
227 .end = end_eisa2_irq,
228};
229
230static struct irqaction eisa_action = {
231 .handler = ip22_eisa_intr,
232 .name = "EISA",
233};
234
235static struct irqaction cascade_action = {
236 .handler = no_action,
237 .name = "EISA cascade",
238};
239
240int __init ip22_eisa_init(void)
241{
242 int i, c;
243 char *str;
244 u8 *slot_addr;
245
246 if (!(sgimc->systemid & SGIMC_SYSID_EPRESENT)) {
247 printk(KERN_INFO "EISA: bus not present.\n");
248 return 1;
249 }
250
251 printk(KERN_INFO "EISA: Probing bus...\n");
252 for (c = 0, i = 1; i <= EISA_MAX_SLOTS; i++) {
253 slot_addr =
254 (u8 *) EISA_TO_KSEG1((0x1000 * i) +
255 EISA_VENDOR_ID_OFFSET);
256 if ((str = decode_eisa_sig(slot_addr))) {
257 printk(KERN_INFO "EISA: slot %d : %s detected.\n",
258 i, str);
259 c++;
260 }
261 }
262 printk(KERN_INFO "EISA: Detected %d card%s.\n", c, c < 2 ? "" : "s");
263#ifdef CONFIG_ISA
264 printk(KERN_INFO "ISA support compiled in.\n");
265#endif
266
267 /* Warning : BlackMagicAhead(tm).
268 Please wave your favorite dead chicken over the busses */
269
270 /* First say hello to the EIU */
271 EIU_WRITE_32(EIU_PREMPT_REG, 0x0000FFFF);
272 EIU_WRITE_32(EIU_QUIET_REG, 1);
273 EIU_WRITE_32(EIU_MODE_REG, 0x40f3c07F);
274
275 /* Now be nice to the EISA chipset */
276 EISA_WRITE_8(EISA_EXT_NMI_RESET_CTRL, 1);
277 for (i = 0; i < 10000; i++); /* Wait long enough for the dust to settle */
278 EISA_WRITE_8(EISA_EXT_NMI_RESET_CTRL, 0);
279 EISA_WRITE_8(EISA_INT1_CTRL, 0x11);
280 EISA_WRITE_8(EISA_INT2_CTRL, 0x11);
281 EISA_WRITE_8(EISA_INT1_MASK, 0);
282 EISA_WRITE_8(EISA_INT2_MASK, 8);
283 EISA_WRITE_8(EISA_INT1_MASK, 4);
284 EISA_WRITE_8(EISA_INT2_MASK, 2);
285 EISA_WRITE_8(EISA_INT1_MASK, 1);
286 EISA_WRITE_8(EISA_INT2_MASK, 1);
287 EISA_WRITE_8(EISA_INT1_MASK, 0xfb);
288 EISA_WRITE_8(EISA_INT2_MASK, 0xff);
289 EISA_WRITE_8(EISA_DMA2_WRITE_SINGLE, 0);
290
291 for (i = SGINT_EISA; i < (SGINT_EISA + EISA_MAX_IRQ); i++) {
292 irq_desc[i].status = IRQ_DISABLED;
293 irq_desc[i].action = 0;
294 irq_desc[i].depth = 1;
295 if (i < (SGINT_EISA + 8))
296 irq_desc[i].handler = &ip22_eisa1_irq_type;
297 else
298 irq_desc[i].handler = &ip22_eisa2_irq_type;
299 }
300
301 /* Cannot use request_irq because of kmalloc not being ready at such
302 * an early stage. Yes, I've been bitten... */
303 setup_irq(SGI_EISA_IRQ, &eisa_action);
304 setup_irq(SGINT_EISA + 2, &cascade_action);
305
306 EISA_bus = 1;
307 return 0;
308}
diff --git a/arch/mips/sgi-ip22/ip22-hpc.c b/arch/mips/sgi-ip22/ip22-hpc.c
new file mode 100644
index 000000000000..c0afeccb08c4
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-hpc.c
@@ -0,0 +1,63 @@
1/*
2 * ip22-hpc.c: Routines for generic manipulation of the HPC controllers.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1998 Ralf Baechle
6 */
7
8#include <linux/init.h>
9#include <linux/module.h>
10#include <linux/types.h>
11
12#include <asm/io.h>
13#include <asm/sgi/hpc3.h>
14#include <asm/sgi/ioc.h>
15#include <asm/sgi/ip22.h>
16
17struct hpc3_regs *hpc3c0, *hpc3c1;
18
19EXPORT_SYMBOL(hpc3c0);
20EXPORT_SYMBOL(hpc3c1);
21
22struct sgioc_regs *sgioc;
23
24EXPORT_SYMBOL(sgioc);
25
26/* We need software copies of these because they are write only. */
27u8 sgi_ioc_reset, sgi_ioc_write;
28
29extern char *system_type;
30
31void __init sgihpc_init(void)
32{
33 /* ioremap can't fail */
34 hpc3c0 = (struct hpc3_regs *)
35 ioremap(HPC3_CHIP0_BASE, sizeof(struct hpc3_regs));
36 hpc3c1 = (struct hpc3_regs *)
37 ioremap(HPC3_CHIP1_BASE, sizeof(struct hpc3_regs));
38 /* IOC lives in PBUS PIO channel 6 */
39 sgioc = (struct sgioc_regs *)hpc3c0->pbus_extregs[6];
40
41 hpc3c0->pbus_piocfg[6][0] |= HPC3_PIOCFG_DS16;
42 if (ip22_is_fullhouse()) {
43 /* Full House comes with INT2 which lives in PBUS PIO
44 * channel 4 */
45 sgint = (struct sgint_regs *)hpc3c0->pbus_extregs[4];
46 system_type = "SGI Indigo2";
47 } else {
48 /* Guiness comes with INT3 which is part of IOC */
49 sgint = &sgioc->int3;
50 system_type = "SGI Indy";
51 }
52
53 sgi_ioc_reset = (SGIOC_RESET_PPORT | SGIOC_RESET_KBDMOUSE |
54 SGIOC_RESET_EISA | SGIOC_RESET_ISDN |
55 SGIOC_RESET_LC0OFF);
56
57 sgi_ioc_write = (SGIOC_WRITE_EASEL | SGIOC_WRITE_NTHRESH |
58 SGIOC_WRITE_TPSPEED | SGIOC_WRITE_EPSEL |
59 SGIOC_WRITE_U0AMODE | SGIOC_WRITE_U1AMODE);
60
61 sgioc->reset = sgi_ioc_reset;
62 sgioc->write = sgi_ioc_write;
63}
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
new file mode 100644
index 000000000000..ea2844d29e6e
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -0,0 +1,410 @@
1/*
2 * ip22-int.c: Routines for generic manipulation of the INT[23] ASIC
3 * found on INDY and Indigo2 workstations.
4 *
5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
7 * Copyright (C) 1999 Andrew R. Baker (andrewb@uab.edu)
8 * - Indigo2 changes
9 * - Interrupt handling fixes
10 * Copyright (C) 2001, 2003 Ladislav Michl (ladis@linux-mips.org)
11 */
12#include <linux/config.h>
13#include <linux/types.h>
14#include <linux/init.h>
15#include <linux/kernel_stat.h>
16#include <linux/signal.h>
17#include <linux/sched.h>
18#include <linux/interrupt.h>
19#include <linux/irq.h>
20
21#include <asm/mipsregs.h>
22#include <asm/addrspace.h>
23
24#include <asm/sgi/ioc.h>
25#include <asm/sgi/hpc3.h>
26#include <asm/sgi/ip22.h>
27
28/* #define DEBUG_SGINT */
29
30/* So far nothing hangs here */
31#undef USE_LIO3_IRQ
32
33struct sgint_regs *sgint;
34
35static char lc0msk_to_irqnr[256];
36static char lc1msk_to_irqnr[256];
37static char lc2msk_to_irqnr[256];
38static char lc3msk_to_irqnr[256];
39
40extern asmlinkage void indyIRQ(void);
41extern int ip22_eisa_init(void);
42
43static void enable_local0_irq(unsigned int irq)
44{
45 unsigned long flags;
46
47 local_irq_save(flags);
48 /* don't allow mappable interrupt to be enabled from setup_irq,
49 * we have our own way to do so */
50 if (irq != SGI_MAP_0_IRQ)
51 sgint->imask0 |= (1 << (irq - SGINT_LOCAL0));
52 local_irq_restore(flags);
53}
54
55static unsigned int startup_local0_irq(unsigned int irq)
56{
57 enable_local0_irq(irq);
58 return 0; /* Never anything pending */
59}
60
61static void disable_local0_irq(unsigned int irq)
62{
63 unsigned long flags;
64
65 local_irq_save(flags);
66 sgint->imask0 &= ~(1 << (irq - SGINT_LOCAL0));
67 local_irq_restore(flags);
68}
69
70#define shutdown_local0_irq disable_local0_irq
71#define mask_and_ack_local0_irq disable_local0_irq
72
73static void end_local0_irq (unsigned int irq)
74{
75 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
76 enable_local0_irq(irq);
77}
78
79static struct hw_interrupt_type ip22_local0_irq_type = {
80 .typename = "IP22 local 0",
81 .startup = startup_local0_irq,
82 .shutdown = shutdown_local0_irq,
83 .enable = enable_local0_irq,
84 .disable = disable_local0_irq,
85 .ack = mask_and_ack_local0_irq,
86 .end = end_local0_irq,
87};
88
89static void enable_local1_irq(unsigned int irq)
90{
91 unsigned long flags;
92
93 local_irq_save(flags);
94 /* don't allow mappable interrupt to be enabled from setup_irq,
95 * we have our own way to do so */
96 if (irq != SGI_MAP_1_IRQ)
97 sgint->imask1 |= (1 << (irq - SGINT_LOCAL1));
98 local_irq_restore(flags);
99}
100
101static unsigned int startup_local1_irq(unsigned int irq)
102{
103 enable_local1_irq(irq);
104 return 0; /* Never anything pending */
105}
106
107void disable_local1_irq(unsigned int irq)
108{
109 unsigned long flags;
110
111 local_irq_save(flags);
112 sgint->imask1 &= ~(1 << (irq - SGINT_LOCAL1));
113 local_irq_restore(flags);
114}
115
116#define shutdown_local1_irq disable_local1_irq
117#define mask_and_ack_local1_irq disable_local1_irq
118
119static void end_local1_irq (unsigned int irq)
120{
121 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
122 enable_local1_irq(irq);
123}
124
125static struct hw_interrupt_type ip22_local1_irq_type = {
126 .typename = "IP22 local 1",
127 .startup = startup_local1_irq,
128 .shutdown = shutdown_local1_irq,
129 .enable = enable_local1_irq,
130 .disable = disable_local1_irq,
131 .ack = mask_and_ack_local1_irq,
132 .end = end_local1_irq,
133};
134
135static void enable_local2_irq(unsigned int irq)
136{
137 unsigned long flags;
138
139 local_irq_save(flags);
140 sgint->imask0 |= (1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0));
141 sgint->cmeimask0 |= (1 << (irq - SGINT_LOCAL2));
142 local_irq_restore(flags);
143}
144
145static unsigned int startup_local2_irq(unsigned int irq)
146{
147 enable_local2_irq(irq);
148 return 0; /* Never anything pending */
149}
150
151void disable_local2_irq(unsigned int irq)
152{
153 unsigned long flags;
154
155 local_irq_save(flags);
156 sgint->cmeimask0 &= ~(1 << (irq - SGINT_LOCAL2));
157 if (!sgint->cmeimask0)
158 sgint->imask0 &= ~(1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0));
159 local_irq_restore(flags);
160}
161
162#define shutdown_local2_irq disable_local2_irq
163#define mask_and_ack_local2_irq disable_local2_irq
164
165static void end_local2_irq (unsigned int irq)
166{
167 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
168 enable_local2_irq(irq);
169}
170
171static struct hw_interrupt_type ip22_local2_irq_type = {
172 .typename = "IP22 local 2",
173 .startup = startup_local2_irq,
174 .shutdown = shutdown_local2_irq,
175 .enable = enable_local2_irq,
176 .disable = disable_local2_irq,
177 .ack = mask_and_ack_local2_irq,
178 .end = end_local2_irq,
179};
180
181static void enable_local3_irq(unsigned int irq)
182{
183 unsigned long flags;
184
185 local_irq_save(flags);
186 sgint->imask1 |= (1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1));
187 sgint->cmeimask1 |= (1 << (irq - SGINT_LOCAL3));
188 local_irq_restore(flags);
189}
190
191static unsigned int startup_local3_irq(unsigned int irq)
192{
193 enable_local3_irq(irq);
194 return 0; /* Never anything pending */
195}
196
197void disable_local3_irq(unsigned int irq)
198{
199 unsigned long flags;
200
201 local_irq_save(flags);
202 sgint->cmeimask1 &= ~(1 << (irq - SGINT_LOCAL3));
203 if (!sgint->cmeimask1)
204 sgint->imask1 &= ~(1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1));
205 local_irq_restore(flags);
206}
207
208#define shutdown_local3_irq disable_local3_irq
209#define mask_and_ack_local3_irq disable_local3_irq
210
211static void end_local3_irq (unsigned int irq)
212{
213 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
214 enable_local3_irq(irq);
215}
216
217static struct hw_interrupt_type ip22_local3_irq_type = {
218 .typename = "IP22 local 3",
219 .startup = startup_local3_irq,
220 .shutdown = shutdown_local3_irq,
221 .enable = enable_local3_irq,
222 .disable = disable_local3_irq,
223 .ack = mask_and_ack_local3_irq,
224 .end = end_local3_irq,
225};
226
227void indy_local0_irqdispatch(struct pt_regs *regs)
228{
229 u8 mask = sgint->istat0 & sgint->imask0;
230 u8 mask2;
231 int irq;
232
233 if (mask & SGINT_ISTAT0_LIO2) {
234 mask2 = sgint->vmeistat & sgint->cmeimask0;
235 irq = lc2msk_to_irqnr[mask2];
236 } else
237 irq = lc0msk_to_irqnr[mask];
238
239 /* if irq == 0, then the interrupt has already been cleared */
240 if (irq)
241 do_IRQ(irq, regs);
242 return;
243}
244
245void indy_local1_irqdispatch(struct pt_regs *regs)
246{
247 u8 mask = sgint->istat1 & sgint->imask1;
248 u8 mask2;
249 int irq;
250
251 if (mask & SGINT_ISTAT1_LIO3) {
252 mask2 = sgint->vmeistat & sgint->cmeimask1;
253 irq = lc3msk_to_irqnr[mask2];
254 } else
255 irq = lc1msk_to_irqnr[mask];
256
257 /* if irq == 0, then the interrupt has already been cleared */
258 if (irq)
259 do_IRQ(irq, regs);
260 return;
261}
262
263extern void ip22_be_interrupt(int irq, struct pt_regs *regs);
264
265void indy_buserror_irq(struct pt_regs *regs)
266{
267 int irq = SGI_BUSERR_IRQ;
268
269 irq_enter();
270 kstat_this_cpu.irqs[irq]++;
271 ip22_be_interrupt(irq, regs);
272 irq_exit();
273}
274
275static struct irqaction local0_cascade = {
276 .handler = no_action,
277 .flags = SA_INTERRUPT,
278 .name = "local0 cascade",
279};
280
281static struct irqaction local1_cascade = {
282 .handler = no_action,
283 .flags = SA_INTERRUPT,
284 .name = "local1 cascade",
285};
286
287static struct irqaction buserr = {
288 .handler = no_action,
289 .flags = SA_INTERRUPT,
290 .name = "Bus Error",
291};
292
293static struct irqaction map0_cascade = {
294 .handler = no_action,
295 .flags = SA_INTERRUPT,
296 .name = "mapable0 cascade",
297};
298
299#ifdef USE_LIO3_IRQ
300static struct irqaction map1_cascade = {
301 .handler = no_action,
302 .flags = SA_INTERRUPT,
303 .name = "mapable1 cascade",
304};
305#define SGI_INTERRUPTS SGINT_END
306#else
307#define SGI_INTERRUPTS SGINT_LOCAL3
308#endif
309
310extern void mips_cpu_irq_init(unsigned int irq_base);
311
312void __init arch_init_irq(void)
313{
314 int i;
315
316 /* Init local mask --> irq tables. */
317 for (i = 0; i < 256; i++) {
318 if (i & 0x80) {
319 lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 7;
320 lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 7;
321 lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 7;
322 lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 7;
323 } else if (i & 0x40) {
324 lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 6;
325 lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 6;
326 lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 6;
327 lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 6;
328 } else if (i & 0x20) {
329 lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 5;
330 lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 5;
331 lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 5;
332 lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 5;
333 } else if (i & 0x10) {
334 lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 4;
335 lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 4;
336 lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 4;
337 lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 4;
338 } else if (i & 0x08) {
339 lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 3;
340 lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 3;
341 lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 3;
342 lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 3;
343 } else if (i & 0x04) {
344 lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 2;
345 lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 2;
346 lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 2;
347 lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 2;
348 } else if (i & 0x02) {
349 lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 1;
350 lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 1;
351 lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 1;
352 lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 1;
353 } else if (i & 0x01) {
354 lc0msk_to_irqnr[i] = SGINT_LOCAL0 + 0;
355 lc1msk_to_irqnr[i] = SGINT_LOCAL1 + 0;
356 lc2msk_to_irqnr[i] = SGINT_LOCAL2 + 0;
357 lc3msk_to_irqnr[i] = SGINT_LOCAL3 + 0;
358 } else {
359 lc0msk_to_irqnr[i] = 0;
360 lc1msk_to_irqnr[i] = 0;
361 lc2msk_to_irqnr[i] = 0;
362 lc3msk_to_irqnr[i] = 0;
363 }
364 }
365
366 /* Mask out all interrupts. */
367 sgint->imask0 = 0;
368 sgint->imask1 = 0;
369 sgint->cmeimask0 = 0;
370 sgint->cmeimask1 = 0;
371
372 set_except_vector(0, indyIRQ);
373
374 /* init CPU irqs */
375 mips_cpu_irq_init(SGINT_CPU);
376
377 for (i = SGINT_LOCAL0; i < SGI_INTERRUPTS; i++) {
378 hw_irq_controller *handler;
379
380 if (i < SGINT_LOCAL1)
381 handler = &ip22_local0_irq_type;
382 else if (i < SGINT_LOCAL2)
383 handler = &ip22_local1_irq_type;
384 else if (i < SGINT_LOCAL3)
385 handler = &ip22_local2_irq_type;
386 else
387 handler = &ip22_local3_irq_type;
388
389 irq_desc[i].status = IRQ_DISABLED;
390 irq_desc[i].action = 0;
391 irq_desc[i].depth = 1;
392 irq_desc[i].handler = handler;
393 }
394
395 /* vector handler. this register the IRQ as non-sharable */
396 setup_irq(SGI_LOCAL_0_IRQ, &local0_cascade);
397 setup_irq(SGI_LOCAL_1_IRQ, &local1_cascade);
398 setup_irq(SGI_BUSERR_IRQ, &buserr);
399
400 /* cascade in cascade. i love Indy ;-) */
401 setup_irq(SGI_MAP_0_IRQ, &map0_cascade);
402#ifdef USE_LIO3_IRQ
403 setup_irq(SGI_MAP_1_IRQ, &map1_cascade);
404#endif
405
406#ifdef CONFIG_EISA
407 if (ip22_is_fullhouse()) /* Only Indigo-2 has EISA stuff */
408 ip22_eisa_init ();
409#endif
410}
diff --git a/arch/mips/sgi-ip22/ip22-irq.S b/arch/mips/sgi-ip22/ip22-irq.S
new file mode 100644
index 000000000000..6ccbd9e1d967
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-irq.S
@@ -0,0 +1,118 @@
1/*
2 * ip22-irq.S: Interrupt exception dispatch code for FullHouse and
3 * Guiness.
4 *
5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 */
7
8#include <asm/asm.h>
9#include <asm/mipsregs.h>
10#include <asm/regdef.h>
11#include <asm/stackframe.h>
12
13/* A lot of complication here is taken away because:
14 *
15 * 1) We handle one interrupt and return, sitting in a loop and moving across
16 * all the pending IRQ bits in the cause register is _NOT_ the answer, the
17 * common case is one pending IRQ so optimize in that direction.
18 *
19 * 2) We need not check against bits in the status register IRQ mask, that
20 * would make this routine slow as hell.
21 *
22 * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
23 * between like BSD spl() brain-damage.
24 *
25 * Furthermore, the IRQs on the INDY look basically (barring software IRQs
26 * which we don't use at all) like:
27 *
28 * MIPS IRQ Source
29 * -------- ------
30 * 0 Software (ignored)
31 * 1 Software (ignored)
32 * 2 Local IRQ level zero
33 * 3 Local IRQ level one
34 * 4 8254 Timer zero
35 * 5 8254 Timer one
36 * 6 Bus Error
37 * 7 R4k timer (what we use)
38 *
39 * We handle the IRQ according to _our_ priority which is:
40 *
41 * Highest ---- R4k Timer
42 * Local IRQ zero
43 * Local IRQ one
44 * Bus Error
45 * 8254 Timer zero
46 * Lowest ---- 8254 Timer one
47 *
48 * then we just return, if multiple IRQs are pending then we will just take
49 * another exception, big deal.
50 */
51
52 .text
53 .set noreorder
54 .set noat
55 .align 5
56 NESTED(indyIRQ, PT_SIZE, sp)
57 SAVE_ALL
58 CLI
59 .set at
60 mfc0 s0, CP0_CAUSE # get irq mask
61
62 /* First we check for r4k counter/timer IRQ. */
63 andi a0, s0, CAUSEF_IP7
64 beq a0, zero, 1f
65 andi a0, s0, CAUSEF_IP2 # delay slot, check local level zero
66
67 /* Wheee, a timer interrupt. */
68 jal indy_r4k_timer_interrupt
69 move a0, sp # delay slot
70 j ret_from_irq
71 nop # delay slot
72
731:
74 beq a0, zero, 1f
75 andi a0, s0, CAUSEF_IP3 # delay slot, check local level one
76
77 /* Wheee, local level zero interrupt. */
78 jal indy_local0_irqdispatch
79 move a0, sp # delay slot
80
81 j ret_from_irq
82 nop # delay slot
83
841:
85 beq a0, zero, 1f
86 andi a0, s0, CAUSEF_IP6 # delay slot, check bus error
87
88 /* Wheee, local level one interrupt. */
89 jal indy_local1_irqdispatch
90 move a0, sp # delay slot
91 j ret_from_irq
92 nop # delay slot
93
941:
95 beq a0, zero, 1f
96 andi a0, s0, (CAUSEF_IP4 | CAUSEF_IP5) # delay slot
97
98 /* Wheee, an asynchronous bus error... */
99 jal indy_buserror_irq
100 move a0, sp # delay slot
101 j ret_from_irq
102 nop # delay slot
103
1041:
105 /* Here by mistake? It is possible, that by the time we take
106 * the exception the IRQ pin goes low, so just leave if this
107 * is the case.
108 */
109 beq a0, zero, 1f
110 nop # delay slot
111
112 /* Must be one of the 8254 timers... */
113 jal indy_8254timer_irq
114 move a0, sp # delay slot
1151:
116 j ret_from_irq
117 nop # delay slot
118 END(indyIRQ)
diff --git a/arch/mips/sgi-ip22/ip22-mc.c b/arch/mips/sgi-ip22/ip22-mc.c
new file mode 100644
index 000000000000..b58bd522262b
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-mc.c
@@ -0,0 +1,208 @@
1/*
2 * ip22-mc.c: Routines for manipulating SGI Memory Controller.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1999 Andrew R. Baker (andrewb@uab.edu) - Indigo2 changes
6 * Copyright (C) 2003 Ladislav Michl (ladis@linux-mips.org)
7 */
8
9#include <linux/init.h>
10#include <linux/module.h>
11#include <linux/kernel.h>
12
13#include <asm/io.h>
14#include <asm/bootinfo.h>
15#include <asm/sgialib.h>
16#include <asm/sgi/mc.h>
17#include <asm/sgi/hpc3.h>
18#include <asm/sgi/ip22.h>
19
20struct sgimc_regs *sgimc;
21
22EXPORT_SYMBOL(sgimc);
23
24static inline unsigned long get_bank_addr(unsigned int memconfig)
25{
26 return ((memconfig & SGIMC_MCONFIG_BASEADDR) <<
27 ((sgimc->systemid & SGIMC_SYSID_MASKREV) >= 5 ? 24 : 22));
28}
29
30static inline unsigned long get_bank_size(unsigned int memconfig)
31{
32 return ((memconfig & SGIMC_MCONFIG_RMASK) + 0x0100) <<
33 ((sgimc->systemid & SGIMC_SYSID_MASKREV) >= 5 ? 16 : 14);
34}
35
36static inline unsigned int get_bank_config(int bank)
37{
38 unsigned int res = bank > 1 ? sgimc->mconfig1 : sgimc->mconfig0;
39 return bank % 2 ? res & 0xffff : res >> 16;
40}
41
42struct mem {
43 unsigned long addr;
44 unsigned long size;
45};
46
47/*
48 * Detect installed memory, do some sanity checks and notify kernel about it
49 */
50static void probe_memory(void)
51{
52 int i, j, found, cnt = 0;
53 struct mem bank[4];
54 struct mem space[2] = {{SGIMC_SEG0_BADDR, 0}, {SGIMC_SEG1_BADDR, 0}};
55
56 printk(KERN_INFO "MC: Probing memory configuration:\n");
57 for (i = 0; i < ARRAY_SIZE(bank); i++) {
58 unsigned int tmp = get_bank_config(i);
59 if (!(tmp & SGIMC_MCONFIG_BVALID))
60 continue;
61
62 bank[cnt].size = get_bank_size(tmp);
63 bank[cnt].addr = get_bank_addr(tmp);
64 printk(KERN_INFO " bank%d: %3ldM @ %08lx\n",
65 i, bank[cnt].size / 1024 / 1024, bank[cnt].addr);
66 cnt++;
67 }
68
69 /* And you thought bubble sort is dead algorithm... */
70 do {
71 unsigned long addr, size;
72
73 found = 0;
74 for (i = 1; i < cnt; i++)
75 if (bank[i-1].addr > bank[i].addr) {
76 addr = bank[i].addr;
77 size = bank[i].size;
78 bank[i].addr = bank[i-1].addr;
79 bank[i].size = bank[i-1].size;
80 bank[i-1].addr = addr;
81 bank[i-1].size = size;
82 found = 1;
83 }
84 } while (found);
85
86 /* Figure out how are memory banks mapped into spaces */
87 for (i = 0; i < cnt; i++) {
88 found = 0;
89 for (j = 0; j < ARRAY_SIZE(space) && !found; j++)
90 if (space[j].addr + space[j].size == bank[i].addr) {
91 space[j].size += bank[i].size;
92 found = 1;
93 }
94 /* There is either hole or overlapping memory */
95 if (!found)
96 printk(KERN_CRIT "MC: Memory configuration mismatch "
97 "(%08lx), expect Bus Error soon\n",
98 bank[i].addr);
99 }
100
101 for (i = 0; i < ARRAY_SIZE(space); i++)
102 if (space[i].size)
103 add_memory_region(space[i].addr, space[i].size,
104 BOOT_MEM_RAM);
105}
106
107void __init sgimc_init(void)
108{
109 u32 tmp;
110
111 /* ioremap can't fail */
112 sgimc = (struct sgimc_regs *)
113 ioremap(SGIMC_BASE, sizeof(struct sgimc_regs));
114
115 printk(KERN_INFO "MC: SGI memory controller Revision %d\n",
116 (int) sgimc->systemid & SGIMC_SYSID_MASKREV);
117
118 /* Place the MC into a known state. This must be done before
119 * interrupts are first enabled etc.
120 */
121
122 /* Step 0: Make sure we turn off the watchdog in case it's
123 * still running (which might be the case after a
124 * soft reboot).
125 */
126 tmp = sgimc->cpuctrl0;
127 tmp &= ~SGIMC_CCTRL0_WDOG;
128 sgimc->cpuctrl0 = tmp;
129
130 /* Step 1: The CPU/GIO error status registers will not latch
131 * up a new error status until the register has been
132 * cleared by the cpu. These status registers are
133 * cleared by writing any value to them.
134 */
135 sgimc->cstat = sgimc->gstat = 0;
136
137 /* Step 2: Enable all parity checking in cpu control register
138 * zero.
139 */
140 tmp = sgimc->cpuctrl0;
141 tmp |= (SGIMC_CCTRL0_EPERRGIO | SGIMC_CCTRL0_EPERRMEM |
142 SGIMC_CCTRL0_R4KNOCHKPARR);
143 sgimc->cpuctrl0 = tmp;
144
145 /* Step 3: Setup the MC write buffer depth, this is controlled
146 * in cpu control register 1 in the lower 4 bits.
147 */
148 tmp = sgimc->cpuctrl1;
149 tmp &= ~0xf;
150 tmp |= 0xd;
151 sgimc->cpuctrl1 = tmp;
152
153 /* Step 4: Initialize the RPSS divider register to run as fast
154 * as it can correctly operate. The register is laid
155 * out as follows:
156 *
157 * ----------------------------------------
158 * | RESERVED | INCREMENT | DIVIDER |
159 * ----------------------------------------
160 * 31 16 15 8 7 0
161 *
162 * DIVIDER determines how often a 'tick' happens,
163 * INCREMENT determines by how the RPSS increment
164 * registers value increases at each 'tick'. Thus,
165 * for IP22 we get INCREMENT=1, DIVIDER=1 == 0x101
166 */
167 sgimc->divider = 0x101;
168
169 /* Step 5: Initialize GIO64 arbitrator configuration register.
170 *
171 * NOTE: HPC init code in sgihpc_init() must run before us because
172 * we need to know Guiness vs. FullHouse and the board
173 * revision on this machine. You have been warned.
174 */
175
176 /* First the basic invariants across all GIO64 implementations. */
177 tmp = SGIMC_GIOPAR_HPC64; /* All 1st HPC's interface at 64bits */
178 tmp |= SGIMC_GIOPAR_ONEBUS; /* Only one physical GIO bus exists */
179
180 if (ip22_is_fullhouse()) {
181 /* Fullhouse specific settings. */
182 if (SGIOC_SYSID_BOARDREV(sgioc->sysid) < 2) {
183 tmp |= SGIMC_GIOPAR_HPC264; /* 2nd HPC at 64bits */
184 tmp |= SGIMC_GIOPAR_PLINEEXP0; /* exp0 pipelines */
185 tmp |= SGIMC_GIOPAR_MASTEREXP1; /* exp1 masters */
186 tmp |= SGIMC_GIOPAR_RTIMEEXP0; /* exp0 is realtime */
187 } else {
188 tmp |= SGIMC_GIOPAR_HPC264; /* 2nd HPC 64bits */
189 tmp |= SGIMC_GIOPAR_PLINEEXP0; /* exp[01] pipelined */
190 tmp |= SGIMC_GIOPAR_PLINEEXP1;
191 tmp |= SGIMC_GIOPAR_MASTEREISA; /* EISA masters */
192 tmp |= SGIMC_GIOPAR_GFX64; /* GFX at 64 bits */
193 }
194 } else {
195 /* Guiness specific settings. */
196 tmp |= SGIMC_GIOPAR_EISA64; /* MC talks to EISA at 64bits */
197 tmp |= SGIMC_GIOPAR_MASTEREISA; /* EISA bus can act as master */
198 }
199 sgimc->giopar = tmp; /* poof */
200
201 probe_memory();
202}
203
204void __init prom_meminit(void) {}
205unsigned long __init prom_free_prom_memory(void)
206{
207 return 0;
208}
diff --git a/arch/mips/sgi-ip22/ip22-nvram.c b/arch/mips/sgi-ip22/ip22-nvram.c
new file mode 100644
index 000000000000..de43e86fa17c
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-nvram.c
@@ -0,0 +1,119 @@
1/*
2 * ip22-nvram.c: NVRAM and serial EEPROM handling.
3 *
4 * Copyright (C) 2003 Ladislav Michl (ladis@linux-mips.org)
5 */
6#include <linux/module.h>
7
8#include <asm/sgi/hpc3.h>
9#include <asm/sgi/ip22.h>
10
11/* Control opcode for serial eeprom */
12#define EEPROM_READ 0xc000 /* serial memory read */
13#define EEPROM_WEN 0x9800 /* write enable before prog modes */
14#define EEPROM_WRITE 0xa000 /* serial memory write */
15#define EEPROM_WRALL 0x8800 /* write all registers */
16#define EEPROM_WDS 0x8000 /* disable all programming */
17#define EEPROM_PRREAD 0xc000 /* read protect register */
18#define EEPROM_PREN 0x9800 /* enable protect register mode */
19#define EEPROM_PRCLEAR 0xffff /* clear protect register */
20#define EEPROM_PRWRITE 0xa000 /* write protect register */
21#define EEPROM_PRDS 0x8000 /* disable protect register, forever */
22
23#define EEPROM_EPROT 0x01 /* Protect register enable */
24#define EEPROM_CSEL 0x02 /* Chip select */
25#define EEPROM_ECLK 0x04 /* EEPROM clock */
26#define EEPROM_DATO 0x08 /* Data out */
27#define EEPROM_DATI 0x10 /* Data in */
28
29/* We need to use these functions early... */
30#define delay() ({ \
31 int x; \
32 for (x=0; x<100000; x++) __asm__ __volatile__(""); })
33
34#define eeprom_cs_on(ptr) ({ \
35 *ptr &= ~EEPROM_DATO; \
36 *ptr &= ~EEPROM_ECLK; \
37 *ptr &= ~EEPROM_EPROT; \
38 delay(); \
39 *ptr |= EEPROM_CSEL; \
40 *ptr |= EEPROM_ECLK; })
41
42
43#define eeprom_cs_off(ptr) ({ \
44 *ptr &= ~EEPROM_ECLK; \
45 *ptr &= ~EEPROM_CSEL; \
46 *ptr |= EEPROM_EPROT; \
47 *ptr |= EEPROM_ECLK; })
48
49#define BITS_IN_COMMAND 11
50/*
51 * clock in the nvram command and the register number. For the
52 * national semiconductor nv ram chip the op code is 3 bits and
53 * the address is 6/8 bits.
54 */
55static inline void eeprom_cmd(volatile unsigned int *ctrl, unsigned cmd,
56 unsigned reg)
57{
58 unsigned short ser_cmd;
59 int i;
60
61 ser_cmd = cmd | (reg << (16 - BITS_IN_COMMAND));
62 for (i = 0; i < BITS_IN_COMMAND; i++) {
63 if (ser_cmd & (1<<15)) /* if high order bit set */
64 *ctrl |= EEPROM_DATO;
65 else
66 *ctrl &= ~EEPROM_DATO;
67 *ctrl &= ~EEPROM_ECLK;
68 *ctrl |= EEPROM_ECLK;
69 ser_cmd <<= 1;
70 }
71 *ctrl &= ~EEPROM_DATO; /* see data sheet timing diagram */
72}
73
74unsigned short ip22_eeprom_read(volatile unsigned int *ctrl, int reg)
75{
76 unsigned short res = 0;
77 int i;
78
79 *ctrl &= ~EEPROM_EPROT;
80 eeprom_cs_on(ctrl);
81 eeprom_cmd(ctrl, EEPROM_READ, reg);
82
83 /* clock the data ouf of serial mem */
84 for (i = 0; i < 16; i++) {
85 *ctrl &= ~EEPROM_ECLK;
86 delay();
87 *ctrl |= EEPROM_ECLK;
88 delay();
89 res <<= 1;
90 if (*ctrl & EEPROM_DATI)
91 res |= 1;
92 }
93
94 eeprom_cs_off(ctrl);
95
96 return res;
97}
98
99EXPORT_SYMBOL(ip22_eeprom_read);
100
101/*
102 * Read specified register from main NVRAM
103 */
104unsigned short ip22_nvram_read(int reg)
105{
106 if (ip22_is_fullhouse())
107 /* IP22 (Indigo2 aka FullHouse) stores env variables into
108 * 93CS56 Microwire Bus EEPROM 2048 Bit (128x16) */
109 return ip22_eeprom_read(&hpc3c0->eeprom, reg);
110 else {
111 unsigned short tmp;
112 /* IP24 (Indy aka Guiness) uses DS1386 8K version */
113 reg <<= 1;
114 tmp = hpc3c0->bbram[reg++] & 0xff;
115 return (tmp << 8) | (hpc3c0->bbram[reg] & 0xff);
116 }
117}
118
119EXPORT_SYMBOL(ip22_nvram_read);
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
new file mode 100644
index 000000000000..ed5c60adce63
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -0,0 +1,247 @@
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) 1997, 1998, 2001, 2003 by Ralf Baechle
7 */
8#include <linux/init.h>
9#include <linux/ds1286.h>
10#include <linux/module.h>
11#include <linux/interrupt.h>
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/notifier.h>
15#include <linux/timer.h>
16
17#include <asm/io.h>
18#include <asm/irq.h>
19#include <asm/system.h>
20#include <asm/reboot.h>
21#include <asm/sgialib.h>
22#include <asm/sgi/ioc.h>
23#include <asm/sgi/hpc3.h>
24#include <asm/sgi/mc.h>
25#include <asm/sgi/ip22.h>
26
27/*
28 * Just powerdown if init hasn't done after POWERDOWN_TIMEOUT seconds.
29 * I'm not sure if this feature is a good idea, for now it's here just to
30 * make the power button make behave just like under IRIX.
31 */
32#define POWERDOWN_TIMEOUT 120
33
34/*
35 * Blink frequency during reboot grace period and when paniced.
36 */
37#define POWERDOWN_FREQ (HZ / 4)
38#define PANIC_FREQ (HZ / 8)
39
40static struct timer_list power_timer, blink_timer, debounce_timer, volume_timer;
41
42#define MACHINE_PANICED 1
43#define MACHINE_SHUTTING_DOWN 2
44static int machine_state = 0;
45
46static void sgi_machine_restart(char *command) __attribute__((noreturn));
47static void sgi_machine_halt(void) __attribute__((noreturn));
48static void sgi_machine_power_off(void) __attribute__((noreturn));
49
50static void sgi_machine_restart(char *command)
51{
52 if (machine_state & MACHINE_SHUTTING_DOWN)
53 sgi_machine_power_off();
54 sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT;
55 while (1);
56}
57
58static void sgi_machine_halt(void)
59{
60 if (machine_state & MACHINE_SHUTTING_DOWN)
61 sgi_machine_power_off();
62 ArcEnterInteractiveMode();
63}
64
65static void sgi_machine_power_off(void)
66{
67 unsigned int tmp;
68
69 local_irq_disable();
70
71 /* Disable watchdog */
72 tmp = hpc3c0->rtcregs[RTC_CMD] & 0xff;
73 hpc3c0->rtcregs[RTC_CMD] = tmp | RTC_WAM;
74 hpc3c0->rtcregs[RTC_WSEC] = 0;
75 hpc3c0->rtcregs[RTC_WHSEC] = 0;
76
77 while (1) {
78 sgioc->panel = ~SGIOC_PANEL_POWERON;
79 /* Good bye cruel world ... */
80
81 /* If we're still running, we probably got sent an alarm
82 interrupt. Read the flag to clear it. */
83 tmp = hpc3c0->rtcregs[RTC_HOURS_ALARM];
84 }
85}
86
87static void power_timeout(unsigned long data)
88{
89 sgi_machine_power_off();
90}
91
92static void blink_timeout(unsigned long data)
93{
94 /* XXX fix this for fullhouse */
95 sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF);
96 sgioc->reset = sgi_ioc_reset;
97
98 mod_timer(&blink_timer, jiffies+data);
99}
100
101static void debounce(unsigned long data)
102{
103 del_timer(&debounce_timer);
104 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
105 /* Interrupt still being sent. */
106 debounce_timer.expires = jiffies + 5; /* 0.05s */
107 add_timer(&debounce_timer);
108
109 sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR |
110 SGIOC_PANEL_VOLDNINTR | SGIOC_PANEL_VOLDNHOLD |
111 SGIOC_PANEL_VOLUPINTR | SGIOC_PANEL_VOLUPHOLD;
112
113 return;
114 }
115
116 if (machine_state & MACHINE_PANICED)
117 sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT;
118
119 enable_irq(SGI_PANEL_IRQ);
120}
121
122static inline void power_button(void)
123{
124 if (machine_state & MACHINE_PANICED)
125 return;
126
127 if ((machine_state & MACHINE_SHUTTING_DOWN) || kill_proc(1,SIGINT,1)) {
128 /* No init process or button pressed twice. */
129 sgi_machine_power_off();
130 }
131
132 machine_state |= MACHINE_SHUTTING_DOWN;
133 blink_timer.data = POWERDOWN_FREQ;
134 blink_timeout(POWERDOWN_FREQ);
135
136 init_timer(&power_timer);
137 power_timer.function = power_timeout;
138 power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
139 add_timer(&power_timer);
140}
141
142void (*indy_volume_button)(int) = NULL;
143
144EXPORT_SYMBOL(indy_volume_button);
145
146static inline void volume_up_button(unsigned long data)
147{
148 del_timer(&volume_timer);
149
150 if (indy_volume_button)
151 indy_volume_button(1);
152
153 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
154 volume_timer.expires = jiffies + 1;
155 add_timer(&volume_timer);
156 }
157}
158
159static inline void volume_down_button(unsigned long data)
160{
161 del_timer(&volume_timer);
162
163 if (indy_volume_button)
164 indy_volume_button(-1);
165
166 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
167 volume_timer.expires = jiffies + 1;
168 add_timer(&volume_timer);
169 }
170}
171
172static irqreturn_t panel_int(int irq, void *dev_id, struct pt_regs *regs)
173{
174 unsigned int buttons;
175
176 buttons = sgioc->panel;
177 sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR;
178
179 if (sgint->istat1 & SGINT_ISTAT1_PWR) {
180 /* Wait until interrupt goes away */
181 disable_irq(SGI_PANEL_IRQ);
182 init_timer(&debounce_timer);
183 debounce_timer.function = debounce;
184 debounce_timer.expires = jiffies + 5;
185 add_timer(&debounce_timer);
186 }
187
188 /* Power button was pressed
189 * ioc.ps page 22: "The Panel Register is called Power Control by Full
190 * House. Only lowest 2 bits are used. Guiness uses upper four bits
191 * for volume control". This is not true, all bits are pulled high
192 * on fullhouse */
193 if (ip22_is_fullhouse() || !(buttons & SGIOC_PANEL_POWERINTR)) {
194 power_button();
195 return IRQ_HANDLED;
196 }
197 /* TODO: mute/unmute */
198 /* Volume up button was pressed */
199 if (!(buttons & SGIOC_PANEL_VOLUPINTR)) {
200 init_timer(&volume_timer);
201 volume_timer.function = volume_up_button;
202 volume_timer.expires = jiffies + 1;
203 add_timer(&volume_timer);
204 }
205 /* Volume down button was pressed */
206 if (!(buttons & SGIOC_PANEL_VOLDNINTR)) {
207 init_timer(&volume_timer);
208 volume_timer.function = volume_down_button;
209 volume_timer.expires = jiffies + 1;
210 add_timer(&volume_timer);
211 }
212
213 return IRQ_HANDLED;
214}
215
216static int panic_event(struct notifier_block *this, unsigned long event,
217 void *ptr)
218{
219 if (machine_state & MACHINE_PANICED)
220 return NOTIFY_DONE;
221 machine_state |= MACHINE_PANICED;
222
223 blink_timer.data = PANIC_FREQ;
224 blink_timeout(PANIC_FREQ);
225
226 return NOTIFY_DONE;
227}
228
229static struct notifier_block panic_block = {
230 .notifier_call = panic_event,
231};
232
233static int __init reboot_setup(void)
234{
235 _machine_restart = sgi_machine_restart;
236 _machine_halt = sgi_machine_halt;
237 _machine_power_off = sgi_machine_power_off;
238
239 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
240 init_timer(&blink_timer);
241 blink_timer.function = blink_timeout;
242 notifier_chain_register(&panic_notifier_list, &panic_block);
243
244 return 0;
245}
246
247subsys_initcall(reboot_setup);
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
new file mode 100644
index 000000000000..0e96a5d67993
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-setup.c
@@ -0,0 +1,144 @@
1/*
2 * ip22-setup.c: SGI specific setup, including init of the feature struct.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
6 */
7#include <linux/config.h>
8#include <linux/ds1286.h>
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/kdev_t.h>
12#include <linux/types.h>
13#include <linux/module.h>
14#include <linux/console.h>
15#include <linux/sched.h>
16#include <linux/tty.h>
17
18#include <asm/addrspace.h>
19#include <asm/bcache.h>
20#include <asm/bootinfo.h>
21#include <asm/irq.h>
22#include <asm/reboot.h>
23#include <asm/time.h>
24#include <asm/gdb-stub.h>
25#include <asm/io.h>
26#include <asm/traps.h>
27#include <asm/sgialib.h>
28#include <asm/sgi/mc.h>
29#include <asm/sgi/hpc3.h>
30#include <asm/sgi/ip22.h>
31
32unsigned long sgi_gfxaddr;
33
34/*
35 * Stop-A is originally a Sun thing that isn't standard on IP22 so to avoid
36 * accidents it's disabled by default on IP22.
37 *
38 * FIXME: provide a mechanism to change the value of stop_a_enabled.
39 */
40int stop_a_enabled;
41
42void ip22_do_break(void)
43{
44 if (!stop_a_enabled)
45 return;
46
47 printk("\n");
48 ArcEnterInteractiveMode();
49}
50
51EXPORT_SYMBOL(ip22_do_break);
52
53extern void ip22_be_init(void) __init;
54extern void ip22_time_init(void) __init;
55
56static int __init ip22_setup(void)
57{
58 char *ctype;
59
60 board_be_init = ip22_be_init;
61 ip22_time_init();
62
63 /* Init the INDY HPC I/O controller. Need to call this before
64 * fucking with the memory controller because it needs to know the
65 * boardID and whether this is a Guiness or a FullHouse machine.
66 */
67 sgihpc_init();
68
69 /* Init INDY memory controller. */
70 sgimc_init();
71
72#ifdef CONFIG_BOARD_SCACHE
73 /* Now enable boardcaches, if any. */
74 indy_sc_init();
75#endif
76
77 /* Set EISA IO port base for Indigo2
78 * ioremap cannot fail */
79 set_io_port_base((unsigned long)ioremap(0x00080000,
80 0x1fffffff - 0x00080000));
81 /* ARCS console environment variable is set to "g?" for
82 * graphics console, it is set to "d" for the first serial
83 * line and "d2" for the second serial line.
84 */
85 ctype = ArcGetEnvironmentVariable("console");
86 if (ctype && *ctype == 'd') {
87 static char options[8];
88 char *baud = ArcGetEnvironmentVariable("dbaud");
89 if (baud)
90 strcpy(options, baud);
91 add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
92 baud ? options : NULL);
93 } else if (!ctype || *ctype != 'g') {
94 /* Use ARC if we don't want serial ('d') or Newport ('g'). */
95 prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
96 add_preferred_console("arc", 0, NULL);
97 }
98
99#ifdef CONFIG_KGDB
100 {
101 char *kgdb_ttyd = prom_getcmdline();
102
103 if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
104 int line;
105 kgdb_ttyd += strlen("kgdb=ttyd");
106 if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
107 printk(KERN_INFO "KGDB: Uknown serial line /dev/ttyd%c"
108 ", falling back to /dev/ttyd1\n", *kgdb_ttyd);
109 line = *kgdb_ttyd == '2' ? 0 : 1;
110 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
111 "session\n", line ? 1 : 2);
112 rs_kgdb_hook(line);
113
114 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
115 "session, please connect your debugger\n", line ? 1:2);
116
117 kgdb_enabled = 1;
118 /* Breakpoints and stuff are in sgi_irq_setup() */
119 }
120 }
121#endif
122
123#if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
124 {
125 ULONG *gfxinfo;
126 ULONG * (*__vec)(void) = (void *) (long)
127 *((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));
128
129 gfxinfo = __vec();
130 sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
131 && gfxinfo[1] <= 0xc0000000)
132 ? gfxinfo[1] - 0xa0000000 : 0);
133
134 /* newport addresses? */
135 if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
136 conswitchp = &newport_con;
137 }
138 }
139#endif
140
141 return 0;
142}
143
144early_initcall(ip22_setup);
diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c
new file mode 100644
index 000000000000..173f76805ea3
--- /dev/null
+++ b/arch/mips/sgi-ip22/ip22-time.c
@@ -0,0 +1,214 @@
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 * Time operations for IP22 machines. Original code may come from
7 * Ralf Baechle or David S. Miller (sorry guys, i'm really not sure)
8 *
9 * Copyright (C) 2001 by Ladislav Michl
10 * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org)
11 */
12#include <linux/bcd.h>
13#include <linux/ds1286.h>
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/interrupt.h>
17#include <linux/kernel_stat.h>
18#include <linux/time.h>
19
20#include <asm/cpu.h>
21#include <asm/mipsregs.h>
22#include <asm/io.h>
23#include <asm/irq.h>
24#include <asm/time.h>
25#include <asm/sgialib.h>
26#include <asm/sgi/ioc.h>
27#include <asm/sgi/hpc3.h>
28#include <asm/sgi/ip22.h>
29
30/*
31 * note that mktime uses month from 1 to 12 while to_tm
32 * uses 0 to 11.
33 */
34static unsigned long indy_rtc_get_time(void)
35{
36 unsigned int yrs, mon, day, hrs, min, sec;
37 unsigned int save_control;
38
39 save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;
40 hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;
41
42 sec = BCD2BIN(hpc3c0->rtcregs[RTC_SECONDS] & 0xff);
43 min = BCD2BIN(hpc3c0->rtcregs[RTC_MINUTES] & 0xff);
44 hrs = BCD2BIN(hpc3c0->rtcregs[RTC_HOURS] & 0x3f);
45 day = BCD2BIN(hpc3c0->rtcregs[RTC_DATE] & 0xff);
46 mon = BCD2BIN(hpc3c0->rtcregs[RTC_MONTH] & 0x1f);
47 yrs = BCD2BIN(hpc3c0->rtcregs[RTC_YEAR] & 0xff);
48
49 hpc3c0->rtcregs[RTC_CMD] = save_control;
50
51 if (yrs < 45)
52 yrs += 30;
53 if ((yrs += 40) < 70)
54 yrs += 100;
55
56 return mktime(yrs + 1900, mon, day, hrs, min, sec);
57}
58
59static int indy_rtc_set_time(unsigned long tim)
60{
61 struct rtc_time tm;
62 unsigned int save_control;
63
64 to_tm(tim, &tm);
65
66 tm.tm_mon += 1; /* tm_mon starts at zero */
67 tm.tm_year -= 1940;
68 if (tm.tm_year >= 100)
69 tm.tm_year -= 100;
70
71 save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;
72 hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;
73
74 hpc3c0->rtcregs[RTC_YEAR] = BIN2BCD(tm.tm_sec);
75 hpc3c0->rtcregs[RTC_MONTH] = BIN2BCD(tm.tm_mon);
76 hpc3c0->rtcregs[RTC_DATE] = BIN2BCD(tm.tm_mday);
77 hpc3c0->rtcregs[RTC_HOURS] = BIN2BCD(tm.tm_hour);
78 hpc3c0->rtcregs[RTC_MINUTES] = BIN2BCD(tm.tm_min);
79 hpc3c0->rtcregs[RTC_SECONDS] = BIN2BCD(tm.tm_sec);
80 hpc3c0->rtcregs[RTC_HUNDREDTH_SECOND] = 0;
81
82 hpc3c0->rtcregs[RTC_CMD] = save_control;
83
84 return 0;
85}
86
87static unsigned long dosample(void)
88{
89 u32 ct0, ct1;
90 volatile u8 msb, lsb;
91
92 /* Start the counter. */
93 sgint->tcword = (SGINT_TCWORD_CNT2 | SGINT_TCWORD_CALL |
94 SGINT_TCWORD_MRGEN);
95 sgint->tcnt2 = SGINT_TCSAMP_COUNTER & 0xff;
96 sgint->tcnt2 = SGINT_TCSAMP_COUNTER >> 8;
97
98 /* Get initial counter invariant */
99 ct0 = read_c0_count();
100
101 /* Latch and spin until top byte of counter2 is zero */
102 do {
103 sgint->tcword = SGINT_TCWORD_CNT2 | SGINT_TCWORD_CLAT;
104 lsb = sgint->tcnt2;
105 msb = sgint->tcnt2;
106 ct1 = read_c0_count();
107 } while (msb);
108
109 /* Stop the counter. */
110 sgint->tcword = (SGINT_TCWORD_CNT2 | SGINT_TCWORD_CALL |
111 SGINT_TCWORD_MSWST);
112 /*
113 * Return the difference, this is how far the r4k counter increments
114 * for every 1/HZ seconds. We round off the nearest 1 MHz of master
115 * clock (= 1000000 / HZ / 2).
116 */
117 /*return (ct1 - ct0 + (500000/HZ/2)) / (500000/HZ) * (500000/HZ);*/
118 return (ct1 - ct0) / (500000/HZ) * (500000/HZ);
119}
120
121/*
122 * Here we need to calibrate the cycle counter to at least be close.
123 */
124static __init void indy_time_init(void)
125{
126 unsigned long r4k_ticks[3];
127 unsigned long r4k_tick;
128
129 /*
130 * Figure out the r4k offset, the algorithm is very simple and works in
131 * _all_ cases as long as the 8254 counter register itself works ok (as
132 * an interrupt driving timer it does not because of bug, this is why
133 * we are using the onchip r4k counter/compare register to serve this
134 * purpose, but for r4k_offset calculation it will work ok for us).
135 * There are other very complicated ways of performing this calculation
136 * but this one works just fine so I am not going to futz around. ;-)
137 */
138 printk(KERN_INFO "Calibrating system timer... ");
139 dosample(); /* Prime cache. */
140 dosample(); /* Prime cache. */
141 /* Zero is NOT an option. */
142 do {
143 r4k_ticks[0] = dosample();
144 } while (!r4k_ticks[0]);
145 do {
146 r4k_ticks[1] = dosample();
147 } while (!r4k_ticks[1]);
148
149 if (r4k_ticks[0] != r4k_ticks[1]) {
150 printk("warning: timer counts differ, retrying... ");
151 r4k_ticks[2] = dosample();
152 if (r4k_ticks[2] == r4k_ticks[0]
153 || r4k_ticks[2] == r4k_ticks[1])
154 r4k_tick = r4k_ticks[2];
155 else {
156 printk("disagreement, using average... ");
157 r4k_tick = (r4k_ticks[0] + r4k_ticks[1]
158 + r4k_ticks[2]) / 3;
159 }
160 } else
161 r4k_tick = r4k_ticks[0];
162
163 printk("%d [%d.%04d MHz CPU]\n", (int) r4k_tick,
164 (int) (r4k_tick / (500000 / HZ)),
165 (int) (r4k_tick % (500000 / HZ)));
166
167 mips_hpt_frequency = r4k_tick * HZ;
168}
169
170/* Generic SGI handler for (spurious) 8254 interrupts */
171void indy_8254timer_irq(struct pt_regs *regs)
172{
173 int irq = SGI_8254_0_IRQ;
174 ULONG cnt;
175 char c;
176
177 irq_enter();
178 kstat_this_cpu.irqs[irq]++;
179 printk(KERN_ALERT "Oops, got 8254 interrupt.\n");
180 ArcRead(0, &c, 1, &cnt);
181 ArcEnterInteractiveMode();
182 irq_exit();
183}
184
185void indy_r4k_timer_interrupt(struct pt_regs *regs)
186{
187 int irq = SGI_TIMER_IRQ;
188
189 irq_enter();
190 kstat_this_cpu.irqs[irq]++;
191 timer_interrupt(irq, NULL, regs);
192 irq_exit();
193}
194
195extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
196
197static void indy_timer_setup(struct irqaction *irq)
198{
199 /* over-write the handler, we use our own way */
200 irq->handler = no_action;
201
202 /* setup irqaction */
203 setup_irq(SGI_TIMER_IRQ, irq);
204}
205
206void __init ip22_time_init(void)
207{
208 /* setup hookup functions */
209 rtc_get_time = indy_rtc_get_time;
210 rtc_set_time = indy_rtc_set_time;
211
212 board_time_init = indy_time_init;
213 board_timer_setup = indy_timer_setup;
214}
diff --git a/arch/mips/sgi-ip27/Makefile b/arch/mips/sgi-ip27/Makefile
new file mode 100644
index 000000000000..4ba340780c35
--- /dev/null
+++ b/arch/mips/sgi-ip27/Makefile
@@ -0,0 +1,12 @@
1#
2# Makefile for the IP27 specific kernel interface routines under Linux.
3#
4
5obj-y := ip27-berr.o ip27-console.o ip27-irq.o ip27-init.o ip27-irq-glue.o \
6 ip27-klconfig.o ip27-klnuma.o ip27-memory.o ip27-nmi.o ip27-reset.o \
7 ip27-timer.o ip27-hubio.o ip27-xtalk.o
8
9obj-$(CONFIG_KGDB) += ip27-dbgio.o
10obj-$(CONFIG_SMP) += ip27-smp.o
11
12EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/sgi-ip27/TODO b/arch/mips/sgi-ip27/TODO
new file mode 100644
index 000000000000..32106131b0d0
--- /dev/null
+++ b/arch/mips/sgi-ip27/TODO
@@ -0,0 +1,23 @@
11. Need to figure out why PCI writes to the IOC3 hang, and if it is okay
2not to write to the IOC3 ever.
32. Need to figure out RRB allocation in bridge_startup().
43. Need to figure out why address swaizzling is needed in inw/outw for
5Qlogic scsi controllers.
64. Need to integrate ip27-klconfig.c:find_lboard and
7ip27-init.c:find_lbaord_real. DONE
85. Is it okay to set calias space on all nodes as 0, instead of 8k as
9in irix?
106. Investigate why things do not work without the setup_test() call
11being invoked on all nodes in ip27-memory.c.
127. Too many CLIs in the locore handlers :
13For the low level handlers set up by set_except_vector(),
14__tlb_refill_debug_tramp, __xtlb_refill_debug_tramp and cacheerror,
15investigate whether the code should do CLI, STI or KMODE.
168. Too many do_page_faults invoked - investigate.
179. start_thread must turn off UX64 ... and define tlb_refill_debug.
1810. Need a bad pmd table, bad pte table. __bad_pmd_table/__bad_pagetable
19does not agree with pgd_bad/pmd_bad.
2011. All intrs (ip27_do_irq handlers) are targetted at cpu A on the node.
21This might need to change later. Only the timer intr is set up to be
22received on both Cpu A and B. (ip27_do_irq()/bridge_startup())
2313. Cache flushing (specially the SMP version) has to be investigated.
diff --git a/arch/mips/sgi-ip27/ip27-berr.c b/arch/mips/sgi-ip27/ip27-berr.c
new file mode 100644
index 000000000000..e1829a5d3b19
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-berr.c
@@ -0,0 +1,94 @@
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) 1994, 1995, 1996, 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 by Silicon Graphics
8 * Copyright (C) 2002 Maciej W. Rozycki
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/module.h>
13
14#include <asm/module.h>
15#include <asm/sn/addrs.h>
16#include <asm/sn/arch.h>
17#include <asm/sn/sn0/hub.h>
18#include <asm/tlbdebug.h>
19#include <asm/traps.h>
20#include <asm/uaccess.h>
21
22extern void dump_tlb_addr(unsigned long addr);
23extern void dump_tlb_all(void);
24
25static void dump_hub_information(unsigned long errst0, unsigned long errst1)
26{
27 static char *err_type[2][8] = {
28 { NULL, "Uncached Partial Read PRERR", "DERR", "Read Timeout",
29 NULL, NULL, NULL, NULL },
30 { "WERR", "Uncached Partial Write", "PWERR", "Write Timeout",
31 NULL, NULL, NULL, NULL }
32 };
33 int wrb = errst1 & PI_ERR_ST1_WRBRRB_MASK;
34
35 if (!(errst0 & PI_ERR_ST0_VALID_MASK)) {
36 printk("Hub does not contain valid error information\n");
37 return;
38 }
39
40
41 printk("Hub has valid error information:\n");
42 if (errst0 & PI_ERR_ST0_OVERRUN_MASK)
43 printk("Overrun is set. Error stack may contain additional "
44 "information.\n");
45 printk("Hub error address is %08lx\n",
46 (errst0 & PI_ERR_ST0_ADDR_MASK) >> (PI_ERR_ST0_ADDR_SHFT - 3));
47 printk("Incoming message command 0x%lx\n",
48 (errst0 & PI_ERR_ST0_CMD_MASK) >> PI_ERR_ST0_CMD_SHFT);
49 printk("Supplemental field of incoming message is 0x%lx\n",
50 (errst0 & PI_ERR_ST0_SUPPL_MASK) >> PI_ERR_ST0_SUPPL_SHFT);
51 printk("T5 Rn (for RRB only) is 0x%lx\n",
52 (errst0 & PI_ERR_ST0_REQNUM_MASK) >> PI_ERR_ST0_REQNUM_SHFT);
53 printk("Error type is %s\n", err_type[wrb]
54 [(errst0 & PI_ERR_ST0_TYPE_MASK) >> PI_ERR_ST0_TYPE_SHFT]
55 ? : "invalid");
56}
57
58int ip27_be_handler(struct pt_regs *regs, int is_fixup)
59{
60 unsigned long errst0, errst1;
61 int data = regs->cp0_cause & 4;
62 int cpu = LOCAL_HUB_L(PI_CPU_NUM);
63
64 if (is_fixup)
65 return MIPS_BE_FIXUP;
66
67 printk("Slice %c got %cbe at 0x%lx\n", 'A' + cpu, data ? 'd' : 'i',
68 regs->cp0_epc);
69 printk("Hub information:\n");
70 printk("ERR_INT_PEND = 0x%06lx\n", LOCAL_HUB_L(PI_ERR_INT_PEND));
71 errst0 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS0_B : PI_ERR_STATUS0_A);
72 errst1 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS1_B : PI_ERR_STATUS1_A);
73 dump_hub_information(errst0, errst1);
74 show_regs(regs);
75 dump_tlb_all();
76 while(1);
77 force_sig(SIGBUS, current);
78}
79
80void __init ip27_be_init(void)
81{
82 /* XXX Initialize all the Hub & Bridge error handling here. */
83 int cpu = LOCAL_HUB_L(PI_CPU_NUM);
84 int cpuoff = cpu << 8;
85
86 board_be_handler = ip27_be_handler;
87
88 LOCAL_HUB_S(PI_ERR_INT_PEND,
89 cpu ? PI_ERR_CLEAR_ALL_B : PI_ERR_CLEAR_ALL_A);
90 LOCAL_HUB_S(PI_ERR_INT_MASK_A + cpuoff, 0);
91 LOCAL_HUB_S(PI_ERR_STACK_ADDR_A + cpuoff, 0);
92 LOCAL_HUB_S(PI_ERR_STACK_SIZE, 0); /* Disable error stack */
93 LOCAL_HUB_S(PI_SYSAD_ERRCHK_EN, PI_SYSAD_CHECK_ALL);
94}
diff --git a/arch/mips/sgi-ip27/ip27-console.c b/arch/mips/sgi-ip27/ip27-console.c
new file mode 100644
index 000000000000..d97f5b5ef844
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-console.c
@@ -0,0 +1,76 @@
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) 2001, 2002 Ralf Baechle
7 */
8#include <linux/init.h>
9#include <linux/console.h>
10#include <linux/kdev_t.h>
11#include <linux/major.h>
12#include <linux/termios.h>
13#include <linux/sched.h>
14#include <linux/tty.h>
15
16#include <asm/page.h>
17#include <asm/semaphore.h>
18#include <asm/sn/addrs.h>
19#include <asm/sn/sn0/hub.h>
20#include <asm/sn/klconfig.h>
21#include <asm/sn/ioc3.h>
22#include <asm/sn/sn_private.h>
23
24#include <linux/serial.h>
25#include <linux/serial_core.h>
26
27#define IOC3_CLK (22000000 / 3)
28#define IOC3_FLAGS (0)
29
30static inline struct ioc3_uartregs *console_uart(void)
31{
32 struct ioc3 *ioc3;
33
34 ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(get_nasid())->memory_base;
35
36 return &ioc3->sregs.uarta;
37}
38
39void prom_putchar(char c)
40{
41 struct ioc3_uartregs *uart = console_uart();
42
43 while ((uart->iu_lsr & 0x20) == 0);
44 uart->iu_thr = c;
45}
46
47char __init prom_getchar(void)
48{
49 return 0;
50}
51
52static void inline ioc3_console_probe(void)
53{
54 struct uart_port up;
55
56 /*
57 * Register to interrupt zero because we share the interrupt with
58 * the serial driver which we don't properly support yet.
59 */
60 memset(&up, 0, sizeof(up));
61 up.membase = (unsigned char *) console_uart();
62 up.irq = 0;
63 up.uartclk = IOC3_CLK;
64 up.regshift = 0;
65 up.iotype = UPIO_MEM;
66 up.flags = IOC3_FLAGS;
67 up.line = 0;
68
69 if (early_serial_setup(&up))
70 printk(KERN_ERR "Early serial init of port 0 failed\n");
71}
72
73__init void ip27_setup_console(void)
74{
75 ioc3_console_probe();
76}
diff --git a/arch/mips/sgi-ip27/ip27-dbgio.c b/arch/mips/sgi-ip27/ip27-dbgio.c
new file mode 100644
index 000000000000..08fd88b36f80
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-dbgio.c
@@ -0,0 +1,60 @@
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
8 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
10 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
13 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
16 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Copyright 2004 Ralf Baechle <ralf@linux-mips.org>
23 */
24#include <asm/sn/addrs.h>
25#include <asm/sn/sn0/hub.h>
26#include <asm/sn/klconfig.h>
27#include <asm/sn/ioc3.h>
28#include <asm/sn/sn_private.h>
29
30#include <linux/serial.h>
31#include <linux/serial_core.h>
32#include <linux/serial_reg.h>
33
34#define IOC3_CLK (22000000 / 3)
35#define IOC3_FLAGS (0)
36
37static inline struct ioc3_uartregs *console_uart(void)
38{
39 struct ioc3 *ioc3;
40
41 ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(get_nasid())->memory_base;
42
43 return &ioc3->sregs.uarta;
44}
45
46unsigned char getDebugChar(void)
47{
48 struct ioc3_uartregs *uart = console_uart();
49
50 while ((uart->iu_lsr & UART_LSR_DR) == 0);
51 return uart->iu_rbr;
52}
53
54void putDebugChar(unsigned char c)
55{
56 struct ioc3_uartregs *uart = console_uart();
57
58 while ((uart->iu_lsr & UART_LSR_THRE) == 0);
59 uart->iu_thr = c;
60}
diff --git a/arch/mips/sgi-ip27/ip27-hubio.c b/arch/mips/sgi-ip27/ip27-hubio.c
new file mode 100644
index 000000000000..524b371f9397
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-hubio.c
@@ -0,0 +1,186 @@
1/*
2 * Copyright (C) 1992-1997, 2000-2003 Silicon Graphics, Inc.
3 * Copyright (C) 2004 Christoph Hellwig.
4 * Released under GPL v2.
5 *
6 * Support functions for the HUB ASIC - mostly PIO mapping related.
7 */
8
9#include <linux/bitops.h>
10#include <linux/string.h>
11#include <linux/mmzone.h>
12#include <asm/sn/addrs.h>
13#include <asm/sn/arch.h>
14#include <asm/sn/hub.h>
15
16
17static int force_fire_and_forget = 1;
18
19/**
20 * hub_pio_map - establish a HUB PIO mapping
21 *
22 * @hub: hub to perform PIO mapping on
23 * @widget: widget ID to perform PIO mapping for
24 * @xtalk_addr: xtalk_address that needs to be mapped
25 * @size: size of the PIO mapping
26 *
27 **/
28unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget,
29 unsigned long xtalk_addr, size_t size)
30{
31 nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
32 volatile hubreg_t junk;
33 unsigned i;
34
35 /* use small-window mapping if possible */
36 if ((xtalk_addr % SWIN_SIZE) + size <= SWIN_SIZE)
37 return NODE_SWIN_BASE(nasid, widget) + (xtalk_addr % SWIN_SIZE);
38
39 if ((xtalk_addr % BWIN_SIZE) + size > BWIN_SIZE) {
40 printk(KERN_WARNING "PIO mapping at hub %d widget %d addr 0x%lx"
41 " too big (%ld)\n",
42 nasid, widget, xtalk_addr, size);
43 return 0;
44 }
45
46 xtalk_addr &= ~(BWIN_SIZE-1);
47 for (i = 0; i < HUB_NUM_BIG_WINDOW; i++) {
48 if (test_and_set_bit(i, hub_data(cnode)->h_bigwin_used))
49 continue;
50
51 /*
52 * The code below does a PIO write to setup an ITTE entry.
53 *
54 * We need to prevent other CPUs from seeing our updated
55 * memory shadow of the ITTE (in the piomap) until the ITTE
56 * entry is actually set up; otherwise, another CPU might
57 * attempt a PIO prematurely.
58 *
59 * Also, the only way we can know that an entry has been
60 * received by the hub and can be used by future PIO reads/
61 * writes is by reading back the ITTE entry after writing it.
62 *
63 * For these two reasons, we PIO read back the ITTE entry
64 * after we write it.
65 */
66 IIO_ITTE_PUT(nasid, i, HUB_PIO_MAP_TO_MEM, widget, xtalk_addr);
67 junk = HUB_L(IIO_ITTE_GET(nasid, i));
68
69 return NODE_BWIN_BASE(nasid, widget) + (xtalk_addr % BWIN_SIZE);
70 }
71
72 printk(KERN_WARNING "unable to establish PIO mapping for at"
73 " hub %d widget %d addr 0x%lx\n",
74 nasid, widget, xtalk_addr);
75 return 0;
76}
77
78
79/*
80 * hub_setup_prb(nasid, prbnum, credits, conveyor)
81 *
82 * Put a PRB into fire-and-forget mode if conveyor isn't set. Otherwise,
83 * put it into conveyor belt mode with the specified number of credits.
84 */
85static void hub_setup_prb(nasid_t nasid, int prbnum, int credits)
86{
87 iprb_t prb;
88 int prb_offset;
89
90 /*
91 * Get the current register value.
92 */
93 prb_offset = IIO_IOPRB(prbnum);
94 prb.iprb_regval = REMOTE_HUB_L(nasid, prb_offset);
95
96 /*
97 * Clear out some fields.
98 */
99 prb.iprb_ovflow = 1;
100 prb.iprb_bnakctr = 0;
101 prb.iprb_anakctr = 0;
102
103 /*
104 * Enable or disable fire-and-forget mode.
105 */
106 prb.iprb_ff = force_fire_and_forget ? 1 : 0;
107
108 /*
109 * Set the appropriate number of PIO cresits for the widget.
110 */
111 prb.iprb_xtalkctr = credits;
112
113 /*
114 * Store the new value to the register.
115 */
116 REMOTE_HUB_S(nasid, prb_offset, prb.iprb_regval);
117}
118
119/**
120 * hub_set_piomode - set pio mode for a given hub
121 *
122 * @nasid: physical node ID for the hub in question
123 *
124 * Put the hub into either "PIO conveyor belt" mode or "fire-and-forget" mode.
125 * To do this, we have to make absolutely sure that no PIOs are in progress
126 * so we turn off access to all widgets for the duration of the function.
127 *
128 * XXX - This code should really check what kind of widget we're talking
129 * to. Bridges can only handle three requests, but XG will do more.
130 * How many can crossbow handle to widget 0? We're assuming 1.
131 *
132 * XXX - There is a bug in the crossbow that link reset PIOs do not
133 * return write responses. The easiest solution to this problem is to
134 * leave widget 0 (xbow) in fire-and-forget mode at all times. This
135 * only affects pio's to xbow registers, which should be rare.
136 **/
137static void hub_set_piomode(nasid_t nasid)
138{
139 hubreg_t ii_iowa;
140 hubii_wcr_t ii_wcr;
141 unsigned i;
142
143 ii_iowa = REMOTE_HUB_L(nasid, IIO_OUTWIDGET_ACCESS);
144 REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, 0);
145
146 ii_wcr.wcr_reg_value = REMOTE_HUB_L(nasid, IIO_WCR);
147
148 if (ii_wcr.iwcr_dir_con) {
149 /*
150 * Assume a bridge here.
151 */
152 hub_setup_prb(nasid, 0, 3);
153 } else {
154 /*
155 * Assume a crossbow here.
156 */
157 hub_setup_prb(nasid, 0, 1);
158 }
159
160 /*
161 * XXX - Here's where we should take the widget type into
162 * when account assigning credits.
163 */
164 for (i = HUB_WIDGET_ID_MIN; i <= HUB_WIDGET_ID_MAX; i++)
165 hub_setup_prb(nasid, i, 3);
166
167 REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, ii_iowa);
168}
169
170/*
171 * hub_pio_init - PIO-related hub initalization
172 *
173 * @hub: hubinfo structure for our hub
174 */
175void hub_pio_init(cnodeid_t cnode)
176{
177 nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
178 unsigned i;
179
180 /* initialize big window piomaps for this hub */
181 bitmap_zero(hub_data(cnode)->h_bigwin_used, HUB_NUM_BIG_WINDOW);
182 for (i = 0; i < HUB_NUM_BIG_WINDOW; i++)
183 IIO_ITTE_DISABLE(nasid, i);
184
185 hub_set_piomode(nasid);
186}
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
new file mode 100644
index 000000000000..6dcee5c46c74
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -0,0 +1,252 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General
3 * Public License. See the file "COPYING" in the main directory of this
4 * archive for more details.
5 *
6 * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com)
7 * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc.
8 */
9#include <linux/config.h>
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/sched.h>
13#include <linux/mm.h>
14#include <linux/module.h>
15#include <linux/cpumask.h>
16#include <asm/cpu.h>
17#include <asm/io.h>
18#include <asm/pgtable.h>
19#include <asm/time.h>
20#include <asm/sn/types.h>
21#include <asm/sn/sn0/addrs.h>
22#include <asm/sn/sn0/hubni.h>
23#include <asm/sn/sn0/hubio.h>
24#include <asm/sn/klconfig.h>
25#include <asm/sn/ioc3.h>
26#include <asm/mipsregs.h>
27#include <asm/sn/gda.h>
28#include <asm/sn/hub.h>
29#include <asm/sn/intr.h>
30#include <asm/current.h>
31#include <asm/smp.h>
32#include <asm/processor.h>
33#include <asm/mmu_context.h>
34#include <asm/thread_info.h>
35#include <asm/sn/launch.h>
36#include <asm/sn/sn_private.h>
37#include <asm/sn/sn0/ip27.h>
38#include <asm/sn/mapped_kernel.h>
39
40#define CPU_NONE (cpuid_t)-1
41
42static DECLARE_BITMAP(hub_init_mask, MAX_COMPACT_NODES);
43nasid_t master_nasid = INVALID_NASID;
44
45cnodeid_t nasid_to_compact_node[MAX_NASIDS];
46nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
47cnodeid_t cpuid_to_compact_node[MAXCPUS];
48
49EXPORT_SYMBOL(nasid_to_compact_node);
50
51extern void pcibr_setup(cnodeid_t);
52
53extern void xtalk_probe_node(cnodeid_t nid);
54
55static void __init per_hub_init(cnodeid_t cnode)
56{
57 struct hub_data *hub = hub_data(cnode);
58 nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
59
60 cpu_set(smp_processor_id(), hub->h_cpus);
61
62 if (test_and_set_bit(cnode, hub_init_mask))
63 return;
64
65 /*
66 * Set CRB timeout at 5ms, (< PI timeout of 10ms)
67 */
68 REMOTE_HUB_S(nasid, IIO_ICTP, 0x800);
69 REMOTE_HUB_S(nasid, IIO_ICTO, 0xff);
70
71 hub_rtc_init(cnode);
72 xtalk_probe_node(cnode);
73
74#ifdef CONFIG_REPLICATE_EXHANDLERS
75 /*
76 * If this is not a headless node initialization,
77 * copy over the caliased exception handlers.
78 */
79 if (get_compact_nodeid() == cnode) {
80 extern char except_vec2_generic, except_vec3_generic;
81 extern void build_tlb_refill_handler(void);
82
83 memcpy((void *)(CKSEG0 + 0x100), &except_vec2_generic, 0x80);
84 memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x80);
85 build_tlb_refill_handler();
86 memcpy((void *)(CKSEG0 + 0x100), (void *) CKSEG0, 0x80);
87 memcpy((void *)(CKSEG0 + 0x180), &except_vec3_generic, 0x100);
88 __flush_cache_all();
89 }
90#endif
91}
92
93void __init per_cpu_init(void)
94{
95 int cpu = smp_processor_id();
96 int slice = LOCAL_HUB_L(PI_CPU_NUM);
97 cnodeid_t cnode = get_compact_nodeid();
98 struct hub_data *hub = hub_data(cnode);
99 struct slice_data *si = hub->slice + slice;
100 int i;
101
102 if (test_and_set_bit(slice, &hub->slice_map))
103 return;
104
105 clear_c0_status(ST0_IM);
106
107 for (i = 0; i < LEVELS_PER_SLICE; i++)
108 si->level_to_irq[i] = -1;
109
110 /*
111 * Some interrupts are reserved by hardware or by software convention.
112 * Mark these as reserved right away so they won't be used accidently
113 * later.
114 */
115 for (i = 0; i <= BASE_PCI_IRQ; i++) {
116 __set_bit(i, si->irq_alloc_mask);
117 LOCAL_HUB_S(PI_INT_PEND_MOD, i);
118 }
119
120 __set_bit(IP_PEND0_6_63, si->irq_alloc_mask);
121 LOCAL_HUB_S(PI_INT_PEND_MOD, IP_PEND0_6_63);
122
123 for (i = NI_BRDCAST_ERR_A; i <= MSC_PANIC_INTR; i++) {
124 __set_bit(i, si->irq_alloc_mask + 1);
125 LOCAL_HUB_S(PI_INT_PEND_MOD, i);
126 }
127
128 LOCAL_HUB_L(PI_INT_PEND0);
129
130 /*
131 * We use this so we can find the local hub's data as fast as only
132 * possible.
133 */
134 cpu_data[cpu].data = si;
135
136 cpu_time_init();
137 install_ipi();
138
139 /* Install our NMI handler if symmon hasn't installed one. */
140 install_cpu_nmi_handler(cputoslice(cpu));
141
142 set_c0_status(SRB_DEV0 | SRB_DEV1);
143
144 per_hub_init(cnode);
145}
146
147/*
148 * get_nasid() returns the physical node id number of the caller.
149 */
150nasid_t
151get_nasid(void)
152{
153 return (nasid_t)((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_NODEID_MASK)
154 >> NSRI_NODEID_SHFT);
155}
156
157/*
158 * Map the physical node id to a virtual node id (virtual node ids are contiguous).
159 */
160cnodeid_t get_compact_nodeid(void)
161{
162 return NASID_TO_COMPACT_NODEID(get_nasid());
163}
164
165/* Extracted from the IOC3 meta driver. FIXME. */
166static inline void ioc3_sio_init(void)
167{
168 struct ioc3 *ioc3;
169 nasid_t nid;
170 long loops;
171
172 nid = get_nasid();
173 ioc3 = (struct ioc3 *) KL_CONFIG_CH_CONS_INFO(nid)->memory_base;
174
175 ioc3->sscr_a = 0; /* PIO mode for uarta. */
176 ioc3->sscr_b = 0; /* PIO mode for uartb. */
177 ioc3->sio_iec = ~0;
178 ioc3->sio_ies = (SIO_IR_SA_INT | SIO_IR_SB_INT);
179
180 loops=1000000; while(loops--);
181 ioc3->sregs.uarta.iu_fcr = 0;
182 ioc3->sregs.uartb.iu_fcr = 0;
183 loops=1000000; while(loops--);
184}
185
186static inline void ioc3_eth_init(void)
187{
188 struct ioc3 *ioc3;
189 nasid_t nid;
190
191 nid = get_nasid();
192 ioc3 = (struct ioc3 *) KL_CONFIG_CH_CONS_INFO(nid)->memory_base;
193
194 ioc3->eier = 0;
195}
196
197extern void ip27_setup_console(void);
198extern void ip27_time_init(void);
199extern void ip27_reboot_setup(void);
200
201static int __init ip27_setup(void)
202{
203 hubreg_t p, e, n_mode;
204 nasid_t nid;
205
206 ip27_setup_console();
207 ip27_reboot_setup();
208
209 /*
210 * hub_rtc init and cpu clock intr enabled for later calibrate_delay.
211 */
212 nid = get_nasid();
213 printk("IP27: Running on node %d.\n", nid);
214
215 p = LOCAL_HUB_L(PI_CPU_PRESENT_A) & 1;
216 e = LOCAL_HUB_L(PI_CPU_ENABLE_A) & 1;
217 printk("Node %d has %s primary CPU%s.\n", nid,
218 p ? "a" : "no",
219 e ? ", CPU is running" : "");
220
221 p = LOCAL_HUB_L(PI_CPU_PRESENT_B) & 1;
222 e = LOCAL_HUB_L(PI_CPU_ENABLE_B) & 1;
223 printk("Node %d has %s secondary CPU%s.\n", nid,
224 p ? "a" : "no",
225 e ? ", CPU is running" : "");
226
227 /*
228 * Try to catch kernel missconfigurations and give user an
229 * indication what option to select.
230 */
231 n_mode = LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_MORENODES_MASK;
232 printk("Machine is in %c mode.\n", n_mode ? 'N' : 'M');
233#ifdef CONFIG_SGI_SN0_N_MODE
234 if (!n_mode)
235 panic("Kernel compiled for M mode.");
236#else
237 if (n_mode)
238 panic("Kernel compiled for N mode.");
239#endif
240
241 ioc3_sio_init();
242 ioc3_eth_init();
243 per_cpu_init();
244
245 set_io_port_base(IO_BASE);
246
247 board_time_init = ip27_time_init;
248
249 return 0;
250}
251
252early_initcall(ip27_setup);
diff --git a/arch/mips/sgi-ip27/ip27-irq-glue.S b/arch/mips/sgi-ip27/ip27-irq-glue.S
new file mode 100644
index 000000000000..c304df715e0a
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-irq-glue.S
@@ -0,0 +1,45 @@
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) 1999 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#include <asm/asm.h>
10#include <asm/mipsregs.h>
11#include <asm/regdef.h>
12#include <asm/stackframe.h>
13
14 .text
15 .align 5
16NESTED(ip27_irq, PT_SIZE, sp)
17 SAVE_ALL
18 CLI
19
20 mfc0 s0, CP0_CAUSE
21 mfc0 t0, CP0_STATUS
22 and s0, t0
23 move a0, sp
24 PTR_LA ra, ret_from_irq
25
26 /* First check for RT interrupt. */
27 andi t0, s0, CAUSEF_IP4
28 bnez t0, ip4
29 andi t0, s0, CAUSEF_IP2
30 bnez t0, ip2
31 andi t0, s0, CAUSEF_IP3
32 bnez t0, ip3
33 andi t0, s0, CAUSEF_IP5
34 bnez t0, ip5
35 andi t0, s0, CAUSEF_IP6
36 bnez t0, ip6
37 j ra
38
39ip2: j ip27_do_irq_mask0 # PI_INT_PEND_0 or CC_PEND_{A|B}
40ip3: j ip27_do_irq_mask1 # PI_INT_PEND_1
41ip4: j ip27_rt_timer_interrupt
42ip5: j ip27_prof_timer
43ip6: j ip27_hub_error
44
45 END(ip27_irq)
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
new file mode 100644
index 000000000000..61817a18aed2
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -0,0 +1,457 @@
1/*
2 * ip27-irq.c: Highlevel interrupt handling for IP27 architecture.
3 *
4 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
5 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
6 * Copyright (C) 1999 - 2001 Kanoj Sarcar
7 */
8#include <linux/config.h>
9#include <linux/init.h>
10#include <linux/irq.h>
11#include <linux/errno.h>
12#include <linux/signal.h>
13#include <linux/sched.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/ioport.h>
17#include <linux/irq.h>
18#include <linux/timex.h>
19#include <linux/slab.h>
20#include <linux/random.h>
21#include <linux/smp_lock.h>
22#include <linux/kernel_stat.h>
23#include <linux/delay.h>
24#include <linux/bitops.h>
25
26#include <asm/bootinfo.h>
27#include <asm/io.h>
28#include <asm/mipsregs.h>
29#include <asm/system.h>
30
31#include <asm/ptrace.h>
32#include <asm/processor.h>
33#include <asm/pci/bridge.h>
34#include <asm/sn/addrs.h>
35#include <asm/sn/agent.h>
36#include <asm/sn/arch.h>
37#include <asm/sn/hub.h>
38#include <asm/sn/intr.h>
39
40#undef DEBUG_IRQ
41#ifdef DEBUG_IRQ
42#define DBG(x...) printk(x)
43#else
44#define DBG(x...)
45#endif
46
47/*
48 * Linux has a controller-independent x86 interrupt architecture.
49 * every controller has a 'controller-template', that is used
50 * by the main code to do the right thing. Each driver-visible
51 * interrupt source is transparently wired to the apropriate
52 * controller. Thus drivers need not be aware of the
53 * interrupt-controller.
54 *
55 * Various interrupt controllers we handle: 8259 PIC, SMP IO-APIC,
56 * PIIX4's internal 8259 PIC and SGI's Visual Workstation Cobalt (IO-)APIC.
57 * (IO-APICs assumed to be messaging to Pentium local-APICs)
58 *
59 * the code is designed to be easily extended with new/different
60 * interrupt controllers, without having to do assembly magic.
61 */
62
63extern asmlinkage void ip27_irq(void);
64
65extern struct bridge_controller *irq_to_bridge[];
66extern int irq_to_slot[];
67
68/*
69 * use these macros to get the encoded nasid and widget id
70 * from the irq value
71 */
72#define IRQ_TO_BRIDGE(i) irq_to_bridge[(i)]
73#define SLOT_FROM_PCI_IRQ(i) irq_to_slot[i]
74
75static inline int alloc_level(int cpu, int irq)
76{
77 struct slice_data *si = cpu_data[cpu].data;
78 int level; /* pre-allocated entries */
79
80 level = find_first_zero_bit(si->irq_alloc_mask, LEVELS_PER_SLICE);
81 if (level >= LEVELS_PER_SLICE)
82 panic("Cpu %d flooded with devices\n", cpu);
83
84 __set_bit(level, si->irq_alloc_mask);
85 si->level_to_irq[level] = irq;
86
87 return level;
88}
89
90static inline int find_level(cpuid_t *cpunum, int irq)
91{
92 int cpu, i;
93
94 for (cpu = 0; cpu <= NR_CPUS; cpu++) {
95 struct slice_data *si = cpu_data[cpu].data;
96
97 if (!cpu_online(cpu))
98 continue;
99
100 for (i = BASE_PCI_IRQ; i < LEVELS_PER_SLICE; i++)
101 if (si->level_to_irq[i] == irq) {
102 *cpunum = cpu;
103
104 return i;
105 }
106 }
107
108 panic("Could not identify cpu/level for irq %d\n", irq);
109}
110
111/*
112 * Find first bit set
113 */
114static int ms1bit(unsigned long x)
115{
116 int b = 0, s;
117
118 s = 16; if (x >> 16 == 0) s = 0; b += s; x >>= s;
119 s = 8; if (x >> 8 == 0) s = 0; b += s; x >>= s;
120 s = 4; if (x >> 4 == 0) s = 0; b += s; x >>= s;
121 s = 2; if (x >> 2 == 0) s = 0; b += s; x >>= s;
122 s = 1; if (x >> 1 == 0) s = 0; b += s;
123
124 return b;
125}
126
127/*
128 * This code is unnecessarily complex, because we do SA_INTERRUPT
129 * intr enabling. Basically, once we grab the set of intrs we need
130 * to service, we must mask _all_ these interrupts; firstly, to make
131 * sure the same intr does not intr again, causing recursion that
132 * can lead to stack overflow. Secondly, we can not just mask the
133 * one intr we are do_IRQing, because the non-masked intrs in the
134 * first set might intr again, causing multiple servicings of the
135 * same intr. This effect is mostly seen for intercpu intrs.
136 * Kanoj 05.13.00
137 */
138
139void ip27_do_irq_mask0(struct pt_regs *regs)
140{
141 int irq, swlevel;
142 hubreg_t pend0, mask0;
143 cpuid_t cpu = smp_processor_id();
144 int pi_int_mask0 =
145 (cputoslice(cpu) == 0) ? PI_INT_MASK0_A : PI_INT_MASK0_B;
146
147 /* copied from Irix intpend0() */
148 pend0 = LOCAL_HUB_L(PI_INT_PEND0);
149 mask0 = LOCAL_HUB_L(pi_int_mask0);
150
151 pend0 &= mask0; /* Pick intrs we should look at */
152 if (!pend0)
153 return;
154
155 swlevel = ms1bit(pend0);
156#ifdef CONFIG_SMP
157 if (pend0 & (1UL << CPU_RESCHED_A_IRQ)) {
158 LOCAL_HUB_CLR_INTR(CPU_RESCHED_A_IRQ);
159 } else if (pend0 & (1UL << CPU_RESCHED_B_IRQ)) {
160 LOCAL_HUB_CLR_INTR(CPU_RESCHED_B_IRQ);
161 } else if (pend0 & (1UL << CPU_CALL_A_IRQ)) {
162 LOCAL_HUB_CLR_INTR(CPU_CALL_A_IRQ);
163 smp_call_function_interrupt();
164 } else if (pend0 & (1UL << CPU_CALL_B_IRQ)) {
165 LOCAL_HUB_CLR_INTR(CPU_CALL_B_IRQ);
166 smp_call_function_interrupt();
167 } else
168#endif
169 {
170 /* "map" swlevel to irq */
171 struct slice_data *si = cpu_data[cpu].data;
172
173 irq = si->level_to_irq[swlevel];
174 do_IRQ(irq, regs);
175 }
176
177 LOCAL_HUB_L(PI_INT_PEND0);
178}
179
180void ip27_do_irq_mask1(struct pt_regs *regs)
181{
182 int irq, swlevel;
183 hubreg_t pend1, mask1;
184 cpuid_t cpu = smp_processor_id();
185 int pi_int_mask1 = (cputoslice(cpu) == 0) ? PI_INT_MASK1_A : PI_INT_MASK1_B;
186 struct slice_data *si = cpu_data[cpu].data;
187
188 /* copied from Irix intpend0() */
189 pend1 = LOCAL_HUB_L(PI_INT_PEND1);
190 mask1 = LOCAL_HUB_L(pi_int_mask1);
191
192 pend1 &= mask1; /* Pick intrs we should look at */
193 if (!pend1)
194 return;
195
196 swlevel = ms1bit(pend1);
197 /* "map" swlevel to irq */
198 irq = si->level_to_irq[swlevel];
199 LOCAL_HUB_CLR_INTR(swlevel);
200 do_IRQ(irq, regs);
201
202 LOCAL_HUB_L(PI_INT_PEND1);
203}
204
205void ip27_prof_timer(struct pt_regs *regs)
206{
207 panic("CPU %d got a profiling interrupt", smp_processor_id());
208}
209
210void ip27_hub_error(struct pt_regs *regs)
211{
212 panic("CPU %d got a hub error interrupt", smp_processor_id());
213}
214
215static int intr_connect_level(int cpu, int bit)
216{
217 nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
218 struct slice_data *si = cpu_data[cpu].data;
219
220 __set_bit(bit, si->irq_enable_mask);
221
222 if (!cputoslice(cpu)) {
223 REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
224 REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
225 } else {
226 REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
227 REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
228 }
229
230 return 0;
231}
232
233static int intr_disconnect_level(int cpu, int bit)
234{
235 nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
236 struct slice_data *si = cpu_data[cpu].data;
237
238 __clear_bit(bit, si->irq_enable_mask);
239
240 if (!cputoslice(cpu)) {
241 REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
242 REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
243 } else {
244 REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
245 REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
246 }
247
248 return 0;
249}
250
251/* Startup one of the (PCI ...) IRQs routes over a bridge. */
252static unsigned int startup_bridge_irq(unsigned int irq)
253{
254 struct bridge_controller *bc;
255 bridgereg_t device;
256 bridge_t *bridge;
257 int pin, swlevel;
258 cpuid_t cpu;
259
260 pin = SLOT_FROM_PCI_IRQ(irq);
261 bc = IRQ_TO_BRIDGE(irq);
262 bridge = bc->base;
263
264 DBG("bridge_startup(): irq= 0x%x pin=%d\n", irq, pin);
265 /*
266 * "map" irq to a swlevel greater than 6 since the first 6 bits
267 * of INT_PEND0 are taken
268 */
269 swlevel = find_level(&cpu, irq);
270 bridge->b_int_addr[pin].addr = (0x20000 | swlevel | (bc->nasid << 8));
271 bridge->b_int_enable |= (1 << pin);
272 bridge->b_int_enable |= 0x7ffffe00; /* more stuff in int_enable */
273
274 /*
275 * Enable sending of an interrupt clear packt to the hub on a high to
276 * low transition of the interrupt pin.
277 *
278 * IRIX sets additional bits in the address which are documented as
279 * reserved in the bridge docs.
280 */
281 bridge->b_int_mode |= (1UL << pin);
282
283 /*
284 * We assume the bridge to have a 1:1 mapping between devices
285 * (slots) and intr pins.
286 */
287 device = bridge->b_int_device;
288 device &= ~(7 << (pin*3));
289 device |= (pin << (pin*3));
290 bridge->b_int_device = device;
291
292 bridge->b_wid_tflush;
293
294 return 0; /* Never anything pending. */
295}
296
297/* Shutdown one of the (PCI ...) IRQs routes over a bridge. */
298static void shutdown_bridge_irq(unsigned int irq)
299{
300 struct bridge_controller *bc = IRQ_TO_BRIDGE(irq);
301 bridge_t *bridge = bc->base;
302 struct slice_data *si = cpu_data[bc->irq_cpu].data;
303 int pin, swlevel;
304 cpuid_t cpu;
305
306 DBG("bridge_shutdown: irq 0x%x\n", irq);
307 pin = SLOT_FROM_PCI_IRQ(irq);
308
309 /*
310 * map irq to a swlevel greater than 6 since the first 6 bits
311 * of INT_PEND0 are taken
312 */
313 swlevel = find_level(&cpu, irq);
314 intr_disconnect_level(cpu, swlevel);
315
316 __clear_bit(swlevel, si->irq_alloc_mask);
317 si->level_to_irq[swlevel] = -1;
318
319 bridge->b_int_enable &= ~(1 << pin);
320 bridge->b_wid_tflush;
321}
322
323static inline void enable_bridge_irq(unsigned int irq)
324{
325 cpuid_t cpu;
326 int swlevel;
327
328 swlevel = find_level(&cpu, irq); /* Criminal offence */
329 intr_connect_level(cpu, swlevel);
330}
331
332static inline void disable_bridge_irq(unsigned int irq)
333{
334 cpuid_t cpu;
335 int swlevel;
336
337 swlevel = find_level(&cpu, irq); /* Criminal offence */
338 intr_disconnect_level(cpu, swlevel);
339}
340
341static void mask_and_ack_bridge_irq(unsigned int irq)
342{
343 disable_bridge_irq(irq);
344}
345
346static void end_bridge_irq(unsigned int irq)
347{
348 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)) &&
349 irq_desc[irq].action)
350 enable_bridge_irq(irq);
351}
352
353static struct hw_interrupt_type bridge_irq_type = {
354 .typename = "bridge",
355 .startup = startup_bridge_irq,
356 .shutdown = shutdown_bridge_irq,
357 .enable = enable_bridge_irq,
358 .disable = disable_bridge_irq,
359 .ack = mask_and_ack_bridge_irq,
360 .end = end_bridge_irq,
361};
362
363static unsigned long irq_map[NR_IRQS / BITS_PER_LONG];
364
365static int allocate_irqno(void)
366{
367 int irq;
368
369again:
370 irq = find_first_zero_bit(irq_map, NR_IRQS);
371
372 if (irq >= NR_IRQS)
373 return -ENOSPC;
374
375 if (test_and_set_bit(irq, irq_map))
376 goto again;
377
378 return irq;
379}
380
381void free_irqno(unsigned int irq)
382{
383 clear_bit(irq, irq_map);
384}
385
386void __devinit register_bridge_irq(unsigned int irq)
387{
388 irq_desc[irq].status = IRQ_DISABLED;
389 irq_desc[irq].action = 0;
390 irq_desc[irq].depth = 1;
391 irq_desc[irq].handler = &bridge_irq_type;
392}
393
394int __devinit request_bridge_irq(struct bridge_controller *bc)
395{
396 int irq = allocate_irqno();
397 int swlevel, cpu;
398 nasid_t nasid;
399
400 if (irq < 0)
401 return irq;
402
403 /*
404 * "map" irq to a swlevel greater than 6 since the first 6 bits
405 * of INT_PEND0 are taken
406 */
407 cpu = bc->irq_cpu;
408 swlevel = alloc_level(cpu, irq);
409 if (unlikely(swlevel < 0)) {
410 free_irqno(irq);
411
412 return -EAGAIN;
413 }
414
415 /* Make sure it's not already pending when we connect it. */
416 nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
417 REMOTE_HUB_CLR_INTR(nasid, swlevel);
418
419 intr_connect_level(cpu, swlevel);
420
421 register_bridge_irq(irq);
422
423 return irq;
424}
425
426void __init arch_init_irq(void)
427{
428 set_except_vector(0, ip27_irq);
429}
430
431void install_ipi(void)
432{
433 int slice = LOCAL_HUB_L(PI_CPU_NUM);
434 int cpu = smp_processor_id();
435 struct slice_data *si = cpu_data[cpu].data;
436 hubreg_t mask, set;
437
438 if (slice == 0) {
439 LOCAL_HUB_CLR_INTR(CPU_RESCHED_A_IRQ);
440 LOCAL_HUB_CLR_INTR(CPU_CALL_A_IRQ);
441 mask = LOCAL_HUB_L(PI_INT_MASK0_A); /* Slice A */
442 set = (1UL << CPU_RESCHED_A_IRQ) | (1UL << CPU_CALL_A_IRQ);
443 mask |= set;
444 si->irq_enable_mask[0] |= set;
445 si->irq_alloc_mask[0] |= set;
446 LOCAL_HUB_S(PI_INT_MASK0_A, mask);
447 } else {
448 LOCAL_HUB_CLR_INTR(CPU_RESCHED_B_IRQ);
449 LOCAL_HUB_CLR_INTR(CPU_CALL_B_IRQ);
450 mask = LOCAL_HUB_L(PI_INT_MASK0_B); /* Slice B */
451 set = (1UL << CPU_RESCHED_B_IRQ) | (1UL << CPU_CALL_B_IRQ);
452 mask |= set;
453 si->irq_enable_mask[1] |= set;
454 si->irq_alloc_mask[1] |= set;
455 LOCAL_HUB_S(PI_INT_MASK0_B, mask);
456 }
457}
diff --git a/arch/mips/sgi-ip27/ip27-klconfig.c b/arch/mips/sgi-ip27/ip27-klconfig.c
new file mode 100644
index 000000000000..dd830b3670d1
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-klconfig.c
@@ -0,0 +1,135 @@
1/*
2 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
3 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
4 */
5#include <linux/init.h>
6#include <linux/kernel.h>
7#include <linux/sched.h>
8#include <linux/interrupt.h>
9#include <linux/kernel_stat.h>
10#include <linux/param.h>
11#include <linux/timex.h>
12#include <linux/mm.h>
13
14#include <asm/sn/klconfig.h>
15#include <asm/sn/arch.h>
16#include <asm/sn/gda.h>
17
18klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char struct_type)
19{
20 int index, j;
21
22 if (kli == (klinfo_t *)NULL) {
23 index = 0;
24 } else {
25 for (j = 0; j < KLCF_NUM_COMPS(brd); j++)
26 if (kli == KLCF_COMP(brd, j))
27 break;
28 index = j;
29 if (index == KLCF_NUM_COMPS(brd)) {
30 printk("find_component: Bad pointer: 0x%p\n", kli);
31 return (klinfo_t *)NULL;
32 }
33 index++; /* next component */
34 }
35
36 for (; index < KLCF_NUM_COMPS(brd); index++) {
37 kli = KLCF_COMP(brd, index);
38 if (KLCF_COMP_TYPE(kli) == struct_type)
39 return kli;
40 }
41
42 /* Didn't find it. */
43 return (klinfo_t *)NULL;
44}
45
46klinfo_t *find_first_component(lboard_t *brd, unsigned char struct_type)
47{
48 return find_component(brd, (klinfo_t *)NULL, struct_type);
49}
50
51lboard_t * find_lboard(lboard_t *start, unsigned char brd_type)
52{
53 /* Search all boards stored on this node. */
54 while (start) {
55 if (start->brd_type == brd_type)
56 return start;
57 start = KLCF_NEXT(start);
58 }
59 /* Didn't find it. */
60 return (lboard_t *)NULL;
61}
62
63lboard_t * find_lboard_class(lboard_t *start, unsigned char brd_type)
64{
65 /* Search all boards stored on this node. */
66 while (start) {
67 if (KLCLASS(start->brd_type) == KLCLASS(brd_type))
68 return start;
69 start = KLCF_NEXT(start);
70 }
71
72 /* Didn't find it. */
73 return (lboard_t *)NULL;
74}
75
76cnodeid_t get_cpu_cnode(cpuid_t cpu)
77{
78 return CPUID_TO_COMPACT_NODEID(cpu);
79}
80
81klcpu_t * nasid_slice_to_cpuinfo(nasid_t nasid, int slice)
82{
83 lboard_t *brd;
84 klcpu_t *acpu;
85
86 if (!(brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27)))
87 return (klcpu_t *)NULL;
88
89 if (!(acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU)))
90 return (klcpu_t *)NULL;
91
92 do {
93 if ((acpu->cpu_info.physid) == slice)
94 return acpu;
95 } while ((acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu,
96 KLSTRUCT_CPU)));
97 return (klcpu_t *)NULL;
98}
99
100klcpu_t * sn_get_cpuinfo(cpuid_t cpu)
101{
102 nasid_t nasid;
103 int slice;
104 klcpu_t *acpu;
105 gda_t *gdap = GDA;
106 cnodeid_t cnode;
107
108 if (!(cpu < MAXCPUS)) {
109 printk("sn_get_cpuinfo: illegal cpuid 0x%lx\n", cpu);
110 return NULL;
111 }
112
113 cnode = get_cpu_cnode(cpu);
114 if (cnode == INVALID_CNODEID)
115 return NULL;
116
117 if ((nasid = gdap->g_nasidtable[cnode]) == INVALID_NASID)
118 return NULL;
119
120 for (slice = 0; slice < CPUS_PER_NODE; slice++) {
121 acpu = nasid_slice_to_cpuinfo(nasid, slice);
122 if (acpu && acpu->cpu_info.virtid == cpu)
123 return acpu;
124 }
125 return NULL;
126}
127
128int get_cpu_slice(cpuid_t cpu)
129{
130 klcpu_t *acpu;
131
132 if ((acpu = sn_get_cpuinfo(cpu)) == NULL)
133 return -1;
134 return acpu->cpu_info.physid;
135}
diff --git a/arch/mips/sgi-ip27/ip27-klnuma.c b/arch/mips/sgi-ip27/ip27-klnuma.c
new file mode 100644
index 000000000000..41c3f405e00c
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-klnuma.c
@@ -0,0 +1,135 @@
1/*
2 * Ported from IRIX to Linux by Kanoj Sarcar, 06/08/00.
3 * Copyright 2000 - 2001 Silicon Graphics, Inc.
4 * Copyright 2000 - 2001 Kanoj Sarcar (kanoj@sgi.com)
5 */
6#include <linux/config.h>
7#include <linux/init.h>
8#include <linux/mmzone.h>
9#include <linux/kernel.h>
10#include <linux/nodemask.h>
11#include <linux/string.h>
12
13#include <asm/page.h>
14#include <asm/sections.h>
15#include <asm/smp.h>
16#include <asm/sn/types.h>
17#include <asm/sn/arch.h>
18#include <asm/sn/gda.h>
19#include <asm/sn/hub.h>
20#include <asm/sn/mapped_kernel.h>
21#include <asm/sn/sn_private.h>
22
23static cpumask_t ktext_repmask;
24
25/*
26 * XXX - This needs to be much smarter about where it puts copies of the
27 * kernel. For example, we should never put a copy on a headless node,
28 * and we should respect the topology of the machine.
29 */
30void __init setup_replication_mask()
31{
32 cnodeid_t cnode;
33
34 /* Set only the master cnode's bit. The master cnode is always 0. */
35 cpus_clear(ktext_repmask);
36 cpu_set(0, ktext_repmask);
37
38#ifdef CONFIG_REPLICATE_KTEXT
39#ifndef CONFIG_MAPPED_KERNEL
40#error Kernel replication works with mapped kernel support. No calias support.
41#endif
42 for_each_online_node(cnode) {
43 if (cnode == 0)
44 continue;
45 /* Advertise that we have a copy of the kernel */
46 cpu_set(cnode, ktext_repmask);
47 }
48#endif
49 /* Set up a GDA pointer to the replication mask. */
50 GDA->g_ktext_repmask = &ktext_repmask;
51}
52
53
54static __init void set_ktext_source(nasid_t client_nasid, nasid_t server_nasid)
55{
56 cnodeid_t client_cnode;
57 kern_vars_t *kvp;
58
59 client_cnode = NASID_TO_COMPACT_NODEID(client_nasid);
60
61 kvp = &hub_data(client_nasid)->kern_vars;
62
63 KERN_VARS_ADDR(client_nasid) = (unsigned long)kvp;
64
65 kvp->kv_magic = KV_MAGIC;
66 kvp->kv_ro_nasid = server_nasid;
67 kvp->kv_rw_nasid = master_nasid;
68 kvp->kv_ro_baseaddr = NODE_CAC_BASE(server_nasid);
69 kvp->kv_rw_baseaddr = NODE_CAC_BASE(master_nasid);
70 printk("REPLICATION: ON nasid %d, ktext from nasid %d, kdata from nasid %d\n", client_nasid, server_nasid, master_nasid);
71}
72
73/* XXX - When the BTE works, we should use it instead of this. */
74static __init void copy_kernel(nasid_t dest_nasid)
75{
76 unsigned long dest_kern_start, source_start, source_end, kern_size;
77
78 source_start = (unsigned long) _stext;
79 source_end = (unsigned long) _etext;
80 kern_size = source_end - source_start;
81
82 dest_kern_start = CHANGE_ADDR_NASID(MAPPED_KERN_RO_TO_K0(source_start),
83 dest_nasid);
84 memcpy((void *)dest_kern_start, (void *)source_start, kern_size);
85}
86
87void __init replicate_kernel_text()
88{
89 cnodeid_t cnode;
90 nasid_t client_nasid;
91 nasid_t server_nasid;
92
93 server_nasid = master_nasid;
94
95 /* Record where the master node should get its kernel text */
96 set_ktext_source(master_nasid, master_nasid);
97
98 for_each_online_node(cnode) {
99 if (cnode == 0)
100 continue;
101 client_nasid = COMPACT_TO_NASID_NODEID(cnode);
102
103 /* Check if this node should get a copy of the kernel */
104 if (cpu_isset(cnode, ktext_repmask)) {
105 server_nasid = client_nasid;
106 copy_kernel(server_nasid);
107 }
108
109 /* Record where this node should get its kernel text */
110 set_ktext_source(client_nasid, server_nasid);
111 }
112}
113
114/*
115 * Return pfn of first free page of memory on a node. PROM may allocate
116 * data structures on the first couple of pages of the first slot of each
117 * node. If this is the case, getfirstfree(node) > getslotstart(node, 0).
118 */
119pfn_t node_getfirstfree(cnodeid_t cnode)
120{
121 unsigned long loadbase = REP_BASE;
122 nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
123 unsigned long offset;
124
125#ifdef CONFIG_MAPPED_KERNEL
126 loadbase += 16777216;
127#endif
128 offset = PAGE_ALIGN((unsigned long)(&_end)) - loadbase;
129 if ((cnode == 0) || (cpu_isset(cnode, ktext_repmask)))
130 return (TO_NODE(nasid, offset) >> PAGE_SHIFT);
131 else
132 return (KDM_TO_PHYS(PAGE_ALIGN(SYMMON_STK_ADDR(nasid, 0))) >>
133 PAGE_SHIFT);
134}
135
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
new file mode 100644
index 000000000000..0a44a98d7adc
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -0,0 +1,586 @@
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) 2000, 05 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2000 by Silicon Graphics, Inc.
8 * Copyright (C) 2004 by Christoph Hellwig
9 *
10 * On SGI IP27 the ARC memory configuration data is completly bogus but
11 * alternate easier to use mechanisms are available.
12 */
13#include <linux/config.h>
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/mm.h>
17#include <linux/mmzone.h>
18#include <linux/module.h>
19#include <linux/nodemask.h>
20#include <linux/swap.h>
21#include <linux/bootmem.h>
22#include <asm/page.h>
23#include <asm/sections.h>
24
25#include <asm/sn/arch.h>
26#include <asm/sn/hub.h>
27#include <asm/sn/klconfig.h>
28#include <asm/sn/sn_private.h>
29
30
31#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
32
33#define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT)
34#define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT)
35
36#define SLOT_IGNORED 0xffff
37
38static short __initdata slot_lastfilled_cache[MAX_COMPACT_NODES];
39static unsigned short __initdata slot_psize_cache[MAX_COMPACT_NODES][MAX_MEM_SLOTS];
40static struct bootmem_data __initdata plat_node_bdata[MAX_COMPACT_NODES];
41
42struct node_data *__node_data[MAX_COMPACT_NODES];
43
44EXPORT_SYMBOL(__node_data);
45
46static int fine_mode;
47
48static int is_fine_dirmode(void)
49{
50 return (((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK)
51 >> NSRI_REGIONSIZE_SHFT) & REGIONSIZE_FINE);
52}
53
54static hubreg_t get_region(cnodeid_t cnode)
55{
56 if (fine_mode)
57 return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_FINEREG_SHFT;
58 else
59 return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_COARSEREG_SHFT;
60}
61
62static hubreg_t region_mask;
63
64static void gen_region_mask(hubreg_t *region_mask)
65{
66 cnodeid_t cnode;
67
68 (*region_mask) = 0;
69 for_each_online_node(cnode) {
70 (*region_mask) |= 1ULL << get_region(cnode);
71 }
72}
73
74#define rou_rflag rou_flags
75
76static int router_distance;
77
78static void router_recurse(klrou_t *router_a, klrou_t *router_b, int depth)
79{
80 klrou_t *router;
81 lboard_t *brd;
82 int port;
83
84 if (router_a->rou_rflag == 1)
85 return;
86
87 if (depth >= router_distance)
88 return;
89
90 router_a->rou_rflag = 1;
91
92 for (port = 1; port <= MAX_ROUTER_PORTS; port++) {
93 if (router_a->rou_port[port].port_nasid == INVALID_NASID)
94 continue;
95
96 brd = (lboard_t *)NODE_OFFSET_TO_K0(
97 router_a->rou_port[port].port_nasid,
98 router_a->rou_port[port].port_offset);
99
100 if (brd->brd_type == KLTYPE_ROUTER) {
101 router = (klrou_t *)NODE_OFFSET_TO_K0(NASID_GET(brd), brd->brd_compts[0]);
102 if (router == router_b) {
103 if (depth < router_distance)
104 router_distance = depth;
105 }
106 else
107 router_recurse(router, router_b, depth + 1);
108 }
109 }
110
111 router_a->rou_rflag = 0;
112}
113
114unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
115
116static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b)
117{
118 klrou_t *router, *router_a = NULL, *router_b = NULL;
119 lboard_t *brd, *dest_brd;
120 cnodeid_t cnode;
121 nasid_t nasid;
122 int port;
123
124 /* Figure out which routers nodes in question are connected to */
125 for_each_online_node(cnode) {
126 nasid = COMPACT_TO_NASID_NODEID(cnode);
127
128 if (nasid == -1) continue;
129
130 brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid),
131 KLTYPE_ROUTER);
132
133 if (!brd)
134 continue;
135
136 do {
137 if (brd->brd_flags & DUPLICATE_BOARD)
138 continue;
139
140 router = (klrou_t *)NODE_OFFSET_TO_K0(NASID_GET(brd), brd->brd_compts[0]);
141 router->rou_rflag = 0;
142
143 for (port = 1; port <= MAX_ROUTER_PORTS; port++) {
144 if (router->rou_port[port].port_nasid == INVALID_NASID)
145 continue;
146
147 dest_brd = (lboard_t *)NODE_OFFSET_TO_K0(
148 router->rou_port[port].port_nasid,
149 router->rou_port[port].port_offset);
150
151 if (dest_brd->brd_type == KLTYPE_IP27) {
152 if (dest_brd->brd_nasid == nasid_a)
153 router_a = router;
154 if (dest_brd->brd_nasid == nasid_b)
155 router_b = router;
156 }
157 }
158
159 } while ((brd = find_lboard_class(KLCF_NEXT(brd), KLTYPE_ROUTER)));
160 }
161
162 if (router_a == NULL) {
163 printk("node_distance: router_a NULL\n");
164 return -1;
165 }
166 if (router_b == NULL) {
167 printk("node_distance: router_b NULL\n");
168 return -1;
169 }
170
171 if (nasid_a == nasid_b)
172 return 0;
173
174 if (router_a == router_b)
175 return 1;
176
177 router_distance = 100;
178 router_recurse(router_a, router_b, 2);
179
180 return router_distance;
181}
182
183static void __init init_topology_matrix(void)
184{
185 nasid_t nasid, nasid2;
186 cnodeid_t row, col;
187
188 for (row = 0; row < MAX_COMPACT_NODES; row++)
189 for (col = 0; col < MAX_COMPACT_NODES; col++)
190 __node_distances[row][col] = -1;
191
192 for_each_online_node(row) {
193 nasid = COMPACT_TO_NASID_NODEID(row);
194 for_each_online_node(col) {
195 nasid2 = COMPACT_TO_NASID_NODEID(col);
196 __node_distances[row][col] =
197 compute_node_distance(nasid, nasid2);
198 }
199 }
200}
201
202static void __init dump_topology(void)
203{
204 nasid_t nasid;
205 cnodeid_t cnode;
206 lboard_t *brd, *dest_brd;
207 int port;
208 int router_num = 0;
209 klrou_t *router;
210 cnodeid_t row, col;
211
212 printk("************** Topology ********************\n");
213
214 printk(" ");
215 for_each_online_node(col)
216 printk("%02d ", col);
217 printk("\n");
218 for_each_online_node(row) {
219 printk("%02d ", row);
220 for_each_online_node(col)
221 printk("%2d ", node_distance(row, col));
222 printk("\n");
223 }
224
225 for_each_online_node(cnode) {
226 nasid = COMPACT_TO_NASID_NODEID(cnode);
227
228 if (nasid == -1) continue;
229
230 brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid),
231 KLTYPE_ROUTER);
232
233 if (!brd)
234 continue;
235
236 do {
237 if (brd->brd_flags & DUPLICATE_BOARD)
238 continue;
239 printk("Router %d:", router_num);
240 router_num++;
241
242 router = (klrou_t *)NODE_OFFSET_TO_K0(NASID_GET(brd), brd->brd_compts[0]);
243
244 for (port = 1; port <= MAX_ROUTER_PORTS; port++) {
245 if (router->rou_port[port].port_nasid == INVALID_NASID)
246 continue;
247
248 dest_brd = (lboard_t *)NODE_OFFSET_TO_K0(
249 router->rou_port[port].port_nasid,
250 router->rou_port[port].port_offset);
251
252 if (dest_brd->brd_type == KLTYPE_IP27)
253 printk(" %d", dest_brd->brd_nasid);
254 if (dest_brd->brd_type == KLTYPE_ROUTER)
255 printk(" r");
256 }
257 printk("\n");
258
259 } while ( (brd = find_lboard_class(KLCF_NEXT(brd), KLTYPE_ROUTER)) );
260 }
261}
262
263static pfn_t __init slot_getbasepfn(cnodeid_t cnode, int slot)
264{
265 nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
266
267 return ((pfn_t)nasid << PFN_NASIDSHFT) | (slot << SLOT_PFNSHIFT);
268}
269
270/*
271 * Return the number of pages of memory provided by the given slot
272 * on the specified node.
273 */
274static pfn_t __init slot_getsize(cnodeid_t node, int slot)
275{
276 return (pfn_t) slot_psize_cache[node][slot];
277}
278
279/*
280 * Return highest slot filled
281 */
282static int __init node_getlastslot(cnodeid_t node)
283{
284 return (int) slot_lastfilled_cache[node];
285}
286
287/*
288 * Return the pfn of the last free page of memory on a node.
289 */
290static pfn_t __init node_getmaxclick(cnodeid_t node)
291{
292 pfn_t slot_psize;
293 int slot;
294
295 /*
296 * Start at the top slot. When we find a slot with memory in it,
297 * that's the winner.
298 */
299 for (slot = (MAX_MEM_SLOTS - 1); slot >= 0; slot--) {
300 if ((slot_psize = slot_getsize(node, slot))) {
301 if (slot_psize == SLOT_IGNORED)
302 continue;
303 /* Return the basepfn + the slot size, minus 1. */
304 return slot_getbasepfn(node, slot) + slot_psize - 1;
305 }
306 }
307
308 /*
309 * If there's no memory on the node, return 0. This is likely
310 * to cause problems.
311 */
312 return 0;
313}
314
315static pfn_t __init slot_psize_compute(cnodeid_t node, int slot)
316{
317 nasid_t nasid;
318 lboard_t *brd;
319 klmembnk_t *banks;
320 unsigned long size;
321
322 nasid = COMPACT_TO_NASID_NODEID(node);
323 /* Find the node board */
324 brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27);
325 if (!brd)
326 return 0;
327
328 /* Get the memory bank structure */
329 banks = (klmembnk_t *) find_first_component(brd, KLSTRUCT_MEMBNK);
330 if (!banks)
331 return 0;
332
333 /* Size in _Megabytes_ */
334 size = (unsigned long)banks->membnk_bnksz[slot/4];
335
336 /* hack for 128 dimm banks */
337 if (size <= 128) {
338 if (slot % 4 == 0) {
339 size <<= 20; /* size in bytes */
340 return(size >> PAGE_SHIFT);
341 } else
342 return 0;
343 } else {
344 size /= 4;
345 size <<= 20;
346 return size >> PAGE_SHIFT;
347 }
348}
349
350static void __init mlreset(void)
351{
352 int i;
353
354 master_nasid = get_nasid();
355 fine_mode = is_fine_dirmode();
356
357 /*
358 * Probe for all CPUs - this creates the cpumask and sets up the
359 * mapping tables. We need to do this as early as possible.
360 */
361#ifdef CONFIG_SMP
362 cpu_node_probe();
363#endif
364
365 init_topology_matrix();
366 dump_topology();
367
368 gen_region_mask(&region_mask);
369
370 setup_replication_mask();
371
372 /*
373 * Set all nodes' calias sizes to 8k
374 */
375 for_each_online_node(i) {
376 nasid_t nasid;
377
378 nasid = COMPACT_TO_NASID_NODEID(i);
379
380 /*
381 * Always have node 0 in the region mask, otherwise
382 * CALIAS accesses get exceptions since the hub
383 * thinks it is a node 0 address.
384 */
385 REMOTE_HUB_S(nasid, PI_REGION_PRESENT, (region_mask | 1));
386#ifdef CONFIG_REPLICATE_EXHANDLERS
387 REMOTE_HUB_S(nasid, PI_CALIAS_SIZE, PI_CALIAS_SIZE_8K);
388#else
389 REMOTE_HUB_S(nasid, PI_CALIAS_SIZE, PI_CALIAS_SIZE_0);
390#endif
391
392#ifdef LATER
393 /*
394 * Set up all hubs to have a big window pointing at
395 * widget 0. Memory mode, widget 0, offset 0
396 */
397 REMOTE_HUB_S(nasid, IIO_ITTE(SWIN0_BIGWIN),
398 ((HUB_PIO_MAP_TO_MEM << IIO_ITTE_IOSP_SHIFT) |
399 (0 << IIO_ITTE_WIDGET_SHIFT)));
400#endif
401 }
402}
403
404static void __init szmem(void)
405{
406 pfn_t slot_psize, slot0sz = 0, nodebytes; /* Hack to detect problem configs */
407 int slot, ignore;
408 cnodeid_t node;
409
410 num_physpages = 0;
411
412 for_each_online_node(node) {
413 ignore = nodebytes = 0;
414 for (slot = 0; slot < MAX_MEM_SLOTS; slot++) {
415 slot_psize = slot_psize_compute(node, slot);
416 if (slot == 0)
417 slot0sz = slot_psize;
418 /*
419 * We need to refine the hack when we have replicated
420 * kernel text.
421 */
422 nodebytes += (1LL << SLOT_SHIFT);
423 if ((nodebytes >> PAGE_SHIFT) * (sizeof(struct page)) >
424 (slot0sz << PAGE_SHIFT))
425 ignore = 1;
426 if (ignore && slot_psize) {
427 printk("Ignoring slot %d onwards on node %d\n",
428 slot, node);
429 slot_psize_cache[node][slot] = SLOT_IGNORED;
430 slot = MAX_MEM_SLOTS;
431 continue;
432 }
433 num_physpages += slot_psize;
434 slot_psize_cache[node][slot] =
435 (unsigned short) slot_psize;
436 if (slot_psize)
437 slot_lastfilled_cache[node] = slot;
438 }
439 }
440}
441
442static void __init node_mem_init(cnodeid_t node)
443{
444 pfn_t slot_firstpfn = slot_getbasepfn(node, 0);
445 pfn_t slot_lastpfn = slot_firstpfn + slot_getsize(node, 0);
446 pfn_t slot_freepfn = node_getfirstfree(node);
447 struct pglist_data *pd;
448 unsigned long bootmap_size;
449
450 /*
451 * Allocate the node data structures on the node first.
452 */
453 __node_data[node] = __va(slot_freepfn << PAGE_SHIFT);
454
455 pd = NODE_DATA(node);
456 pd->bdata = &plat_node_bdata[node];
457
458 cpus_clear(hub_data(node)->h_cpus);
459
460 slot_freepfn += PFN_UP(sizeof(struct pglist_data) +
461 sizeof(struct hub_data));
462
463 bootmap_size = init_bootmem_node(NODE_DATA(node), slot_freepfn,
464 slot_firstpfn, slot_lastpfn);
465 free_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT,
466 (slot_lastpfn - slot_firstpfn) << PAGE_SHIFT);
467 reserve_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT,
468 ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size);
469}
470
471/*
472 * A node with nothing. We use it to avoid any special casing in
473 * node_to_cpumask
474 */
475static struct node_data null_node = {
476 .hub = {
477 .h_cpus = CPU_MASK_NONE
478 }
479};
480
481/*
482 * Currently, the intranode memory hole support assumes that each slot
483 * contains at least 32 MBytes of memory. We assume all bootmem data
484 * fits on the first slot.
485 */
486void __init prom_meminit(void)
487{
488 cnodeid_t node;
489
490 mlreset();
491 szmem();
492
493 for (node = 0; node < MAX_COMPACT_NODES; node++) {
494 if (node_online(node)) {
495 node_mem_init(node);
496 continue;
497 }
498 __node_data[node] = &null_node;
499 }
500}
501
502unsigned long __init prom_free_prom_memory(void)
503{
504 /* We got nothing to free here ... */
505 return 0;
506}
507
508extern void pagetable_init(void);
509extern unsigned long setup_zero_pages(void);
510
511void __init paging_init(void)
512{
513 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
514 unsigned node;
515
516 pagetable_init();
517
518 for_each_online_node(node) {
519 pfn_t start_pfn = slot_getbasepfn(node, 0);
520 pfn_t end_pfn = node_getmaxclick(node) + 1;
521
522 zones_size[ZONE_DMA] = end_pfn - start_pfn;
523 free_area_init_node(node, NODE_DATA(node),
524 zones_size, start_pfn, NULL);
525
526 if (end_pfn > max_low_pfn)
527 max_low_pfn = end_pfn;
528 }
529}
530
531void __init mem_init(void)
532{
533 unsigned long codesize, datasize, initsize, tmp;
534 unsigned node;
535
536 high_memory = (void *) __va(num_physpages << PAGE_SHIFT);
537
538 for_each_online_node(node) {
539 unsigned slot, numslots;
540 struct page *end, *p;
541
542 /*
543 * This will free up the bootmem, ie, slot 0 memory.
544 */
545 totalram_pages += free_all_bootmem_node(NODE_DATA(node));
546
547 /*
548 * We need to manually do the other slots.
549 */
550 numslots = node_getlastslot(node);
551 for (slot = 1; slot <= numslots; slot++) {
552 p = NODE_DATA(node)->node_mem_map +
553 (slot_getbasepfn(node, slot) -
554 slot_getbasepfn(node, 0));
555
556 /*
557 * Free valid memory in current slot.
558 */
559 for (end = p + slot_getsize(node, slot); p < end; p++) {
560 /* if (!page_is_ram(pgnr)) continue; */
561 /* commented out until page_is_ram works */
562 ClearPageReserved(p);
563 set_page_count(p, 1);
564 __free_page(p);
565 totalram_pages++;
566 }
567 }
568 }
569
570 totalram_pages -= setup_zero_pages(); /* This comes from node 0 */
571
572 codesize = (unsigned long) &_etext - (unsigned long) &_text;
573 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
574 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
575
576 tmp = nr_free_pages();
577 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
578 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
579 tmp << (PAGE_SHIFT-10),
580 num_physpages << (PAGE_SHIFT-10),
581 codesize >> 10,
582 (num_physpages - tmp) << (PAGE_SHIFT-10),
583 datasize >> 10,
584 initsize >> 10,
585 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
586}
diff --git a/arch/mips/sgi-ip27/ip27-nmi.c b/arch/mips/sgi-ip27/ip27-nmi.c
new file mode 100644
index 000000000000..b0a25e1ee8b7
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-nmi.c
@@ -0,0 +1,249 @@
1#include <linux/kallsyms.h>
2#include <linux/kernel.h>
3#include <linux/mmzone.h>
4#include <linux/nodemask.h>
5#include <linux/spinlock.h>
6#include <linux/smp.h>
7#include <asm/atomic.h>
8#include <asm/sn/types.h>
9#include <asm/sn/addrs.h>
10#include <asm/sn/nmi.h>
11#include <asm/sn/arch.h>
12#include <asm/sn/sn0/hub.h>
13
14#if 0
15#define NODE_NUM_CPUS(n) CNODE_NUM_CPUS(n)
16#else
17#define NODE_NUM_CPUS(n) CPUS_PER_NODE
18#endif
19
20#define CNODEID_NONE (cnodeid_t)-1
21#define enter_panic_mode() spin_lock(&nmi_lock)
22
23typedef unsigned long machreg_t;
24
25DEFINE_SPINLOCK(nmi_lock);
26
27/*
28 * Lets see what else we need to do here. Set up sp, gp?
29 */
30void nmi_dump(void)
31{
32 void cont_nmi_dump(void);
33
34 cont_nmi_dump();
35}
36
37void install_cpu_nmi_handler(int slice)
38{
39 nmi_t *nmi_addr;
40
41 nmi_addr = (nmi_t *)NMI_ADDR(get_nasid(), slice);
42 if (nmi_addr->call_addr)
43 return;
44 nmi_addr->magic = NMI_MAGIC;
45 nmi_addr->call_addr = (void *)nmi_dump;
46 nmi_addr->call_addr_c =
47 (void *)(~((unsigned long)(nmi_addr->call_addr)));
48 nmi_addr->call_parm = 0;
49}
50
51/*
52 * Copy the cpu registers which have been saved in the IP27prom format
53 * into the eframe format for the node under consideration.
54 */
55
56void nmi_cpu_eframe_save(nasid_t nasid, int slice)
57{
58 struct reg_struct *nr;
59 int i;
60
61 /* Get the pointer to the current cpu's register set. */
62 nr = (struct reg_struct *)
63 (TO_UNCAC(TO_NODE(nasid, IP27_NMI_KREGS_OFFSET)) +
64 slice * IP27_NMI_KREGS_CPU_SIZE);
65
66 printk("NMI nasid %d: slice %d\n", nasid, slice);
67
68 /*
69 * Saved main processor registers
70 */
71 for (i = 0; i < 32; ) {
72 if ((i % 4) == 0)
73 printk("$%2d :", i);
74 printk(" %016lx", nr->gpr[i]);
75
76 i++;
77 if ((i % 4) == 0)
78 printk("\n");
79 }
80
81 printk("Hi : (value lost)\n");
82 printk("Lo : (value lost)\n");
83
84 /*
85 * Saved cp0 registers
86 */
87 printk("epc : %016lx ", nr->epc);
88 print_symbol("%s ", nr->epc);
89 printk("%s\n", print_tainted());
90 printk("ErrEPC: %016lx ", nr->error_epc);
91 print_symbol("%s\n", nr->error_epc);
92 printk("ra : %016lx ", nr->gpr[31]);
93 print_symbol("%s\n", nr->gpr[31]);
94 printk("Status: %08lx ", nr->sr);
95
96 if (nr->sr & ST0_KX)
97 printk("KX ");
98 if (nr->sr & ST0_SX)
99 printk("SX ");
100 if (nr->sr & ST0_UX)
101 printk("UX ");
102
103 switch (nr->sr & ST0_KSU) {
104 case KSU_USER:
105 printk("USER ");
106 break;
107 case KSU_SUPERVISOR:
108 printk("SUPERVISOR ");
109 break;
110 case KSU_KERNEL:
111 printk("KERNEL ");
112 break;
113 default:
114 printk("BAD_MODE ");
115 break;
116 }
117
118 if (nr->sr & ST0_ERL)
119 printk("ERL ");
120 if (nr->sr & ST0_EXL)
121 printk("EXL ");
122 if (nr->sr & ST0_IE)
123 printk("IE ");
124 printk("\n");
125
126 printk("Cause : %08lx\n", nr->cause);
127 printk("PrId : %08x\n", read_c0_prid());
128 printk("BadVA : %016lx\n", nr->badva);
129 printk("CErr : %016lx\n", nr->cache_err);
130 printk("NMI_SR: %016lx\n", nr->nmi_sr);
131
132 printk("\n");
133}
134
135void nmi_dump_hub_irq(nasid_t nasid, int slice)
136{
137 hubreg_t mask0, mask1, pend0, pend1;
138
139 if (slice == 0) { /* Slice A */
140 mask0 = REMOTE_HUB_L(nasid, PI_INT_MASK0_A);
141 mask1 = REMOTE_HUB_L(nasid, PI_INT_MASK1_A);
142 } else { /* Slice B */
143 mask0 = REMOTE_HUB_L(nasid, PI_INT_MASK0_B);
144 mask1 = REMOTE_HUB_L(nasid, PI_INT_MASK1_B);
145 }
146
147 pend0 = REMOTE_HUB_L(nasid, PI_INT_PEND0);
148 pend1 = REMOTE_HUB_L(nasid, PI_INT_PEND1);
149
150 printk("PI_INT_MASK0: %16lx PI_INT_MASK1: %16lx\n", mask0, mask1);
151 printk("PI_INT_PEND0: %16lx PI_INT_PEND1: %16lx\n", pend0, pend1);
152 printk("\n\n");
153}
154
155/*
156 * Copy the cpu registers which have been saved in the IP27prom format
157 * into the eframe format for the node under consideration.
158 */
159void nmi_node_eframe_save(cnodeid_t cnode)
160{
161 nasid_t nasid;
162 int slice;
163
164 /* Make sure that we have a valid node */
165 if (cnode == CNODEID_NONE)
166 return;
167
168 nasid = COMPACT_TO_NASID_NODEID(cnode);
169 if (nasid == INVALID_NASID)
170 return;
171
172 /* Save the registers into eframe for each cpu */
173 for (slice = 0; slice < NODE_NUM_CPUS(slice); slice++) {
174 nmi_cpu_eframe_save(nasid, slice);
175 nmi_dump_hub_irq(nasid, slice);
176 }
177}
178
179/*
180 * Save the nmi cpu registers for all cpus in the system.
181 */
182void
183nmi_eframes_save(void)
184{
185 cnodeid_t cnode;
186
187 for_each_online_node(cnode)
188 nmi_node_eframe_save(cnode);
189}
190
191void
192cont_nmi_dump(void)
193{
194#ifndef REAL_NMI_SIGNAL
195 static atomic_t nmied_cpus = ATOMIC_INIT(0);
196
197 atomic_inc(&nmied_cpus);
198#endif
199 /*
200 * Use enter_panic_mode to allow only 1 cpu to proceed
201 */
202 enter_panic_mode();
203
204#ifdef REAL_NMI_SIGNAL
205 /*
206 * Wait up to 15 seconds for the other cpus to respond to the NMI.
207 * If a cpu has not responded after 10 sec, send it 1 additional NMI.
208 * This is for 2 reasons:
209 * - sometimes a MMSC fail to NMI all cpus.
210 * - on 512p SN0 system, the MMSC will only send NMIs to
211 * half the cpus. Unfortunately, we don't know which cpus may be
212 * NMIed - it depends on how the site chooses to configure.
213 *
214 * Note: it has been measure that it takes the MMSC up to 2.3 secs to
215 * send NMIs to all cpus on a 256p system.
216 */
217 for (i=0; i < 1500; i++) {
218 for_each_online_node(node)
219 if (NODEPDA(node)->dump_count == 0)
220 break;
221 if (node == MAX_NUMNODES)
222 break;
223 if (i == 1000) {
224 for_each_online_node(node)
225 if (NODEPDA(node)->dump_count == 0) {
226 cpu = node_to_first_cpu(node);
227 for (n=0; n < CNODE_NUM_CPUS(node); cpu++, n++) {
228 CPUMASK_SETB(nmied_cpus, cpu);
229 /*
230 * cputonasid, cputoslice
231 * needs kernel cpuid
232 */
233 SEND_NMI((cputonasid(cpu)), (cputoslice(cpu)));
234 }
235 }
236
237 }
238 udelay(10000);
239 }
240#else
241 while (atomic_read(&nmied_cpus) != num_online_cpus());
242#endif
243
244 /*
245 * Save the nmi cpu registers for all cpu in the eframe format.
246 */
247 nmi_eframes_save();
248 LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
249}
diff --git a/arch/mips/sgi-ip27/ip27-reset.c b/arch/mips/sgi-ip27/ip27-reset.c
new file mode 100644
index 000000000000..2e16be94c78b
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-reset.c
@@ -0,0 +1,81 @@
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 * Reset an IP27.
7 *
8 * Copyright (C) 1997, 1998, 1999, 2000 by Ralf Baechle
9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 */
11#include <linux/config.h>
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/timer.h>
15#include <linux/smp.h>
16#include <linux/mmzone.h>
17#include <linux/nodemask.h>
18
19#include <asm/io.h>
20#include <asm/irq.h>
21#include <asm/reboot.h>
22#include <asm/system.h>
23#include <asm/sgialib.h>
24#include <asm/sn/addrs.h>
25#include <asm/sn/arch.h>
26#include <asm/sn/gda.h>
27#include <asm/sn/sn0/hub.h>
28
29void machine_restart(char *command) __attribute__((noreturn));
30void machine_halt(void) __attribute__((noreturn));
31void machine_power_off(void) __attribute__((noreturn));
32
33#define noreturn while(1); /* Silence gcc. */
34
35/* XXX How to pass the reboot command to the firmware??? */
36static void ip27_machine_restart(char *command)
37{
38#if 0
39 int i;
40#endif
41
42 printk("Reboot started from CPU %d\n", smp_processor_id());
43#ifdef CONFIG_SMP
44 smp_send_stop();
45#endif
46#if 0
47 for_each_online_node(i)
48 REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
49 PROMOP_REBOOT);
50#else
51 LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
52#endif
53 noreturn;
54}
55
56static void ip27_machine_halt(void)
57{
58 int i;
59
60#ifdef CONFIG_SMP
61 smp_send_stop();
62#endif
63 for_each_online_node(i)
64 REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
65 PROMOP_RESTART);
66 LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
67 noreturn;
68}
69
70static void ip27_machine_power_off(void)
71{
72 /* To do ... */
73 noreturn;
74}
75
76void ip27_reboot_setup(void)
77{
78 _machine_restart = ip27_machine_restart;
79 _machine_halt = ip27_machine_halt;
80 _machine_power_off = ip27_machine_power_off;
81}
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
new file mode 100644
index 000000000000..17f768cba94f
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -0,0 +1,225 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General
3 * Public License. See the file "COPYING" in the main directory of this
4 * archive for more details.
5 *
6 * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com)
7 * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc.
8 */
9#include <linux/init.h>
10#include <linux/sched.h>
11#include <linux/nodemask.h>
12#include <asm/page.h>
13#include <asm/processor.h>
14#include <asm/sn/arch.h>
15#include <asm/sn/gda.h>
16#include <asm/sn/intr.h>
17#include <asm/sn/klconfig.h>
18#include <asm/sn/launch.h>
19#include <asm/sn/mapped_kernel.h>
20#include <asm/sn/sn_private.h>
21#include <asm/sn/types.h>
22#include <asm/sn/sn0/hubpi.h>
23#include <asm/sn/sn0/hubio.h>
24#include <asm/sn/sn0/ip27.h>
25
26/*
27 * Takes as first input the PROM assigned cpu id, and the kernel
28 * assigned cpu id as the second.
29 */
30static void alloc_cpupda(cpuid_t cpu, int cpunum)
31{
32 cnodeid_t node = get_cpu_cnode(cpu);
33 nasid_t nasid = COMPACT_TO_NASID_NODEID(node);
34
35 cputonasid(cpunum) = nasid;
36 cpu_data[cpunum].p_nodeid = node;
37 cputoslice(cpunum) = get_cpu_slice(cpu);
38}
39
40static nasid_t get_actual_nasid(lboard_t *brd)
41{
42 klhub_t *hub;
43
44 if (!brd)
45 return INVALID_NASID;
46
47 /* find out if we are a completely disabled brd. */
48 hub = (klhub_t *)find_first_component(brd, KLSTRUCT_HUB);
49 if (!hub)
50 return INVALID_NASID;
51 if (!(hub->hub_info.flags & KLINFO_ENABLE)) /* disabled node brd */
52 return hub->hub_info.physid;
53 else
54 return brd->brd_nasid;
55}
56
57static int do_cpumask(cnodeid_t cnode, nasid_t nasid, int highest)
58{
59 static int tot_cpus_found = 0;
60 lboard_t *brd;
61 klcpu_t *acpu;
62 int cpus_found = 0;
63 cpuid_t cpuid;
64
65 brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27);
66
67 do {
68 acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU);
69 while (acpu) {
70 cpuid = acpu->cpu_info.virtid;
71 /* cnode is not valid for completely disabled brds */
72 if (get_actual_nasid(brd) == brd->brd_nasid)
73 cpuid_to_compact_node[cpuid] = cnode;
74 if (cpuid > highest)
75 highest = cpuid;
76 /* Only let it join in if it's marked enabled */
77 if ((acpu->cpu_info.flags & KLINFO_ENABLE) &&
78 (tot_cpus_found != NR_CPUS)) {
79 cpu_set(cpuid, phys_cpu_present_map);
80 alloc_cpupda(cpuid, tot_cpus_found);
81 cpus_found++;
82 tot_cpus_found++;
83 }
84 acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu,
85 KLSTRUCT_CPU);
86 }
87 brd = KLCF_NEXT(brd);
88 if (!brd)
89 break;
90
91 brd = find_lboard(brd, KLTYPE_IP27);
92 } while (brd);
93
94 return highest;
95}
96
97void cpu_node_probe(void)
98{
99 int i, highest = 0;
100 gda_t *gdap = GDA;
101
102 /*
103 * Initialize the arrays to invalid nodeid (-1)
104 */
105 for (i = 0; i < MAX_COMPACT_NODES; i++)
106 compact_to_nasid_node[i] = INVALID_NASID;
107 for (i = 0; i < MAX_NASIDS; i++)
108 nasid_to_compact_node[i] = INVALID_CNODEID;
109 for (i = 0; i < MAXCPUS; i++)
110 cpuid_to_compact_node[i] = INVALID_CNODEID;
111
112 /*
113 * MCD - this whole "compact node" stuff can probably be dropped,
114 * as we can handle sparse numbering now
115 */
116 nodes_clear(node_online_map);
117 for (i = 0; i < MAX_COMPACT_NODES; i++) {
118 nasid_t nasid = gdap->g_nasidtable[i];
119 if (nasid == INVALID_NASID)
120 break;
121 compact_to_nasid_node[i] = nasid;
122 nasid_to_compact_node[nasid] = i;
123 node_set_online(num_online_nodes());
124 highest = do_cpumask(i, nasid, highest);
125 }
126
127 printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes());
128}
129
130static void intr_clear_bits(nasid_t nasid, volatile hubreg_t *pend,
131 int base_level)
132{
133 volatile hubreg_t bits;
134 int i;
135
136 /* Check pending interrupts */
137 if ((bits = HUB_L(pend)) != 0)
138 for (i = 0; i < N_INTPEND_BITS; i++)
139 if (bits & (1 << i))
140 LOCAL_HUB_CLR_INTR(base_level + i);
141}
142
143static void intr_clear_all(nasid_t nasid)
144{
145 REMOTE_HUB_S(nasid, PI_INT_MASK0_A, 0);
146 REMOTE_HUB_S(nasid, PI_INT_MASK0_B, 0);
147 REMOTE_HUB_S(nasid, PI_INT_MASK1_A, 0);
148 REMOTE_HUB_S(nasid, PI_INT_MASK1_B, 0);
149 intr_clear_bits(nasid, REMOTE_HUB_ADDR(nasid, PI_INT_PEND0),
150 INT_PEND0_BASELVL);
151 intr_clear_bits(nasid, REMOTE_HUB_ADDR(nasid, PI_INT_PEND1),
152 INT_PEND1_BASELVL);
153}
154
155void __init prom_prepare_cpus(unsigned int max_cpus)
156{
157 cnodeid_t cnode;
158
159 for_each_online_node(cnode)
160 intr_clear_all(COMPACT_TO_NASID_NODEID(cnode));
161
162 replicate_kernel_text();
163
164 /*
165 * Assumption to be fixed: we're always booted on logical / physical
166 * processor 0. While we're always running on logical processor 0
167 * this still means this is physical processor zero; it might for
168 * example be disabled in the firwware.
169 */
170 alloc_cpupda(0, 0);
171}
172
173/*
174 * Launch a slave into smp_bootstrap(). It doesn't take an argument, and we
175 * set sp to the kernel stack of the newly created idle process, gp to the proc
176 * struct so that current_thread_info() will work.
177 */
178void __init prom_boot_secondary(int cpu, struct task_struct *idle)
179{
180 unsigned long gp = (unsigned long) idle->thread_info;
181 unsigned long sp = gp + THREAD_SIZE - 32;
182
183 LAUNCH_SLAVE(cputonasid(cpu),cputoslice(cpu),
184 (launch_proc_t)MAPPED_KERN_RW_TO_K0(smp_bootstrap),
185 0, (void *) sp, (void *) gp);
186}
187
188void prom_init_secondary(void)
189{
190 per_cpu_init();
191 local_irq_enable();
192}
193
194void __init prom_cpus_done(void)
195{
196}
197
198void prom_smp_finish(void)
199{
200}
201
202void core_send_ipi(int destid, unsigned int action)
203{
204 int irq;
205
206 switch (action) {
207 case SMP_RESCHEDULE_YOURSELF:
208 irq = CPU_RESCHED_A_IRQ;
209 break;
210 case SMP_CALL_FUNCTION:
211 irq = CPU_CALL_A_IRQ;
212 break;
213 default:
214 panic("sendintr");
215 }
216
217 irq += cputoslice(destid);
218
219 /*
220 * Convert the compact hub number to the NASID to get the correct
221 * part of the address space. Then set the interrupt bit associated
222 * with the CPU we want to send the interrupt to.
223 */
224 REMOTE_HUB_SEND_INTR(COMPACT_TO_NASID_NODEID(cpu_to_node(destid)), irq);
225}
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
new file mode 100644
index 000000000000..8c1b96fffa76
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -0,0 +1,243 @@
1/*
2 * Copytight (C) 1999, 2000, 05 Ralf Baechle (ralf@linux-mips.org)
3 * Copytight (C) 1999, 2000 Silicon Graphics, Inc.
4 */
5#include <linux/bcd.h>
6#include <linux/init.h>
7#include <linux/kernel.h>
8#include <linux/sched.h>
9#include <linux/interrupt.h>
10#include <linux/kernel_stat.h>
11#include <linux/param.h>
12#include <linux/time.h>
13#include <linux/timex.h>
14#include <linux/mm.h>
15
16#include <asm/time.h>
17#include <asm/pgtable.h>
18#include <asm/sgialib.h>
19#include <asm/sn/ioc3.h>
20#include <asm/m48t35.h>
21#include <asm/sn/klconfig.h>
22#include <asm/sn/arch.h>
23#include <asm/sn/addrs.h>
24#include <asm/sn/sn_private.h>
25#include <asm/sn/sn0/ip27.h>
26#include <asm/sn/sn0/hub.h>
27
28/*
29 * This is a hack; we really need to figure these values out dynamically
30 *
31 * Since 800 ns works very well with various HUB frequencies, such as
32 * 360, 380, 390 and 400 MHZ, we use 800 ns rtc cycle time.
33 *
34 * Ralf: which clock rate is used to feed the counter?
35 */
36#define NSEC_PER_CYCLE 800
37#define CYCLES_PER_SEC (NSEC_PER_SEC/NSEC_PER_CYCLE)
38#define CYCLES_PER_JIFFY (CYCLES_PER_SEC/HZ)
39
40#define TICK_SIZE (tick_nsec / 1000)
41
42static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */
43static long last_rtc_update; /* Last time the rtc clock got updated */
44
45extern volatile unsigned long wall_jiffies;
46
47#if 0
48static int set_rtc_mmss(unsigned long nowtime)
49{
50 int retval = 0;
51 int real_seconds, real_minutes, cmos_minutes;
52 struct m48t35_rtc *rtc;
53 nasid_t nid;
54
55 nid = get_nasid();
56 rtc = (struct m48t35_rtc *)(KL_CONFIG_CH_CONS_INFO(nid)->memory_base +
57 IOC3_BYTEBUS_DEV0);
58
59 rtc->control |= M48T35_RTC_READ;
60 cmos_minutes = BCD2BIN(rtc->min);
61 rtc->control &= ~M48T35_RTC_READ;
62
63 /*
64 * Since we're only adjusting minutes and seconds, don't interfere with
65 * hour overflow. This avoids messing with unknown time zones but
66 * requires your RTC not to be off by more than 15 minutes
67 */
68 real_seconds = nowtime % 60;
69 real_minutes = nowtime / 60;
70 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
71 real_minutes += 30; /* correct for half hour time zone */
72 real_minutes %= 60;
73
74 if (abs(real_minutes - cmos_minutes) < 30) {
75 real_seconds = BIN2BCD(real_seconds);
76 real_minutes = BIN2BCD(real_minutes);
77 rtc->control |= M48T35_RTC_SET;
78 rtc->sec = real_seconds;
79 rtc->min = real_minutes;
80 rtc->control &= ~M48T35_RTC_SET;
81 } else {
82 printk(KERN_WARNING
83 "set_rtc_mmss: can't update from %d to %d\n",
84 cmos_minutes, real_minutes);
85 retval = -1;
86 }
87
88 return retval;
89}
90#endif
91
92void ip27_rt_timer_interrupt(struct pt_regs *regs)
93{
94 int cpu = smp_processor_id();
95 int cpuA = cputoslice(cpu) == 0;
96 int irq = 9; /* XXX Assign number */
97
98 irq_enter();
99 write_seqlock(&xtime_lock);
100
101again:
102 LOCAL_HUB_S(cpuA ? PI_RT_PEND_A : PI_RT_PEND_B, 0); /* Ack */
103 ct_cur[cpu] += CYCLES_PER_JIFFY;
104 LOCAL_HUB_S(cpuA ? PI_RT_COMPARE_A : PI_RT_COMPARE_B, ct_cur[cpu]);
105
106 if (LOCAL_HUB_L(PI_RT_COUNT) >= ct_cur[cpu])
107 goto again;
108
109 kstat_this_cpu.irqs[irq]++; /* kstat only for bootcpu? */
110
111 if (cpu == 0)
112 do_timer(regs);
113
114 update_process_times(user_mode(regs));
115
116 /*
117 * If we have an externally synchronized Linux clock, then update
118 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
119 * called as close as possible to when a second starts.
120 */
121 if ((time_status & STA_UNSYNC) == 0 &&
122 xtime.tv_sec > last_rtc_update + 660 &&
123 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
124 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
125 if (rtc_set_time(xtime.tv_sec) == 0) {
126 last_rtc_update = xtime.tv_sec;
127 } else {
128 last_rtc_update = xtime.tv_sec - 600;
129 /* do it again in 60 s */
130 }
131 }
132
133 write_sequnlock(&xtime_lock);
134 irq_exit();
135}
136
137unsigned long ip27_do_gettimeoffset(void)
138{
139 unsigned long ct_cur1;
140 ct_cur1 = REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT) + CYCLES_PER_JIFFY;
141 return (ct_cur1 - ct_cur[0]) * NSEC_PER_CYCLE / 1000;
142}
143
144/* Includes for ioc3_init(). */
145#include <asm/sn/types.h>
146#include <asm/sn/sn0/addrs.h>
147#include <asm/sn/sn0/hubni.h>
148#include <asm/sn/sn0/hubio.h>
149#include <asm/pci/bridge.h>
150
151static __init unsigned long get_m48t35_time(void)
152{
153 unsigned int year, month, date, hour, min, sec;
154 struct m48t35_rtc *rtc;
155 nasid_t nid;
156
157 nid = get_nasid();
158 rtc = (struct m48t35_rtc *)(KL_CONFIG_CH_CONS_INFO(nid)->memory_base +
159 IOC3_BYTEBUS_DEV0);
160
161 rtc->control |= M48T35_RTC_READ;
162 sec = rtc->sec;
163 min = rtc->min;
164 hour = rtc->hour;
165 date = rtc->date;
166 month = rtc->month;
167 year = rtc->year;
168 rtc->control &= ~M48T35_RTC_READ;
169
170 sec = BCD2BIN(sec);
171 min = BCD2BIN(min);
172 hour = BCD2BIN(hour);
173 date = BCD2BIN(date);
174 month = BCD2BIN(month);
175 year = BCD2BIN(year);
176
177 year += 1970;
178
179 return mktime(year, month, date, hour, min, sec);
180}
181
182static void ip27_timer_setup(struct irqaction *irq)
183{
184 /* over-write the handler, we use our own way */
185 irq->handler = no_action;
186
187 /* setup irqaction */
188// setup_irq(IP27_TIMER_IRQ, irq); /* XXX Can't do this yet. */
189}
190
191void __init ip27_time_init(void)
192{
193 xtime.tv_sec = get_m48t35_time();
194 xtime.tv_nsec = 0;
195
196 do_gettimeoffset = ip27_do_gettimeoffset;
197
198 board_timer_setup = ip27_timer_setup;
199}
200
201void __init cpu_time_init(void)
202{
203 lboard_t *board;
204 klcpu_t *cpu;
205 int cpuid;
206
207 /* Don't use ARCS. ARCS is fragile. Klconfig is simple and sane. */
208 board = find_lboard(KL_CONFIG_INFO(get_nasid()), KLTYPE_IP27);
209 if (!board)
210 panic("Can't find board info for myself.");
211
212 cpuid = LOCAL_HUB_L(PI_CPU_NUM) ? IP27_CPU0_INDEX : IP27_CPU1_INDEX;
213 cpu = (klcpu_t *) KLCF_COMP(board, cpuid);
214 if (!cpu)
215 panic("No information about myself?");
216
217 printk("CPU %d clock is %dMHz.\n", smp_processor_id(), cpu->cpu_speed);
218
219 set_c0_status(SRB_TIMOCLK);
220}
221
222void __init hub_rtc_init(cnodeid_t cnode)
223{
224 /*
225 * We only need to initialize the current node.
226 * If this is not the current node then it is a cpuless
227 * node and timeouts will not happen there.
228 */
229 if (get_compact_nodeid() == cnode) {
230 int cpu = smp_processor_id();
231 LOCAL_HUB_S(PI_RT_EN_A, 1);
232 LOCAL_HUB_S(PI_RT_EN_B, 1);
233 LOCAL_HUB_S(PI_PROF_EN_A, 0);
234 LOCAL_HUB_S(PI_PROF_EN_B, 0);
235 ct_cur[cpu] = CYCLES_PER_JIFFY;
236 LOCAL_HUB_S(PI_RT_COMPARE_A, ct_cur[cpu]);
237 LOCAL_HUB_S(PI_RT_COUNT, 0);
238 LOCAL_HUB_S(PI_RT_PEND_A, 0);
239 LOCAL_HUB_S(PI_RT_COMPARE_B, ct_cur[cpu]);
240 LOCAL_HUB_S(PI_RT_COUNT, 0);
241 LOCAL_HUB_S(PI_RT_PEND_B, 0);
242 }
243}
diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c
new file mode 100644
index 000000000000..fc82f34a32ce
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-xtalk.c
@@ -0,0 +1,135 @@
1/*
2 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
3 * Copyright (C) 1999, 2000 Silcon Graphics, Inc.
4 * Copyright (C) 2004 Christoph Hellwig.
5 * Released under GPL v2.
6 *
7 * Generic XTALK initialization code
8 */
9
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <asm/sn/types.h>
13#include <asm/sn/klconfig.h>
14#include <asm/sn/hub.h>
15#include <asm/pci/bridge.h>
16#include <asm/xtalk/xtalk.h>
17
18
19#define XBOW_WIDGET_PART_NUM 0x0
20#define XXBOW_WIDGET_PART_NUM 0xd000 /* Xbow in Xbridge */
21#define BASE_XBOW_PORT 8 /* Lowest external port */
22
23extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
24
25static int __init probe_one_port(nasid_t nasid, int widget, int masterwid)
26{
27 widgetreg_t widget_id;
28 xwidget_part_num_t partnum;
29
30 widget_id = *(volatile widgetreg_t *)
31 (RAW_NODE_SWIN_BASE(nasid, widget) + WIDGET_ID);
32 partnum = XWIDGET_PART_NUM(widget_id);
33
34 printk(KERN_INFO "Cpu %d, Nasid 0x%x, widget 0x%x (partnum 0x%x) is ",
35 smp_processor_id(), nasid, widget, partnum);
36
37 switch (partnum) {
38 case BRIDGE_WIDGET_PART_NUM:
39 case XBRIDGE_WIDGET_PART_NUM:
40 bridge_probe(nasid, widget, masterwid);
41 break;
42 default:
43 break;
44 }
45
46 return 0;
47}
48
49static int __init xbow_probe(nasid_t nasid)
50{
51 lboard_t *brd;
52 klxbow_t *xbow_p;
53 unsigned masterwid, i;
54
55 printk("is xbow\n");
56
57 /*
58 * found xbow, so may have multiple bridges
59 * need to probe xbow
60 */
61 brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_MIDPLANE8);
62 if (!brd)
63 return -ENODEV;
64
65 xbow_p = (klxbow_t *)find_component(brd, NULL, KLSTRUCT_XBOW);
66 if (!xbow_p)
67 return -ENODEV;
68
69 /*
70 * Okay, here's a xbow. Lets arbitrate and find
71 * out if we should initialize it. Set enabled
72 * hub connected at highest or lowest widget as
73 * master.
74 */
75#ifdef WIDGET_A
76 i = HUB_WIDGET_ID_MAX + 1;
77 do {
78 i--;
79 } while ((!XBOW_PORT_TYPE_HUB(xbow_p, i)) ||
80 (!XBOW_PORT_IS_ENABLED(xbow_p, i)));
81#else
82 i = HUB_WIDGET_ID_MIN - 1;
83 do {
84 i++;
85 } while ((!XBOW_PORT_TYPE_HUB(xbow_p, i)) ||
86 (!XBOW_PORT_IS_ENABLED(xbow_p, i)));
87#endif
88
89 masterwid = i;
90 if (nasid != XBOW_PORT_NASID(xbow_p, i))
91 return 1;
92
93 for (i = HUB_WIDGET_ID_MIN; i <= HUB_WIDGET_ID_MAX; i++) {
94 if (XBOW_PORT_IS_ENABLED(xbow_p, i) &&
95 XBOW_PORT_TYPE_IO(xbow_p, i))
96 probe_one_port(nasid, i, masterwid);
97 }
98
99 return 0;
100}
101
102void __init xtalk_probe_node(cnodeid_t nid)
103{
104 volatile u64 hubreg;
105 nasid_t nasid;
106 xwidget_part_num_t partnum;
107 widgetreg_t widget_id;
108
109 nasid = COMPACT_TO_NASID_NODEID(nid);
110 hubreg = REMOTE_HUB_L(nasid, IIO_LLP_CSR);
111
112 /* check whether the link is up */
113 if (!(hubreg & IIO_LLP_CSR_IS_UP))
114 return;
115
116 widget_id = *(volatile widgetreg_t *)
117 (RAW_NODE_SWIN_BASE(nasid, 0x0) + WIDGET_ID);
118 partnum = XWIDGET_PART_NUM(widget_id);
119
120 printk(KERN_INFO "Cpu %d, Nasid 0x%x: partnum 0x%x is ",
121 smp_processor_id(), nasid, partnum);
122
123 switch (partnum) {
124 case BRIDGE_WIDGET_PART_NUM:
125 bridge_probe(nasid, 0x8, 0xa);
126 break;
127 case XBOW_WIDGET_PART_NUM:
128 case XXBOW_WIDGET_PART_NUM:
129 xbow_probe(nasid);
130 break;
131 default:
132 printk(" unknown widget??\n");
133 break;
134 }
135}
diff --git a/arch/mips/sgi-ip32/Makefile b/arch/mips/sgi-ip32/Makefile
new file mode 100644
index 000000000000..470898f4afe1
--- /dev/null
+++ b/arch/mips/sgi-ip32/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for the SGI specific kernel interface routines
3# under Linux.
4#
5
6obj-y += ip32-berr.o ip32-irq.o ip32-irq-glue.o ip32-setup.o ip32-reset.o \
7 crime.o ip32-memory.o
8
9EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/sgi-ip32/crime.c b/arch/mips/sgi-ip32/crime.c
new file mode 100644
index 000000000000..eb3a16a04fee
--- /dev/null
+++ b/arch/mips/sgi-ip32/crime.c
@@ -0,0 +1,103 @@
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) 2001, 2003 Keith M Wesolowski
7 * Copyright (C) 2005 Ilya A. Volynets <ilya@total-knowledge.com>
8 */
9#include <linux/types.h>
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/interrupt.h>
13#include <asm/bootinfo.h>
14#include <asm/io.h>
15#include <asm/mipsregs.h>
16#include <asm/ptrace.h>
17#include <asm/page.h>
18#include <asm/ip32/crime.h>
19#include <asm/ip32/mace.h>
20
21struct sgi_crime *crime;
22struct sgi_mace *mace;
23
24void __init crime_init(void)
25{
26 unsigned int id, rev;
27 const int field = 2 * sizeof(unsigned long);
28
29 set_io_port_base((unsigned long) ioremap(MACEPCI_LOW_IO, 0x2000000));
30 crime = ioremap(CRIME_BASE, sizeof(struct sgi_crime));
31 mace = ioremap(MACE_BASE, sizeof(struct sgi_mace));
32
33 id = crime->id;
34 rev = id & CRIME_ID_REV;
35 id = (id & CRIME_ID_IDBITS) >> 4;
36 printk (KERN_INFO "CRIME id %1x rev %d at 0x%0*lx\n",
37 id, rev, field, (unsigned long) CRIME_BASE);
38}
39
40irqreturn_t
41crime_memerr_intr (unsigned int irq, void *dev_id, struct pt_regs *regs)
42{
43 unsigned long stat, addr;
44 int fatal = 0;
45
46 stat = crime->mem_error_stat & CRIME_MEM_ERROR_STAT_MASK;
47 addr = crime->mem_error_addr & CRIME_MEM_ERROR_ADDR_MASK;
48
49 printk("CRIME memory error at 0x%08lx ST 0x%08lx<", addr, stat);
50
51 if (stat & CRIME_MEM_ERROR_INV)
52 printk("INV,");
53 if (stat & CRIME_MEM_ERROR_ECC) {
54 unsigned long ecc_syn =
55 crime->mem_ecc_syn & CRIME_MEM_ERROR_ECC_SYN_MASK;
56 unsigned long ecc_gen =
57 crime->mem_ecc_chk & CRIME_MEM_ERROR_ECC_CHK_MASK;
58 printk("ECC,SYN=0x%08lx,GEN=0x%08lx,", ecc_syn, ecc_gen);
59 }
60 if (stat & CRIME_MEM_ERROR_MULTIPLE) {
61 fatal = 1;
62 printk("MULTIPLE,");
63 }
64 if (stat & CRIME_MEM_ERROR_HARD_ERR) {
65 fatal = 1;
66 printk("HARD,");
67 }
68 if (stat & CRIME_MEM_ERROR_SOFT_ERR)
69 printk("SOFT,");
70 if (stat & CRIME_MEM_ERROR_CPU_ACCESS)
71 printk("CPU,");
72 if (stat & CRIME_MEM_ERROR_VICE_ACCESS)
73 printk("VICE,");
74 if (stat & CRIME_MEM_ERROR_GBE_ACCESS)
75 printk("GBE,");
76 if (stat & CRIME_MEM_ERROR_RE_ACCESS)
77 printk("RE,REID=0x%02lx,", (stat & CRIME_MEM_ERROR_RE_ID)>>8);
78 if (stat & CRIME_MEM_ERROR_MACE_ACCESS)
79 printk("MACE,MACEID=0x%02lx,", stat & CRIME_MEM_ERROR_MACE_ID);
80
81 crime->mem_error_stat = 0;
82
83 if (fatal) {
84 printk("FATAL>\n");
85 panic("Fatal memory error.");
86 } else
87 printk("NONFATAL>\n");
88
89 return IRQ_HANDLED;
90}
91
92irqreturn_t
93crime_cpuerr_intr (unsigned int irq, void *dev_id, struct pt_regs *regs)
94{
95 unsigned long stat = crime->cpu_error_stat & CRIME_CPU_ERROR_MASK;
96 unsigned long addr = crime->cpu_error_addr & CRIME_CPU_ERROR_ADDR_MASK;
97
98 addr <<= 2;
99 printk ("CRIME CPU error at 0x%09lx status 0x%08lx\n", addr, stat);
100 crime->cpu_error_stat = 0;
101
102 return IRQ_HANDLED;
103}
diff --git a/arch/mips/sgi-ip32/ip32-berr.c b/arch/mips/sgi-ip32/ip32-berr.c
new file mode 100644
index 000000000000..a278e918a019
--- /dev/null
+++ b/arch/mips/sgi-ip32/ip32-berr.c
@@ -0,0 +1,36 @@
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) 1994, 1995, 1996, 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 by Silicon Graphics
8 * Copyright (C) 2002 Maciej W. Rozycki
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/sched.h>
13#include <asm/traps.h>
14#include <asm/uaccess.h>
15#include <asm/addrspace.h>
16#include <asm/ptrace.h>
17#include <asm/tlbdebug.h>
18
19int ip32_be_handler(struct pt_regs *regs, int is_fixup)
20{
21 int data = regs->cp0_cause & 4;
22
23 if (is_fixup)
24 return MIPS_BE_FIXUP;
25
26 printk("Got %cbe at 0x%lx\n", data ? 'd' : 'i', regs->cp0_epc);
27 show_regs(regs);
28 dump_tlb_all();
29 while(1);
30 force_sig(SIGBUS, current);
31}
32
33void __init ip32_be_init(void)
34{
35 board_be_handler = ip32_be_handler;
36}
diff --git a/arch/mips/sgi-ip32/ip32-irq-glue.S b/arch/mips/sgi-ip32/ip32-irq-glue.S
new file mode 100644
index 000000000000..200924e1c4f5
--- /dev/null
+++ b/arch/mips/sgi-ip32/ip32-irq-glue.S
@@ -0,0 +1,86 @@
1/*
2 * Low level interrupt handler for the SGI O2 aka IP32 aka Moosehead
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2000 Harald Koerfgen
9 * Copyright (C) 2001 Keith M Wesolowski
10 */
11#include <asm/asm.h>
12#include <asm/regdef.h>
13#include <asm/mipsregs.h>
14#include <asm/stackframe.h>
15#include <asm/addrspace.h>
16
17 .text
18 .set noreorder
19 .set noat
20 .align 5
21 NESTED(ip32_handle_int, PT_SIZE, ra)
22 .set noat
23 SAVE_ALL
24 CLI # TEST: interrupts should be off
25 .set at
26 .set noreorder
27
28 mfc0 s0,CP0_CAUSE
29
30 andi t1, s0, IE_IRQ0
31 bnez t1, handle_irq0
32 andi t1, s0, IE_IRQ1
33 bnez t1, handle_irq1
34 andi t1, s0, IE_IRQ2
35 bnez t1, handle_irq2
36 andi t1, s0, IE_IRQ3
37 bnez t1, handle_irq3
38 andi t1, s0, IE_IRQ4
39 bnez t1, handle_irq4
40 andi t1, s0, IE_IRQ5
41 bnez t1, handle_irq5
42 nop
43
44 /* Either someone has triggered the "software interrupts"
45 * or we lost an interrupt somehow. Ignore it.
46 */
47 j ret_from_irq
48 nop
49
50handle_irq0:
51 jal ip32_irq0
52 move a0, sp
53 j ret_from_irq
54 nop
55
56handle_irq1:
57 jal ip32_irq1
58 move a0, sp
59 j ret_from_irq
60 nop
61
62handle_irq2:
63 jal ip32_irq2
64 move a0, sp
65 j ret_from_irq
66 nop
67
68handle_irq3:
69 jal ip32_irq3
70 move a0, sp
71 j ret_from_irq
72 nop
73
74handle_irq4:
75 jal ip32_irq4
76 move a0, sp
77 j ret_from_irq
78 nop
79
80handle_irq5:
81 jal ip32_irq5
82 move a0, sp
83 j ret_from_irq
84 nop
85
86 END(ip32_handle_int)
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
new file mode 100644
index 000000000000..fc3a8e90d763
--- /dev/null
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -0,0 +1,590 @@
1/*
2 * Code to handle IP32 IRQs
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2000 Harald Koerfgen
9 * Copyright (C) 2001 Keith M Wesolowski
10 */
11#include <linux/init.h>
12#include <linux/kernel_stat.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/irq.h>
16#include <linux/bitops.h>
17#include <linux/kernel.h>
18#include <linux/slab.h>
19#include <linux/mm.h>
20#include <linux/random.h>
21#include <linux/sched.h>
22
23#include <asm/mipsregs.h>
24#include <asm/signal.h>
25#include <asm/system.h>
26#include <asm/time.h>
27#include <asm/ip32/crime.h>
28#include <asm/ip32/mace.h>
29#include <asm/ip32/ip32_ints.h>
30
31/* issue a PIO read to make sure no PIO writes are pending */
32static void inline flush_crime_bus(void)
33{
34 volatile unsigned long junk = crime->control;
35}
36
37static void inline flush_mace_bus(void)
38{
39 volatile unsigned long junk = mace->perif.ctrl.misc;
40}
41
42#undef DEBUG_IRQ
43#ifdef DEBUG_IRQ
44#define DBG(x...) printk(x)
45#else
46#define DBG(x...)
47#endif
48
49/* O2 irq map
50 *
51 * IP0 -> software (ignored)
52 * IP1 -> software (ignored)
53 * IP2 -> (irq0) C crime 1.1 all interrupts; crime 1.5 ???
54 * IP3 -> (irq1) X unknown
55 * IP4 -> (irq2) X unknown
56 * IP5 -> (irq3) X unknown
57 * IP6 -> (irq4) X unknown
58 * IP7 -> (irq5) 0 CPU count/compare timer (system timer)
59 *
60 * crime: (C)
61 *
62 * CRIME_INT_STAT 31:0:
63 *
64 * 0 -> 1 Video in 1
65 * 1 -> 2 Video in 2
66 * 2 -> 3 Video out
67 * 3 -> 4 Mace ethernet
68 * 4 -> S SuperIO sub-interrupt
69 * 5 -> M Miscellaneous sub-interrupt
70 * 6 -> A Audio sub-interrupt
71 * 7 -> 8 PCI bridge errors
72 * 8 -> 9 PCI SCSI aic7xxx 0
73 * 9 -> 10 PCI SCSI aic7xxx 1
74 * 10 -> 11 PCI slot 0
75 * 11 -> 12 unused (PCI slot 1)
76 * 12 -> 13 unused (PCI slot 2)
77 * 13 -> 14 unused (PCI shared 0)
78 * 14 -> 15 unused (PCI shared 1)
79 * 15 -> 16 unused (PCI shared 2)
80 * 16 -> 17 GBE0 (E)
81 * 17 -> 18 GBE1 (E)
82 * 18 -> 19 GBE2 (E)
83 * 19 -> 20 GBE3 (E)
84 * 20 -> 21 CPU errors
85 * 21 -> 22 Memory errors
86 * 22 -> 23 RE empty edge (E)
87 * 23 -> 24 RE full edge (E)
88 * 24 -> 25 RE idle edge (E)
89 * 25 -> 26 RE empty level
90 * 26 -> 27 RE full level
91 * 27 -> 28 RE idle level
92 * 28 -> 29 unused (software 0) (E)
93 * 29 -> 30 unused (software 1) (E)
94 * 30 -> 31 unused (software 2) - crime 1.5 CPU SysCorError (E)
95 * 31 -> 32 VICE
96 *
97 * S, M, A: Use the MACE ISA interrupt register
98 * MACE_ISA_INT_STAT 31:0
99 *
100 * 0-7 -> 33-40 Audio
101 * 8 -> 41 RTC
102 * 9 -> 42 Keyboard
103 * 10 -> X Keyboard polled
104 * 11 -> 44 Mouse
105 * 12 -> X Mouse polled
106 * 13-15 -> 46-48 Count/compare timers
107 * 16-19 -> 49-52 Parallel (16 E)
108 * 20-25 -> 53-58 Serial 1 (22 E)
109 * 26-31 -> 59-64 Serial 2 (28 E)
110 *
111 * Note that this means IRQs 5-7, 43, and 45 do not exist. This is a
112 * different IRQ map than IRIX uses, but that's OK as Linux irq handling
113 * is quite different anyway.
114 */
115
116/*
117 * IRQ spinlock - Ralf says not to disable CPU interrupts,
118 * and I think he knows better.
119 */
120static DEFINE_SPINLOCK(ip32_irq_lock);
121
122/* Some initial interrupts to set up */
123extern irqreturn_t crime_memerr_intr (int irq, void *dev_id,
124 struct pt_regs *regs);
125extern irqreturn_t crime_cpuerr_intr (int irq, void *dev_id,
126 struct pt_regs *regs);
127
128struct irqaction memerr_irq = { crime_memerr_intr, SA_INTERRUPT,
129 CPU_MASK_NONE, "CRIME memory error", NULL, NULL };
130struct irqaction cpuerr_irq = { crime_cpuerr_intr, SA_INTERRUPT,
131 CPU_MASK_NONE, "CRIME CPU error", NULL, NULL };
132
133extern void ip32_handle_int(void);
134
135/*
136 * For interrupts wired from a single device to the CPU. Only the clock
137 * uses this it seems, which is IRQ 0 and IP7.
138 */
139
140static void enable_cpu_irq(unsigned int irq)
141{
142 set_c0_status(STATUSF_IP7);
143}
144
145static unsigned int startup_cpu_irq(unsigned int irq)
146{
147 enable_cpu_irq(irq);
148 return 0;
149}
150
151static void disable_cpu_irq(unsigned int irq)
152{
153 clear_c0_status(STATUSF_IP7);
154}
155
156static void end_cpu_irq(unsigned int irq)
157{
158 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
159 enable_cpu_irq (irq);
160}
161
162#define shutdown_cpu_irq disable_cpu_irq
163#define mask_and_ack_cpu_irq disable_cpu_irq
164
165static struct hw_interrupt_type ip32_cpu_interrupt = {
166 "IP32 CPU",
167 startup_cpu_irq,
168 shutdown_cpu_irq,
169 enable_cpu_irq,
170 disable_cpu_irq,
171 mask_and_ack_cpu_irq,
172 end_cpu_irq,
173 NULL
174};
175
176/*
177 * This is for pure CRIME interrupts - ie not MACE. The advantage?
178 * We get to split the register in half and do faster lookups.
179 */
180
181static uint64_t crime_mask;
182
183static void enable_crime_irq(unsigned int irq)
184{
185 unsigned long flags;
186
187 spin_lock_irqsave(&ip32_irq_lock, flags);
188 crime_mask |= 1 << (irq - 1);
189 crime->imask = crime_mask;
190 spin_unlock_irqrestore(&ip32_irq_lock, flags);
191}
192
193static unsigned int startup_crime_irq(unsigned int irq)
194{
195 enable_crime_irq(irq);
196 return 0; /* This is probably not right; we could have pending irqs */
197}
198
199static void disable_crime_irq(unsigned int irq)
200{
201 unsigned long flags;
202
203 spin_lock_irqsave(&ip32_irq_lock, flags);
204 crime_mask &= ~(1 << (irq - 1));
205 crime->imask = crime_mask;
206 flush_crime_bus();
207 spin_unlock_irqrestore(&ip32_irq_lock, flags);
208}
209
210static void mask_and_ack_crime_irq(unsigned int irq)
211{
212 unsigned long flags;
213
214 /* Edge triggered interrupts must be cleared. */
215 if ((irq >= CRIME_GBE0_IRQ && irq <= CRIME_GBE3_IRQ)
216 || (irq >= CRIME_RE_EMPTY_E_IRQ && irq <= CRIME_RE_IDLE_E_IRQ)
217 || (irq >= CRIME_SOFT0_IRQ && irq <= CRIME_SOFT2_IRQ)) {
218 uint64_t crime_int;
219 spin_lock_irqsave(&ip32_irq_lock, flags);
220 crime_int = crime->hard_int;
221 crime_int &= ~(1 << (irq - 1));
222 crime->hard_int = crime_int;
223 spin_unlock_irqrestore(&ip32_irq_lock, flags);
224 }
225 disable_crime_irq(irq);
226}
227
228static void end_crime_irq(unsigned int irq)
229{
230 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
231 enable_crime_irq(irq);
232}
233
234#define shutdown_crime_irq disable_crime_irq
235
236static struct hw_interrupt_type ip32_crime_interrupt = {
237 "IP32 CRIME",
238 startup_crime_irq,
239 shutdown_crime_irq,
240 enable_crime_irq,
241 disable_crime_irq,
242 mask_and_ack_crime_irq,
243 end_crime_irq,
244 NULL
245};
246
247/*
248 * This is for MACE PCI interrupts. We can decrease bus traffic by masking
249 * as close to the source as possible. This also means we can take the
250 * next chunk of the CRIME register in one piece.
251 */
252
253static unsigned long macepci_mask;
254
255static void enable_macepci_irq(unsigned int irq)
256{
257 unsigned long flags;
258
259 spin_lock_irqsave(&ip32_irq_lock, flags);
260 macepci_mask |= MACEPCI_CONTROL_INT(irq - 9);
261 mace->pci.control = macepci_mask;
262 crime_mask |= 1 << (irq - 1);
263 crime->imask = crime_mask;
264 spin_unlock_irqrestore(&ip32_irq_lock, flags);
265}
266
267static unsigned int startup_macepci_irq(unsigned int irq)
268{
269 enable_macepci_irq (irq);
270 return 0;
271}
272
273static void disable_macepci_irq(unsigned int irq)
274{
275 unsigned long flags;
276
277 spin_lock_irqsave(&ip32_irq_lock, flags);
278 crime_mask &= ~(1 << (irq - 1));
279 crime->imask = crime_mask;
280 flush_crime_bus();
281 macepci_mask &= ~MACEPCI_CONTROL_INT(irq - 9);
282 mace->pci.control = macepci_mask;
283 flush_mace_bus();
284 spin_unlock_irqrestore(&ip32_irq_lock, flags);
285}
286
287static void end_macepci_irq(unsigned int irq)
288{
289 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
290 enable_macepci_irq(irq);
291}
292
293#define shutdown_macepci_irq disable_macepci_irq
294#define mask_and_ack_macepci_irq disable_macepci_irq
295
296static struct hw_interrupt_type ip32_macepci_interrupt = {
297 "IP32 MACE PCI",
298 startup_macepci_irq,
299 shutdown_macepci_irq,
300 enable_macepci_irq,
301 disable_macepci_irq,
302 mask_and_ack_macepci_irq,
303 end_macepci_irq,
304 NULL
305};
306
307/* This is used for MACE ISA interrupts. That means bits 4-6 in the
308 * CRIME register.
309 */
310
311#define MACEISA_AUDIO_INT (MACEISA_AUDIO_SW_INT | \
312 MACEISA_AUDIO_SC_INT | \
313 MACEISA_AUDIO1_DMAT_INT | \
314 MACEISA_AUDIO1_OF_INT | \
315 MACEISA_AUDIO2_DMAT_INT | \
316 MACEISA_AUDIO2_MERR_INT | \
317 MACEISA_AUDIO3_DMAT_INT | \
318 MACEISA_AUDIO3_MERR_INT)
319#define MACEISA_MISC_INT (MACEISA_RTC_INT | \
320 MACEISA_KEYB_INT | \
321 MACEISA_KEYB_POLL_INT | \
322 MACEISA_MOUSE_INT | \
323 MACEISA_MOUSE_POLL_INT | \
324 MACEISA_TIMER0_INT | \
325 MACEISA_TIMER1_INT | \
326 MACEISA_TIMER2_INT)
327#define MACEISA_SUPERIO_INT (MACEISA_PARALLEL_INT | \
328 MACEISA_PAR_CTXA_INT | \
329 MACEISA_PAR_CTXB_INT | \
330 MACEISA_PAR_MERR_INT | \
331 MACEISA_SERIAL1_INT | \
332 MACEISA_SERIAL1_TDMAT_INT | \
333 MACEISA_SERIAL1_TDMAPR_INT | \
334 MACEISA_SERIAL1_TDMAME_INT | \
335 MACEISA_SERIAL1_RDMAT_INT | \
336 MACEISA_SERIAL1_RDMAOR_INT | \
337 MACEISA_SERIAL2_INT | \
338 MACEISA_SERIAL2_TDMAT_INT | \
339 MACEISA_SERIAL2_TDMAPR_INT | \
340 MACEISA_SERIAL2_TDMAME_INT | \
341 MACEISA_SERIAL2_RDMAT_INT | \
342 MACEISA_SERIAL2_RDMAOR_INT)
343
344static unsigned long maceisa_mask;
345
346static void enable_maceisa_irq (unsigned int irq)
347{
348 unsigned int crime_int = 0;
349 unsigned long flags;
350
351 DBG ("maceisa enable: %u\n", irq);
352
353 switch (irq) {
354 case MACEISA_AUDIO_SW_IRQ ... MACEISA_AUDIO3_MERR_IRQ:
355 crime_int = MACE_AUDIO_INT;
356 break;
357 case MACEISA_RTC_IRQ ... MACEISA_TIMER2_IRQ:
358 crime_int = MACE_MISC_INT;
359 break;
360 case MACEISA_PARALLEL_IRQ ... MACEISA_SERIAL2_RDMAOR_IRQ:
361 crime_int = MACE_SUPERIO_INT;
362 break;
363 }
364 DBG ("crime_int %08x enabled\n", crime_int);
365 spin_lock_irqsave(&ip32_irq_lock, flags);
366 crime_mask |= crime_int;
367 crime->imask = crime_mask;
368 maceisa_mask |= 1 << (irq - 33);
369 mace->perif.ctrl.imask = maceisa_mask;
370 spin_unlock_irqrestore(&ip32_irq_lock, flags);
371}
372
373static unsigned int startup_maceisa_irq(unsigned int irq)
374{
375 enable_maceisa_irq(irq);
376 return 0;
377}
378
379static void disable_maceisa_irq(unsigned int irq)
380{
381 unsigned int crime_int = 0;
382 unsigned long flags;
383
384 spin_lock_irqsave(&ip32_irq_lock, flags);
385 maceisa_mask &= ~(1 << (irq - 33));
386 if(!(maceisa_mask & MACEISA_AUDIO_INT))
387 crime_int |= MACE_AUDIO_INT;
388 if(!(maceisa_mask & MACEISA_MISC_INT))
389 crime_int |= MACE_MISC_INT;
390 if(!(maceisa_mask & MACEISA_SUPERIO_INT))
391 crime_int |= MACE_SUPERIO_INT;
392 crime_mask &= ~crime_int;
393 crime->imask = crime_mask;
394 flush_crime_bus();
395 mace->perif.ctrl.imask = maceisa_mask;
396 flush_mace_bus();
397 spin_unlock_irqrestore(&ip32_irq_lock, flags);
398}
399
400static void mask_and_ack_maceisa_irq(unsigned int irq)
401{
402 unsigned long mace_int, flags;
403
404 switch (irq) {
405 case MACEISA_PARALLEL_IRQ:
406 case MACEISA_SERIAL1_TDMAPR_IRQ:
407 case MACEISA_SERIAL2_TDMAPR_IRQ:
408 /* edge triggered */
409 spin_lock_irqsave(&ip32_irq_lock, flags);
410 mace_int = mace->perif.ctrl.istat;
411 mace_int &= ~(1 << (irq - 33));
412 mace->perif.ctrl.istat = mace_int;
413 spin_unlock_irqrestore(&ip32_irq_lock, flags);
414 break;
415 }
416 disable_maceisa_irq(irq);
417}
418
419static void end_maceisa_irq(unsigned irq)
420{
421 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
422 enable_maceisa_irq(irq);
423}
424
425#define shutdown_maceisa_irq disable_maceisa_irq
426
427static struct hw_interrupt_type ip32_maceisa_interrupt = {
428 "IP32 MACE ISA",
429 startup_maceisa_irq,
430 shutdown_maceisa_irq,
431 enable_maceisa_irq,
432 disable_maceisa_irq,
433 mask_and_ack_maceisa_irq,
434 end_maceisa_irq,
435 NULL
436};
437
438/* This is used for regular non-ISA, non-PCI MACE interrupts. That means
439 * bits 0-3 and 7 in the CRIME register.
440 */
441
442static void enable_mace_irq(unsigned int irq)
443{
444 unsigned long flags;
445
446 spin_lock_irqsave(&ip32_irq_lock, flags);
447 crime_mask |= 1 << (irq - 1);
448 crime->imask = crime_mask;
449 spin_unlock_irqrestore(&ip32_irq_lock, flags);
450}
451
452static unsigned int startup_mace_irq(unsigned int irq)
453{
454 enable_mace_irq(irq);
455 return 0;
456}
457
458static void disable_mace_irq(unsigned int irq)
459{
460 unsigned long flags;
461
462 spin_lock_irqsave(&ip32_irq_lock, flags);
463 crime_mask &= ~(1 << (irq - 1));
464 crime->imask = crime_mask;
465 flush_crime_bus();
466 spin_unlock_irqrestore(&ip32_irq_lock, flags);
467}
468
469static void end_mace_irq(unsigned int irq)
470{
471 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
472 enable_mace_irq(irq);
473}
474
475#define shutdown_mace_irq disable_mace_irq
476#define mask_and_ack_mace_irq disable_mace_irq
477
478static struct hw_interrupt_type ip32_mace_interrupt = {
479 "IP32 MACE",
480 startup_mace_irq,
481 shutdown_mace_irq,
482 enable_mace_irq,
483 disable_mace_irq,
484 mask_and_ack_mace_irq,
485 end_mace_irq,
486 NULL
487};
488
489static void ip32_unknown_interrupt(struct pt_regs *regs)
490{
491 printk ("Unknown interrupt occurred!\n");
492 printk ("cp0_status: %08x\n", read_c0_status());
493 printk ("cp0_cause: %08x\n", read_c0_cause());
494 printk ("CRIME intr mask: %016lx\n", crime->imask);
495 printk ("CRIME intr status: %016lx\n", crime->istat);
496 printk ("CRIME hardware intr register: %016lx\n", crime->hard_int);
497 printk ("MACE ISA intr mask: %08lx\n", mace->perif.ctrl.imask);
498 printk ("MACE ISA intr status: %08lx\n", mace->perif.ctrl.istat);
499 printk ("MACE PCI control register: %08x\n", mace->pci.control);
500
501 printk("Register dump:\n");
502 show_regs(regs);
503
504 printk("Please mail this report to linux-mips@linux-mips.org\n");
505 printk("Spinning...");
506 while(1) ;
507}
508
509/* CRIME 1.1 appears to deliver all interrupts to this one pin. */
510/* change this to loop over all edge-triggered irqs, exception masked out ones */
511void ip32_irq0(struct pt_regs *regs)
512{
513 uint64_t crime_int;
514 int irq = 0;
515
516 crime_int = crime->istat & crime_mask;
517 irq = ffs(crime_int);
518 crime_int = 1 << (irq - 1);
519
520 if (crime_int & CRIME_MACEISA_INT_MASK) {
521 unsigned long mace_int = mace->perif.ctrl.istat;
522 irq = ffs(mace_int & maceisa_mask) + 32;
523 }
524 DBG("*irq %u*\n", irq);
525 do_IRQ(irq, regs);
526}
527
528void ip32_irq1(struct pt_regs *regs)
529{
530 ip32_unknown_interrupt(regs);
531}
532
533void ip32_irq2(struct pt_regs *regs)
534{
535 ip32_unknown_interrupt(regs);
536}
537
538void ip32_irq3(struct pt_regs *regs)
539{
540 ip32_unknown_interrupt(regs);
541}
542
543void ip32_irq4(struct pt_regs *regs)
544{
545 ip32_unknown_interrupt(regs);
546}
547
548void ip32_irq5(struct pt_regs *regs)
549{
550 ll_timer_interrupt(IP32_R4K_TIMER_IRQ, regs);
551}
552
553void __init arch_init_irq(void)
554{
555 unsigned int irq;
556
557 /* Install our interrupt handler, then clear and disable all
558 * CRIME and MACE interrupts. */
559 crime->imask = 0;
560 crime->hard_int = 0;
561 crime->soft_int = 0;
562 mace->perif.ctrl.istat = 0;
563 mace->perif.ctrl.imask = 0;
564 set_except_vector(0, ip32_handle_int);
565
566 for (irq = 0; irq <= IP32_IRQ_MAX; irq++) {
567 hw_irq_controller *controller;
568
569 if (irq == IP32_R4K_TIMER_IRQ)
570 controller = &ip32_cpu_interrupt;
571 else if (irq <= MACE_PCI_BRIDGE_IRQ && irq >= MACE_VID_IN1_IRQ)
572 controller = &ip32_mace_interrupt;
573 else if (irq <= MACEPCI_SHARED2_IRQ && irq >= MACEPCI_SCSI0_IRQ)
574 controller = &ip32_macepci_interrupt;
575 else if (irq <= CRIME_VICE_IRQ && irq >= CRIME_GBE0_IRQ)
576 controller = &ip32_crime_interrupt;
577 else
578 controller = &ip32_maceisa_interrupt;
579
580 irq_desc[irq].status = IRQ_DISABLED;
581 irq_desc[irq].action = 0;
582 irq_desc[irq].depth = 0;
583 irq_desc[irq].handler = controller;
584 }
585 setup_irq(CRIME_MEMERR_IRQ, &memerr_irq);
586 setup_irq(CRIME_CPUERR_IRQ, &cpuerr_irq);
587
588#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
589 change_c0_status(ST0_IM, ALLINTS);
590}
diff --git a/arch/mips/sgi-ip32/ip32-memory.c b/arch/mips/sgi-ip32/ip32-memory.c
new file mode 100644
index 000000000000..fc76ca92bab9
--- /dev/null
+++ b/arch/mips/sgi-ip32/ip32-memory.c
@@ -0,0 +1,49 @@
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) 2003 Keith M Wesolowski
7 * Copyright (C) 2005 Ilya A. Volynets (Total Knowledge)
8 */
9#include <linux/types.h>
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/mm.h>
13
14#include <asm/ip32/crime.h>
15#include <asm/bootinfo.h>
16#include <asm/page.h>
17#include <asm/pgtable.h>
18#include <asm/pgalloc.h>
19
20extern void crime_init(void);
21
22void __init prom_meminit (void)
23{
24 u64 base, size;
25 int bank;
26
27 crime_init();
28
29 for (bank=0; bank < CRIME_MAXBANKS; bank++) {
30 u64 bankctl = crime->bank_ctrl[bank];
31 base = (bankctl & CRIME_MEM_BANK_CONTROL_ADDR) << 25;
32 if (bank != 0 && base == 0)
33 continue;
34 size = (bankctl & CRIME_MEM_BANK_CONTROL_SDRAM_SIZE) ? 128 : 32;
35 size <<= 20;
36 if (base + size > (256 << 20))
37 base += CRIME_HI_MEM_BASE;
38
39 printk("CRIME MC: bank %u base 0x%016lx size %luMB\n",
40 bank, base, size);
41 add_memory_region (base, size, BOOT_MEM_RAM);
42 }
43}
44
45
46unsigned long __init prom_free_prom_memory (void)
47{
48 return 0;
49}
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
new file mode 100644
index 000000000000..281f090e48a4
--- /dev/null
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -0,0 +1,202 @@
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) 2001 Keith M Wesolowski
7 * Copyright (C) 2001 Paul Mundt
8 * Copyright (C) 2003 Guido Guenther <agx@sigxcpu.org>
9 */
10
11#include <linux/init.h>
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/notifier.h>
15#include <linux/delay.h>
16#include <linux/ds17287rtc.h>
17#include <linux/interrupt.h>
18
19#include <asm/addrspace.h>
20#include <asm/irq.h>
21#include <asm/reboot.h>
22#include <asm/system.h>
23#include <asm/wbflush.h>
24#include <asm/ip32/mace.h>
25#include <asm/ip32/crime.h>
26#include <asm/ip32/ip32_ints.h>
27
28#define POWERDOWN_TIMEOUT 120
29/*
30 * Blink frequency during reboot grace period and when paniced.
31 */
32#define POWERDOWN_FREQ (HZ / 4)
33#define PANIC_FREQ (HZ / 8)
34
35static struct timer_list power_timer, blink_timer, debounce_timer;
36static int has_paniced, shuting_down;
37
38static void ip32_machine_restart(char *command) __attribute__((noreturn));
39static void ip32_machine_halt(void) __attribute__((noreturn));
40static void ip32_machine_power_off(void) __attribute__((noreturn));
41
42static void ip32_machine_restart(char *cmd)
43{
44 crime->control = CRIME_CONTROL_HARD_RESET;
45 while (1);
46}
47
48static inline void ip32_machine_halt(void)
49{
50 ip32_machine_power_off();
51}
52
53static void ip32_machine_power_off(void)
54{
55 volatile unsigned char reg_a, xctrl_a, xctrl_b;
56
57 disable_irq(MACEISA_RTC_IRQ);
58 reg_a = CMOS_READ(RTC_REG_A);
59
60 /* setup for kickstart & wake-up (DS12287 Ref. Man. p. 19) */
61 reg_a &= ~DS_REGA_DV2;
62 reg_a |= DS_REGA_DV1;
63
64 CMOS_WRITE(reg_a | DS_REGA_DV0, RTC_REG_A);
65 wbflush();
66 xctrl_b = CMOS_READ(DS_B1_XCTRL4B)
67 | DS_XCTRL4B_ABE | DS_XCTRL4B_KFE;
68 CMOS_WRITE(xctrl_b, DS_B1_XCTRL4B);
69 xctrl_a = CMOS_READ(DS_B1_XCTRL4A) & ~DS_XCTRL4A_IFS;
70 CMOS_WRITE(xctrl_a, DS_B1_XCTRL4A);
71 wbflush();
72 /* adios amigos... */
73 CMOS_WRITE(xctrl_a | DS_XCTRL4A_PAB, DS_B1_XCTRL4A);
74 CMOS_WRITE(reg_a, RTC_REG_A);
75 wbflush();
76 while (1);
77}
78
79static void power_timeout(unsigned long data)
80{
81 ip32_machine_power_off();
82}
83
84static void blink_timeout(unsigned long data)
85{
86 unsigned long led = mace->perif.ctrl.misc ^ MACEISA_LED_RED;
87 mace->perif.ctrl.misc = led;
88 mod_timer(&blink_timer, jiffies + data);
89}
90
91static void debounce(unsigned long data)
92{
93 volatile unsigned char reg_a, reg_c, xctrl_a;
94
95 reg_c = CMOS_READ(RTC_INTR_FLAGS);
96 CMOS_WRITE(reg_a | DS_REGA_DV0, RTC_REG_A);
97 wbflush();
98 xctrl_a = CMOS_READ(DS_B1_XCTRL4A);
99 if ((xctrl_a & DS_XCTRL4A_IFS) || (reg_c & RTC_IRQF )) {
100 /* Interrupt still being sent. */
101 debounce_timer.expires = jiffies + 50;
102 add_timer(&debounce_timer);
103
104 /* clear interrupt source */
105 CMOS_WRITE(xctrl_a & ~DS_XCTRL4A_IFS, DS_B1_XCTRL4A);
106 CMOS_WRITE(reg_a & ~DS_REGA_DV0, RTC_REG_A);
107 return;
108 }
109 CMOS_WRITE(reg_a & ~DS_REGA_DV0, RTC_REG_A);
110
111 if (has_paniced)
112 ip32_machine_restart(NULL);
113
114 enable_irq(MACEISA_RTC_IRQ);
115}
116
117static inline void ip32_power_button(void)
118{
119 if (has_paniced)
120 return;
121
122 if (shuting_down || kill_proc(1, SIGINT, 1)) {
123 /* No init process or button pressed twice. */
124 ip32_machine_power_off();
125 }
126
127 shuting_down = 1;
128 blink_timer.data = POWERDOWN_FREQ;
129 blink_timeout(POWERDOWN_FREQ);
130
131 init_timer(&power_timer);
132 power_timer.function = power_timeout;
133 power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
134 add_timer(&power_timer);
135}
136
137static irqreturn_t ip32_rtc_int(int irq, void *dev_id, struct pt_regs *regs)
138{
139 volatile unsigned char reg_c;
140
141 reg_c = CMOS_READ(RTC_INTR_FLAGS);
142 if (!(reg_c & RTC_IRQF)) {
143 printk(KERN_WARNING
144 "%s: RTC IRQ without RTC_IRQF\n", __FUNCTION__);
145 }
146 /* Wait until interrupt goes away */
147 disable_irq(MACEISA_RTC_IRQ);
148 init_timer(&debounce_timer);
149 debounce_timer.function = debounce;
150 debounce_timer.expires = jiffies + 50;
151 add_timer(&debounce_timer);
152
153 printk(KERN_DEBUG "Power button pressed\n");
154 ip32_power_button();
155 return IRQ_HANDLED;
156}
157
158static int panic_event(struct notifier_block *this, unsigned long event,
159 void *ptr)
160{
161 unsigned long led;
162
163 if (has_paniced)
164 return NOTIFY_DONE;
165 has_paniced = 1;
166
167 /* turn off the green LED */
168 led = mace->perif.ctrl.misc | MACEISA_LED_GREEN;
169 mace->perif.ctrl.misc = led;
170
171 blink_timer.data = PANIC_FREQ;
172 blink_timeout(PANIC_FREQ);
173
174 return NOTIFY_DONE;
175}
176
177static struct notifier_block panic_block = {
178 .notifier_call = panic_event,
179};
180
181static __init int ip32_reboot_setup(void)
182{
183 /* turn on the green led only */
184 unsigned long led = mace->perif.ctrl.misc;
185 led |= MACEISA_LED_RED;
186 led &= ~MACEISA_LED_GREEN;
187 mace->perif.ctrl.misc = led;
188
189 _machine_restart = ip32_machine_restart;
190 _machine_halt = ip32_machine_halt;
191 _machine_power_off = ip32_machine_power_off;
192
193 init_timer(&blink_timer);
194 blink_timer.function = blink_timeout;
195 notifier_chain_register(&panic_notifier_list, &panic_block);
196
197 request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL);
198
199 return 0;
200}
201
202subsys_initcall(ip32_reboot_setup);
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
new file mode 100644
index 000000000000..8d270be58224
--- /dev/null
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -0,0 +1,159 @@
1/*
2 * IP32 basic setup
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2000 Harald Koerfgen
9 * Copyright (C) 2002, 2003, 2005 Ilya A. Volynets
10 */
11#include <linux/config.h>
12#include <linux/console.h>
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/mc146818rtc.h>
16#include <linux/param.h>
17#include <linux/sched.h>
18
19#include <asm/bootinfo.h>
20#include <asm/mc146818-time.h>
21#include <asm/mipsregs.h>
22#include <asm/mmu_context.h>
23#include <asm/sgialib.h>
24#include <asm/time.h>
25#include <asm/traps.h>
26#include <asm/io.h>
27#include <asm/ip32/crime.h>
28#include <asm/ip32/mace.h>
29#include <asm/ip32/ip32_ints.h>
30
31extern void ip32_be_init(void);
32extern void crime_init(void);
33
34#ifdef CONFIG_SGI_O2MACE_ETH
35/*
36 * This is taken care of in here 'cause they say using Arc later on is
37 * problematic
38 */
39extern char o2meth_eaddr[8];
40static inline unsigned char str2hexnum(unsigned char c)
41{
42 if (c >= '0' && c <= '9')
43 return c - '0';
44 if (c >= 'a' && c <= 'f')
45 return c - 'a' + 10;
46 return 0; /* foo */
47}
48
49static inline void str2eaddr(unsigned char *ea, unsigned char *str)
50{
51 int i;
52
53 for (i = 0; i < 6; i++) {
54 unsigned char num;
55
56 if(*str == ':')
57 str++;
58 num = str2hexnum(*str++) << 4;
59 num |= (str2hexnum(*str++));
60 ea[i] = num;
61 }
62}
63#endif
64
65#ifdef CONFIG_SERIAL_8250
66#include <linux/tty.h>
67#include <linux/serial.h>
68#include <linux/serial_core.h>
69extern int early_serial_setup(struct uart_port *port);
70
71#define STD_COM_FLAGS (ASYNC_SKIP_TEST)
72#define BASE_BAUD (1843200 / 16)
73
74#endif /* CONFIG_SERIAL_8250 */
75
76/* An arbitrary time; this can be decreased if reliability looks good */
77#define WAIT_MS 10
78
79void __init ip32_time_init(void)
80{
81 printk(KERN_INFO "Calibrating system timer... ");
82 write_c0_count(0);
83 crime->timer = 0;
84 while (crime->timer < CRIME_MASTER_FREQ * WAIT_MS / 1000) ;
85 mips_hpt_frequency = read_c0_count() * 1000 / WAIT_MS;
86 printk("%d MHz CPU detected\n", mips_hpt_frequency * 2 / 1000000);
87}
88
89void __init ip32_timer_setup(struct irqaction *irq)
90{
91 irq->handler = no_action;
92 setup_irq(IP32_R4K_TIMER_IRQ, irq);
93}
94
95static int __init ip32_setup(void)
96{
97 board_be_init = ip32_be_init;
98
99 rtc_get_time = mc146818_get_cmos_time;
100 rtc_set_mmss = mc146818_set_rtc_mmss;
101
102 board_time_init = ip32_time_init;
103 board_timer_setup = ip32_timer_setup;
104
105#ifdef CONFIG_SERIAL_8250
106 {
107 static struct uart_port o2_serial[2];
108
109 memset(o2_serial, 0, sizeof(o2_serial));
110 o2_serial[0].type = PORT_16550A;
111 o2_serial[0].line = 0;
112 o2_serial[0].irq = MACEISA_SERIAL1_IRQ;
113 o2_serial[0].flags = STD_COM_FLAGS;
114 o2_serial[0].uartclk = BASE_BAUD * 16;
115 o2_serial[0].iotype = UPIO_MEM;
116 o2_serial[0].membase = (char *)&mace->isa.serial1;
117 o2_serial[0].fifosize = 14;
118 /* How much to shift register offset by. Each UART register
119 * is replicated over 256 byte space */
120 o2_serial[0].regshift = 8;
121 o2_serial[1].type = PORT_16550A;
122 o2_serial[1].line = 1;
123 o2_serial[1].irq = MACEISA_SERIAL2_IRQ;
124 o2_serial[1].flags = STD_COM_FLAGS;
125 o2_serial[1].uartclk = BASE_BAUD * 16;
126 o2_serial[1].iotype = UPIO_MEM;
127 o2_serial[1].membase = (char *)&mace->isa.serial2;
128 o2_serial[1].fifosize = 14;
129 o2_serial[1].regshift = 8;
130
131 early_serial_setup(&o2_serial[0]);
132 early_serial_setup(&o2_serial[1]);
133 }
134#endif
135#ifdef CONFIG_SGI_O2MACE_ETH
136 {
137 char *mac = ArcGetEnvironmentVariable("eaddr");
138 str2eaddr(o2meth_eaddr, mac);
139 }
140#endif
141
142#if defined(CONFIG_SERIAL_CORE_CONSOLE)
143 {
144 char* con = ArcGetEnvironmentVariable("console");
145 if (con && *con == 'd') {
146 static char options[8];
147 char *baud = ArcGetEnvironmentVariable("dbaud");
148 if (baud)
149 strcpy(options, baud);
150 add_preferred_console("ttyS", *(con + 1) == '2' ? 1 : 0,
151 baud ? options : NULL);
152 }
153 }
154#endif
155
156 return 0;
157}
158
159early_initcall(ip32_setup);
diff --git a/arch/mips/sibyte/cfe/Makefile b/arch/mips/sibyte/cfe/Makefile
new file mode 100644
index 000000000000..059d84a1d8a8
--- /dev/null
+++ b/arch/mips/sibyte/cfe/Makefile
@@ -0,0 +1,3 @@
1lib-y = cfe_api.o setup.o
2lib-$(CONFIG_SMP) += smp.o
3lib-$(CONFIG_SIBYTE_CFE_CONSOLE) += console.o
diff --git a/arch/mips/sibyte/cfe/cfe_api.c b/arch/mips/sibyte/cfe/cfe_api.c
new file mode 100644
index 000000000000..c0213605e18a
--- /dev/null
+++ b/arch/mips/sibyte/cfe/cfe_api.c
@@ -0,0 +1,502 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/* *********************************************************************
20 *
21 * Broadcom Common Firmware Environment (CFE)
22 *
23 * Device Function stubs File: cfe_api.c
24 *
25 * This module contains device function stubs (small routines to
26 * call the standard "iocb" interface entry point to CFE).
27 * There should be one routine here per iocb function call.
28 *
29 * Authors: Mitch Lichtenberg, Chris Demetriou
30 *
31 ********************************************************************* */
32
33#include "cfe_api.h"
34#include "cfe_api_int.h"
35
36/* Cast from a native pointer to a cfe_xptr_t and back. */
37#define XPTR_FROM_NATIVE(n) ((cfe_xptr_t) (intptr_t) (n))
38#define NATIVE_FROM_XPTR(x) ((void *) (intptr_t) (x))
39
40#ifdef CFE_API_IMPL_NAMESPACE
41#define cfe_iocb_dispatch(a) __cfe_iocb_dispatch(a)
42#endif
43int cfe_iocb_dispatch(cfe_xiocb_t * xiocb);
44
45#if defined(CFE_API_common) || defined(CFE_API_ALL)
46/*
47 * Declare the dispatch function with args of "intptr_t".
48 * This makes sure whatever model we're compiling in
49 * puts the pointers in a single register. For example,
50 * combining -mlong64 and -mips1 or -mips2 would lead to
51 * trouble, since the handle and IOCB pointer will be
52 * passed in two registers each, and CFE expects one.
53 */
54
55static int (*cfe_dispfunc) (intptr_t handle, intptr_t xiocb) = 0;
56static cfe_xuint_t cfe_handle = 0;
57
58int cfe_init(cfe_xuint_t handle, cfe_xuint_t ept)
59{
60 cfe_dispfunc = NATIVE_FROM_XPTR(ept);
61 cfe_handle = handle;
62 return 0;
63}
64
65int cfe_iocb_dispatch(cfe_xiocb_t * xiocb)
66{
67 if (!cfe_dispfunc)
68 return -1;
69 return (*cfe_dispfunc) ((intptr_t) cfe_handle, (intptr_t) xiocb);
70}
71#endif /* CFE_API_common || CFE_API_ALL */
72
73#if defined(CFE_API_close) || defined(CFE_API_ALL)
74int cfe_close(int handle)
75{
76 cfe_xiocb_t xiocb;
77
78 xiocb.xiocb_fcode = CFE_CMD_DEV_CLOSE;
79 xiocb.xiocb_status = 0;
80 xiocb.xiocb_handle = handle;
81 xiocb.xiocb_flags = 0;
82 xiocb.xiocb_psize = 0;
83
84 cfe_iocb_dispatch(&xiocb);
85
86 return xiocb.xiocb_status;
87
88}
89#endif /* CFE_API_close || CFE_API_ALL */
90
91#if defined(CFE_API_cpu_start) || defined(CFE_API_ALL)
92int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1)
93{
94 cfe_xiocb_t xiocb;
95
96 xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL;
97 xiocb.xiocb_status = 0;
98 xiocb.xiocb_handle = 0;
99 xiocb.xiocb_flags = 0;
100 xiocb.xiocb_psize = sizeof(xiocb_cpuctl_t);
101 xiocb.plist.xiocb_cpuctl.cpu_number = cpu;
102 xiocb.plist.xiocb_cpuctl.cpu_command = CFE_CPU_CMD_START;
103 xiocb.plist.xiocb_cpuctl.gp_val = gp;
104 xiocb.plist.xiocb_cpuctl.sp_val = sp;
105 xiocb.plist.xiocb_cpuctl.a1_val = a1;
106 xiocb.plist.xiocb_cpuctl.start_addr = (long) fn;
107
108 cfe_iocb_dispatch(&xiocb);
109
110 return xiocb.xiocb_status;
111}
112#endif /* CFE_API_cpu_start || CFE_API_ALL */
113
114#if defined(CFE_API_cpu_stop) || defined(CFE_API_ALL)
115int cfe_cpu_stop(int cpu)
116{
117 cfe_xiocb_t xiocb;
118
119 xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL;
120 xiocb.xiocb_status = 0;
121 xiocb.xiocb_handle = 0;
122 xiocb.xiocb_flags = 0;
123 xiocb.xiocb_psize = sizeof(xiocb_cpuctl_t);
124 xiocb.plist.xiocb_cpuctl.cpu_number = cpu;
125 xiocb.plist.xiocb_cpuctl.cpu_command = CFE_CPU_CMD_STOP;
126
127 cfe_iocb_dispatch(&xiocb);
128
129 return xiocb.xiocb_status;
130}
131#endif /* CFE_API_cpu_stop || CFE_API_ALL */
132
133#if defined(CFE_API_enumenv) || defined(CFE_API_ALL)
134int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen)
135{
136 cfe_xiocb_t xiocb;
137
138 xiocb.xiocb_fcode = CFE_CMD_ENV_SET;
139 xiocb.xiocb_status = 0;
140 xiocb.xiocb_handle = 0;
141 xiocb.xiocb_flags = 0;
142 xiocb.xiocb_psize = sizeof(xiocb_envbuf_t);
143 xiocb.plist.xiocb_envbuf.enum_idx = idx;
144 xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name);
145 xiocb.plist.xiocb_envbuf.name_length = namelen;
146 xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(val);
147 xiocb.plist.xiocb_envbuf.val_length = vallen;
148
149 cfe_iocb_dispatch(&xiocb);
150
151 return xiocb.xiocb_status;
152}
153#endif /* CFE_API_enumenv || CFE_API_ALL */
154
155#if defined(CFE_API_enummem) || defined(CFE_API_ALL)
156int
157cfe_enummem(int idx, int flags, cfe_xuint_t * start, cfe_xuint_t * length,
158 cfe_xuint_t * type)
159{
160 cfe_xiocb_t xiocb;
161
162 xiocb.xiocb_fcode = CFE_CMD_FW_MEMENUM;
163 xiocb.xiocb_status = 0;
164 xiocb.xiocb_handle = 0;
165 xiocb.xiocb_flags = flags;
166 xiocb.xiocb_psize = sizeof(xiocb_meminfo_t);
167 xiocb.plist.xiocb_meminfo.mi_idx = idx;
168
169 cfe_iocb_dispatch(&xiocb);
170
171 if (xiocb.xiocb_status < 0)
172 return xiocb.xiocb_status;
173
174 *start = xiocb.plist.xiocb_meminfo.mi_addr;
175 *length = xiocb.plist.xiocb_meminfo.mi_size;
176 *type = xiocb.plist.xiocb_meminfo.mi_type;
177
178 return 0;
179}
180#endif /* CFE_API_enummem || CFE_API_ALL */
181
182#if defined(CFE_API_exit) || defined(CFE_API_ALL)
183int cfe_exit(int warm, int status)
184{
185 cfe_xiocb_t xiocb;
186
187 xiocb.xiocb_fcode = CFE_CMD_FW_RESTART;
188 xiocb.xiocb_status = 0;
189 xiocb.xiocb_handle = 0;
190 xiocb.xiocb_flags = warm ? CFE_FLG_WARMSTART : 0;
191 xiocb.xiocb_psize = sizeof(xiocb_exitstat_t);
192 xiocb.plist.xiocb_exitstat.status = status;
193
194 cfe_iocb_dispatch(&xiocb);
195
196 return xiocb.xiocb_status;
197}
198#endif /* CFE_API_exit || CFE_API_ALL */
199
200#if defined(CFE_API_flushcache) || defined(CFE_API_ALL)
201int cfe_flushcache(int flg)
202{
203 cfe_xiocb_t xiocb;
204
205 xiocb.xiocb_fcode = CFE_CMD_FW_FLUSHCACHE;
206 xiocb.xiocb_status = 0;
207 xiocb.xiocb_handle = 0;
208 xiocb.xiocb_flags = flg;
209 xiocb.xiocb_psize = 0;
210
211 cfe_iocb_dispatch(&xiocb);
212
213 return xiocb.xiocb_status;
214}
215#endif /* CFE_API_flushcache || CFE_API_ALL */
216
217#if defined(CFE_API_getdevinfo) || defined(CFE_API_ALL)
218int cfe_getdevinfo(char *name)
219{
220 cfe_xiocb_t xiocb;
221
222 xiocb.xiocb_fcode = CFE_CMD_DEV_GETINFO;
223 xiocb.xiocb_status = 0;
224 xiocb.xiocb_handle = 0;
225 xiocb.xiocb_flags = 0;
226 xiocb.xiocb_psize = sizeof(xiocb_buffer_t);
227 xiocb.plist.xiocb_buffer.buf_offset = 0;
228 xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(name);
229 xiocb.plist.xiocb_buffer.buf_length = cfe_strlen(name);
230
231 cfe_iocb_dispatch(&xiocb);
232
233 if (xiocb.xiocb_status < 0)
234 return xiocb.xiocb_status;
235 return xiocb.plist.xiocb_buffer.buf_devflags;
236}
237#endif /* CFE_API_getdevinfo || CFE_API_ALL */
238
239#if defined(CFE_API_getenv) || defined(CFE_API_ALL)
240int cfe_getenv(char *name, char *dest, int destlen)
241{
242 cfe_xiocb_t xiocb;
243
244 *dest = 0;
245
246 xiocb.xiocb_fcode = CFE_CMD_ENV_GET;
247 xiocb.xiocb_status = 0;
248 xiocb.xiocb_handle = 0;
249 xiocb.xiocb_flags = 0;
250 xiocb.xiocb_psize = sizeof(xiocb_envbuf_t);
251 xiocb.plist.xiocb_envbuf.enum_idx = 0;
252 xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name);
253 xiocb.plist.xiocb_envbuf.name_length = cfe_strlen(name);
254 xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(dest);
255 xiocb.plist.xiocb_envbuf.val_length = destlen;
256
257 cfe_iocb_dispatch(&xiocb);
258
259 return xiocb.xiocb_status;
260}
261#endif /* CFE_API_getenv || CFE_API_ALL */
262
263#if defined(CFE_API_getfwinfo) || defined(CFE_API_ALL)
264int cfe_getfwinfo(cfe_fwinfo_t * info)
265{
266 cfe_xiocb_t xiocb;
267
268 xiocb.xiocb_fcode = CFE_CMD_FW_GETINFO;
269 xiocb.xiocb_status = 0;
270 xiocb.xiocb_handle = 0;
271 xiocb.xiocb_flags = 0;
272 xiocb.xiocb_psize = sizeof(xiocb_fwinfo_t);
273
274 cfe_iocb_dispatch(&xiocb);
275
276 if (xiocb.xiocb_status < 0)
277 return xiocb.xiocb_status;
278
279 info->fwi_version = xiocb.plist.xiocb_fwinfo.fwi_version;
280 info->fwi_totalmem = xiocb.plist.xiocb_fwinfo.fwi_totalmem;
281 info->fwi_flags = xiocb.plist.xiocb_fwinfo.fwi_flags;
282 info->fwi_boardid = xiocb.plist.xiocb_fwinfo.fwi_boardid;
283 info->fwi_bootarea_va = xiocb.plist.xiocb_fwinfo.fwi_bootarea_va;
284 info->fwi_bootarea_pa = xiocb.plist.xiocb_fwinfo.fwi_bootarea_pa;
285 info->fwi_bootarea_size =
286 xiocb.plist.xiocb_fwinfo.fwi_bootarea_size;
287#if 0
288 info->fwi_reserved1 = xiocb.plist.xiocb_fwinfo.fwi_reserved1;
289 info->fwi_reserved2 = xiocb.plist.xiocb_fwinfo.fwi_reserved2;
290 info->fwi_reserved3 = xiocb.plist.xiocb_fwinfo.fwi_reserved3;
291#endif
292
293 return 0;
294}
295#endif /* CFE_API_getfwinfo || CFE_API_ALL */
296
297#if defined(CFE_API_getstdhandle) || defined(CFE_API_ALL)
298int cfe_getstdhandle(int flg)
299{
300 cfe_xiocb_t xiocb;
301
302 xiocb.xiocb_fcode = CFE_CMD_DEV_GETHANDLE;
303 xiocb.xiocb_status = 0;
304 xiocb.xiocb_handle = 0;
305 xiocb.xiocb_flags = flg;
306 xiocb.xiocb_psize = 0;
307
308 cfe_iocb_dispatch(&xiocb);
309
310 if (xiocb.xiocb_status < 0)
311 return xiocb.xiocb_status;
312 return xiocb.xiocb_handle;
313}
314#endif /* CFE_API_getstdhandle || CFE_API_ALL */
315
316#if defined(CFE_API_getticks) || defined(CFE_API_ALL)
317int64_t
318#ifdef CFE_API_IMPL_NAMESPACE
319__cfe_getticks(void)
320#else
321cfe_getticks(void)
322#endif
323{
324 cfe_xiocb_t xiocb;
325
326 xiocb.xiocb_fcode = CFE_CMD_FW_GETTIME;
327 xiocb.xiocb_status = 0;
328 xiocb.xiocb_handle = 0;
329 xiocb.xiocb_flags = 0;
330 xiocb.xiocb_psize = sizeof(xiocb_time_t);
331 xiocb.plist.xiocb_time.ticks = 0;
332
333 cfe_iocb_dispatch(&xiocb);
334
335 return xiocb.plist.xiocb_time.ticks;
336
337}
338#endif /* CFE_API_getticks || CFE_API_ALL */
339
340#if defined(CFE_API_inpstat) || defined(CFE_API_ALL)
341int cfe_inpstat(int handle)
342{
343 cfe_xiocb_t xiocb;
344
345 xiocb.xiocb_fcode = CFE_CMD_DEV_INPSTAT;
346 xiocb.xiocb_status = 0;
347 xiocb.xiocb_handle = handle;
348 xiocb.xiocb_flags = 0;
349 xiocb.xiocb_psize = sizeof(xiocb_inpstat_t);
350 xiocb.plist.xiocb_inpstat.inp_status = 0;
351
352 cfe_iocb_dispatch(&xiocb);
353
354 if (xiocb.xiocb_status < 0)
355 return xiocb.xiocb_status;
356 return xiocb.plist.xiocb_inpstat.inp_status;
357}
358#endif /* CFE_API_inpstat || CFE_API_ALL */
359
360#if defined(CFE_API_ioctl) || defined(CFE_API_ALL)
361int
362cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer,
363 int length, int *retlen, cfe_xuint_t offset)
364{
365 cfe_xiocb_t xiocb;
366
367 xiocb.xiocb_fcode = CFE_CMD_DEV_IOCTL;
368 xiocb.xiocb_status = 0;
369 xiocb.xiocb_handle = handle;
370 xiocb.xiocb_flags = 0;
371 xiocb.xiocb_psize = sizeof(xiocb_buffer_t);
372 xiocb.plist.xiocb_buffer.buf_offset = offset;
373 xiocb.plist.xiocb_buffer.buf_ioctlcmd = ioctlnum;
374 xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer);
375 xiocb.plist.xiocb_buffer.buf_length = length;
376
377 cfe_iocb_dispatch(&xiocb);
378
379 if (retlen)
380 *retlen = xiocb.plist.xiocb_buffer.buf_retlen;
381 return xiocb.xiocb_status;
382}
383#endif /* CFE_API_ioctl || CFE_API_ALL */
384
385#if defined(CFE_API_open) || defined(CFE_API_ALL)
386int cfe_open(char *name)
387{
388 cfe_xiocb_t xiocb;
389
390 xiocb.xiocb_fcode = CFE_CMD_DEV_OPEN;
391 xiocb.xiocb_status = 0;
392 xiocb.xiocb_handle = 0;
393 xiocb.xiocb_flags = 0;
394 xiocb.xiocb_psize = sizeof(xiocb_buffer_t);
395 xiocb.plist.xiocb_buffer.buf_offset = 0;
396 xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(name);
397 xiocb.plist.xiocb_buffer.buf_length = cfe_strlen(name);
398
399 cfe_iocb_dispatch(&xiocb);
400
401 if (xiocb.xiocb_status < 0)
402 return xiocb.xiocb_status;
403 return xiocb.xiocb_handle;
404}
405#endif /* CFE_API_open || CFE_API_ALL */
406
407#if defined(CFE_API_read) || defined(CFE_API_ALL)
408int cfe_read(int handle, unsigned char *buffer, int length)
409{
410 return cfe_readblk(handle, 0, buffer, length);
411}
412#endif /* CFE_API_read || CFE_API_ALL */
413
414#if defined(CFE_API_readblk) || defined(CFE_API_ALL)
415int
416cfe_readblk(int handle, cfe_xint_t offset, unsigned char *buffer,
417 int length)
418{
419 cfe_xiocb_t xiocb;
420
421 xiocb.xiocb_fcode = CFE_CMD_DEV_READ;
422 xiocb.xiocb_status = 0;
423 xiocb.xiocb_handle = handle;
424 xiocb.xiocb_flags = 0;
425 xiocb.xiocb_psize = sizeof(xiocb_buffer_t);
426 xiocb.plist.xiocb_buffer.buf_offset = offset;
427 xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer);
428 xiocb.plist.xiocb_buffer.buf_length = length;
429
430 cfe_iocb_dispatch(&xiocb);
431
432 if (xiocb.xiocb_status < 0)
433 return xiocb.xiocb_status;
434 return xiocb.plist.xiocb_buffer.buf_retlen;
435}
436#endif /* CFE_API_readblk || CFE_API_ALL */
437
438#if defined(CFE_API_setenv) || defined(CFE_API_ALL)
439int cfe_setenv(char *name, char *val)
440{
441 cfe_xiocb_t xiocb;
442
443 xiocb.xiocb_fcode = CFE_CMD_ENV_SET;
444 xiocb.xiocb_status = 0;
445 xiocb.xiocb_handle = 0;
446 xiocb.xiocb_flags = 0;
447 xiocb.xiocb_psize = sizeof(xiocb_envbuf_t);
448 xiocb.plist.xiocb_envbuf.enum_idx = 0;
449 xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name);
450 xiocb.plist.xiocb_envbuf.name_length = cfe_strlen(name);
451 xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(val);
452 xiocb.plist.xiocb_envbuf.val_length = cfe_strlen(val);
453
454 cfe_iocb_dispatch(&xiocb);
455
456 return xiocb.xiocb_status;
457}
458#endif /* CFE_API_setenv || CFE_API_ALL */
459
460#if (defined(CFE_API_strlen) || defined(CFE_API_ALL)) \
461 && !defined(CFE_API_STRLEN_CUSTOM)
462int cfe_strlen(char *name)
463{
464 int count = 0;
465
466 while (*name++)
467 count++;
468
469 return count;
470}
471#endif /* CFE_API_strlen || CFE_API_ALL */
472
473#if defined(CFE_API_write) || defined(CFE_API_ALL)
474int cfe_write(int handle, unsigned char *buffer, int length)
475{
476 return cfe_writeblk(handle, 0, buffer, length);
477}
478#endif /* CFE_API_write || CFE_API_ALL */
479
480#if defined(CFE_API_writeblk) || defined(CFE_API_ALL)
481int
482cfe_writeblk(int handle, cfe_xint_t offset, unsigned char *buffer,
483 int length)
484{
485 cfe_xiocb_t xiocb;
486
487 xiocb.xiocb_fcode = CFE_CMD_DEV_WRITE;
488 xiocb.xiocb_status = 0;
489 xiocb.xiocb_handle = handle;
490 xiocb.xiocb_flags = 0;
491 xiocb.xiocb_psize = sizeof(xiocb_buffer_t);
492 xiocb.plist.xiocb_buffer.buf_offset = offset;
493 xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer);
494 xiocb.plist.xiocb_buffer.buf_length = length;
495
496 cfe_iocb_dispatch(&xiocb);
497
498 if (xiocb.xiocb_status < 0)
499 return xiocb.xiocb_status;
500 return xiocb.plist.xiocb_buffer.buf_retlen;
501}
502#endif /* CFE_API_writeblk || CFE_API_ALL */
diff --git a/arch/mips/sibyte/cfe/cfe_api.h b/arch/mips/sibyte/cfe/cfe_api.h
new file mode 100644
index 000000000000..d8230cc53b81
--- /dev/null
+++ b/arch/mips/sibyte/cfe/cfe_api.h
@@ -0,0 +1,185 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/* *********************************************************************
20 *
21 * Broadcom Common Firmware Environment (CFE)
22 *
23 * Device function prototypes File: cfe_api.h
24 *
25 * This file contains declarations for doing callbacks to
26 * cfe from an application. It should be the only header
27 * needed by the application to use this library
28 *
29 * Authors: Mitch Lichtenberg, Chris Demetriou
30 *
31 ********************************************************************* */
32
33#ifndef CFE_API_H
34#define CFE_API_H
35
36/*
37 * Apply customizations here for different OSes. These need to:
38 * * typedef uint64_t, int64_t, intptr_t, uintptr_t.
39 * * define cfe_strlen() if use of an existing function is desired.
40 * * define CFE_API_IMPL_NAMESPACE if API functions are to use
41 * names in the implementation namespace.
42 * Also, optionally, if the build environment does not do so automatically,
43 * CFE_API_* can be defined here as desired.
44 */
45/* Begin customization. */
46#include <linux/types.h>
47#include <linux/string.h>
48
49typedef long intptr_t;
50
51#define cfe_strlen strlen
52
53#define CFE_API_ALL
54#define CFE_API_STRLEN_CUSTOM
55/* End customization. */
56
57
58/* *********************************************************************
59 * Constants
60 ********************************************************************* */
61
62/* Seal indicating CFE's presence, passed to user program. */
63#define CFE_EPTSEAL 0x43464531
64
65#define CFE_MI_RESERVED 0 /* memory is reserved, do not use */
66#define CFE_MI_AVAILABLE 1 /* memory is available */
67
68#define CFE_FLG_WARMSTART 0x00000001
69#define CFE_FLG_FULL_ARENA 0x00000001
70#define CFE_FLG_ENV_PERMANENT 0x00000001
71
72#define CFE_CPU_CMD_START 1
73#define CFE_CPU_CMD_STOP 0
74
75#define CFE_STDHANDLE_CONSOLE 0
76
77#define CFE_DEV_NETWORK 1
78#define CFE_DEV_DISK 2
79#define CFE_DEV_FLASH 3
80#define CFE_DEV_SERIAL 4
81#define CFE_DEV_CPU 5
82#define CFE_DEV_NVRAM 6
83#define CFE_DEV_CLOCK 7
84#define CFE_DEV_OTHER 8
85#define CFE_DEV_MASK 0x0F
86
87#define CFE_CACHE_FLUSH_D 1
88#define CFE_CACHE_INVAL_I 2
89#define CFE_CACHE_INVAL_D 4
90#define CFE_CACHE_INVAL_L2 8
91
92#define CFE_FWI_64BIT 0x00000001
93#define CFE_FWI_32BIT 0x00000002
94#define CFE_FWI_RELOC 0x00000004
95#define CFE_FWI_UNCACHED 0x00000008
96#define CFE_FWI_MULTICPU 0x00000010
97#define CFE_FWI_FUNCSIM 0x00000020
98#define CFE_FWI_RTLSIM 0x00000040
99
100typedef struct {
101 int64_t fwi_version; /* major, minor, eco version */
102 int64_t fwi_totalmem; /* total installed mem */
103 int64_t fwi_flags; /* various flags */
104 int64_t fwi_boardid; /* board ID */
105 int64_t fwi_bootarea_va; /* VA of boot area */
106 int64_t fwi_bootarea_pa; /* PA of boot area */
107 int64_t fwi_bootarea_size; /* size of boot area */
108} cfe_fwinfo_t;
109
110
111/*
112 * cfe_strlen is handled specially: If already defined, it has been
113 * overridden in this environment with a standard strlen-like function.
114 */
115#ifdef cfe_strlen
116# define CFE_API_STRLEN_CUSTOM
117#else
118# ifdef CFE_API_IMPL_NAMESPACE
119# define cfe_strlen(a) __cfe_strlen(a)
120# endif
121int cfe_strlen(char *name);
122#endif
123
124/*
125 * Defines and prototypes for functions which take no arguments.
126 */
127#ifdef CFE_API_IMPL_NAMESPACE
128int64_t __cfe_getticks(void);
129#define cfe_getticks() __cfe_getticks()
130#else
131int64_t cfe_getticks(void);
132#endif
133
134/*
135 * Defines and prototypes for the rest of the functions.
136 */
137#ifdef CFE_API_IMPL_NAMESPACE
138#define cfe_close(a) __cfe_close(a)
139#define cfe_cpu_start(a,b,c,d,e) __cfe_cpu_start(a,b,c,d,e)
140#define cfe_cpu_stop(a) __cfe_cpu_stop(a)
141#define cfe_enumenv(a,b,d,e,f) __cfe_enumenv(a,b,d,e,f)
142#define cfe_enummem(a,b,c,d,e) __cfe_enummem(a,b,c,d,e)
143#define cfe_exit(a,b) __cfe_exit(a,b)
144#define cfe_flushcache(a) __cfe_cacheflush(a)
145#define cfe_getdevinfo(a) __cfe_getdevinfo(a)
146#define cfe_getenv(a,b,c) __cfe_getenv(a,b,c)
147#define cfe_getfwinfo(a) __cfe_getfwinfo(a)
148#define cfe_getstdhandle(a) __cfe_getstdhandle(a)
149#define cfe_init(a,b) __cfe_init(a,b)
150#define cfe_inpstat(a) __cfe_inpstat(a)
151#define cfe_ioctl(a,b,c,d,e,f) __cfe_ioctl(a,b,c,d,e,f)
152#define cfe_open(a) __cfe_open(a)
153#define cfe_read(a,b,c) __cfe_read(a,b,c)
154#define cfe_readblk(a,b,c,d) __cfe_readblk(a,b,c,d)
155#define cfe_setenv(a,b) __cfe_setenv(a,b)
156#define cfe_write(a,b,c) __cfe_write(a,b,c)
157#define cfe_writeblk(a,b,c,d) __cfe_writeblk(a,b,c,d)
158#endif /* CFE_API_IMPL_NAMESPACE */
159
160int cfe_close(int handle);
161int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1);
162int cfe_cpu_stop(int cpu);
163int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen);
164int cfe_enummem(int idx, int flags, uint64_t * start, uint64_t * length,
165 uint64_t * type);
166int cfe_exit(int warm, int status);
167int cfe_flushcache(int flg);
168int cfe_getdevinfo(char *name);
169int cfe_getenv(char *name, char *dest, int destlen);
170int cfe_getfwinfo(cfe_fwinfo_t * info);
171int cfe_getstdhandle(int flg);
172int cfe_init(uint64_t handle, uint64_t ept);
173int cfe_inpstat(int handle);
174int cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer,
175 int length, int *retlen, uint64_t offset);
176int cfe_open(char *name);
177int cfe_read(int handle, unsigned char *buffer, int length);
178int cfe_readblk(int handle, int64_t offset, unsigned char *buffer,
179 int length);
180int cfe_setenv(char *name, char *val);
181int cfe_write(int handle, unsigned char *buffer, int length);
182int cfe_writeblk(int handle, int64_t offset, unsigned char *buffer,
183 int length);
184
185#endif /* CFE_API_H */
diff --git a/arch/mips/sibyte/cfe/cfe_api_int.h b/arch/mips/sibyte/cfe/cfe_api_int.h
new file mode 100644
index 000000000000..f7e5a64b55f3
--- /dev/null
+++ b/arch/mips/sibyte/cfe/cfe_api_int.h
@@ -0,0 +1,152 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/* *********************************************************************
20 *
21 * Broadcom Common Firmware Environment (CFE)
22 *
23 * Device function prototypes File: cfe_api_int.h
24 *
25 * This header defines all internal types and macros for the
26 * library. This is stuff that's not exported to an app
27 * using the library.
28 *
29 * Authors: Mitch Lichtenberg, Chris Demetriou
30 *
31 ********************************************************************* */
32
33#ifndef CFE_API_INT_H
34#define CFE_API_INT_H
35
36/* *********************************************************************
37 * Constants
38 ********************************************************************* */
39
40#define CFE_CMD_FW_GETINFO 0
41#define CFE_CMD_FW_RESTART 1
42#define CFE_CMD_FW_BOOT 2
43#define CFE_CMD_FW_CPUCTL 3
44#define CFE_CMD_FW_GETTIME 4
45#define CFE_CMD_FW_MEMENUM 5
46#define CFE_CMD_FW_FLUSHCACHE 6
47
48#define CFE_CMD_DEV_GETHANDLE 9
49#define CFE_CMD_DEV_ENUM 10
50#define CFE_CMD_DEV_OPEN 11
51#define CFE_CMD_DEV_INPSTAT 12
52#define CFE_CMD_DEV_READ 13
53#define CFE_CMD_DEV_WRITE 14
54#define CFE_CMD_DEV_IOCTL 15
55#define CFE_CMD_DEV_CLOSE 16
56#define CFE_CMD_DEV_GETINFO 17
57
58#define CFE_CMD_ENV_ENUM 20
59#define CFE_CMD_ENV_GET 22
60#define CFE_CMD_ENV_SET 23
61#define CFE_CMD_ENV_DEL 24
62
63#define CFE_CMD_MAX 32
64
65#define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */
66
67/* *********************************************************************
68 * Structures
69 ********************************************************************* */
70
71typedef uint64_t cfe_xuint_t;
72typedef int64_t cfe_xint_t;
73typedef int64_t cfe_xptr_t;
74
75typedef struct xiocb_buffer_s {
76 cfe_xuint_t buf_offset; /* offset on device (bytes) */
77 cfe_xptr_t buf_ptr; /* pointer to a buffer */
78 cfe_xuint_t buf_length; /* length of this buffer */
79 cfe_xuint_t buf_retlen; /* returned length (for read ops) */
80 cfe_xuint_t buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */
81} xiocb_buffer_t;
82
83#define buf_devflags buf_ioctlcmd /* returned device info flags */
84
85typedef struct xiocb_inpstat_s {
86 cfe_xuint_t inp_status; /* 1 means input available */
87} xiocb_inpstat_t;
88
89typedef struct xiocb_envbuf_s {
90 cfe_xint_t enum_idx; /* 0-based enumeration index */
91 cfe_xptr_t name_ptr; /* name string buffer */
92 cfe_xint_t name_length; /* size of name buffer */
93 cfe_xptr_t val_ptr; /* value string buffer */
94 cfe_xint_t val_length; /* size of value string buffer */
95} xiocb_envbuf_t;
96
97typedef struct xiocb_cpuctl_s {
98 cfe_xuint_t cpu_number; /* cpu number to control */
99 cfe_xuint_t cpu_command; /* command to issue to CPU */
100 cfe_xuint_t start_addr; /* CPU start address */
101 cfe_xuint_t gp_val; /* starting GP value */
102 cfe_xuint_t sp_val; /* starting SP value */
103 cfe_xuint_t a1_val; /* starting A1 value */
104} xiocb_cpuctl_t;
105
106typedef struct xiocb_time_s {
107 cfe_xint_t ticks; /* current time in ticks */
108} xiocb_time_t;
109
110typedef struct xiocb_exitstat_s {
111 cfe_xint_t status;
112} xiocb_exitstat_t;
113
114typedef struct xiocb_meminfo_s {
115 cfe_xint_t mi_idx; /* 0-based enumeration index */
116 cfe_xint_t mi_type; /* type of memory block */
117 cfe_xuint_t mi_addr; /* physical start address */
118 cfe_xuint_t mi_size; /* block size */
119} xiocb_meminfo_t;
120
121typedef struct xiocb_fwinfo_s {
122 cfe_xint_t fwi_version; /* major, minor, eco version */
123 cfe_xint_t fwi_totalmem; /* total installed mem */
124 cfe_xint_t fwi_flags; /* various flags */
125 cfe_xint_t fwi_boardid; /* board ID */
126 cfe_xint_t fwi_bootarea_va; /* VA of boot area */
127 cfe_xint_t fwi_bootarea_pa; /* PA of boot area */
128 cfe_xint_t fwi_bootarea_size; /* size of boot area */
129 cfe_xint_t fwi_reserved1;
130 cfe_xint_t fwi_reserved2;
131 cfe_xint_t fwi_reserved3;
132} xiocb_fwinfo_t;
133
134typedef struct cfe_xiocb_s {
135 cfe_xuint_t xiocb_fcode; /* IOCB function code */
136 cfe_xint_t xiocb_status; /* return status */
137 cfe_xint_t xiocb_handle; /* file/device handle */
138 cfe_xuint_t xiocb_flags; /* flags for this IOCB */
139 cfe_xuint_t xiocb_psize; /* size of parameter list */
140 union {
141 xiocb_buffer_t xiocb_buffer; /* buffer parameters */
142 xiocb_inpstat_t xiocb_inpstat; /* input status parameters */
143 xiocb_envbuf_t xiocb_envbuf; /* environment function parameters */
144 xiocb_cpuctl_t xiocb_cpuctl; /* CPU control parameters */
145 xiocb_time_t xiocb_time; /* timer parameters */
146 xiocb_meminfo_t xiocb_meminfo; /* memory arena info parameters */
147 xiocb_fwinfo_t xiocb_fwinfo; /* firmware information */
148 xiocb_exitstat_t xiocb_exitstat; /* Exit Status */
149 } plist;
150} cfe_xiocb_t;
151
152#endif /* CFE_API_INT_H */
diff --git a/arch/mips/sibyte/cfe/cfe_error.h b/arch/mips/sibyte/cfe/cfe_error.h
new file mode 100644
index 000000000000..77eb4935bfb4
--- /dev/null
+++ b/arch/mips/sibyte/cfe/cfe_error.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/* *********************************************************************
20 *
21 * Broadcom Common Firmware Environment (CFE)
22 *
23 * Error codes File: cfe_error.h
24 *
25 * CFE's global error code list is here.
26 *
27 * Author: Mitch Lichtenberg
28 *
29 ********************************************************************* */
30
31
32#define CFE_OK 0
33#define CFE_ERR -1 /* generic error */
34#define CFE_ERR_INV_COMMAND -2
35#define CFE_ERR_EOF -3
36#define CFE_ERR_IOERR -4
37#define CFE_ERR_NOMEM -5
38#define CFE_ERR_DEVNOTFOUND -6
39#define CFE_ERR_DEVOPEN -7
40#define CFE_ERR_INV_PARAM -8
41#define CFE_ERR_ENVNOTFOUND -9
42#define CFE_ERR_ENVREADONLY -10
43
44#define CFE_ERR_NOTELF -11
45#define CFE_ERR_NOT32BIT -12
46#define CFE_ERR_WRONGENDIAN -13
47#define CFE_ERR_BADELFVERS -14
48#define CFE_ERR_NOTMIPS -15
49#define CFE_ERR_BADELFFMT -16
50#define CFE_ERR_BADADDR -17
51
52#define CFE_ERR_FILENOTFOUND -18
53#define CFE_ERR_UNSUPPORTED -19
54
55#define CFE_ERR_HOSTUNKNOWN -20
56
57#define CFE_ERR_TIMEOUT -21
58
59#define CFE_ERR_PROTOCOLERR -22
60
61#define CFE_ERR_NETDOWN -23
62#define CFE_ERR_NONAMESERVER -24
63
64#define CFE_ERR_NOHANDLES -25
65#define CFE_ERR_ALREADYBOUND -26
66
67#define CFE_ERR_CANNOTSET -27
68#define CFE_ERR_NOMORE -28
69#define CFE_ERR_BADFILESYS -29
70#define CFE_ERR_FSNOTAVAIL -30
71
72#define CFE_ERR_INVBOOTBLOCK -31
73#define CFE_ERR_WRONGDEVTYPE -32
74#define CFE_ERR_BBCHECKSUM -33
75#define CFE_ERR_BOOTPROGCHKSUM -34
76
77#define CFE_ERR_LDRNOTAVAIL -35
78
79#define CFE_ERR_NOTREADY -36
80
81#define CFE_ERR_GETMEM -37
82#define CFE_ERR_SETMEM -38
83
84#define CFE_ERR_NOTCONN -39
85#define CFE_ERR_ADDRINUSE -40
diff --git a/arch/mips/sibyte/cfe/console.c b/arch/mips/sibyte/cfe/console.c
new file mode 100644
index 000000000000..53a5c1eb5611
--- /dev/null
+++ b/arch/mips/sibyte/cfe/console.c
@@ -0,0 +1,80 @@
1#include <linux/config.h>
2#include <linux/init.h>
3#include <linux/errno.h>
4#include <linux/console.h>
5
6#include <asm/sibyte/board.h>
7
8#include "cfe_api.h"
9#include "cfe_error.h"
10
11extern int cfe_cons_handle;
12
13static void cfe_console_write(struct console *cons, const char *str,
14 unsigned int count)
15{
16 int i, last, written;
17
18 for (i=0,last=0; i<count; i++) {
19 if (!str[i])
20 /* XXXKW can/should this ever happen? */
21 return;
22 if (str[i] == '\n') {
23 do {
24 written = cfe_write(cfe_cons_handle, &str[last], i-last);
25 if (written < 0)
26 ;
27 last += written;
28 } while (last < i);
29 while (cfe_write(cfe_cons_handle, "\r", 1) <= 0)
30 ;
31 }
32 }
33 if (last != count) {
34 do {
35 written = cfe_write(cfe_cons_handle, &str[last], count-last);
36 if (written < 0)
37 ;
38 last += written;
39 } while (last < count);
40 }
41
42}
43
44static int cfe_console_setup(struct console *cons, char *str)
45{
46 char consdev[32];
47 /* XXXKW think about interaction with 'console=' cmdline arg */
48 /* If none of the console options are configured, the build will break. */
49 if (cfe_getenv("BOOT_CONSOLE", consdev, 32) >= 0) {
50#ifdef CONFIG_SIBYTE_SB1250_DUART
51 if (!strcmp(consdev, "uart0")) {
52 setleds("u0cn");
53 } else if (!strcmp(consdev, "uart1")) {
54 setleds("u1cn");
55#endif
56#ifdef CONFIG_VGA_CONSOLE
57 } else if (!strcmp(consdev, "pcconsole0")) {
58 setleds("pccn");
59#endif
60 } else
61 return -ENODEV;
62 }
63 return 0;
64}
65
66static struct console sb1250_cfe_cons = {
67 .name = "cfe",
68 .write = cfe_console_write,
69 .setup = cfe_console_setup,
70 .flags = CON_PRINTBUFFER,
71 .index = -1,
72};
73
74static int __init sb1250_cfe_console_init(void)
75{
76 register_console(&sb1250_cfe_cons);
77 return 0;
78}
79
80console_initcall(sb1250_cfe_console_init);
diff --git a/arch/mips/sibyte/cfe/setup.c b/arch/mips/sibyte/cfe/setup.c
new file mode 100644
index 000000000000..d6d0364fa760
--- /dev/null
+++ b/arch/mips/sibyte/cfe/setup.c
@@ -0,0 +1,358 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#include <linux/config.h>
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/linkage.h>
23#include <linux/mm.h>
24#include <linux/blkdev.h>
25#include <linux/bootmem.h>
26#include <linux/smp.h>
27
28#include <asm/bootinfo.h>
29#include <asm/reboot.h>
30#include <asm/sibyte/board.h>
31
32#include "cfe_api.h"
33#include "cfe_error.h"
34
35/* Max ram addressable in 32-bit segments */
36#ifdef CONFIG_MIPS64
37#define MAX_RAM_SIZE (~0ULL)
38#else
39#ifdef CONFIG_HIGHMEM
40#ifdef CONFIG_64BIT_PHYS_ADDR
41#define MAX_RAM_SIZE (~0ULL)
42#else
43#define MAX_RAM_SIZE (0xffffffffULL)
44#endif
45#else
46#define MAX_RAM_SIZE (0x1fffffffULL)
47#endif
48#endif
49
50#define SIBYTE_MAX_MEM_REGIONS 8
51phys_t board_mem_region_addrs[SIBYTE_MAX_MEM_REGIONS];
52phys_t board_mem_region_sizes[SIBYTE_MAX_MEM_REGIONS];
53unsigned int board_mem_region_count;
54
55int cfe_cons_handle;
56
57#ifdef CONFIG_BLK_DEV_INITRD
58extern unsigned long initrd_start, initrd_end;
59#endif
60
61#ifdef CONFIG_KGDB
62extern int kgdb_port;
63#endif
64
65static void ATTRIB_NORET cfe_linux_exit(void *arg)
66{
67 int warm = *(int *)arg;
68
69 if (smp_processor_id()) {
70 static int reboot_smp;
71
72 /* Don't repeat the process from another CPU */
73 if (!reboot_smp) {
74 /* Get CPU 0 to do the cfe_exit */
75 reboot_smp = 1;
76 smp_call_function(cfe_linux_exit, arg, 1, 0);
77 }
78 } else {
79 printk("Passing control back to CFE...\n");
80 cfe_exit(warm, 0);
81 printk("cfe_exit returned??\n");
82 }
83 while (1);
84}
85
86static void ATTRIB_NORET cfe_linux_restart(char *command)
87{
88 static const int zero;
89
90 cfe_linux_exit((void *)&zero);
91}
92
93static void ATTRIB_NORET cfe_linux_halt(void)
94{
95 static const int one = 1;
96
97 cfe_linux_exit((void *)&one);
98}
99
100static __init void prom_meminit(void)
101{
102 u64 addr, size, type; /* regardless of 64BIT_PHYS_ADDR */
103 int mem_flags = 0;
104 unsigned int idx;
105 int rd_flag;
106#ifdef CONFIG_BLK_DEV_INITRD
107 unsigned long initrd_pstart;
108 unsigned long initrd_pend;
109
110 initrd_pstart = CPHYSADDR(initrd_start);
111 initrd_pend = CPHYSADDR(initrd_end);
112 if (initrd_start &&
113 ((initrd_pstart > MAX_RAM_SIZE)
114 || (initrd_pend > MAX_RAM_SIZE))) {
115 panic("initrd out of addressable memory");
116 }
117
118#endif /* INITRD */
119
120 for (idx = 0; cfe_enummem(idx, mem_flags, &addr, &size, &type) != CFE_ERR_NOMORE;
121 idx++) {
122 rd_flag = 0;
123 if (type == CFE_MI_AVAILABLE) {
124 /*
125 * See if this block contains (any portion of) the
126 * ramdisk
127 */
128#ifdef CONFIG_BLK_DEV_INITRD
129 if (initrd_start) {
130 if ((initrd_pstart > addr) &&
131 (initrd_pstart < (addr + size))) {
132 add_memory_region(addr,
133 initrd_pstart - addr,
134 BOOT_MEM_RAM);
135 rd_flag = 1;
136 }
137 if ((initrd_pend > addr) &&
138 (initrd_pend < (addr + size))) {
139 add_memory_region(initrd_pend,
140 (addr + size) - initrd_pend,
141 BOOT_MEM_RAM);
142 rd_flag = 1;
143 }
144 }
145#endif
146 if (!rd_flag) {
147 if (addr > MAX_RAM_SIZE)
148 continue;
149 if (addr+size > MAX_RAM_SIZE)
150 size = MAX_RAM_SIZE - (addr+size) + 1;
151 /*
152 * memcpy/__copy_user prefetch, which
153 * will cause a bus error for
154 * KSEG/KUSEG addrs not backed by RAM.
155 * Hence, reserve some padding for the
156 * prefetch distance.
157 */
158 if (size > 512)
159 size -= 512;
160 add_memory_region(addr, size, BOOT_MEM_RAM);
161 }
162 board_mem_region_addrs[board_mem_region_count] = addr;
163 board_mem_region_sizes[board_mem_region_count] = size;
164 board_mem_region_count++;
165 if (board_mem_region_count ==
166 SIBYTE_MAX_MEM_REGIONS) {
167 /*
168 * Too many regions. Need to configure more
169 */
170 while(1);
171 }
172 }
173 }
174#ifdef CONFIG_BLK_DEV_INITRD
175 if (initrd_start) {
176 add_memory_region(initrd_pstart, initrd_pend - initrd_pstart,
177 BOOT_MEM_RESERVED);
178 }
179#endif
180}
181
182#ifdef CONFIG_BLK_DEV_INITRD
183static int __init initrd_setup(char *str)
184{
185 char rdarg[64];
186 int idx;
187 char *tmp, *endptr;
188 unsigned long initrd_size;
189
190 /* Make a copy of the initrd argument so we can smash it up here */
191 for (idx = 0; idx < sizeof(rdarg)-1; idx++) {
192 if (!str[idx] || (str[idx] == ' ')) break;
193 rdarg[idx] = str[idx];
194 }
195
196 rdarg[idx] = 0;
197 str = rdarg;
198
199 /*
200 *Initrd location comes in the form "<hex size of ramdisk in bytes>@<location in memory>"
201 * e.g. initrd=3abfd@80010000. This is set up by the loader.
202 */
203 for (tmp = str; *tmp != '@'; tmp++) {
204 if (!*tmp) {
205 goto fail;
206 }
207 }
208 *tmp = 0;
209 tmp++;
210 if (!*tmp) {
211 goto fail;
212 }
213 initrd_size = simple_strtoul(str, &endptr, 16);
214 if (*endptr) {
215 *(tmp-1) = '@';
216 goto fail;
217 }
218 *(tmp-1) = '@';
219 initrd_start = simple_strtoul(tmp, &endptr, 16);
220 if (*endptr) {
221 goto fail;
222 }
223 initrd_end = initrd_start + initrd_size;
224 prom_printf("Found initrd of %lx@%lx\n", initrd_size, initrd_start);
225 return 1;
226 fail:
227 prom_printf("Bad initrd argument. Disabling initrd\n");
228 initrd_start = 0;
229 initrd_end = 0;
230 return 1;
231}
232
233#endif
234
235/*
236 * prom_init is called just after the cpu type is determined, from setup_arch()
237 */
238void __init prom_init(void)
239{
240 uint64_t cfe_ept, cfe_handle;
241 unsigned int cfe_eptseal;
242 int argc = fw_arg0;
243 char **envp = (char **) fw_arg2;
244 int *prom_vec = (int *) fw_arg3;
245#ifdef CONFIG_KGDB
246 char *arg;
247#endif
248
249 _machine_restart = cfe_linux_restart;
250 _machine_halt = cfe_linux_halt;
251 _machine_power_off = cfe_linux_halt;
252
253 /*
254 * Check if a loader was used; if NOT, the 4 arguments are
255 * what CFE gives us (handle, 0, EPT and EPTSEAL)
256 */
257 if (argc < 0) {
258 cfe_handle = (uint64_t)(long)argc;
259 cfe_ept = (long)envp;
260 cfe_eptseal = (uint32_t)(unsigned long)prom_vec;
261 } else {
262 if ((int32_t)(long)prom_vec < 0) {
263 /*
264 * Old loader; all it gives us is the handle,
265 * so use the "known" entrypoint and assume
266 * the seal.
267 */
268 cfe_handle = (uint64_t)(long)prom_vec;
269 cfe_ept = (uint64_t)((int32_t)0x9fc00500);
270 cfe_eptseal = CFE_EPTSEAL;
271 } else {
272 /*
273 * Newer loaders bundle the handle/ept/eptseal
274 * Note: prom_vec is in the loader's useg
275 * which is still alive in the TLB.
276 */
277 cfe_handle = (uint64_t)((int32_t *)prom_vec)[0];
278 cfe_ept = (uint64_t)((int32_t *)prom_vec)[2];
279 cfe_eptseal = (unsigned int)((uint32_t *)prom_vec)[3];
280 }
281 }
282 if (cfe_eptseal != CFE_EPTSEAL) {
283 /* too early for panic to do any good */
284 prom_printf("CFE's entrypoint seal doesn't match. Spinning.");
285 while (1) ;
286 }
287 cfe_init(cfe_handle, cfe_ept);
288 /*
289 * Get the handle for (at least) prom_putchar, possibly for
290 * boot console
291 */
292 cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
293 if (cfe_getenv("LINUX_CMDLINE", arcs_cmdline, CL_SIZE) < 0) {
294 if (argc < 0) {
295 /*
296 * It's OK for direct boot to not provide a
297 * command line
298 */
299 strcpy(arcs_cmdline, "root=/dev/ram0 ");
300#ifdef CONFIG_SIBYTE_PTSWARM
301 strcat(arcs_cmdline, "console=ttyS0,115200 ");
302#endif
303 } else {
304 /* The loader should have set the command line */
305 /* too early for panic to do any good */
306 prom_printf("LINUX_CMDLINE not defined in cfe.");
307 while (1) ;
308 }
309 }
310
311#ifdef CONFIG_KGDB
312 if ((arg = strstr(arcs_cmdline,"kgdb=duart")) != NULL)
313 kgdb_port = (arg[10] == '0') ? 0 : 1;
314 else
315 kgdb_port = 1;
316#endif
317
318#ifdef CONFIG_BLK_DEV_INITRD
319 {
320 char *ptr;
321 /* Need to find out early whether we've got an initrd. So scan
322 the list looking now */
323 for (ptr = arcs_cmdline; *ptr; ptr++) {
324 while (*ptr == ' ') {
325 ptr++;
326 }
327 if (!strncmp(ptr, "initrd=", 7)) {
328 initrd_setup(ptr+7);
329 break;
330 } else {
331 while (*ptr && (*ptr != ' ')) {
332 ptr++;
333 }
334 }
335 }
336 }
337#endif /* CONFIG_BLK_DEV_INITRD */
338
339 /* Not sure this is needed, but it's the safe way. */
340 arcs_cmdline[CL_SIZE-1] = 0;
341
342 mips_machgroup = MACH_GROUP_SIBYTE;
343 prom_meminit();
344}
345
346unsigned long __init prom_free_prom_memory(void)
347{
348 /* Not sure what I'm supposed to do here. Nothing, I think */
349 return 0;
350}
351
352void prom_putchar(char c)
353{
354 int ret;
355
356 while ((ret = cfe_write(cfe_cons_handle, &c, 1)) == 0)
357 ;
358}
diff --git a/arch/mips/sibyte/cfe/smp.c b/arch/mips/sibyte/cfe/smp.c
new file mode 100644
index 000000000000..73392190d2b1
--- /dev/null
+++ b/arch/mips/sibyte/cfe/smp.c
@@ -0,0 +1,92 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#include <linux/init.h>
20#include <linux/sched.h>
21#include <linux/smp.h>
22#include <asm/processor.h>
23
24#include "cfe_api.h"
25#include "cfe_error.h"
26
27/*
28 * Use CFE to find out how many CPUs are available, setting up
29 * phys_cpu_present_map and the logical/physical mappings.
30 * XXXKW will the boot CPU ever not be physical 0?
31 *
32 * Common setup before any secondaries are started
33 */
34void __init prom_prepare_cpus(unsigned int max_cpus)
35{
36 int i, num;
37
38 cpus_clear(phys_cpu_present_map);
39 cpu_set(0, phys_cpu_present_map);
40 __cpu_number_map[0] = 0;
41 __cpu_logical_map[0] = 0;
42
43 for (i=1, num=0; i<NR_CPUS; i++) {
44 if (cfe_cpu_stop(i) == 0) {
45 cpu_set(i, phys_cpu_present_map);
46 __cpu_number_map[i] = ++num;
47 __cpu_logical_map[num] = i;
48 }
49 }
50 printk("Detected %i available secondary CPU(s)\n", num);
51}
52
53/*
54 * Setup the PC, SP, and GP of a secondary processor and start it
55 * running!
56 */
57void prom_boot_secondary(int cpu, struct task_struct *idle)
58{
59 int retval;
60
61 retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap,
62 __KSTK_TOS(idle),
63 (unsigned long)idle->thread_info, 0);
64 if (retval != 0)
65 printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval);
66}
67
68/*
69 * Code to run on secondary just after probing the CPU
70 */
71void prom_init_secondary(void)
72{
73 extern void sb1250_smp_init(void);
74 sb1250_smp_init();
75}
76
77/*
78 * Do any tidying up before marking online and running the idle
79 * loop
80 */
81void prom_smp_finish(void)
82{
83 extern void sb1250_smp_finish(void);
84 sb1250_smp_finish();
85}
86
87/*
88 * Final cleanup after all secondaries booted
89 */
90void prom_cpus_done(void)
91{
92}
diff --git a/arch/mips/sibyte/sb1250/Makefile b/arch/mips/sibyte/sb1250/Makefile
new file mode 100644
index 000000000000..a8af84697588
--- /dev/null
+++ b/arch/mips/sibyte/sb1250/Makefile
@@ -0,0 +1,8 @@
1obj-y := setup.o irq.o irq_handler.o time.o
2
3obj-$(CONFIG_SMP) += smp.o
4obj-$(CONFIG_SIBYTE_TBPROF) += bcm1250_tbprof.o
5obj-$(CONFIG_SIBYTE_STANDALONE) += prom.o
6obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o
7
8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
new file mode 100644
index 000000000000..7f813ae9eaff
--- /dev/null
+++ b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
@@ -0,0 +1,390 @@
1/*
2 * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#define SBPROF_TB_DEBUG 0
20
21#include <linux/module.h>
22#include <linux/kernel.h>
23#include <linux/types.h>
24#include <linux/init.h>
25#include <linux/interrupt.h>
26#include <linux/slab.h>
27#include <linux/vmalloc.h>
28#include <linux/fs.h>
29#include <linux/errno.h>
30#include <linux/reboot.h>
31#include <asm/uaccess.h>
32#include <asm/io.h>
33#include <asm/sibyte/sb1250.h>
34#include <asm/sibyte/sb1250_regs.h>
35#include <asm/sibyte/sb1250_scd.h>
36#include <asm/sibyte/sb1250_int.h>
37#include <asm/sibyte/trace_prof.h>
38
39#define DEVNAME "bcm1250_tbprof"
40
41static struct sbprof_tb sbp;
42
43#define TB_FULL (sbp.next_tb_sample == MAX_TB_SAMPLES)
44
45/************************************************************************
46 * Support for ZBbus sampling using the trace buffer
47 *
48 * We use the SCD performance counter interrupt, caused by a Zclk counter
49 * overflow, to trigger the start of tracing.
50 *
51 * We set the trace buffer to sample everything and freeze on
52 * overflow.
53 *
54 * We map the interrupt for trace_buffer_freeze to handle it on CPU 0.
55 *
56 ************************************************************************/
57
58static u_int64_t tb_period;
59
60static void arm_tb(void)
61{
62 u_int64_t scdperfcnt;
63 u_int64_t next = (1ULL << 40) - tb_period;
64 u_int64_t tb_options = M_SCD_TRACE_CFG_FREEZE_FULL;
65 /* Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to
66 trigger start of trace. XXX vary sampling period */
67 bus_writeq(0, IOADDR(A_SCD_PERF_CNT_1));
68 scdperfcnt = bus_readq(IOADDR(A_SCD_PERF_CNT_CFG));
69 /* Unfortunately, in Pass 2 we must clear all counters to knock down
70 a previous interrupt request. This means that bus profiling
71 requires ALL of the SCD perf counters. */
72 bus_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) | // keep counters 0,2,3 as is
73 M_SPC_CFG_ENABLE | // enable counting
74 M_SPC_CFG_CLEAR | // clear all counters
75 V_SPC_CFG_SRC1(1), // counter 1 counts cycles
76 IOADDR(A_SCD_PERF_CNT_CFG));
77 bus_writeq(next, IOADDR(A_SCD_PERF_CNT_1));
78 /* Reset the trace buffer */
79 bus_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG));
80#if 0 && defined(M_SCD_TRACE_CFG_FORCECNT)
81 /* XXXKW may want to expose control to the data-collector */
82 tb_options |= M_SCD_TRACE_CFG_FORCECNT;
83#endif
84 bus_writeq(tb_options, IOADDR(A_SCD_TRACE_CFG));
85 sbp.tb_armed = 1;
86}
87
88static irqreturn_t sbprof_tb_intr(int irq, void *dev_id, struct pt_regs *regs)
89{
90 int i;
91 DBG(printk(DEVNAME ": tb_intr\n"));
92 if (sbp.next_tb_sample < MAX_TB_SAMPLES) {
93 /* XXX should use XKPHYS to make writes bypass L2 */
94 u_int64_t *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++];
95 /* Read out trace */
96 bus_writeq(M_SCD_TRACE_CFG_START_READ, IOADDR(A_SCD_TRACE_CFG));
97 __asm__ __volatile__ ("sync" : : : "memory");
98 /* Loop runs backwards because bundles are read out in reverse order */
99 for (i = 256 * 6; i > 0; i -= 6) {
100 // Subscripts decrease to put bundle in the order
101 // t0 lo, t0 hi, t1 lo, t1 hi, t2 lo, t2 hi
102 p[i-1] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t2 hi
103 p[i-2] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t2 lo
104 p[i-3] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t1 hi
105 p[i-4] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t1 lo
106 p[i-5] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t0 hi
107 p[i-6] = bus_readq(IOADDR(A_SCD_TRACE_READ)); // read t0 lo
108 }
109 if (!sbp.tb_enable) {
110 DBG(printk(DEVNAME ": tb_intr shutdown\n"));
111 bus_writeq(M_SCD_TRACE_CFG_RESET,
112 IOADDR(A_SCD_TRACE_CFG));
113 sbp.tb_armed = 0;
114 wake_up(&sbp.tb_sync);
115 } else {
116 arm_tb(); // knock down current interrupt and get another one later
117 }
118 } else {
119 /* No more trace buffer samples */
120 DBG(printk(DEVNAME ": tb_intr full\n"));
121 bus_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG));
122 sbp.tb_armed = 0;
123 if (!sbp.tb_enable) {
124 wake_up(&sbp.tb_sync);
125 }
126 wake_up(&sbp.tb_read);
127 }
128 return IRQ_HANDLED;
129}
130
131static irqreturn_t sbprof_pc_intr(int irq, void *dev_id, struct pt_regs *regs)
132{
133 printk(DEVNAME ": unexpected pc_intr");
134 return IRQ_NONE;
135}
136
137int sbprof_zbprof_start(struct file *filp)
138{
139 u_int64_t scdperfcnt;
140
141 if (sbp.tb_enable)
142 return -EBUSY;
143
144 DBG(printk(DEVNAME ": starting\n"));
145
146 sbp.tb_enable = 1;
147 sbp.next_tb_sample = 0;
148 filp->f_pos = 0;
149
150 if (request_irq
151 (K_INT_TRACE_FREEZE, sbprof_tb_intr, 0, DEVNAME " trace freeze", &sbp)) {
152 return -EBUSY;
153 }
154 /* Make sure there isn't a perf-cnt interrupt waiting */
155 scdperfcnt = bus_readq(IOADDR(A_SCD_PERF_CNT_CFG));
156 /* Disable and clear counters, override SRC_1 */
157 bus_writeq((scdperfcnt & ~(M_SPC_CFG_SRC1 | M_SPC_CFG_ENABLE)) |
158 M_SPC_CFG_ENABLE |
159 M_SPC_CFG_CLEAR |
160 V_SPC_CFG_SRC1(1),
161 IOADDR(A_SCD_PERF_CNT_CFG));
162
163 /* We grab this interrupt to prevent others from trying to use
164 it, even though we don't want to service the interrupts
165 (they only feed into the trace-on-interrupt mechanism) */
166 if (request_irq
167 (K_INT_PERF_CNT, sbprof_pc_intr, 0, DEVNAME " scd perfcnt", &sbp)) {
168 free_irq(K_INT_TRACE_FREEZE, &sbp);
169 return -EBUSY;
170 }
171
172 /* I need the core to mask these, but the interrupt mapper to
173 pass them through. I am exploiting my knowledge that
174 cp0_status masks out IP[5]. krw */
175 bus_writeq(K_INT_MAP_I3,
176 IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) +
177 (K_INT_PERF_CNT << 3)));
178
179 /* Initialize address traps */
180 bus_writeq(0, IOADDR(A_ADDR_TRAP_UP_0));
181 bus_writeq(0, IOADDR(A_ADDR_TRAP_UP_1));
182 bus_writeq(0, IOADDR(A_ADDR_TRAP_UP_2));
183 bus_writeq(0, IOADDR(A_ADDR_TRAP_UP_3));
184
185 bus_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_0));
186 bus_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_1));
187 bus_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_2));
188 bus_writeq(0, IOADDR(A_ADDR_TRAP_DOWN_3));
189
190 bus_writeq(0, IOADDR(A_ADDR_TRAP_CFG_0));
191 bus_writeq(0, IOADDR(A_ADDR_TRAP_CFG_1));
192 bus_writeq(0, IOADDR(A_ADDR_TRAP_CFG_2));
193 bus_writeq(0, IOADDR(A_ADDR_TRAP_CFG_3));
194
195 /* Initialize Trace Event 0-7 */
196 // when interrupt
197 bus_writeq(M_SCD_TREVT_INTERRUPT, IOADDR(A_SCD_TRACE_EVENT_0));
198 bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_1));
199 bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_2));
200 bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_3));
201 bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_4));
202 bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_5));
203 bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_6));
204 bus_writeq(0, IOADDR(A_SCD_TRACE_EVENT_7));
205
206 /* Initialize Trace Sequence 0-7 */
207 // Start on event 0 (interrupt)
208 bus_writeq(V_SCD_TRSEQ_FUNC_START | 0x0fff,
209 IOADDR(A_SCD_TRACE_SEQUENCE_0));
210 // dsamp when d used | asamp when a used
211 bus_writeq(M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE |
212 K_SCD_TRSEQ_TRIGGER_ALL,
213 IOADDR(A_SCD_TRACE_SEQUENCE_1));
214 bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_2));
215 bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_3));
216 bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_4));
217 bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_5));
218 bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_6));
219 bus_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_7));
220
221 /* Now indicate the PERF_CNT interrupt as a trace-relevant interrupt */
222 bus_writeq((1ULL << K_INT_PERF_CNT),
223 IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_TRACE)));
224
225 arm_tb();
226
227 DBG(printk(DEVNAME ": done starting\n"));
228
229 return 0;
230}
231
232int sbprof_zbprof_stop(void)
233{
234 DBG(printk(DEVNAME ": stopping\n"));
235
236 if (sbp.tb_enable) {
237 sbp.tb_enable = 0;
238 /* XXXKW there is a window here where the intr handler
239 may run, see the disable, and do the wake_up before
240 this sleep happens. */
241 if (sbp.tb_armed) {
242 DBG(printk(DEVNAME ": wait for disarm\n"));
243 interruptible_sleep_on(&sbp.tb_sync);
244 DBG(printk(DEVNAME ": disarm complete\n"));
245 }
246 free_irq(K_INT_TRACE_FREEZE, &sbp);
247 free_irq(K_INT_PERF_CNT, &sbp);
248 }
249
250 DBG(printk(DEVNAME ": done stopping\n"));
251
252 return 0;
253}
254
255static int sbprof_tb_open(struct inode *inode, struct file *filp)
256{
257 int minor;
258
259 minor = iminor(inode);
260 if (minor != 0) {
261 return -ENODEV;
262 }
263 if (sbp.open) {
264 return -EBUSY;
265 }
266
267 memset(&sbp, 0, sizeof(struct sbprof_tb));
268 sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES);
269 if (!sbp.sbprof_tbbuf) {
270 return -ENOMEM;
271 }
272 memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES);
273 init_waitqueue_head(&sbp.tb_sync);
274 init_waitqueue_head(&sbp.tb_read);
275 sbp.open = 1;
276
277 return 0;
278}
279
280static int sbprof_tb_release(struct inode *inode, struct file *filp)
281{
282 int minor;
283
284 minor = iminor(inode);
285 if (minor != 0 || !sbp.open) {
286 return -ENODEV;
287 }
288
289 if (sbp.tb_armed || sbp.tb_enable) {
290 sbprof_zbprof_stop();
291 }
292
293 vfree(sbp.sbprof_tbbuf);
294 sbp.open = 0;
295
296 return 0;
297}
298
299static ssize_t sbprof_tb_read(struct file *filp, char *buf,
300 size_t size, loff_t *offp)
301{
302 int cur_sample, sample_off, cur_count, sample_left;
303 char *src;
304 int count = 0;
305 char *dest = buf;
306 long cur_off = *offp;
307
308 count = 0;
309 cur_sample = cur_off / TB_SAMPLE_SIZE;
310 sample_off = cur_off % TB_SAMPLE_SIZE;
311 sample_left = TB_SAMPLE_SIZE - sample_off;
312 while (size && (cur_sample < sbp.next_tb_sample)) {
313 cur_count = size < sample_left ? size : sample_left;
314 src = (char *)(((long)sbp.sbprof_tbbuf[cur_sample])+sample_off);
315 copy_to_user(dest, src, cur_count);
316 DBG(printk(DEVNAME ": read from sample %d, %d bytes\n",
317 cur_sample, cur_count));
318 size -= cur_count;
319 sample_left -= cur_count;
320 if (!sample_left) {
321 cur_sample++;
322 sample_off = 0;
323 sample_left = TB_SAMPLE_SIZE;
324 } else {
325 sample_off += cur_count;
326 }
327 cur_off += cur_count;
328 dest += cur_count;
329 count += cur_count;
330 }
331 *offp = cur_off;
332
333 return count;
334}
335
336static int sbprof_tb_ioctl(struct inode *inode,
337 struct file *filp,
338 unsigned int command,
339 unsigned long arg)
340{
341 int error = 0;
342
343 switch (command) {
344 case SBPROF_ZBSTART:
345 error = sbprof_zbprof_start(filp);
346 break;
347 case SBPROF_ZBSTOP:
348 error = sbprof_zbprof_stop();
349 break;
350 case SBPROF_ZBWAITFULL:
351 interruptible_sleep_on(&sbp.tb_read);
352 /* XXXKW check if interrupted? */
353 return put_user(TB_FULL, (int *) arg);
354 default:
355 error = -EINVAL;
356 break;
357 }
358
359 return error;
360}
361
362static struct file_operations sbprof_tb_fops = {
363 .owner = THIS_MODULE,
364 .open = sbprof_tb_open,
365 .release = sbprof_tb_release,
366 .read = sbprof_tb_read,
367 .ioctl = sbprof_tb_ioctl,
368 .mmap = NULL,
369};
370
371static int __init sbprof_tb_init(void)
372{
373 if (register_chrdev(SBPROF_TB_MAJOR, DEVNAME, &sbprof_tb_fops)) {
374 printk(KERN_WARNING DEVNAME ": initialization failed (dev %d)\n",
375 SBPROF_TB_MAJOR);
376 return -EIO;
377 }
378 sbp.open = 0;
379 tb_period = zbbus_mhz * 10000LL;
380 printk(KERN_INFO DEVNAME ": initialized - tb_period = %lld\n", tb_period);
381 return 0;
382}
383
384static void __exit sbprof_tb_cleanup(void)
385{
386 unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME);
387}
388
389module_init(sbprof_tb_init);
390module_exit(sbprof_tb_cleanup);
diff --git a/arch/mips/sibyte/sb1250/bus_watcher.c b/arch/mips/sibyte/sb1250/bus_watcher.c
new file mode 100644
index 000000000000..182a16f42e2d
--- /dev/null
+++ b/arch/mips/sibyte/sb1250/bus_watcher.c
@@ -0,0 +1,259 @@
1/*
2 * Copyright (C) 2002,2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/*
20 * The Bus Watcher monitors internal bus transactions and maintains
21 * counts of transactions with error status, logging details and
22 * causing one of several interrupts. This driver provides a handler
23 * for those interrupts which aggregates the counts (to avoid
24 * saturating the 8-bit counters) and provides a presence in
25 * /proc/bus_watcher if PROC_FS is on.
26 */
27
28#include <linux/config.h>
29#include <linux/init.h>
30#include <linux/kernel.h>
31#include <linux/interrupt.h>
32#include <linux/sched.h>
33#include <linux/proc_fs.h>
34#include <asm/system.h>
35#include <asm/io.h>
36
37#include <asm/sibyte/sb1250.h>
38#include <asm/sibyte/sb1250_regs.h>
39#include <asm/sibyte/sb1250_int.h>
40#include <asm/sibyte/sb1250_scd.h>
41
42
43struct bw_stats_struct {
44 uint64_t status;
45 uint32_t l2_err;
46 uint32_t memio_err;
47 int status_printed;
48 unsigned long l2_cor_d;
49 unsigned long l2_bad_d;
50 unsigned long l2_cor_t;
51 unsigned long l2_bad_t;
52 unsigned long mem_cor_d;
53 unsigned long mem_bad_d;
54 unsigned long bus_error;
55} bw_stats;
56
57
58static void print_summary(uint32_t status, uint32_t l2_err,
59 uint32_t memio_err)
60{
61 printk("Bus watcher error counters: %08x %08x\n", l2_err, memio_err);
62 printk("\nLast recorded signature:\n");
63 printk("Request %02x from %d, answered by %d with Dcode %d\n",
64 (unsigned int)(G_SCD_BERR_TID(status) & 0x3f),
65 (int)(G_SCD_BERR_TID(status) >> 6),
66 (int)G_SCD_BERR_RID(status),
67 (int)G_SCD_BERR_DCODE(status));
68}
69
70/*
71 * check_bus_watcher is exported for use in situations where we want
72 * to see the most recent status of the bus watcher, which might have
73 * already been destructively read out of the registers.
74 *
75 * notes: this is currently used by the cache error handler
76 * should provide locking against the interrupt handler
77 */
78void check_bus_watcher(void)
79{
80 u32 status, l2_err, memio_err;
81
82#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
83 /* Destructive read, clears register and interrupt */
84 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS));
85#else
86 /* Use non-destructive register */
87 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG));
88#endif
89 if (!(status & 0x7fffffff)) {
90 printk("Using last values reaped by bus watcher driver\n");
91 status = bw_stats.status;
92 l2_err = bw_stats.l2_err;
93 memio_err = bw_stats.memio_err;
94 } else {
95 l2_err = csr_in32(IOADDR(A_BUS_L2_ERRORS));
96 memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS));
97 }
98 if (status & ~(1UL << 31))
99 print_summary(status, l2_err, memio_err);
100 else
101 printk("Bus watcher indicates no error\n");
102}
103
104static int bw_print_buffer(char *page, struct bw_stats_struct *stats)
105{
106 int len;
107
108 len = sprintf(page, "SiByte Bus Watcher statistics\n");
109 len += sprintf(page+len, "-----------------------------\n");
110 len += sprintf(page+len, "L2-d-cor %8ld\nL2-d-bad %8ld\n",
111 stats->l2_cor_d, stats->l2_bad_d);
112 len += sprintf(page+len, "L2-t-cor %8ld\nL2-t-bad %8ld\n",
113 stats->l2_cor_t, stats->l2_bad_t);
114 len += sprintf(page+len, "MC-d-cor %8ld\nMC-d-bad %8ld\n",
115 stats->mem_cor_d, stats->mem_bad_d);
116 len += sprintf(page+len, "IO-err %8ld\n", stats->bus_error);
117 len += sprintf(page+len, "\nLast recorded signature:\n");
118 len += sprintf(page+len, "Request %02x from %d, answered by %d with Dcode %d\n",
119 (unsigned int)(G_SCD_BERR_TID(stats->status) & 0x3f),
120 (int)(G_SCD_BERR_TID(stats->status) >> 6),
121 (int)G_SCD_BERR_RID(stats->status),
122 (int)G_SCD_BERR_DCODE(stats->status));
123 /* XXXKW indicate multiple errors between printings, or stats
124 collection (or both)? */
125 if (stats->status & M_SCD_BERR_MULTERRS)
126 len += sprintf(page+len, "Multiple errors observed since last check.\n");
127 if (stats->status_printed) {
128 len += sprintf(page+len, "(no change since last printing)\n");
129 } else {
130 stats->status_printed = 1;
131 }
132
133 return len;
134}
135
136#ifdef CONFIG_PROC_FS
137
138/* For simplicity, I want to assume a single read is required each
139 time */
140static int bw_read_proc(char *page, char **start, off_t off,
141 int count, int *eof, void *data)
142{
143 int len;
144
145 if (off == 0) {
146 len = bw_print_buffer(page, data);
147 *start = page;
148 } else {
149 len = 0;
150 *eof = 1;
151 }
152 return len;
153}
154
155static void create_proc_decoder(struct bw_stats_struct *stats)
156{
157 struct proc_dir_entry *ent;
158
159 ent = create_proc_read_entry("bus_watcher", S_IWUSR | S_IRUGO, NULL,
160 bw_read_proc, stats);
161 if (!ent) {
162 printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n");
163 return;
164 }
165}
166
167#endif /* CONFIG_PROC_FS */
168
169/*
170 * sibyte_bw_int - handle bus watcher interrupts and accumulate counts
171 *
172 * notes: possible re-entry due to multiple sources
173 * should check/indicate saturation
174 */
175static irqreturn_t sibyte_bw_int(int irq, void *data, struct pt_regs *regs)
176{
177 struct bw_stats_struct *stats = data;
178 unsigned long cntr;
179#ifdef CONFIG_SIBYTE_BW_TRACE
180 int i;
181#endif
182#ifndef CONFIG_PROC_FS
183 char bw_buf[1024];
184#endif
185
186#ifdef CONFIG_SIBYTE_BW_TRACE
187 csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
188 csr_out32(M_SCD_TRACE_CFG_START_READ, IOADDR(A_SCD_TRACE_CFG));
189
190 for (i=0; i<256*6; i++)
191 printk("%016llx\n",
192 (unsigned long long)bus_readq(IOADDR(A_SCD_TRACE_READ)));
193
194 csr_out32(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG));
195 csr_out32(M_SCD_TRACE_CFG_START, IOADDR(A_SCD_TRACE_CFG));
196#endif
197
198 /* Destructive read, clears register and interrupt */
199 stats->status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS));
200 stats->status_printed = 0;
201
202 stats->l2_err = cntr = csr_in32(IOADDR(A_BUS_L2_ERRORS));
203 stats->l2_cor_d += G_SCD_L2ECC_CORR_D(cntr);
204 stats->l2_bad_d += G_SCD_L2ECC_BAD_D(cntr);
205 stats->l2_cor_t += G_SCD_L2ECC_CORR_T(cntr);
206 stats->l2_bad_t += G_SCD_L2ECC_BAD_T(cntr);
207 csr_out32(0, IOADDR(A_BUS_L2_ERRORS));
208
209 stats->memio_err = cntr = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS));
210 stats->mem_cor_d += G_SCD_MEM_ECC_CORR(cntr);
211 stats->mem_bad_d += G_SCD_MEM_ECC_BAD(cntr);
212 stats->bus_error += G_SCD_MEM_BUSERR(cntr);
213 csr_out32(0, IOADDR(A_BUS_MEM_IO_ERRORS));
214
215#ifndef CONFIG_PROC_FS
216 bw_print_buffer(bw_buf, stats);
217 printk(bw_buf);
218#endif
219
220 return IRQ_HANDLED;
221}
222
223int __init sibyte_bus_watcher(void)
224{
225 memset(&bw_stats, 0, sizeof(struct bw_stats_struct));
226 bw_stats.status_printed = 1;
227
228 if (request_irq(K_INT_BAD_ECC, sibyte_bw_int, 0, "Bus watcher", &bw_stats)) {
229 printk("Failed to register bus watcher BAD_ECC irq\n");
230 return -1;
231 }
232 if (request_irq(K_INT_COR_ECC, sibyte_bw_int, 0, "Bus watcher", &bw_stats)) {
233 free_irq(K_INT_BAD_ECC, &bw_stats);
234 printk("Failed to register bus watcher COR_ECC irq\n");
235 return -1;
236 }
237 if (request_irq(K_INT_IO_BUS, sibyte_bw_int, 0, "Bus watcher", &bw_stats)) {
238 free_irq(K_INT_BAD_ECC, &bw_stats);
239 free_irq(K_INT_COR_ECC, &bw_stats);
240 printk("Failed to register bus watcher IO_BUS irq\n");
241 return -1;
242 }
243
244#ifdef CONFIG_PROC_FS
245 create_proc_decoder(&bw_stats);
246#endif
247
248#ifdef CONFIG_SIBYTE_BW_TRACE
249 csr_out32((M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE |
250 K_SCD_TRSEQ_TRIGGER_ALL),
251 IOADDR(A_SCD_TRACE_SEQUENCE_0));
252 csr_out32(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG));
253 csr_out32(M_SCD_TRACE_CFG_START, IOADDR(A_SCD_TRACE_CFG));
254#endif
255
256 return 0;
257}
258
259__initcall(sibyte_bus_watcher);
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
new file mode 100644
index 000000000000..2728abbc94d2
--- /dev/null
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -0,0 +1,431 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/config.h>
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/linkage.h>
22#include <linux/interrupt.h>
23#include <linux/spinlock.h>
24#include <linux/smp.h>
25#include <linux/mm.h>
26#include <linux/slab.h>
27#include <linux/kernel_stat.h>
28
29#include <asm/errno.h>
30#include <asm/signal.h>
31#include <asm/system.h>
32#include <asm/ptrace.h>
33#include <asm/io.h>
34
35#include <asm/sibyte/sb1250_regs.h>
36#include <asm/sibyte/sb1250_int.h>
37#include <asm/sibyte/sb1250_uart.h>
38#include <asm/sibyte/sb1250_scd.h>
39#include <asm/sibyte/sb1250.h>
40
41/*
42 * These are the routines that handle all the low level interrupt stuff.
43 * Actions handled here are: initialization of the interrupt map, requesting of
44 * interrupt lines by handlers, dispatching if interrupts to handlers, probing
45 * for interrupt lines
46 */
47
48
49#define shutdown_sb1250_irq disable_sb1250_irq
50static void end_sb1250_irq(unsigned int irq);
51static void enable_sb1250_irq(unsigned int irq);
52static void disable_sb1250_irq(unsigned int irq);
53static unsigned int startup_sb1250_irq(unsigned int irq);
54static void ack_sb1250_irq(unsigned int irq);
55#ifdef CONFIG_SMP
56static void sb1250_set_affinity(unsigned int irq, unsigned long mask);
57#endif
58
59#ifdef CONFIG_SIBYTE_HAS_LDT
60extern unsigned long ldt_eoi_space;
61#endif
62
63#ifdef CONFIG_KGDB
64static int kgdb_irq;
65
66/* Default to UART1 */
67int kgdb_port = 1;
68#ifdef CONFIG_SIBYTE_SB1250_DUART
69extern char sb1250_duart_present[];
70#endif
71#endif
72
73static struct hw_interrupt_type sb1250_irq_type = {
74 "SB1250-IMR",
75 startup_sb1250_irq,
76 shutdown_sb1250_irq,
77 enable_sb1250_irq,
78 disable_sb1250_irq,
79 ack_sb1250_irq,
80 end_sb1250_irq,
81#ifdef CONFIG_SMP
82 sb1250_set_affinity
83#else
84 NULL
85#endif
86};
87
88/* Store the CPU id (not the logical number) */
89int sb1250_irq_owner[SB1250_NR_IRQS];
90
91DEFINE_SPINLOCK(sb1250_imr_lock);
92
93void sb1250_mask_irq(int cpu, int irq)
94{
95 unsigned long flags;
96 u64 cur_ints;
97
98 spin_lock_irqsave(&sb1250_imr_lock, flags);
99 cur_ints = __bus_readq(IOADDR(A_IMR_MAPPER(cpu) +
100 R_IMR_INTERRUPT_MASK));
101 cur_ints |= (((u64) 1) << irq);
102 __bus_writeq(cur_ints, IOADDR(A_IMR_MAPPER(cpu) +
103 R_IMR_INTERRUPT_MASK));
104 spin_unlock_irqrestore(&sb1250_imr_lock, flags);
105}
106
107void sb1250_unmask_irq(int cpu, int irq)
108{
109 unsigned long flags;
110 u64 cur_ints;
111
112 spin_lock_irqsave(&sb1250_imr_lock, flags);
113 cur_ints = __bus_readq(IOADDR(A_IMR_MAPPER(cpu) +
114 R_IMR_INTERRUPT_MASK));
115 cur_ints &= ~(((u64) 1) << irq);
116 __bus_writeq(cur_ints, IOADDR(A_IMR_MAPPER(cpu) +
117 R_IMR_INTERRUPT_MASK));
118 spin_unlock_irqrestore(&sb1250_imr_lock, flags);
119}
120
121#ifdef CONFIG_SMP
122static void sb1250_set_affinity(unsigned int irq, unsigned long mask)
123{
124 int i = 0, old_cpu, cpu, int_on;
125 u64 cur_ints;
126 irq_desc_t *desc = irq_desc + irq;
127 unsigned long flags;
128
129 while (mask) {
130 if (mask & 1) {
131 mask >>= 1;
132 break;
133 }
134 mask >>= 1;
135 i++;
136 }
137
138 if (mask) {
139 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq);
140 return;
141 }
142
143 /* Convert logical CPU to physical CPU */
144 cpu = cpu_logical_map(i);
145
146 /* Protect against other affinity changers and IMR manipulation */
147 spin_lock_irqsave(&desc->lock, flags);
148 spin_lock(&sb1250_imr_lock);
149
150 /* Swizzle each CPU's IMR (but leave the IP selection alone) */
151 old_cpu = sb1250_irq_owner[irq];
152 cur_ints = __bus_readq(IOADDR(A_IMR_MAPPER(old_cpu) +
153 R_IMR_INTERRUPT_MASK));
154 int_on = !(cur_ints & (((u64) 1) << irq));
155 if (int_on) {
156 /* If it was on, mask it */
157 cur_ints |= (((u64) 1) << irq);
158 __bus_writeq(cur_ints, IOADDR(A_IMR_MAPPER(old_cpu) +
159 R_IMR_INTERRUPT_MASK));
160 }
161 sb1250_irq_owner[irq] = cpu;
162 if (int_on) {
163 /* unmask for the new CPU */
164 cur_ints = __bus_readq(IOADDR(A_IMR_MAPPER(cpu) +
165 R_IMR_INTERRUPT_MASK));
166 cur_ints &= ~(((u64) 1) << irq);
167 __bus_writeq(cur_ints, IOADDR(A_IMR_MAPPER(cpu) +
168 R_IMR_INTERRUPT_MASK));
169 }
170 spin_unlock(&sb1250_imr_lock);
171 spin_unlock_irqrestore(&desc->lock, flags);
172}
173#endif
174
175
176/* Defined in arch/mips/sibyte/sb1250/irq_handler.S */
177extern void sb1250_irq_handler(void);
178
179/*****************************************************************************/
180
181static unsigned int startup_sb1250_irq(unsigned int irq)
182{
183 sb1250_unmask_irq(sb1250_irq_owner[irq], irq);
184
185 return 0; /* never anything pending */
186}
187
188
189static void disable_sb1250_irq(unsigned int irq)
190{
191 sb1250_mask_irq(sb1250_irq_owner[irq], irq);
192}
193
194static void enable_sb1250_irq(unsigned int irq)
195{
196 sb1250_unmask_irq(sb1250_irq_owner[irq], irq);
197}
198
199
200static void ack_sb1250_irq(unsigned int irq)
201{
202#ifdef CONFIG_SIBYTE_HAS_LDT
203 u64 pending;
204
205 /*
206 * If the interrupt was an HT interrupt, now is the time to
207 * clear it. NOTE: we assume the HT bridge was set up to
208 * deliver the interrupts to all CPUs (which makes affinity
209 * changing easier for us)
210 */
211 pending = bus_readq(IOADDR(A_IMR_REGISTER(sb1250_irq_owner[irq],
212 R_IMR_LDT_INTERRUPT)));
213 pending &= ((u64)1 << (irq));
214 if (pending) {
215 int i;
216 for (i=0; i<NR_CPUS; i++) {
217 int cpu;
218#ifdef CONFIG_SMP
219 cpu = cpu_logical_map(i);
220#else
221 cpu = i;
222#endif
223 /*
224 * Clear for all CPUs so an affinity switch
225 * doesn't find an old status
226 */
227 bus_writeq(pending,
228 IOADDR(A_IMR_REGISTER(cpu,
229 R_IMR_LDT_INTERRUPT_CLR)));
230 }
231
232 /*
233 * Generate EOI. For Pass 1 parts, EOI is a nop. For
234 * Pass 2, the LDT world may be edge-triggered, but
235 * this EOI shouldn't hurt. If they are
236 * level-sensitive, the EOI is required.
237 */
238 *(uint32_t *)(ldt_eoi_space+(irq<<16)+(7<<2)) = 0;
239 }
240#endif
241 sb1250_mask_irq(sb1250_irq_owner[irq], irq);
242}
243
244
245static void end_sb1250_irq(unsigned int irq)
246{
247 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
248 sb1250_unmask_irq(sb1250_irq_owner[irq], irq);
249 }
250}
251
252
253void __init init_sb1250_irqs(void)
254{
255 int i;
256
257 for (i = 0; i < NR_IRQS; i++) {
258 irq_desc[i].status = IRQ_DISABLED;
259 irq_desc[i].action = 0;
260 irq_desc[i].depth = 1;
261 if (i < SB1250_NR_IRQS) {
262 irq_desc[i].handler = &sb1250_irq_type;
263 sb1250_irq_owner[i] = 0;
264 } else {
265 irq_desc[i].handler = &no_irq_type;
266 }
267 }
268}
269
270
271static irqreturn_t sb1250_dummy_handler(int irq, void *dev_id,
272 struct pt_regs *regs)
273{
274 return IRQ_NONE;
275}
276
277static struct irqaction sb1250_dummy_action = {
278 .handler = sb1250_dummy_handler,
279 .flags = 0,
280 .mask = CPU_MASK_NONE,
281 .name = "sb1250-private",
282 .next = NULL,
283 .dev_id = 0
284};
285
286int sb1250_steal_irq(int irq)
287{
288 irq_desc_t *desc = irq_desc + irq;
289 unsigned long flags;
290 int retval = 0;
291
292 if (irq >= SB1250_NR_IRQS)
293 return -EINVAL;
294
295 spin_lock_irqsave(&desc->lock,flags);
296 /* Don't allow sharing at all for these */
297 if (desc->action != NULL)
298 retval = -EBUSY;
299 else {
300 desc->action = &sb1250_dummy_action;
301 desc->depth = 0;
302 }
303 spin_unlock_irqrestore(&desc->lock,flags);
304 return 0;
305}
306
307/*
308 * arch_init_irq is called early in the boot sequence from init/main.c via
309 * init_IRQ. It is responsible for setting up the interrupt mapper and
310 * installing the handler that will be responsible for dispatching interrupts
311 * to the "right" place.
312 */
313/*
314 * For now, map all interrupts to IP[2]. We could save
315 * some cycles by parceling out system interrupts to different
316 * IP lines, but keep it simple for bringup. We'll also direct
317 * all interrupts to a single CPU; we should probably route
318 * PCI and LDT to one cpu and everything else to the other
319 * to balance the load a bit.
320 *
321 * On the second cpu, everything is set to IP5, which is
322 * ignored, EXCEPT the mailbox interrupt. That one is
323 * set to IP[2] so it is handled. This is needed so we
324 * can do cross-cpu function calls, as requred by SMP
325 */
326
327#define IMR_IP2_VAL K_INT_MAP_I0
328#define IMR_IP3_VAL K_INT_MAP_I1
329#define IMR_IP4_VAL K_INT_MAP_I2
330#define IMR_IP5_VAL K_INT_MAP_I3
331#define IMR_IP6_VAL K_INT_MAP_I4
332
333void __init arch_init_irq(void)
334{
335
336 unsigned int i;
337 u64 tmp;
338 unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 |
339 STATUSF_IP1 | STATUSF_IP0;
340
341 /* Default everything to IP2 */
342 for (i = 0; i < SB1250_NR_IRQS; i++) { /* was I0 */
343 bus_writeq(IMR_IP2_VAL,
344 IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) +
345 (i << 3)));
346 bus_writeq(IMR_IP2_VAL,
347 IOADDR(A_IMR_REGISTER(1, R_IMR_INTERRUPT_MAP_BASE) +
348 (i << 3)));
349 }
350
351 init_sb1250_irqs();
352
353 /*
354 * Map the high 16 bits of the mailbox registers to IP[3], for
355 * inter-cpu messages
356 */
357 /* Was I1 */
358 bus_writeq(IMR_IP3_VAL,
359 IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) +
360 (K_INT_MBOX_0 << 3)));
361 bus_writeq(IMR_IP3_VAL,
362 IOADDR(A_IMR_REGISTER(1, R_IMR_INTERRUPT_MAP_BASE) +
363 (K_INT_MBOX_0 << 3)));
364
365 /* Clear the mailboxes. The firmware may leave them dirty */
366 bus_writeq(0xffffffffffffffffULL,
367 IOADDR(A_IMR_REGISTER(0, R_IMR_MAILBOX_CLR_CPU)));
368 bus_writeq(0xffffffffffffffffULL,
369 IOADDR(A_IMR_REGISTER(1, R_IMR_MAILBOX_CLR_CPU)));
370
371 /* Mask everything except the mailbox registers for both cpus */
372 tmp = ~((u64) 0) ^ (((u64) 1) << K_INT_MBOX_0);
373 bus_writeq(tmp, IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MASK)));
374 bus_writeq(tmp, IOADDR(A_IMR_REGISTER(1, R_IMR_INTERRUPT_MASK)));
375
376 sb1250_steal_irq(K_INT_MBOX_0);
377
378 /*
379 * Note that the timer interrupts are also mapped, but this is
380 * done in sb1250_time_init(). Also, the profiling driver
381 * does its own management of IP7.
382 */
383
384#ifdef CONFIG_KGDB
385 imask |= STATUSF_IP6;
386#endif
387 /* Enable necessary IPs, disable the rest */
388 change_c0_status(ST0_IM, imask);
389 set_except_vector(0, sb1250_irq_handler);
390
391#ifdef CONFIG_KGDB
392 if (kgdb_flag) {
393 kgdb_irq = K_INT_UART_0 + kgdb_port;
394
395#ifdef CONFIG_SIBYTE_SB1250_DUART
396 sb1250_duart_present[kgdb_port] = 0;
397#endif
398 /* Setup uart 1 settings, mapper */
399 bus_writeq(M_DUART_IMR_BRK, IOADDR(A_DUART_IMRREG(kgdb_port)));
400
401 sb1250_steal_irq(kgdb_irq);
402 bus_writeq(IMR_IP6_VAL,
403 IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) +
404 (kgdb_irq<<3)));
405 sb1250_unmask_irq(0, kgdb_irq);
406 }
407#endif
408}
409
410#ifdef CONFIG_KGDB
411
412#include <linux/delay.h>
413
414#define duart_out(reg, val) csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port,reg)))
415#define duart_in(reg) csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port,reg)))
416
417void sb1250_kgdb_interrupt(struct pt_regs *regs)
418{
419 /*
420 * Clear break-change status (allow some time for the remote
421 * host to stop the break, since we would see another
422 * interrupt on the end-of-break too)
423 */
424 kstat_this_cpu.irqs[kgdb_irq]++;
425 mdelay(500);
426 duart_out(R_DUART_CMD, V_DUART_MISC_CMD_RESET_BREAK_INT |
427 M_DUART_RX_EN | M_DUART_TX_EN);
428 set_async_breakpoint(&regs->cp0_epc);
429}
430
431#endif /* CONFIG_KGDB */
diff --git a/arch/mips/sibyte/sb1250/irq_handler.S b/arch/mips/sibyte/sb1250/irq_handler.S
new file mode 100644
index 000000000000..60edc8fb302b
--- /dev/null
+++ b/arch/mips/sibyte/sb1250/irq_handler.S
@@ -0,0 +1,147 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/*
20 * sb1250_handle_int() is the routine that is actually called when an interrupt
21 * occurs. It is installed as the exception vector handler in arch_init_irq()
22 * in arch/mips/sibyte/sb1250/irq.c
23 *
24 * In the handle we figure out which interrupts need handling, and use that to
25 * call the dispatcher, which will take care of actually calling registered
26 * handlers
27 *
28 * Note that we take care of all raised interrupts in one go at the handler.
29 * This is more BSDish than the Indy code, and also, IMHO, more sane.
30 */
31#include <linux/config.h>
32
33#include <asm/addrspace.h>
34#include <asm/asm.h>
35#include <asm/mipsregs.h>
36#include <asm/regdef.h>
37#include <asm/stackframe.h>
38#include <asm/sibyte/sb1250_defs.h>
39#include <asm/sibyte/sb1250_regs.h>
40#include <asm/sibyte/sb1250_int.h>
41
42/*
43 * What a pain. We have to be really careful saving the upper 32 bits of any
44 * register across function calls if we don't want them trashed--since were
45 * running in -o32, the calling routing never saves the full 64 bits of a
46 * register across a function call. Being the interrupt handler, we're
47 * guaranteed that interrupts are disabled during this code so we don't have
48 * to worry about random interrupts blasting the high 32 bits.
49 */
50
51 .text
52 .set push
53 .set noreorder
54 .set noat
55 .set mips64
56 .align 5
57 NESTED(sb1250_irq_handler, PT_SIZE, sp)
58 SAVE_ALL
59 CLI
60
61#ifdef CONFIG_SIBYTE_SB1250_PROF
62 /* Set compare to count to silence count/compare timer interrupts */
63 mfc0 t1, CP0_COUNT
64 mtc0 t1, CP0_COMPARE /* pause to clear IP[7] bit of cause ? */
65#endif
66 /* Read cause */
67 mfc0 s0, CP0_CAUSE
68
69#ifdef CONFIG_SIBYTE_SB1250_PROF
70 /* Cpu performance counter interrupt is routed to IP[7] */
71 andi t1, s0, CAUSEF_IP7
72 beqz t1, 0f
73 srl t1, s0, (CAUSEB_BD-2) /* Shift BD bit to bit 2 */
74 and t1, t1, 0x4 /* mask to get just BD bit */
75 mfc0 a0, CP0_EPC
76 jal sbprof_cpu_intr
77 addu a0, a0, t1 /* a0 = EPC + (BD ? 4 : 0) */
78 j ret_from_irq
79 nop
800:
81#endif
82
83 /* Timer interrupt is routed to IP[4] */
84 andi t1, s0, CAUSEF_IP4
85 beqz t1, 1f
86 nop
87 jal sb1250_timer_interrupt
88 move a0, sp /* Pass the registers along */
89 j ret_from_irq
90 nop # delay slot
911:
92
93#ifdef CONFIG_SMP
94 /* Mailbox interrupt is routed to IP[3] */
95 andi t1, s0, CAUSEF_IP3
96 beqz t1, 2f
97 nop
98 jal sb1250_mailbox_interrupt
99 move a0, sp
100 j ret_from_irq
101 nop # delay slot
1022:
103#endif
104
105#ifdef CONFIG_KGDB
106 /* KGDB (uart 1) interrupt is routed to IP[6] */
107 andi t1, s0, CAUSEF_IP6
108 beqz t1, 1f
109 nop # delay slot
110 jal sb1250_kgdb_interrupt
111 move a0, sp
112 j ret_from_irq
113 nop # delay slot
1141:
115#endif
116
117 and t1, s0, CAUSEF_IP2
118 beqz t1, 4f
119 nop
120
121 /*
122 * Default...we've hit an IP[2] interrupt, which means we've got to
123 * check the 1250 interrupt registers to figure out what to do
124 * Need to detect which CPU we're on, now that smp_affinity is supported.
125 */
126 PTR_LA v0, CKSEG1 + A_IMR_CPU0_BASE
127#ifdef CONFIG_SMP
128 lw t1, TI_CPU($28)
129 sll t1, IMR_REGISTER_SPACING_SHIFT
130 addu v0, t1
131#endif
132 ld s0, R_IMR_INTERRUPT_STATUS_BASE(v0) /* read IP[2] status */
133
134 beqz s0, 4f /* No interrupts. Return */
135 move a1, sp
136
1373: dclz s1, s0 /* Find the next interrupt */
138 dsubu a0, zero, s1
139 daddiu a0, a0, 63
140 jal do_IRQ
141 nop
142
1434: j ret_from_irq
144 nop
145
146 .set pop
147 END(sb1250_irq_handler)
diff --git a/arch/mips/sibyte/sb1250/prom.c b/arch/mips/sibyte/sb1250/prom.c
new file mode 100644
index 000000000000..de62ab0f55a2
--- /dev/null
+++ b/arch/mips/sibyte/sb1250/prom.c
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#include <linux/config.h>
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/mm.h>
23#include <linux/blkdev.h>
24#include <linux/bootmem.h>
25#include <linux/smp.h>
26#include <linux/initrd.h>
27
28#include <asm/bootinfo.h>
29#include <asm/reboot.h>
30
31#define MAX_RAM_SIZE ((CONFIG_SIBYTE_STANDALONE_RAM_SIZE * 1024 * 1024) - 1)
32
33static __init void prom_meminit(void)
34{
35#ifdef CONFIG_BLK_DEV_INITRD
36 unsigned long initrd_pstart;
37 unsigned long initrd_pend;
38
39 initrd_pstart = __pa(initrd_start);
40 initrd_pend = __pa(initrd_end);
41 if (initrd_start &&
42 ((initrd_pstart > MAX_RAM_SIZE)
43 || (initrd_pend > MAX_RAM_SIZE))) {
44 panic("initrd out of addressable memory");
45 }
46
47 add_memory_region(0, initrd_pstart,
48 BOOT_MEM_RAM);
49 add_memory_region(initrd_pstart, initrd_pend - initrd_pstart,
50 BOOT_MEM_RESERVED);
51 add_memory_region(initrd_pend,
52 (CONFIG_SIBYTE_STANDALONE_RAM_SIZE * 1024 * 1024) - initrd_pend,
53 BOOT_MEM_RAM);
54#else
55 add_memory_region(0, CONFIG_SIBYTE_STANDALONE_RAM_SIZE * 1024 * 1024,
56 BOOT_MEM_RAM);
57#endif
58}
59
60void prom_cpu0_exit(void *unused)
61{
62 while (1) ;
63}
64
65static void prom_linux_exit(void)
66{
67#ifdef CONFIG_SMP
68 if (smp_processor_id()) {
69 smp_call_function(prom_cpu0_exit,NULL,1,1);
70 }
71#endif
72 while(1);
73}
74
75/*
76 * prom_init is called just after the cpu type is determined, from setup_arch()
77 */
78void __init prom_init(void)
79{
80 _machine_restart = (void (*)(char *))prom_linux_exit;
81 _machine_halt = prom_linux_exit;
82 _machine_power_off = prom_linux_exit;
83
84 strcpy(arcs_cmdline, "root=/dev/ram0 ");
85
86 mips_machgroup = MACH_GROUP_SIBYTE;
87 prom_meminit();
88}
89
90unsigned long __init prom_free_prom_memory(void)
91{
92 /* Not sure what I'm supposed to do here. Nothing, I think */
93 return 0;
94}
95
96void prom_putchar(char c)
97{
98}
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
new file mode 100644
index 000000000000..f8c605be96c7
--- /dev/null
+++ b/arch/mips/sibyte/sb1250/setup.c
@@ -0,0 +1,206 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/config.h>
19#include <linux/kernel.h>
20#include <linux/reboot.h>
21#include <linux/string.h>
22
23#include <asm/bootinfo.h>
24#include <asm/mipsregs.h>
25#include <asm/io.h>
26#include <asm/sibyte/sb1250.h>
27#include <asm/sibyte/sb1250_regs.h>
28#include <asm/sibyte/sb1250_scd.h>
29
30unsigned int sb1_pass;
31unsigned int soc_pass;
32unsigned int soc_type;
33unsigned int periph_rev;
34unsigned int zbbus_mhz;
35
36static char *soc_str;
37static char *pass_str;
38static unsigned int war_pass; /* XXXKW don't overload PASS defines? */
39
40static inline int setup_bcm1250(void);
41static inline int setup_bcm112x(void);
42
43/* Setup code likely to be common to all SiByte platforms */
44
45static inline int sys_rev_decode(void)
46{
47 int ret = 0;
48
49 war_pass = soc_pass;
50 switch (soc_type) {
51 case K_SYS_SOC_TYPE_BCM1250:
52 case K_SYS_SOC_TYPE_BCM1250_ALT:
53 case K_SYS_SOC_TYPE_BCM1250_ALT2:
54 soc_str = "BCM1250";
55 ret = setup_bcm1250();
56 break;
57 case K_SYS_SOC_TYPE_BCM1120:
58 soc_str = "BCM1120";
59 ret = setup_bcm112x();
60 break;
61 case K_SYS_SOC_TYPE_BCM1125:
62 soc_str = "BCM1125";
63 ret = setup_bcm112x();
64 break;
65 case K_SYS_SOC_TYPE_BCM1125H:
66 soc_str = "BCM1125H";
67 ret = setup_bcm112x();
68 break;
69 default:
70 prom_printf("Unknown SOC type %x\n", soc_type);
71 ret = 1;
72 break;
73 }
74 return ret;
75}
76
77static inline int setup_bcm1250(void)
78{
79 int ret = 0;
80
81 switch (soc_pass) {
82 case K_SYS_REVISION_BCM1250_PASS1:
83 periph_rev = 1;
84 pass_str = "Pass 1";
85 break;
86 case K_SYS_REVISION_BCM1250_A10:
87 periph_rev = 2;
88 pass_str = "A8/A10";
89 /* XXXKW different war_pass? */
90 war_pass = K_SYS_REVISION_BCM1250_PASS2;
91 break;
92 case K_SYS_REVISION_BCM1250_PASS2_2:
93 periph_rev = 2;
94 pass_str = "B1";
95 break;
96 case K_SYS_REVISION_BCM1250_B2:
97 periph_rev = 2;
98 pass_str = "B2";
99 war_pass = K_SYS_REVISION_BCM1250_PASS2_2;
100 break;
101 case K_SYS_REVISION_BCM1250_PASS3:
102 periph_rev = 3;
103 pass_str = "C0";
104 break;
105 case K_SYS_REVISION_BCM1250_C1:
106 periph_rev = 3;
107 pass_str = "C1";
108 break;
109 default:
110 if (soc_pass < K_SYS_REVISION_BCM1250_PASS2_2) {
111 periph_rev = 2;
112 pass_str = "A0-A6";
113 war_pass = K_SYS_REVISION_BCM1250_PASS2;
114 } else {
115 prom_printf("Unknown BCM1250 rev %x\n", soc_pass);
116 ret = 1;
117 }
118 break;
119 }
120 return ret;
121}
122
123static inline int setup_bcm112x(void)
124{
125 int ret = 0;
126
127 switch (soc_pass) {
128 case 0:
129 /* Early build didn't have revid set */
130 periph_rev = 3;
131 pass_str = "A1";
132 war_pass = K_SYS_REVISION_BCM112x_A1;
133 break;
134 case K_SYS_REVISION_BCM112x_A1:
135 periph_rev = 3;
136 pass_str = "A1";
137 break;
138 case K_SYS_REVISION_BCM112x_A2:
139 periph_rev = 3;
140 pass_str = "A2";
141 break;
142 default:
143 prom_printf("Unknown %s rev %x\n", soc_str, soc_pass);
144 ret = 1;
145 }
146 return ret;
147}
148
149void sb1250_setup(void)
150{
151 uint64_t sys_rev;
152 int plldiv;
153 int bad_config = 0;
154
155 sb1_pass = read_c0_prid() & 0xff;
156 sys_rev = bus_readq(IOADDR(A_SCD_SYSTEM_REVISION));
157 soc_type = SYS_SOC_TYPE(sys_rev);
158 soc_pass = G_SYS_REVISION(sys_rev);
159
160 if (sys_rev_decode()) {
161 prom_printf("Restart after failure to identify SiByte chip\n");
162 machine_restart(NULL);
163 }
164
165 plldiv = G_SYS_PLL_DIV(bus_readq(IOADDR(A_SCD_SYSTEM_CFG)));
166 zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25);
167
168 prom_printf("Broadcom SiByte %s %s @ %d MHz (SB1 rev %d)\n",
169 soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
170 prom_printf("Board type: %s\n", get_system_type());
171
172 switch(war_pass) {
173 case K_SYS_REVISION_BCM1250_PASS1:
174#ifndef CONFIG_SB1_PASS_1_WORKAROUNDS
175 prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n");
176 bad_config = 1;
177#endif
178 break;
179 case K_SYS_REVISION_BCM1250_PASS2:
180 /* Pass 2 - easiest as default for now - so many numbers */
181#if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS)
182 prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n");
183 bad_config = 1;
184#endif
185#ifdef CONFIG_CPU_HAS_PREFETCH
186 prom_printf("@@@@ Prefetches may be enabled in this kernel, but are buggy on this board. @@@@\n");
187 bad_config = 1;
188#endif
189 break;
190 case K_SYS_REVISION_BCM1250_PASS2_2:
191#ifndef CONFIG_SB1_PASS_2_WORKAROUNDS
192 prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n");
193 bad_config = 1;
194#endif
195#if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || !defined(CONFIG_CPU_HAS_PREFETCH)
196 prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is conservatively configured for an 'A' stepping. @@@@\n");
197#endif
198 break;
199 default:
200 break;
201 }
202 if (bad_config) {
203 prom_printf("Invalid configuration for this chip.\n");
204 machine_restart(NULL);
205 }
206}
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c
new file mode 100644
index 000000000000..be91b3990952
--- /dev/null
+++ b/arch/mips/sibyte/sb1250/smp.c
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#include <linux/init.h>
20#include <linux/delay.h>
21#include <linux/interrupt.h>
22#include <linux/smp.h>
23#include <linux/kernel_stat.h>
24
25#include <asm/mmu_context.h>
26#include <asm/io.h>
27#include <asm/sibyte/sb1250.h>
28#include <asm/sibyte/sb1250_regs.h>
29#include <asm/sibyte/sb1250_int.h>
30
31static void *mailbox_set_regs[] = {
32 (void *)IOADDR(A_IMR_CPU0_BASE + R_IMR_MAILBOX_SET_CPU),
33 (void *)IOADDR(A_IMR_CPU1_BASE + R_IMR_MAILBOX_SET_CPU)
34};
35
36static void *mailbox_clear_regs[] = {
37 (void *)IOADDR(A_IMR_CPU0_BASE + R_IMR_MAILBOX_CLR_CPU),
38 (void *)IOADDR(A_IMR_CPU1_BASE + R_IMR_MAILBOX_CLR_CPU)
39};
40
41static void *mailbox_regs[] = {
42 (void *)IOADDR(A_IMR_CPU0_BASE + R_IMR_MAILBOX_CPU),
43 (void *)IOADDR(A_IMR_CPU1_BASE + R_IMR_MAILBOX_CPU)
44};
45
46/*
47 * SMP init and finish on secondary CPUs
48 */
49void sb1250_smp_init(void)
50{
51 unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 |
52 STATUSF_IP1 | STATUSF_IP0;
53
54 /* Set interrupt mask, but don't enable */
55 change_c0_status(ST0_IM, imask);
56}
57
58void sb1250_smp_finish(void)
59{
60 extern void sb1250_time_init(void);
61 sb1250_time_init();
62 local_irq_enable();
63}
64
65/*
66 * These are routines for dealing with the sb1250 smp capabilities
67 * independent of board/firmware
68 */
69
70/*
71 * Simple enough; everything is set up, so just poke the appropriate mailbox
72 * register, and we should be set
73 */
74void core_send_ipi(int cpu, unsigned int action)
75{
76 bus_writeq((((u64)action) << 48), mailbox_set_regs[cpu]);
77}
78
79void sb1250_mailbox_interrupt(struct pt_regs *regs)
80{
81 int cpu = smp_processor_id();
82 unsigned int action;
83
84 kstat_this_cpu.irqs[K_INT_MBOX_0]++;
85 /* Load the mailbox register to figure out what we're supposed to do */
86 action = (__bus_readq(mailbox_regs[cpu]) >> 48) & 0xffff;
87
88 /* Clear the mailbox to clear the interrupt */
89 __bus_writeq(((u64)action) << 48, mailbox_clear_regs[cpu]);
90
91 /*
92 * Nothing to do for SMP_RESCHEDULE_YOURSELF; returning from the
93 * interrupt will do the reschedule for us
94 */
95
96 if (action & SMP_CALL_FUNCTION)
97 smp_call_function_interrupt();
98}
diff --git a/arch/mips/sibyte/sb1250/time.c b/arch/mips/sibyte/sb1250/time.c
new file mode 100644
index 000000000000..8b4c848c907b
--- /dev/null
+++ b/arch/mips/sibyte/sb1250/time.c
@@ -0,0 +1,136 @@
1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/*
20 * These are routines to set up and handle interrupts from the
21 * sb1250 general purpose timer 0. We're using the timer as a
22 * system clock, so we set it up to run at 100 Hz. On every
23 * interrupt, we update our idea of what the time of day is,
24 * then call do_timer() in the architecture-independent kernel
25 * code to do general bookkeeping (e.g. update jiffies, run
26 * bottom halves, etc.)
27 */
28#include <linux/config.h>
29#include <linux/interrupt.h>
30#include <linux/sched.h>
31#include <linux/spinlock.h>
32#include <linux/kernel_stat.h>
33
34#include <asm/irq.h>
35#include <asm/ptrace.h>
36#include <asm/addrspace.h>
37#include <asm/time.h>
38#include <asm/io.h>
39
40#include <asm/sibyte/sb1250.h>
41#include <asm/sibyte/sb1250_regs.h>
42#include <asm/sibyte/sb1250_int.h>
43#include <asm/sibyte/sb1250_scd.h>
44
45
46#define IMR_IP2_VAL K_INT_MAP_I0
47#define IMR_IP3_VAL K_INT_MAP_I1
48#define IMR_IP4_VAL K_INT_MAP_I2
49
50extern int sb1250_steal_irq(int irq);
51
52void sb1250_time_init(void)
53{
54 int cpu = smp_processor_id();
55 int irq = K_INT_TIMER_0+cpu;
56
57 /* Only have 4 general purpose timers */
58 if (cpu > 3) {
59 BUG();
60 }
61
62 if (!cpu) {
63 /* Use our own gettimeoffset() routine */
64 do_gettimeoffset = sb1250_gettimeoffset;
65 }
66
67 sb1250_mask_irq(cpu, irq);
68
69 /* Map the timer interrupt to ip[4] of this cpu */
70 bus_writeq(IMR_IP4_VAL,
71 IOADDR(A_IMR_REGISTER(cpu, R_IMR_INTERRUPT_MAP_BASE) +
72 (irq << 3)));
73
74 /* the general purpose timer ticks at 1 Mhz independent if the rest of the system */
75 /* Disable the timer and set up the count */
76 bus_writeq(0, IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
77#ifdef CONFIG_SIMULATION
78 bus_writeq(50000 / HZ,
79 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT)));
80#else
81 bus_writeq(1000000/HZ,
82 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT)));
83#endif
84
85 /* Set the timer running */
86 bus_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
87 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
88
89 sb1250_unmask_irq(cpu, irq);
90 sb1250_steal_irq(irq);
91 /*
92 * This interrupt is "special" in that it doesn't use the request_irq
93 * way to hook the irq line. The timer interrupt is initialized early
94 * enough to make this a major pain, and it's also firing enough to
95 * warrant a bit of special case code. sb1250_timer_interrupt is
96 * called directly from irq_handler.S when IP[4] is set during an
97 * interrupt
98 */
99}
100
101void sb1250_timer_interrupt(struct pt_regs *regs)
102{
103 extern asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs);
104 int cpu = smp_processor_id();
105 int irq = K_INT_TIMER_0 + cpu;
106
107 /* Reset the timer */
108 __bus_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
109 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
110
111 /*
112 * CPU 0 handles the global timer interrupt job
113 */
114 if (cpu == 0) {
115 ll_timer_interrupt(irq, regs);
116 }
117
118 /*
119 * every CPU should do profiling and process accouting
120 */
121 ll_local_timer_interrupt(irq, regs);
122}
123
124/*
125 * We use our own do_gettimeoffset() instead of the generic one,
126 * because the generic one does not work for SMP case.
127 * In addition, since we use general timer 0 for system time,
128 * we can get accurate intra-jiffy offset without calibration.
129 */
130unsigned long sb1250_gettimeoffset(void)
131{
132 unsigned long count =
133 bus_readq(IOADDR(A_SCD_TIMER_REGISTER(0, R_SCD_TIMER_CNT)));
134
135 return 1000000/HZ - count;
136 }
diff --git a/arch/mips/sibyte/swarm/Makefile b/arch/mips/sibyte/swarm/Makefile
new file mode 100644
index 000000000000..2d626039195c
--- /dev/null
+++ b/arch/mips/sibyte/swarm/Makefile
@@ -0,0 +1,3 @@
1lib-y = setup.o rtc_xicor1241.o rtc_m41t81.o
2
3lib-$(CONFIG_KGDB) += dbg_io.o
diff --git a/arch/mips/sibyte/swarm/dbg_io.c b/arch/mips/sibyte/swarm/dbg_io.c
new file mode 100644
index 000000000000..75ce14c8eb69
--- /dev/null
+++ b/arch/mips/sibyte/swarm/dbg_io.c
@@ -0,0 +1,76 @@
1/*
2 * kgdb debug routines for SiByte boards.
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: Jun Sun, 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/* -------------------- BEGINNING OF CONFIG --------------------- */
15
16#include <linux/delay.h>
17#include <asm/io.h>
18#include <asm/sibyte/sb1250.h>
19#include <asm/sibyte/sb1250_regs.h>
20#include <asm/sibyte/sb1250_uart.h>
21#include <asm/sibyte/sb1250_int.h>
22#include <asm/addrspace.h>
23
24/*
25 * We use the second serial port for kgdb traffic.
26 * 115200, 8, N, 1.
27 */
28
29#define BAUD_RATE 115200
30#define CLK_DIVISOR V_DUART_BAUD_RATE(BAUD_RATE)
31#define DATA_BITS V_DUART_BITS_PER_CHAR_8 /* or 7 */
32#define PARITY V_DUART_PARITY_MODE_NONE /* or even */
33#define STOP_BITS M_DUART_STOP_BIT_LEN_1 /* or 2 */
34
35static int duart_initialized = 0; /* 0: need to be init'ed by kgdb */
36
37/* -------------------- END OF CONFIG --------------------- */
38extern int kgdb_port;
39
40#define duart_out(reg, val) csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port,reg)))
41#define duart_in(reg) csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port,reg)))
42
43void putDebugChar(unsigned char c);
44unsigned char getDebugChar(void);
45static void
46duart_init(int clk_divisor, int data, int parity, int stop)
47{
48 duart_out(R_DUART_MODE_REG_1, data | parity);
49 duart_out(R_DUART_MODE_REG_2, stop);
50 duart_out(R_DUART_CLK_SEL, clk_divisor);
51
52 duart_out(R_DUART_CMD, M_DUART_RX_EN | M_DUART_TX_EN); /* enable rx and tx */
53}
54
55void
56putDebugChar(unsigned char c)
57{
58 if (!duart_initialized) {
59 duart_initialized = 1;
60 duart_init(CLK_DIVISOR, DATA_BITS, PARITY, STOP_BITS);
61 }
62 while ((duart_in(R_DUART_STATUS) & M_DUART_TX_RDY) == 0);
63 duart_out(R_DUART_TX_HOLD, c);
64}
65
66unsigned char
67getDebugChar(void)
68{
69 if (!duart_initialized) {
70 duart_initialized = 1;
71 duart_init(CLK_DIVISOR, DATA_BITS, PARITY, STOP_BITS);
72 }
73 while ((duart_in(R_DUART_STATUS) & M_DUART_RX_RDY) == 0) ;
74 return duart_in(R_DUART_RX_HOLD);
75}
76
diff --git a/arch/mips/sibyte/swarm/rtc_m41t81.c b/arch/mips/sibyte/swarm/rtc_m41t81.c
new file mode 100644
index 000000000000..0e633ee8d83c
--- /dev/null
+++ b/arch/mips/sibyte/swarm/rtc_m41t81.c
@@ -0,0 +1,224 @@
1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * Copyright (C) 2002 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#include <linux/bcd.h>
14#include <linux/types.h>
15#include <linux/time.h>
16
17#include <asm/time.h>
18#include <asm/addrspace.h>
19#include <asm/io.h>
20
21#include <asm/sibyte/sb1250.h>
22#include <asm/sibyte/sb1250_regs.h>
23#include <asm/sibyte/sb1250_smbus.h>
24
25
26/* M41T81 definitions */
27
28/*
29 * Register bits
30 */
31
32#define M41T81REG_SC_ST 0x80 /* stop bit */
33#define M41T81REG_HR_CB 0x40 /* century bit */
34#define M41T81REG_HR_CEB 0x80 /* century enable bit */
35#define M41T81REG_CTL_S 0x20 /* sign bit */
36#define M41T81REG_CTL_FT 0x40 /* frequency test bit */
37#define M41T81REG_CTL_OUT 0x80 /* output level */
38#define M41T81REG_WD_RB0 0x01 /* watchdog resolution bit 0 */
39#define M41T81REG_WD_RB1 0x02 /* watchdog resolution bit 1 */
40#define M41T81REG_WD_BMB0 0x04 /* watchdog multiplier bit 0 */
41#define M41T81REG_WD_BMB1 0x08 /* watchdog multiplier bit 1 */
42#define M41T81REG_WD_BMB2 0x10 /* watchdog multiplier bit 2 */
43#define M41T81REG_WD_BMB3 0x20 /* watchdog multiplier bit 3 */
44#define M41T81REG_WD_BMB4 0x40 /* watchdog multiplier bit 4 */
45#define M41T81REG_AMO_ABE 0x20 /* alarm in "battery back-up mode" enable bit */
46#define M41T81REG_AMO_SQWE 0x40 /* square wave enable */
47#define M41T81REG_AMO_AFE 0x80 /* alarm flag enable flag */
48#define M41T81REG_ADT_RPT5 0x40 /* alarm repeat mode bit 5 */
49#define M41T81REG_ADT_RPT4 0x80 /* alarm repeat mode bit 4 */
50#define M41T81REG_AHR_RPT3 0x80 /* alarm repeat mode bit 3 */
51#define M41T81REG_AHR_HT 0x40 /* halt update bit */
52#define M41T81REG_AMN_RPT2 0x80 /* alarm repeat mode bit 2 */
53#define M41T81REG_ASC_RPT1 0x80 /* alarm repeat mode bit 1 */
54#define M41T81REG_FLG_AF 0x40 /* alarm flag (read only) */
55#define M41T81REG_FLG_WDF 0x80 /* watchdog flag (read only) */
56#define M41T81REG_SQW_RS0 0x10 /* sqw frequency bit 0 */
57#define M41T81REG_SQW_RS1 0x20 /* sqw frequency bit 1 */
58#define M41T81REG_SQW_RS2 0x40 /* sqw frequency bit 2 */
59#define M41T81REG_SQW_RS3 0x80 /* sqw frequency bit 3 */
60
61
62/*
63 * Register numbers
64 */
65
66#define M41T81REG_TSC 0x00 /* tenths/hundredths of second */
67#define M41T81REG_SC 0x01 /* seconds */
68#define M41T81REG_MN 0x02 /* minute */
69#define M41T81REG_HR 0x03 /* hour/century */
70#define M41T81REG_DY 0x04 /* day of week */
71#define M41T81REG_DT 0x05 /* date of month */
72#define M41T81REG_MO 0x06 /* month */
73#define M41T81REG_YR 0x07 /* year */
74#define M41T81REG_CTL 0x08 /* control */
75#define M41T81REG_WD 0x09 /* watchdog */
76#define M41T81REG_AMO 0x0A /* alarm: month */
77#define M41T81REG_ADT 0x0B /* alarm: date */
78#define M41T81REG_AHR 0x0C /* alarm: hour */
79#define M41T81REG_AMN 0x0D /* alarm: minute */
80#define M41T81REG_ASC 0x0E /* alarm: second */
81#define M41T81REG_FLG 0x0F /* flags */
82#define M41T81REG_SQW 0x13 /* square wave register */
83
84#define M41T81_CCR_ADDRESS 0x68
85#define SMB_CSR(reg) ((u8 *) (IOADDR(A_SMB_REGISTER(1, reg))))
86
87static int m41t81_read(uint8_t addr)
88{
89 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
90 ;
91
92 bus_writeq(addr & 0xff, SMB_CSR(R_SMB_CMD));
93 bus_writeq((V_SMB_ADDR(M41T81_CCR_ADDRESS) | V_SMB_TT_WR1BYTE),
94 SMB_CSR(R_SMB_START));
95
96 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
97 ;
98
99 bus_writeq((V_SMB_ADDR(M41T81_CCR_ADDRESS) | V_SMB_TT_RD1BYTE),
100 SMB_CSR(R_SMB_START));
101
102 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
103 ;
104
105 if (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_ERROR) {
106 /* Clear error bit by writing a 1 */
107 bus_writeq(M_SMB_ERROR, SMB_CSR(R_SMB_STATUS));
108 return -1;
109 }
110
111 return (bus_readq(SMB_CSR(R_SMB_DATA)) & 0xff);
112}
113
114static int m41t81_write(uint8_t addr, int b)
115{
116 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
117 ;
118
119 bus_writeq((addr & 0xFF), SMB_CSR(R_SMB_CMD));
120 bus_writeq((b & 0xff), SMB_CSR(R_SMB_DATA));
121 bus_writeq(V_SMB_ADDR(M41T81_CCR_ADDRESS) | V_SMB_TT_WR2BYTE,
122 SMB_CSR(R_SMB_START));
123
124 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
125 ;
126
127 if (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_ERROR) {
128 /* Clear error bit by writing a 1 */
129 bus_writeq(M_SMB_ERROR, SMB_CSR(R_SMB_STATUS));
130 return -1;
131 }
132
133 /* read the same byte again to make sure it is written */
134 bus_writeq(V_SMB_ADDR(M41T81_CCR_ADDRESS) | V_SMB_TT_RD1BYTE,
135 SMB_CSR(R_SMB_START));
136
137 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
138 ;
139
140 return 0;
141}
142
143int m41t81_set_time(unsigned long t)
144{
145 struct rtc_time tm;
146
147 to_tm(t, &tm);
148
149 /*
150 * Note the write order matters as it ensures the correctness.
151 * When we write sec, 10th sec is clear. It is reasonable to
152 * believe we should finish writing min within a second.
153 */
154
155 tm.tm_sec = BIN2BCD(tm.tm_sec);
156 m41t81_write(M41T81REG_SC, tm.tm_sec);
157
158 tm.tm_min = BIN2BCD(tm.tm_min);
159 m41t81_write(M41T81REG_MN, tm.tm_min);
160
161 tm.tm_hour = BIN2BCD(tm.tm_hour);
162 tm.tm_hour = (tm.tm_hour & 0x3f) | (m41t81_read(M41T81REG_HR) & 0xc0);
163 m41t81_write(M41T81REG_HR, tm.tm_hour);
164
165 /* tm_wday starts from 0 to 6 */
166 if (tm.tm_wday == 0) tm.tm_wday = 7;
167 tm.tm_wday = BIN2BCD(tm.tm_wday);
168 m41t81_write(M41T81REG_DY, tm.tm_wday);
169
170 tm.tm_mday = BIN2BCD(tm.tm_mday);
171 m41t81_write(M41T81REG_DT, tm.tm_mday);
172
173 /* tm_mon starts from 0, *ick* */
174 tm.tm_mon ++;
175 tm.tm_mon = BIN2BCD(tm.tm_mon);
176 m41t81_write(M41T81REG_MO, tm.tm_mon);
177
178 /* we don't do century, everything is beyond 2000 */
179 tm.tm_year %= 100;
180 tm.tm_year = BIN2BCD(tm.tm_year);
181 m41t81_write(M41T81REG_YR, tm.tm_year);
182
183 return 0;
184}
185
186unsigned long m41t81_get_time(void)
187{
188 unsigned int year, mon, day, hour, min, sec;
189
190 /*
191 * min is valid if two reads of sec are the same.
192 */
193 for (;;) {
194 sec = m41t81_read(M41T81REG_SC);
195 min = m41t81_read(M41T81REG_MN);
196 if (sec == m41t81_read(M41T81REG_SC)) break;
197 }
198 hour = m41t81_read(M41T81REG_HR) & 0x3f;
199 day = m41t81_read(M41T81REG_DT);
200 mon = m41t81_read(M41T81REG_MO);
201 year = m41t81_read(M41T81REG_YR);
202
203 sec = BCD2BIN(sec);
204 min = BCD2BIN(min);
205 hour = BCD2BIN(hour);
206 day = BCD2BIN(day);
207 mon = BCD2BIN(mon);
208 year = BCD2BIN(year);
209
210 year += 2000;
211
212 return mktime(year, mon, day, hour, min, sec);
213}
214
215int m41t81_probe(void)
216{
217 unsigned int tmp;
218
219 /* enable chip if it is not enabled yet */
220 tmp = m41t81_read(M41T81REG_SC);
221 m41t81_write(M41T81REG_SC, tmp & 0x7f);
222
223 return (m41t81_read(M41T81REG_SC) != -1);
224}
diff --git a/arch/mips/sibyte/swarm/rtc_xicor1241.c b/arch/mips/sibyte/swarm/rtc_xicor1241.c
new file mode 100644
index 000000000000..981d21f16e64
--- /dev/null
+++ b/arch/mips/sibyte/swarm/rtc_xicor1241.c
@@ -0,0 +1,203 @@
1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * Copyright (C) 2002 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#include <linux/bcd.h>
13#include <linux/types.h>
14#include <linux/time.h>
15
16#include <asm/time.h>
17#include <asm/addrspace.h>
18#include <asm/io.h>
19
20#include <asm/sibyte/sb1250.h>
21#include <asm/sibyte/sb1250_regs.h>
22#include <asm/sibyte/sb1250_smbus.h>
23
24
25/* Xicor 1241 definitions */
26
27/*
28 * Register bits
29 */
30
31#define X1241REG_SR_BAT 0x80 /* currently on battery power */
32#define X1241REG_SR_RWEL 0x04 /* r/w latch is enabled, can write RTC */
33#define X1241REG_SR_WEL 0x02 /* r/w latch is unlocked, can enable r/w now */
34#define X1241REG_SR_RTCF 0x01 /* clock failed */
35#define X1241REG_BL_BP2 0x80 /* block protect 2 */
36#define X1241REG_BL_BP1 0x40 /* block protect 1 */
37#define X1241REG_BL_BP0 0x20 /* block protect 0 */
38#define X1241REG_BL_WD1 0x10
39#define X1241REG_BL_WD0 0x08
40#define X1241REG_HR_MIL 0x80 /* military time format */
41
42/*
43 * Register numbers
44 */
45
46#define X1241REG_BL 0x10 /* block protect bits */
47#define X1241REG_INT 0x11 /* */
48#define X1241REG_SC 0x30 /* Seconds */
49#define X1241REG_MN 0x31 /* Minutes */
50#define X1241REG_HR 0x32 /* Hours */
51#define X1241REG_DT 0x33 /* Day of month */
52#define X1241REG_MO 0x34 /* Month */
53#define X1241REG_YR 0x35 /* Year */
54#define X1241REG_DW 0x36 /* Day of Week */
55#define X1241REG_Y2K 0x37 /* Year 2K */
56#define X1241REG_SR 0x3F /* Status register */
57
58#define X1241_CCR_ADDRESS 0x6F
59
60#define SMB_CSR(reg) ((u8 *) (IOADDR(A_SMB_REGISTER(1, reg))))
61
62static int xicor_read(uint8_t addr)
63{
64 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
65 ;
66
67 bus_writeq((addr >> 8) & 0x7, SMB_CSR(R_SMB_CMD));
68 bus_writeq((addr & 0xff), SMB_CSR(R_SMB_DATA));
69 bus_writeq((V_SMB_ADDR(X1241_CCR_ADDRESS) | V_SMB_TT_WR2BYTE),
70 SMB_CSR(R_SMB_START));
71
72 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
73 ;
74
75 bus_writeq((V_SMB_ADDR(X1241_CCR_ADDRESS) | V_SMB_TT_RD1BYTE),
76 SMB_CSR(R_SMB_START));
77
78 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
79 ;
80
81 if (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_ERROR) {
82 /* Clear error bit by writing a 1 */
83 bus_writeq(M_SMB_ERROR, SMB_CSR(R_SMB_STATUS));
84 return -1;
85 }
86
87 return (bus_readq(SMB_CSR(R_SMB_DATA)) & 0xff);
88}
89
90static int xicor_write(uint8_t addr, int b)
91{
92 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
93 ;
94
95 bus_writeq(addr, SMB_CSR(R_SMB_CMD));
96 bus_writeq((addr & 0xff) | ((b & 0xff) << 8), SMB_CSR(R_SMB_DATA));
97 bus_writeq(V_SMB_ADDR(X1241_CCR_ADDRESS) | V_SMB_TT_WR3BYTE,
98 SMB_CSR(R_SMB_START));
99
100 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
101 ;
102
103 if (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_ERROR) {
104 /* Clear error bit by writing a 1 */
105 bus_writeq(M_SMB_ERROR, SMB_CSR(R_SMB_STATUS));
106 return -1;
107 } else {
108 return 0;
109 }
110}
111
112int xicor_set_time(unsigned long t)
113{
114 struct rtc_time tm;
115 int tmp;
116
117 to_tm(t, &tm);
118
119 /* unlock writes to the CCR */
120 xicor_write(X1241REG_SR, X1241REG_SR_WEL);
121 xicor_write(X1241REG_SR, X1241REG_SR_WEL | X1241REG_SR_RWEL);
122
123 /* trivial ones */
124 tm.tm_sec = BIN2BCD(tm.tm_sec);
125 xicor_write(X1241REG_SC, tm.tm_sec);
126
127 tm.tm_min = BIN2BCD(tm.tm_min);
128 xicor_write(X1241REG_MN, tm.tm_min);
129
130 tm.tm_mday = BIN2BCD(tm.tm_mday);
131 xicor_write(X1241REG_DT, tm.tm_mday);
132
133 /* tm_mon starts from 0, *ick* */
134 tm.tm_mon ++;
135 tm.tm_mon = BIN2BCD(tm.tm_mon);
136 xicor_write(X1241REG_MO, tm.tm_mon);
137
138 /* year is split */
139 tmp = tm.tm_year / 100;
140 tm.tm_year %= 100;
141 xicor_write(X1241REG_YR, tm.tm_year);
142 xicor_write(X1241REG_Y2K, tmp);
143
144 /* hour is the most tricky one */
145 tmp = xicor_read(X1241REG_HR);
146 if (tmp & X1241REG_HR_MIL) {
147 /* 24 hour format */
148 tm.tm_hour = BIN2BCD(tm.tm_hour);
149 tmp = (tmp & ~0x3f) | (tm.tm_hour & 0x3f);
150 } else {
151 /* 12 hour format, with 0x2 for pm */
152 tmp = tmp & ~0x3f;
153 if (tm.tm_hour >= 12) {
154 tmp |= 0x20;
155 tm.tm_hour -= 12;
156 }
157 tm.tm_hour = BIN2BCD(tm.tm_hour);
158 tmp |= tm.tm_hour;
159 }
160 xicor_write(X1241REG_HR, tmp);
161
162 xicor_write(X1241REG_SR, 0);
163
164 return 0;
165}
166
167unsigned long xicor_get_time(void)
168{
169 unsigned int year, mon, day, hour, min, sec, y2k;
170
171 sec = xicor_read(X1241REG_SC);
172 min = xicor_read(X1241REG_MN);
173 hour = xicor_read(X1241REG_HR);
174
175 if (hour & X1241REG_HR_MIL) {
176 hour &= 0x3f;
177 } else {
178 if (hour & 0x20)
179 hour = (hour & 0xf) + 0x12;
180 }
181
182 day = xicor_read(X1241REG_DT);
183 mon = xicor_read(X1241REG_MO);
184 year = xicor_read(X1241REG_YR);
185 y2k = xicor_read(X1241REG_Y2K);
186
187 sec = BCD2BIN(sec);
188 min = BCD2BIN(min);
189 hour = BCD2BIN(hour);
190 day = BCD2BIN(day);
191 mon = BCD2BIN(mon);
192 year = BCD2BIN(year);
193 y2k = BCD2BIN(y2k);
194
195 year += (y2k * 100);
196
197 return mktime(year, mon, day, hour, min, sec);
198}
199
200int xicor_probe(void)
201{
202 return (xicor_read(X1241REG_SC) != -1);
203}
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
new file mode 100644
index 000000000000..457aeb7be858
--- /dev/null
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -0,0 +1,163 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20/*
21 * Setup code for the SWARM board
22 */
23
24#include <linux/config.h>
25#include <linux/spinlock.h>
26#include <linux/mm.h>
27#include <linux/bootmem.h>
28#include <linux/blkdev.h>
29#include <linux/init.h>
30#include <linux/kernel.h>
31#include <linux/tty.h>
32#include <linux/initrd.h>
33
34#include <asm/irq.h>
35#include <asm/io.h>
36#include <asm/bootinfo.h>
37#include <asm/mipsregs.h>
38#include <asm/reboot.h>
39#include <asm/time.h>
40#include <asm/traps.h>
41#include <asm/sibyte/sb1250.h>
42#include <asm/sibyte/sb1250_regs.h>
43#include <asm/sibyte/sb1250_genbus.h>
44#include <asm/sibyte/board.h>
45
46extern void sb1250_setup(void);
47
48extern int xicor_probe(void);
49extern int xicor_set_time(unsigned long);
50extern unsigned long xicor_get_time(void);
51
52extern int m41t81_probe(void);
53extern int m41t81_set_time(unsigned long);
54extern unsigned long m41t81_get_time(void);
55
56const char *get_system_type(void)
57{
58 return "SiByte " SIBYTE_BOARD_NAME;
59}
60
61void __init swarm_timer_setup(struct irqaction *irq)
62{
63 /*
64 * we don't set up irqaction, because we will deliver timer
65 * interrupts through low-level (direct) meachanism.
66 */
67
68 /* We only need to setup the generic timer */
69 sb1250_time_init();
70}
71
72int swarm_be_handler(struct pt_regs *regs, int is_fixup)
73{
74 if (!is_fixup && (regs->cp0_cause & 4)) {
75 /* Data bus error - print PA */
76#ifdef CONFIG_MIPS64
77 printk("DBE physical address: %010lx\n",
78 __read_64bit_c0_register($26, 1));
79#else
80 printk("DBE physical address: %010llx\n",
81 __read_64bit_c0_split($26, 1));
82#endif
83 }
84 return (is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL);
85}
86
87static int __init swarm_setup(void)
88{
89 sb1250_setup();
90
91 panic_timeout = 5; /* For debug. */
92
93 board_timer_setup = swarm_timer_setup;
94 board_be_handler = swarm_be_handler;
95
96 if (xicor_probe()) {
97 printk("swarm setup: Xicor 1241 RTC detected.\n");
98 rtc_get_time = xicor_get_time;
99 rtc_set_time = xicor_set_time;
100 }
101
102 if (m41t81_probe()) {
103 printk("swarm setup: M41T81 RTC detected.\n");
104 rtc_get_time = m41t81_get_time;
105 rtc_set_time = m41t81_set_time;
106 }
107
108 printk("This kernel optimized for "
109#ifdef CONFIG_SIMULATION
110 "simulation"
111#else
112 "board"
113#endif
114 " runs "
115#ifdef CONFIG_SIBYTE_CFE
116 "with"
117#else
118 "without"
119#endif
120 " CFE\n");
121
122#ifdef CONFIG_VT
123 screen_info = (struct screen_info) {
124 0, 0, /* orig-x, orig-y */
125 0, /* unused */
126 52, /* orig_video_page */
127 3, /* orig_video_mode */
128 80, /* orig_video_cols */
129 4626, 3, 9, /* unused, ega_bx, unused */
130 25, /* orig_video_lines */
131 0x22, /* orig_video_isVGA */
132 16 /* orig_video_points */
133 };
134 /* XXXKW for CFE, get lines/cols from environment */
135#endif
136
137 return 0;
138}
139
140early_initcall(swarm_setup);
141
142#ifdef LEDS_PHYS
143
144#ifdef CONFIG_SIBYTE_CARMEL
145/* XXXKW need to detect Monterey/LittleSur/etc */
146#undef LEDS_PHYS
147#define LEDS_PHYS MLEDS_PHYS
148#endif
149
150#define setled(index, c) \
151 ((unsigned char *)(IOADDR(LEDS_PHYS)+0x20))[(3-(index))<<3] = (c)
152void setleds(char *str)
153{
154 int i;
155 for (i = 0; i < 4; i++) {
156 if (!str[i]) {
157 setled(i, ' ');
158 } else {
159 setled(i, str[i]);
160 }
161 }
162}
163#endif
diff --git a/arch/mips/sibyte/swarm/time.c b/arch/mips/sibyte/swarm/time.c
new file mode 100644
index 000000000000..c1f1a9defeeb
--- /dev/null
+++ b/arch/mips/sibyte/swarm/time.c
@@ -0,0 +1,244 @@
1/*
2 * Copyright (C) 2000, 2001 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19/*
20 * Time routines for the swarm board. We pass all the hard stuff
21 * through to the sb1250 handling code. Only thing we really keep
22 * track of here is what time of day we think it is. And we don't
23 * really even do a good job of that...
24 */
25
26
27#include <linux/bcd.h>
28#include <linux/init.h>
29#include <linux/time.h>
30#include <linux/sched.h>
31#include <linux/spinlock.h>
32#include <asm/system.h>
33#include <asm/addrspace.h>
34#include <asm/io.h>
35
36#include <asm/sibyte/sb1250.h>
37#include <asm/sibyte/sb1250_regs.h>
38#include <asm/sibyte/sb1250_smbus.h>
39
40static unsigned long long sec_bias = 0;
41static unsigned int usec_bias = 0;
42
43/* Xicor 1241 definitions */
44
45/*
46 * Register bits
47 */
48
49#define X1241REG_SR_BAT 0x80 /* currently on battery power */
50#define X1241REG_SR_RWEL 0x04 /* r/w latch is enabled, can write RTC */
51#define X1241REG_SR_WEL 0x02 /* r/w latch is unlocked, can enable r/w now */
52#define X1241REG_SR_RTCF 0x01 /* clock failed */
53#define X1241REG_BL_BP2 0x80 /* block protect 2 */
54#define X1241REG_BL_BP1 0x40 /* block protect 1 */
55#define X1241REG_BL_BP0 0x20 /* block protect 0 */
56#define X1241REG_BL_WD1 0x10
57#define X1241REG_BL_WD0 0x08
58#define X1241REG_HR_MIL 0x80 /* military time format */
59
60/*
61 * Register numbers
62 */
63
64#define X1241REG_BL 0x10 /* block protect bits */
65#define X1241REG_INT 0x11 /* */
66#define X1241REG_SC 0x30 /* Seconds */
67#define X1241REG_MN 0x31 /* Minutes */
68#define X1241REG_HR 0x32 /* Hours */
69#define X1241REG_DT 0x33 /* Day of month */
70#define X1241REG_MO 0x34 /* Month */
71#define X1241REG_YR 0x35 /* Year */
72#define X1241REG_DW 0x36 /* Day of Week */
73#define X1241REG_Y2K 0x37 /* Year 2K */
74#define X1241REG_SR 0x3F /* Status register */
75
76#define X1241_CCR_ADDRESS 0x6F
77
78#define SMB_CSR(reg) (IOADDR(A_SMB_REGISTER(1, reg)))
79
80static int xicor_read(uint8_t addr)
81{
82 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
83 ;
84
85 bus_writeq((addr >> 8) & 0x7, SMB_CSR(R_SMB_CMD));
86 bus_writeq((addr & 0xff), SMB_CSR(R_SMB_DATA));
87 bus_writeq((V_SMB_ADDR(X1241_CCR_ADDRESS) | V_SMB_TT_WR2BYTE),
88 SMB_CSR(R_SMB_START));
89
90 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
91 ;
92
93 bus_writeq((V_SMB_ADDR(X1241_CCR_ADDRESS) | V_SMB_TT_RD1BYTE),
94 SMB_CSR(R_SMB_START));
95
96 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
97 ;
98
99 if (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_ERROR) {
100 /* Clear error bit by writing a 1 */
101 bus_writeq(M_SMB_ERROR, SMB_CSR(R_SMB_STATUS));
102 return -1;
103 }
104
105 return (bus_readq(SMB_CSR(R_SMB_DATA)) & 0xff);
106}
107
108static int xicor_write(uint8_t addr, int b)
109{
110 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
111 ;
112
113 bus_writeq(addr, SMB_CSR(R_SMB_CMD));
114 bus_writeq((addr & 0xff) | ((b & 0xff) << 8), SMB_CSR(R_SMB_DATA));
115 bus_writeq(V_SMB_ADDR(X1241_CCR_ADDRESS) | V_SMB_TT_WR3BYTE,
116 SMB_CSR(R_SMB_START));
117
118 while (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_BUSY)
119 ;
120
121 if (bus_readq(SMB_CSR(R_SMB_STATUS)) & M_SMB_ERROR) {
122 /* Clear error bit by writing a 1 */
123 bus_writeq(M_SMB_ERROR, SMB_CSR(R_SMB_STATUS));
124 return -1;
125 } else {
126 return 0;
127 }
128}
129
130/*
131 * In order to set the CMOS clock precisely, set_rtc_mmss has to be
132 * called 500 ms after the second nowtime has started, because when
133 * nowtime is written into the registers of the CMOS clock, it will
134 * jump to the next second precisely 500 ms later. Check the Motorola
135 * MC146818A or Dallas DS12887 data sheet for details.
136 *
137 * BUG: This routine does not handle hour overflow properly; it just
138 * sets the minutes. Usually you'll only notice that after reboot!
139 */
140int set_rtc_mmss(unsigned long nowtime)
141{
142 int retval = 0;
143 int real_seconds, real_minutes, cmos_minutes;
144
145 cmos_minutes = xicor_read(X1241REG_MN);
146 cmos_minutes = BCD2BIN(cmos_minutes);
147
148 /*
149 * since we're only adjusting minutes and seconds,
150 * don't interfere with hour overflow. This avoids
151 * messing with unknown time zones but requires your
152 * RTC not to be off by more than 15 minutes
153 */
154 real_seconds = nowtime % 60;
155 real_minutes = nowtime / 60;
156 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
157 real_minutes += 30; /* correct for half hour time zone */
158 real_minutes %= 60;
159
160 /* unlock writes to the CCR */
161 xicor_write(X1241REG_SR, X1241REG_SR_WEL);
162 xicor_write(X1241REG_SR, X1241REG_SR_WEL | X1241REG_SR_RWEL);
163
164 if (abs(real_minutes - cmos_minutes) < 30) {
165 real_seconds = BIN2BCD(real_seconds);
166 real_minutes = BIN2BCD(real_minutes);
167 xicor_write(X1241REG_SC, real_seconds);
168 xicor_write(X1241REG_MN, real_minutes);
169 } else {
170 printk(KERN_WARNING
171 "set_rtc_mmss: can't update from %d to %d\n",
172 cmos_minutes, real_minutes);
173 retval = -1;
174 }
175
176 xicor_write(X1241REG_SR, 0);
177
178 printk("set_rtc_mmss: %02d:%02d\n", real_minutes, real_seconds);
179
180 return retval;
181}
182
183static unsigned long __init get_swarm_time(void)
184{
185 unsigned int year, mon, day, hour, min, sec, y2k;
186
187 sec = xicor_read(X1241REG_SC);
188 min = xicor_read(X1241REG_MN);
189 hour = xicor_read(X1241REG_HR);
190
191 if (hour & X1241REG_HR_MIL) {
192 hour &= 0x3f;
193 } else {
194 if (hour & 0x20)
195 hour = (hour & 0xf) + 0x12;
196 }
197
198 sec = BCD2BIN(sec);
199 min = BCD2BIN(min);
200 hour = BCD2BIN(hour);
201
202 day = xicor_read(X1241REG_DT);
203 mon = xicor_read(X1241REG_MO);
204 year = xicor_read(X1241REG_YR);
205 y2k = xicor_read(X1241REG_Y2K);
206
207 day = BCD2BIN(day);
208 mon = BCD2BIN(mon);
209 year = BCD2BIN(year);
210 y2k = BCD2BIN(y2k);
211
212 year += (y2k * 100);
213
214 return mktime(year, mon, day, hour, min, sec);
215}
216
217/*
218 * Bring up the timer at 100 Hz.
219 */
220void __init swarm_time_init(void)
221{
222 unsigned int flags;
223 int status;
224
225 /* Set up the scd general purpose timer 0 to cpu 0 */
226 sb1250_time_init();
227
228 /* Establish communication with the Xicor 1241 RTC */
229 /* XXXKW how do I share the SMBus with the I2C subsystem? */
230
231 bus_writeq(K_SMB_FREQ_400KHZ, SMB_CSR(R_SMB_FREQ));
232 bus_writeq(0, SMB_CSR(R_SMB_CONTROL));
233
234 if ((status = xicor_read(X1241REG_SR_RTCF)) < 0) {
235 printk("x1241: couldn't detect on SWARM SMBus 1\n");
236 } else {
237 if (status & X1241REG_SR_RTCF)
238 printk("x1241: battery failed -- time is probably wrong\n");
239 write_seqlock_irqsave(&xtime_lock, flags);
240 xtime.tv_sec = get_swarm_time();
241 xtime.tv_nsec = 0;
242 write_sequnlock_irqrestore(&xtime_lock, flags);
243 }
244}
diff --git a/arch/mips/sni/Makefile b/arch/mips/sni/Makefile
new file mode 100644
index 000000000000..1e5676e4be86
--- /dev/null
+++ b/arch/mips/sni/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for the SNI specific part of the kernel
3#
4
5obj-y += int-handler.o irq.o pcimt_scache.o reset.o setup.o
6
7EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/sni/int-handler.S b/arch/mips/sni/int-handler.S
new file mode 100644
index 000000000000..2cdc09f55f18
--- /dev/null
+++ b/arch/mips/sni/int-handler.S
@@ -0,0 +1,106 @@
1/*
2 * SNI RM200 PCI specific interrupt handler code.
3 *
4 * Copyright (C) 1994, 95, 96, 97, 98, 1999, 2000, 01 by Ralf Baechle
5 */
6#include <asm/asm.h>
7#include <asm/mipsregs.h>
8#include <asm/regdef.h>
9#include <asm/sni.h>
10#include <asm/stackframe.h>
11
12/*
13 * The PCI ASIC has the nasty property that it may delay writes if it is busy.
14 * As a consequence from writes that have not graduated when we exit from the
15 * interrupt handler we might catch a spurious interrupt. To avoid this we
16 * force the PCI ASIC to graduate all writes by executing a read from the
17 * PCI bus.
18 */
19 .set noreorder
20 .set noat
21 .align 5
22 NESTED(sni_rm200_pci_handle_int, PT_SIZE, sp)
23 SAVE_ALL
24 CLI
25 .set at
26
27 /* Blinken light ... */
28 lb t0, led_cache
29 addiu t0, 1
30 sb t0, led_cache
31 sb t0, PCIMT_CSLED # write only register
32 .data
33led_cache: .byte 0
34 .text
35
36 mfc0 t0, CP0_STATUS
37 mfc0 t1, CP0_CAUSE
38 and t0, t1
39
40 andi t1, t0, 0x0800 # hardware interrupt 1
41 bnez t1, _hwint1
42 andi t1, t0, 0x4000 # hardware interrupt 4
43 bnez t1, _hwint4
44 andi t1, t0, 0x2000 # hardware interrupt 3
45 bnez t1, _hwint3
46 andi t1, t0, 0x1000 # hardware interrupt 2
47 bnez t1, _hwint2
48 andi t1, t0, 0x8000 # hardware interrupt 5
49 bnez t1, _hwint5
50 andi t1, t0, 0x0400 # hardware interrupt 0
51 bnez t1, _hwint0
52 nop
53
54 j restore_all # spurious interrupt
55 nop
56
57 ##############################################################################
58
59/* hwint0 should deal with MP agent, ASIC PCI, EISA NMI and debug
60 button interrupts. */
61_hwint0: jal pciasic_hwint0
62 move a0, sp
63 j ret_from_irq
64 nop
65
66/*
67 * hwint 1 deals with EISA and SCSI interrupts
68 */
69_hwint1: jal pciasic_hwint1
70 move a0, sp
71 j ret_from_irq
72 nop
73
74
75/*
76 * This interrupt was used for the com1 console on the first prototypes;
77 * it's unsed otherwise
78 */
79_hwint2: jal pciasic_hwint2
80 move a0, sp
81 j ret_from_irq
82 nop
83
84/*
85 * hwint 3 are the PCI interrupts A - D
86 */
87_hwint3: jal pciasic_hwint3
88 move a0, sp
89 j ret_from_irq
90 nop
91
92/*
93 * hwint 4 is used for only the onboard PCnet 32.
94 */
95_hwint4: jal pciasic_hwint4
96 move a0, sp
97 j ret_from_irq
98 nop
99
100/* hwint5 is the r4k count / compare interrupt */
101_hwint5: jal pciasic_hwint5
102 move a0, sp
103 j ret_from_irq
104 nop
105
106 END(sni_rm200_pci_handle_int)
diff --git a/arch/mips/sni/irq.c b/arch/mips/sni/irq.c
new file mode 100644
index 000000000000..62c760f14674
--- /dev/null
+++ b/arch/mips/sni/irq.c
@@ -0,0 +1,194 @@
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) 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2000 Ralf Baechle
8 */
9#include <linux/delay.h>
10#include <linux/init.h>
11#include <linux/interrupt.h>
12#include <linux/irq.h>
13#include <linux/kernel.h>
14#include <linux/spinlock.h>
15
16#include <asm/i8259.h>
17#include <asm/io.h>
18#include <asm/sni.h>
19
20DEFINE_SPINLOCK(pciasic_lock);
21
22extern asmlinkage void sni_rm200_pci_handle_int(void);
23
24static void enable_pciasic_irq(unsigned int irq)
25{
26 unsigned int mask = 1 << (irq - PCIMT_IRQ_INT2);
27 unsigned long flags;
28
29 spin_lock_irqsave(&pciasic_lock, flags);
30 *(volatile u8 *) PCIMT_IRQSEL |= mask;
31 spin_unlock_irqrestore(&pciasic_lock, flags);
32}
33
34static unsigned int startup_pciasic_irq(unsigned int irq)
35{
36 enable_pciasic_irq(irq);
37 return 0; /* never anything pending */
38}
39
40#define shutdown_pciasic_irq disable_pciasic_irq
41
42void disable_pciasic_irq(unsigned int irq)
43{
44 unsigned int mask = ~(1 << (irq - PCIMT_IRQ_INT2));
45 unsigned long flags;
46
47 spin_lock_irqsave(&pciasic_lock, flags);
48 *(volatile u8 *) PCIMT_IRQSEL &= mask;
49 spin_unlock_irqrestore(&pciasic_lock, flags);
50}
51
52#define mask_and_ack_pciasic_irq disable_pciasic_irq
53
54static void end_pciasic_irq(unsigned int irq)
55{
56 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
57 enable_pciasic_irq(irq);
58}
59
60static struct hw_interrupt_type pciasic_irq_type = {
61 "ASIC-PCI",
62 startup_pciasic_irq,
63 shutdown_pciasic_irq,
64 enable_pciasic_irq,
65 disable_pciasic_irq,
66 mask_and_ack_pciasic_irq,
67 end_pciasic_irq,
68 NULL
69};
70
71/*
72 * hwint0 should deal with MP agent, ASIC PCI, EISA NMI and debug
73 * button interrupts. Later ...
74 */
75void pciasic_hwint0(struct pt_regs *regs)
76{
77 panic("Received int0 but no handler yet ...");
78}
79
80/* This interrupt was used for the com1 console on the first prototypes. */
81void pciasic_hwint2(struct pt_regs *regs)
82{
83 /* I think this shouldn't happen on production machines. */
84 panic("hwint2 and no handler yet");
85}
86
87/* hwint5 is the r4k count / compare interrupt */
88void pciasic_hwint5(struct pt_regs *regs)
89{
90 panic("hwint5 and no handler yet");
91}
92
93static unsigned int ls1bit8(unsigned int x)
94{
95 int b = 7, s;
96
97 s = 4; if ((x & 0x0f) == 0) s = 0; b -= s; x <<= s;
98 s = 2; if ((x & 0x30) == 0) s = 0; b -= s; x <<= s;
99 s = 1; if ((x & 0x40) == 0) s = 0; b -= s;
100
101 return b;
102}
103
104/*
105 * hwint 1 deals with EISA and SCSI interrupts,
106 *
107 * The EISA_INT bit in CSITPEND is high active, all others are low active.
108 */
109void pciasic_hwint1(struct pt_regs *regs)
110{
111 u8 pend = *(volatile char *)PCIMT_CSITPEND;
112 unsigned long flags;
113
114 if (pend & IT_EISA) {
115 int irq;
116 /*
117 * Note: ASIC PCI's builtin interrupt achknowledge feature is
118 * broken. Using it may result in loss of some or all i8259
119 * interupts, so don't use PCIMT_INT_ACKNOWLEDGE ...
120 */
121 irq = i8259_irq();
122 if (unlikely(irq < 0))
123 return;
124
125 do_IRQ(irq, regs);
126 }
127
128 if (!(pend & IT_SCSI)) {
129 flags = read_c0_status();
130 clear_c0_status(ST0_IM);
131 do_IRQ(PCIMT_IRQ_SCSI, regs);
132 write_c0_status(flags);
133 }
134}
135
136/*
137 * hwint 3 should deal with the PCI A - D interrupts,
138 */
139void pciasic_hwint3(struct pt_regs *regs)
140{
141 u8 pend = *(volatile char *)PCIMT_CSITPEND;
142 int irq;
143
144 pend &= (IT_INTA | IT_INTB | IT_INTC | IT_INTD);
145 clear_c0_status(IE_IRQ3);
146 irq = PCIMT_IRQ_INT2 + ls1bit8(pend);
147 do_IRQ(irq, regs);
148 set_c0_status(IE_IRQ3);
149}
150
151/*
152 * hwint 4 is used for only the onboard PCnet 32.
153 */
154void pciasic_hwint4(struct pt_regs *regs)
155{
156 clear_c0_status(IE_IRQ4);
157 do_IRQ(PCIMT_IRQ_ETHERNET, regs);
158 set_c0_status(IE_IRQ4);
159}
160
161void __init init_pciasic(void)
162{
163 unsigned long flags;
164
165 spin_lock_irqsave(&pciasic_lock, flags);
166 * (volatile u8 *) PCIMT_IRQSEL =
167 IT_EISA | IT_INTA | IT_INTB | IT_INTC | IT_INTD;
168 spin_unlock_irqrestore(&pciasic_lock, flags);
169}
170
171/*
172 * On systems with i8259-style interrupt controllers we assume for
173 * driver compatibility reasons interrupts 0 - 15 to be the i8295
174 * interrupts even if the hardware uses a different interrupt numbering.
175 */
176void __init arch_init_irq(void)
177{
178 int i;
179
180 set_except_vector(0, sni_rm200_pci_handle_int);
181
182 init_i8259_irqs(); /* Integrated i8259 */
183 init_pciasic();
184
185 /* Actually we've got more interrupts to handle ... */
186 for (i = PCIMT_IRQ_INT2; i <= PCIMT_IRQ_ETHERNET; i++) {
187 irq_desc[i].status = IRQ_DISABLED;
188 irq_desc[i].action = 0;
189 irq_desc[i].depth = 1;
190 irq_desc[i].handler = &pciasic_irq_type;
191 }
192
193 change_c0_status(ST0_IM, IE_IRQ1|IE_IRQ2|IE_IRQ3|IE_IRQ4);
194}
diff --git a/arch/mips/sni/pcimt_scache.c b/arch/mips/sni/pcimt_scache.c
new file mode 100644
index 000000000000..a59d457fa8b1
--- /dev/null
+++ b/arch/mips/sni/pcimt_scache.c
@@ -0,0 +1,37 @@
1/*
2 * arch/mips/sni/pcimt_scache.c
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (c) 1997, 1998 by Ralf Baechle
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <asm/bcache.h>
13#include <asm/sni.h>
14
15#define cacheconf (*(volatile unsigned int *)PCIMT_CACHECONF)
16#define invspace (*(volatile unsigned int *)PCIMT_INVSPACE)
17
18void __init sni_pcimt_sc_init(void)
19{
20 unsigned int scsiz, sc_size;
21
22 scsiz = cacheconf & 7;
23 if (scsiz == 0) {
24 printk("Second level cache is deactived.\n");
25 return;
26 }
27 if (scsiz >= 6) {
28 printk("Invalid second level cache size configured, "
29 "deactivating second level cache.\n");
30 cacheconf = 0;
31 return;
32 }
33
34 sc_size = 128 << scsiz;
35 printk("%dkb second level cache detected, deactivating.\n", sc_size);
36 cacheconf = 0;
37}
diff --git a/arch/mips/sni/reset.c b/arch/mips/sni/reset.c
new file mode 100644
index 000000000000..be85bec002e1
--- /dev/null
+++ b/arch/mips/sni/reset.c
@@ -0,0 +1,51 @@
1/*
2 * linux/arch/mips/sni/process.c
3 *
4 * Reset a SNI machine.
5 */
6#include <asm/io.h>
7#include <asm/reboot.h>
8#include <asm/system.h>
9#include <asm/sni.h>
10
11/*
12 * This routine reboots the machine by asking the keyboard
13 * controller to pulse the reset-line low. We try that for a while,
14 * and if it doesn't work, we do some other stupid things.
15 */
16static inline void
17kb_wait(void)
18{
19 int i;
20
21 for (i=0; i<0x10000; i++)
22 if ((inb_p(0x64) & 0x02) == 0)
23 break;
24}
25
26/* XXX This ends up at the ARC firmware prompt ... */
27void sni_machine_restart(char *command)
28{
29 int i, j;
30
31 /* This does a normal via the keyboard controller like a PC.
32 We can do that easier ... */
33 local_irq_disable();
34 for (;;) {
35 for (i=0; i<100; i++) {
36 kb_wait();
37 for(j = 0; j < 100000 ; j++)
38 /* nothing */;
39 outb_p(0xfe,0x64); /* pulse reset low */
40 }
41 }
42}
43
44void sni_machine_halt(void)
45{
46}
47
48void sni_machine_power_off(void)
49{
50 *(volatile unsigned char *)PCIMT_CSWCSM = 0xfd;
51}
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
new file mode 100644
index 000000000000..8f67cee4317b
--- /dev/null
+++ b/arch/mips/sni/setup.c
@@ -0,0 +1,203 @@
1/*
2 * Setup pointers to hardware-dependent routines.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 97, 98, 2000, 03, 04 Ralf Baechle (ralf@linux-mips.org)
9 */
10#include <linux/config.h>
11#include <linux/eisa.h>
12#include <linux/hdreg.h>
13#include <linux/ioport.h>
14#include <linux/sched.h>
15#include <linux/init.h>
16#include <linux/interrupt.h>
17#include <linux/mc146818rtc.h>
18#include <linux/pci.h>
19#include <linux/console.h>
20#include <linux/fb.h>
21#include <linux/tty.h>
22
23#include <asm/arc/types.h>
24#include <asm/sgialib.h>
25#include <asm/bcache.h>
26#include <asm/bootinfo.h>
27#include <asm/io.h>
28#include <asm/irq.h>
29#include <asm/mc146818-time.h>
30#include <asm/processor.h>
31#include <asm/ptrace.h>
32#include <asm/reboot.h>
33#include <asm/sni.h>
34#include <asm/time.h>
35#include <asm/traps.h>
36
37extern void sni_machine_restart(char *command);
38extern void sni_machine_halt(void);
39extern void sni_machine_power_off(void);
40
41static void __init sni_rm200_pci_timer_setup(struct irqaction *irq)
42{
43 /* set the clock to 100 Hz */
44 outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */
45 outb_p(LATCH & 0xff , 0x40); /* LSB */
46 outb(LATCH >> 8 , 0x40); /* MSB */
47 setup_irq(0, irq);
48}
49
50/*
51 * A bit more gossip about the iron we're running on ...
52 */
53static inline void sni_pcimt_detect(void)
54{
55 char boardtype[80];
56 unsigned char csmsr;
57 char *p = boardtype;
58 unsigned int asic;
59
60 csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
61
62 p += sprintf(p, "%s PCI", (csmsr & 0x80) ? "RM200" : "RM300");
63 if ((csmsr & 0x80) == 0)
64 p += sprintf(p, ", board revision %s",
65 (csmsr & 0x20) ? "D" : "C");
66 asic = csmsr & 0x80;
67 asic = (csmsr & 0x08) ? asic : !asic;
68 p += sprintf(p, ", ASIC PCI Rev %s", asic ? "1.0" : "1.1");
69 printk("%s.\n", boardtype);
70}
71
72static void __init sni_display_setup(void)
73{
74#ifdef CONFIG_VT
75#if defined(CONFIG_VGA_CONSOLE)
76 struct screen_info *si = &screen_info;
77 DISPLAY_STATUS *di;
78
79 di = ArcGetDisplayStatus(1);
80
81 if (di) {
82 si->orig_x = di->CursorXPosition;
83 si->orig_y = di->CursorYPosition;
84 si->orig_video_cols = di->CursorMaxXPosition;
85 si->orig_video_lines = di->CursorMaxYPosition;
86 si->orig_video_isVGA = VIDEO_TYPE_VGAC;
87 si->orig_video_points = 16;
88 }
89#endif
90#endif
91}
92
93static struct resource sni_io_resource = {
94 "PCIMT IO MEM", 0x00001000UL, 0x03bfffffUL, IORESOURCE_IO,
95};
96
97static struct resource pcimt_io_resources[] = {
98 { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
99 { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
100 { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY },
101 { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
102 { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
103 { "PCI config data", 0xcfc, 0xcff, IORESOURCE_BUSY }
104};
105
106static struct resource sni_mem_resource = {
107 "PCIMT PCI MEM", 0x10000000UL, 0xffffffffUL, IORESOURCE_MEM
108};
109
110/*
111 * The RM200/RM300 has a few holes in it's PCI/EISA memory address space used
112 * for other purposes. Be paranoid and allocate all of the before the PCI
113 * code gets a chance to to map anything else there ...
114 *
115 * This leaves the following areas available:
116 *
117 * 0x10000000 - 0x1009ffff (640kB) PCI/EISA/ISA Bus Memory
118 * 0x10100000 - 0x13ffffff ( 15MB) PCI/EISA/ISA Bus Memory
119 * 0x18000000 - 0x1fbfffff (124MB) PCI/EISA Bus Memory
120 * 0x1ff08000 - 0x1ffeffff (816kB) PCI/EISA Bus Memory
121 * 0xa0000000 - 0xffffffff (1.5GB) PCI/EISA Bus Memory
122 */
123static struct resource pcimt_mem_resources[] = {
124 { "Video RAM area", 0x100a0000, 0x100bffff, IORESOURCE_BUSY },
125 { "ISA Reserved", 0x100c0000, 0x100fffff, IORESOURCE_BUSY },
126 { "PCI IO", 0x14000000, 0x17bfffff, IORESOURCE_BUSY },
127 { "Cache Replacement Area", 0x17c00000, 0x17ffffff, IORESOURCE_BUSY},
128 { "PCI INT Acknowledge", 0x1a000000, 0x1a000003, IORESOURCE_BUSY },
129 { "Boot PROM", 0x1fc00000, 0x1fc7ffff, IORESOURCE_BUSY},
130 { "Diag PROM", 0x1fc80000, 0x1fcfffff, IORESOURCE_BUSY},
131 { "X-Bus", 0x1fd00000, 0x1fdfffff, IORESOURCE_BUSY},
132 { "BIOS map", 0x1fe00000, 0x1fefffff, IORESOURCE_BUSY},
133 { "NVRAM / EEPROM", 0x1ff00000, 0x1ff7ffff, IORESOURCE_BUSY},
134 { "ASIC PCI", 0x1fff0000, 0x1fffefff, IORESOURCE_BUSY},
135 { "MP Agent", 0x1ffff000, 0x1fffffff, IORESOURCE_BUSY},
136 { "Main Memory", 0x20000000, 0x9fffffff, IORESOURCE_BUSY}
137};
138
139static void __init sni_resource_init(void)
140{
141 int i;
142
143 /* request I/O space for devices used on all i[345]86 PCs */
144 for (i = 0; i < ARRAY_SIZE(pcimt_io_resources); i++)
145 request_resource(&ioport_resource, pcimt_io_resources + i);
146
147 /* request mem space for pcimt-specific devices */
148 for (i = 0; i < ARRAY_SIZE(pcimt_mem_resources); i++)
149 request_resource(&sni_mem_resource, pcimt_mem_resources + i);
150
151 ioport_resource.end = sni_io_resource.end;
152}
153
154extern struct pci_ops sni_pci_ops;
155
156static struct pci_controller sni_controller = {
157 .pci_ops = &sni_pci_ops,
158 .mem_resource = &sni_mem_resource,
159 .mem_offset = 0x10000000UL,
160 .io_resource = &sni_io_resource,
161 .io_offset = 0x00000000UL
162};
163
164static inline void sni_pcimt_time_init(void)
165{
166 rtc_get_time = mc146818_get_cmos_time;
167 rtc_set_time = mc146818_set_rtc_mmss;
168}
169
170static int __init sni_rm200_pci_setup(void)
171{
172 sni_pcimt_detect();
173 sni_pcimt_sc_init();
174 sni_pcimt_time_init();
175
176 set_io_port_base(SNI_PORT_BASE);
177 ioport_resource.end = sni_io_resource.end;
178
179 /*
180 * Setup (E)ISA I/O memory access stuff
181 */
182 isa_slot_offset = 0xb0000000;
183#ifdef CONFIG_EISA
184 EISA_bus = 1;
185#endif
186
187 sni_resource_init();
188 board_timer_setup = sni_rm200_pci_timer_setup;
189
190 _machine_restart = sni_machine_restart;
191 _machine_halt = sni_machine_halt;
192 _machine_power_off = sni_machine_power_off;
193
194 sni_display_setup();
195
196#ifdef CONFIG_PCI
197 register_pci_controller(&sni_controller);
198#endif
199
200 return 0;
201}
202
203early_initcall(sni_rm200_pci_setup);
diff --git a/arch/mips/tx4927/common/Makefile b/arch/mips/tx4927/common/Makefile
new file mode 100644
index 000000000000..8fa126b296e1
--- /dev/null
+++ b/arch/mips/tx4927/common/Makefile
@@ -0,0 +1,12 @@
1#
2# Makefile for common code for Toshiba TX4927 based systems
3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7#
8
9obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o tx4927_irq_handler.o
10
11obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o
12obj-$(CONFIG_KGDB) += tx4927_dbgio.o
diff --git a/arch/mips/tx4927/common/tx4927_dbgio.c b/arch/mips/tx4927/common/tx4927_dbgio.c
new file mode 100644
index 000000000000..09bdf2baa835
--- /dev/null
+++ b/arch/mips/tx4927/common/tx4927_dbgio.c
@@ -0,0 +1,47 @@
1/*
2 * linux/arch/mips/tx4927/common/tx4927_dbgio.c
3 *
4 * kgdb interface for gdb
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * Copyright 2001-2002 MontaVista Software Inc.
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
24 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31
32#include <asm/mipsregs.h>
33#include <asm/system.h>
34#include <asm/tx4927/tx4927_mips.h>
35
36u8 getDebugChar(void)
37{
38 extern u8 txx9_sio_kdbg_rd(void);
39 return (txx9_sio_kdbg_rd());
40}
41
42
43int putDebugChar(u8 byte)
44{
45 extern int txx9_sio_kdbg_wr( u8 ch );
46 return (txx9_sio_kdbg_wr(byte));
47}
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
new file mode 100644
index 000000000000..5ab2e2b76018
--- /dev/null
+++ b/arch/mips/tx4927/common/tx4927_irq.c
@@ -0,0 +1,584 @@
1/*
2 * Common tx4927 irq handler
3 *
4 * Author: MontaVista Software, Inc.
5 * source@mvista.com
6 *
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
16 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
17 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
19 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
20 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#include <linux/config.h>
27#include <linux/errno.h>
28#include <linux/init.h>
29#include <linux/kernel_stat.h>
30#include <linux/module.h>
31#include <linux/signal.h>
32#include <linux/sched.h>
33#include <linux/types.h>
34#include <linux/interrupt.h>
35#include <linux/ioport.h>
36#include <linux/timex.h>
37#include <linux/slab.h>
38#include <linux/random.h>
39#include <linux/irq.h>
40#include <linux/bitops.h>
41#include <asm/bootinfo.h>
42#include <asm/io.h>
43#include <asm/irq.h>
44#include <asm/mipsregs.h>
45#include <asm/system.h>
46#include <asm/tx4927/tx4927.h>
47
48/*
49 * DEBUG
50 */
51
52#undef TX4927_IRQ_DEBUG
53
54#ifdef TX4927_IRQ_DEBUG
55#define TX4927_IRQ_NONE 0x00000000
56
57#define TX4927_IRQ_INFO ( 1 << 0 )
58#define TX4927_IRQ_WARN ( 1 << 1 )
59#define TX4927_IRQ_EROR ( 1 << 2 )
60
61#define TX4927_IRQ_INIT ( 1 << 5 )
62#define TX4927_IRQ_NEST1 ( 1 << 6 )
63#define TX4927_IRQ_NEST2 ( 1 << 7 )
64#define TX4927_IRQ_NEST3 ( 1 << 8 )
65#define TX4927_IRQ_NEST4 ( 1 << 9 )
66
67#define TX4927_IRQ_CP0_INIT ( 1 << 10 )
68#define TX4927_IRQ_CP0_STARTUP ( 1 << 11 )
69#define TX4927_IRQ_CP0_SHUTDOWN ( 1 << 12 )
70#define TX4927_IRQ_CP0_ENABLE ( 1 << 13 )
71#define TX4927_IRQ_CP0_DISABLE ( 1 << 14 )
72#define TX4927_IRQ_CP0_MASK ( 1 << 15 )
73#define TX4927_IRQ_CP0_ENDIRQ ( 1 << 16 )
74
75#define TX4927_IRQ_PIC_INIT ( 1 << 20 )
76#define TX4927_IRQ_PIC_STARTUP ( 1 << 21 )
77#define TX4927_IRQ_PIC_SHUTDOWN ( 1 << 22 )
78#define TX4927_IRQ_PIC_ENABLE ( 1 << 23 )
79#define TX4927_IRQ_PIC_DISABLE ( 1 << 24 )
80#define TX4927_IRQ_PIC_MASK ( 1 << 25 )
81#define TX4927_IRQ_PIC_ENDIRQ ( 1 << 26 )
82
83#define TX4927_IRQ_ALL 0xffffffff
84#endif
85
86#ifdef TX4927_IRQ_DEBUG
87static const u32 tx4927_irq_debug_flag = (TX4927_IRQ_NONE
88 | TX4927_IRQ_INFO
89 | TX4927_IRQ_WARN | TX4927_IRQ_EROR
90// | TX4927_IRQ_CP0_INIT
91// | TX4927_IRQ_CP0_STARTUP
92// | TX4927_IRQ_CP0_SHUTDOWN
93// | TX4927_IRQ_CP0_ENABLE
94// | TX4927_IRQ_CP0_DISABLE
95// | TX4927_IRQ_CP0_MASK
96// | TX4927_IRQ_CP0_ENDIRQ
97// | TX4927_IRQ_PIC_INIT
98// | TX4927_IRQ_PIC_STARTUP
99// | TX4927_IRQ_PIC_SHUTDOWN
100// | TX4927_IRQ_PIC_ENABLE
101// | TX4927_IRQ_PIC_DISABLE
102// | TX4927_IRQ_PIC_MASK
103// | TX4927_IRQ_PIC_ENDIRQ
104// | TX4927_IRQ_INIT
105// | TX4927_IRQ_NEST1
106// | TX4927_IRQ_NEST2
107// | TX4927_IRQ_NEST3
108// | TX4927_IRQ_NEST4
109 );
110#endif
111
112#ifdef TX4927_IRQ_DEBUG
113#define TX4927_IRQ_DPRINTK(flag,str...) \
114 if ( (tx4927_irq_debug_flag) & (flag) ) \
115 { \
116 char tmp[100]; \
117 sprintf( tmp, str ); \
118 printk( "%s(%s:%u)::%s", __FUNCTION__, __FILE__, __LINE__, tmp ); \
119 }
120#else
121#define TX4927_IRQ_DPRINTK(flag,str...)
122#endif
123
124/*
125 * Forwad definitions for all pic's
126 */
127
128static unsigned int tx4927_irq_cp0_startup(unsigned int irq);
129static void tx4927_irq_cp0_shutdown(unsigned int irq);
130static void tx4927_irq_cp0_enable(unsigned int irq);
131static void tx4927_irq_cp0_disable(unsigned int irq);
132static void tx4927_irq_cp0_mask_and_ack(unsigned int irq);
133static void tx4927_irq_cp0_end(unsigned int irq);
134
135static unsigned int tx4927_irq_pic_startup(unsigned int irq);
136static void tx4927_irq_pic_shutdown(unsigned int irq);
137static void tx4927_irq_pic_enable(unsigned int irq);
138static void tx4927_irq_pic_disable(unsigned int irq);
139static void tx4927_irq_pic_mask_and_ack(unsigned int irq);
140static void tx4927_irq_pic_end(unsigned int irq);
141
142/*
143 * Kernel structs for all pic's
144 */
145
146static DEFINE_SPINLOCK(tx4927_cp0_lock);
147static DEFINE_SPINLOCK(tx4927_pic_lock);
148
149#define TX4927_CP0_NAME "TX4927-CP0"
150static struct hw_interrupt_type tx4927_irq_cp0_type = {
151 .typename = TX4927_CP0_NAME,
152 .startup = tx4927_irq_cp0_startup,
153 .shutdown = tx4927_irq_cp0_shutdown,
154 .enable = tx4927_irq_cp0_enable,
155 .disable = tx4927_irq_cp0_disable,
156 .ack = tx4927_irq_cp0_mask_and_ack,
157 .end = tx4927_irq_cp0_end,
158 .set_affinity = NULL
159};
160
161#define TX4927_PIC_NAME "TX4927-PIC"
162static struct hw_interrupt_type tx4927_irq_pic_type = {
163 .typename = TX4927_PIC_NAME,
164 .startup = tx4927_irq_pic_startup,
165 .shutdown = tx4927_irq_pic_shutdown,
166 .enable = tx4927_irq_pic_enable,
167 .disable = tx4927_irq_pic_disable,
168 .ack = tx4927_irq_pic_mask_and_ack,
169 .end = tx4927_irq_pic_end,
170 .set_affinity = NULL
171};
172
173#define TX4927_PIC_ACTION(s) { no_action, 0, CPU_MASK_NONE, s, NULL, NULL }
174static struct irqaction tx4927_irq_pic_action =
175TX4927_PIC_ACTION(TX4927_PIC_NAME);
176
177#define CCP0_STATUS 12
178#define CCP0_CAUSE 13
179
180/*
181 * Functions for cp0
182 */
183
184#define tx4927_irq_cp0_mask(irq) ( 1 << ( irq-TX4927_IRQ_CP0_BEG+8 ) )
185
186static void
187tx4927_irq_cp0_modify(unsigned cp0_reg, unsigned clr_bits, unsigned set_bits)
188{
189 unsigned long val = 0;
190
191 switch (cp0_reg) {
192 case CCP0_STATUS:
193 val = read_c0_status();
194 break;
195
196 case CCP0_CAUSE:
197 val = read_c0_cause();
198 break;
199
200 }
201
202 val &= (~clr_bits);
203 val |= (set_bits);
204
205 switch (cp0_reg) {
206 case CCP0_STATUS:{
207 write_c0_status(val);
208 break;
209 }
210 case CCP0_CAUSE:{
211 write_c0_cause(val);
212 break;
213 }
214 }
215
216 return;
217}
218
219static void __init tx4927_irq_cp0_init(void)
220{
221 int i;
222
223 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_INIT, "beg=%d end=%d\n",
224 TX4927_IRQ_CP0_BEG, TX4927_IRQ_CP0_END);
225
226 for (i = TX4927_IRQ_CP0_BEG; i <= TX4927_IRQ_CP0_END; i++) {
227 irq_desc[i].status = IRQ_DISABLED;
228 irq_desc[i].action = 0;
229 irq_desc[i].depth = 1;
230 irq_desc[i].handler = &tx4927_irq_cp0_type;
231 }
232
233 return;
234}
235
236static unsigned int tx4927_irq_cp0_startup(unsigned int irq)
237{
238 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_STARTUP, "irq=%d \n", irq);
239
240 tx4927_irq_cp0_enable(irq);
241
242 return (0);
243}
244
245static void tx4927_irq_cp0_shutdown(unsigned int irq)
246{
247 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_SHUTDOWN, "irq=%d \n", irq);
248
249 tx4927_irq_cp0_disable(irq);
250
251 return;
252}
253
254static void tx4927_irq_cp0_enable(unsigned int irq)
255{
256 unsigned long flags;
257
258 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_ENABLE, "irq=%d \n", irq);
259
260 spin_lock_irqsave(&tx4927_cp0_lock, flags);
261
262 tx4927_irq_cp0_modify(CCP0_STATUS, 0, tx4927_irq_cp0_mask(irq));
263
264 spin_unlock_irqrestore(&tx4927_cp0_lock, flags);
265
266 return;
267}
268
269static void tx4927_irq_cp0_disable(unsigned int irq)
270{
271 unsigned long flags;
272
273 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_DISABLE, "irq=%d \n", irq);
274
275 spin_lock_irqsave(&tx4927_cp0_lock, flags);
276
277 tx4927_irq_cp0_modify(CCP0_STATUS, tx4927_irq_cp0_mask(irq), 0);
278
279 spin_unlock_irqrestore(&tx4927_cp0_lock, flags);
280
281 return;
282}
283
284static void tx4927_irq_cp0_mask_and_ack(unsigned int irq)
285{
286 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_MASK, "irq=%d \n", irq);
287
288 tx4927_irq_cp0_disable(irq);
289
290 return;
291}
292
293static void tx4927_irq_cp0_end(unsigned int irq)
294{
295 TX4927_IRQ_DPRINTK(TX4927_IRQ_CP0_ENDIRQ, "irq=%d \n", irq);
296
297 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
298 tx4927_irq_cp0_enable(irq);
299 }
300
301 return;
302}
303
304/*
305 * Functions for pic
306 */
307u32 tx4927_irq_pic_addr(int irq)
308{
309 /* MVMCP -- need to formulize this */
310 irq -= TX4927_IRQ_PIC_BEG;
311 switch (irq) {
312 case 17:
313 case 16:
314 case 1:
315 case 0:
316 return (0xff1ff610);
317
318 case 19:
319 case 18:
320 case 3:
321 case 2:
322 return (0xff1ff614);
323
324 case 21:
325 case 20:
326 case 5:
327 case 4:
328 return (0xff1ff618);
329
330 case 23:
331 case 22:
332 case 7:
333 case 6:
334 return (0xff1ff61c);
335
336 case 25:
337 case 24:
338 case 9:
339 case 8:
340 return (0xff1ff620);
341
342 case 27:
343 case 26:
344 case 11:
345 case 10:
346 return (0xff1ff624);
347
348 case 29:
349 case 28:
350 case 13:
351 case 12:
352 return (0xff1ff628);
353
354 case 31:
355 case 30:
356 case 15:
357 case 14:
358 return (0xff1ff62c);
359
360 }
361 return (0);
362}
363
364u32 tx4927_irq_pic_mask(int irq)
365{
366 /* MVMCP -- need to formulize this */
367 irq -= TX4927_IRQ_PIC_BEG;
368 switch (irq) {
369 case 31:
370 case 29:
371 case 27:
372 case 25:
373 case 23:
374 case 21:
375 case 19:
376 case 17:{
377 return (0x07000000);
378 }
379 case 30:
380 case 28:
381 case 26:
382 case 24:
383 case 22:
384 case 20:
385 case 18:
386 case 16:{
387 return (0x00070000);
388 }
389 case 15:
390 case 13:
391 case 11:
392 case 9:
393 case 7:
394 case 5:
395 case 3:
396 case 1:{
397 return (0x00000700);
398 }
399 case 14:
400 case 12:
401 case 10:
402 case 8:
403 case 6:
404 case 4:
405 case 2:
406 case 0:{
407 return (0x00000007);
408 }
409 }
410 return (0x00000000);
411}
412
413static void tx4927_irq_pic_modify(unsigned pic_reg, unsigned clr_bits,
414 unsigned set_bits)
415{
416 unsigned long val = 0;
417
418 val = TX4927_RD(pic_reg);
419 val &= (~clr_bits);
420 val |= (set_bits);
421 TX4927_WR(pic_reg, val);
422
423 return;
424}
425
426static void __init tx4927_irq_pic_init(void)
427{
428 unsigned long flags;
429 int i;
430
431 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_INIT, "beg=%d end=%d\n",
432 TX4927_IRQ_PIC_BEG, TX4927_IRQ_PIC_END);
433
434 for (i = TX4927_IRQ_PIC_BEG; i <= TX4927_IRQ_PIC_END; i++) {
435 irq_desc[i].status = IRQ_DISABLED;
436 irq_desc[i].action = 0;
437 irq_desc[i].depth = 2;
438 irq_desc[i].handler = &tx4927_irq_pic_type;
439 }
440
441 setup_irq(TX4927_IRQ_NEST_PIC_ON_CP0, &tx4927_irq_pic_action);
442
443 spin_lock_irqsave(&tx4927_pic_lock, flags);
444
445 TX4927_WR(0xff1ff640, 0x6); /* irq level mask -- only accept hightest */
446 TX4927_WR(0xff1ff600, TX4927_RD(0xff1ff600) | 0x1); /* irq enable */
447
448 spin_unlock_irqrestore(&tx4927_pic_lock, flags);
449
450 return;
451}
452
453static unsigned int tx4927_irq_pic_startup(unsigned int irq)
454{
455 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_STARTUP, "irq=%d\n", irq);
456
457 tx4927_irq_pic_enable(irq);
458
459 return (0);
460}
461
462static void tx4927_irq_pic_shutdown(unsigned int irq)
463{
464 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_SHUTDOWN, "irq=%d\n", irq);
465
466 tx4927_irq_pic_disable(irq);
467
468 return;
469}
470
471static void tx4927_irq_pic_enable(unsigned int irq)
472{
473 unsigned long flags;
474
475 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_ENABLE, "irq=%d\n", irq);
476
477 spin_lock_irqsave(&tx4927_pic_lock, flags);
478
479 tx4927_irq_pic_modify(tx4927_irq_pic_addr(irq), 0,
480 tx4927_irq_pic_mask(irq));
481
482 spin_unlock_irqrestore(&tx4927_pic_lock, flags);
483
484 return;
485}
486
487static void tx4927_irq_pic_disable(unsigned int irq)
488{
489 unsigned long flags;
490
491 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_DISABLE, "irq=%d\n", irq);
492
493 spin_lock_irqsave(&tx4927_pic_lock, flags);
494
495 tx4927_irq_pic_modify(tx4927_irq_pic_addr(irq),
496 tx4927_irq_pic_mask(irq), 0);
497
498 spin_unlock_irqrestore(&tx4927_pic_lock, flags);
499
500 return;
501}
502
503static void tx4927_irq_pic_mask_and_ack(unsigned int irq)
504{
505 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_MASK, "irq=%d\n", irq);
506
507 tx4927_irq_pic_disable(irq);
508
509 return;
510}
511
512static void tx4927_irq_pic_end(unsigned int irq)
513{
514 TX4927_IRQ_DPRINTK(TX4927_IRQ_PIC_ENDIRQ, "irq=%d\n", irq);
515
516 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
517 tx4927_irq_pic_enable(irq);
518 }
519
520 return;
521}
522
523/*
524 * Main init functions
525 */
526void __init tx4927_irq_init(void)
527{
528 extern asmlinkage void tx4927_irq_handler(void);
529
530 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "-\n");
531
532 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_cp0_init()\n");
533 tx4927_irq_cp0_init();
534
535 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_pic_init()\n");
536 tx4927_irq_pic_init();
537
538 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT,
539 "=Calling set_except_vector(tx4927_irq_handler)\n");
540 set_except_vector(0, tx4927_irq_handler);
541
542 TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "+\n");
543
544 return;
545}
546
547int tx4927_irq_nested(void)
548{
549 int sw_irq = 0;
550 u32 level2;
551
552 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST1, "-\n");
553
554 level2 = TX4927_RD(0xff1ff6a0);
555 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST2, "=level2a=0x%x\n", level2);
556
557 if ((level2 & 0x10000) == 0) {
558 level2 &= 0x1f;
559 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST3, "=level2b=0x%x\n", level2);
560
561 sw_irq = TX4927_IRQ_PIC_BEG + level2;
562 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST3, "=sw_irq=%d\n", sw_irq);
563
564 if (sw_irq == 27) {
565 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST4, "=irq-%d\n",
566 sw_irq);
567
568#ifdef CONFIG_TOSHIBA_RBTX4927
569 {
570 sw_irq = toshiba_rbtx4927_irq_nested(sw_irq);
571 }
572#endif
573
574 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST4, "=irq+%d\n",
575 sw_irq);
576 }
577 }
578
579 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST2, "=sw_irq=%d\n", sw_irq);
580
581 TX4927_IRQ_DPRINTK(TX4927_IRQ_NEST1, "+\n");
582
583 return (sw_irq);
584}
diff --git a/arch/mips/tx4927/common/tx4927_irq_handler.S b/arch/mips/tx4927/common/tx4927_irq_handler.S
new file mode 100644
index 000000000000..ca123e28d1ef
--- /dev/null
+++ b/arch/mips/tx4927/common/tx4927_irq_handler.S
@@ -0,0 +1,103 @@
1/*
2 * linux/arch/mips/tx4927/common/tx4927_irq_handler.S
3 *
4 * Primary interrupt handler for tx4927 based systems
5 *
6 * Author: MontaVista Software, Inc.
7 * Author: jsun@mvista.com or jsun@junsun.net
8 * source@mvista.com
9 *
10 * Copyright 2001-2002 MontaVista Software Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32#include <asm/asm.h>
33#include <asm/mipsregs.h>
34#include <asm/addrspace.h>
35#include <asm/regdef.h>
36#include <asm/stackframe.h>
37#include <asm/tx4927/tx4927.h>
38
39 .align 5
40 NESTED(tx4927_irq_handler, PT_SIZE, sp)
41 SAVE_ALL
42 CLI
43 .set at
44
45 mfc0 t0, CP0_CAUSE
46 mfc0 t1, CP0_STATUS
47 and t0, t1
48
49 andi t1, t0, STATUSF_IP7 /* cpu timer */
50 bnez t1, ll_ip7
51
52 /* IP6..IP3 multiplexed -- do not use */
53
54 andi t1, t0, STATUSF_IP2 /* tx4927 pic */
55 bnez t1, ll_ip2
56
57 andi t1, t0, STATUSF_IP0 /* user line 0 */
58 bnez t1, ll_ip0
59
60 andi t1, t0, STATUSF_IP1 /* user line 1 */
61 bnez t1, ll_ip1
62
63 .set reorder
64
65 /* wrong alarm or masked ... */
66 j spurious_interrupt
67 nop
68 END(tx4927_irq_handler)
69
70 .align 5
71
72
73ll_ip7:
74 li a0, TX4927_IRQ_CPU_TIMER
75 move a1, sp
76 jal do_IRQ
77 j ret_from_irq
78
79ll_ip2:
80 jal tx4927_irq_nested
81 nop
82 beqz v0, goto_spurious_interrupt
83 nop
84 move a0, v0
85 move a1, sp
86 jal do_IRQ
87 j ret_from_irq
88
89goto_spurious_interrupt:
90 j spurious_interrupt
91 nop
92
93ll_ip1:
94 li a0, TX4927_IRQ_USER1
95 move a1, sp
96 jal do_IRQ
97 j ret_from_irq
98
99ll_ip0:
100 li a0, TX4927_IRQ_USER0
101 move a1, sp
102 jal do_IRQ
103 j ret_from_irq
diff --git a/arch/mips/tx4927/common/tx4927_prom.c b/arch/mips/tx4927/common/tx4927_prom.c
new file mode 100644
index 000000000000..7d4cbf512d8a
--- /dev/null
+++ b/arch/mips/tx4927/common/tx4927_prom.c
@@ -0,0 +1,146 @@
1/*
2 * linux/arch/mips/tx4927/common/tx4927_prom.c
3 *
4 * common tx4927 memory interface
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * Copyright 2001-2002 MontaVista Software Inc.
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
24 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31
32#include <linux/init.h>
33#include <linux/mm.h>
34#include <linux/sched.h>
35#include <linux/bootmem.h>
36
37#include <asm/addrspace.h>
38#include <asm/bootinfo.h>
39#include <asm/tx4927/tx4927.h>
40
41static unsigned int __init tx4927_process_sdccr(u64 * addr)
42{
43 u64 val;
44 unsigned int sdccr_ce;
45 unsigned int sdccr_bs;
46 unsigned int sdccr_rs;
47 unsigned int sdccr_cs;
48 unsigned int sdccr_mw;
49 unsigned int bs = 0;
50 unsigned int rs = 0;
51 unsigned int cs = 0;
52 unsigned int mw = 0;
53 unsigned int msize = 0;
54
55 val = (*((vu64 *) (addr)));
56
57 /* MVMCP -- need #defs for these bits masks */
58 sdccr_ce = ((val & (1 << 10)) >> 10);
59 sdccr_bs = ((val & (1 << 8)) >> 8);
60 sdccr_rs = ((val & (3 << 5)) >> 5);
61 sdccr_cs = ((val & (3 << 2)) >> 2);
62 sdccr_mw = ((val & (1 << 0)) >> 0);
63
64 if (sdccr_ce) {
65 switch (sdccr_bs) {
66 case 0:{
67 bs = 2;
68 break;
69 }
70 case 1:{
71 bs = 4;
72 break;
73 }
74 }
75 switch (sdccr_rs) {
76 case 0:{
77 rs = 2048;
78 break;
79 }
80 case 1:{
81 rs = 4096;
82 break;
83 }
84 case 2:{
85 rs = 8192;
86 break;
87 }
88 case 3:{
89 rs = 0;
90 break;
91 }
92 }
93 switch (sdccr_cs) {
94 case 0:{
95 cs = 256;
96 break;
97 }
98 case 1:{
99 cs = 512;
100 break;
101 }
102 case 2:{
103 cs = 1024;
104 break;
105 }
106 case 3:{
107 cs = 2048;
108 break;
109 }
110 }
111 switch (sdccr_mw) {
112 case 0:{
113 mw = 8;
114 break;
115 } /* 8 bytes = 64 bits */
116 case 1:{
117 mw = 4;
118 break;
119 } /* 4 bytes = 32 bits */
120 }
121 }
122
123 /* bytes per chip MB per chip num chips */
124 msize = (((rs * cs * mw) / (1024 * 1024)) * bs);
125
126 return (msize);
127}
128
129
130unsigned int __init tx4927_get_mem_size(void)
131{
132 unsigned int c0;
133 unsigned int c1;
134 unsigned int c2;
135 unsigned int c3;
136 unsigned int total;
137
138 /* MVMCP -- need #defs for these registers */
139 c0 = tx4927_process_sdccr((u64 *) 0xff1f8000);
140 c1 = tx4927_process_sdccr((u64 *) 0xff1f8008);
141 c2 = tx4927_process_sdccr((u64 *) 0xff1f8010);
142 c3 = tx4927_process_sdccr((u64 *) 0xff1f8018);
143 total = c0 + c1 + c2 + c3;
144
145 return (total);
146}
diff --git a/arch/mips/tx4927/common/tx4927_setup.c b/arch/mips/tx4927/common/tx4927_setup.c
new file mode 100644
index 000000000000..16bcbdc6d1cc
--- /dev/null
+++ b/arch/mips/tx4927/common/tx4927_setup.c
@@ -0,0 +1,237 @@
1/*
2 * Author: MontaVista Software, Inc.
3 * source@mvista.com
4 *
5 * Copyright 2001-2002 MontaVista Software Inc.
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
17 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
18 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
20 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27#include <linux/config.h>
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/kernel_stat.h>
31#include <linux/module.h>
32#include <linux/signal.h>
33#include <linux/sched.h>
34#include <linux/types.h>
35#include <linux/interrupt.h>
36#include <linux/ioport.h>
37#include <linux/timex.h>
38#include <linux/slab.h>
39#include <linux/random.h>
40#include <linux/irq.h>
41#include <linux/bitops.h>
42#include <asm/bootinfo.h>
43#include <asm/io.h>
44#include <asm/irq.h>
45#include <asm/mipsregs.h>
46#include <asm/system.h>
47#include <asm/time.h>
48#include <asm/tx4927/tx4927.h>
49
50
51#undef DEBUG
52
53void __init tx4927_time_init(void);
54void __init tx4927_timer_setup(struct irqaction *irq);
55void dump_cp0(char *key);
56
57
58void (*__wbflush) (void);
59
60static void tx4927_write_buffer_flush(void)
61{
62 __asm__ __volatile__
63 ("sync\n\t" "nop\n\t" "loop: bc0f loop\n\t" "nop\n\t");
64}
65
66
67static void __init tx4927_setup(void)
68{
69 board_time_init = tx4927_time_init;
70 board_timer_setup = tx4927_timer_setup;
71 __wbflush = tx4927_write_buffer_flush;
72
73#ifdef CONFIG_TOSHIBA_RBTX4927
74 {
75 extern void toshiba_rbtx4927_setup(void);
76 toshiba_rbtx4927_setup();
77 }
78#endif
79
80 return;
81}
82
83early_initcall(tx4927_setup);
84
85void __init tx4927_time_init(void)
86{
87
88#ifdef CONFIG_TOSHIBA_RBTX4927
89 {
90 extern void toshiba_rbtx4927_time_init(void);
91 toshiba_rbtx4927_time_init();
92 }
93#endif
94
95 return;
96}
97
98
99void __init tx4927_timer_setup(struct irqaction *irq)
100{
101 u32 count;
102 u32 c1;
103 u32 c2;
104
105 setup_irq(TX4927_IRQ_CPU_TIMER, irq);
106
107 /* to generate the first timer interrupt */
108 c1 = read_c0_count();
109 count = c1 + (mips_hpt_frequency / HZ);
110 write_c0_compare(count);
111 c2 = read_c0_count();
112
113#ifdef CONFIG_TOSHIBA_RBTX4927
114 {
115 extern void toshiba_rbtx4927_timer_setup(struct irqaction
116 *irq);
117 toshiba_rbtx4927_timer_setup(irq);
118 }
119#endif
120
121 return;
122}
123
124
125#ifdef DEBUG
126void print_cp0(char *key, int num, char *name, u32 val)
127{
128 printk("%s cp0:%02d:%s=0x%08x\n", key, num, name, val);
129 return;
130}
131
132indent: Standard input:25: Error:Unexpected end of file
133
134void
135dump_cp0(char *key)
136{
137 if (key == NULL)
138 key = "";
139
140 print_cp0(key, 0, "INDEX ", read_c0_index());
141 print_cp0(key, 2, "ENTRYLO1", read_c0_entrylo0());
142 print_cp0(key, 3, "ENTRYLO2", read_c0_entrylo1());
143 print_cp0(key, 4, "CONTEXT ", read_c0_context());
144 print_cp0(key, 5, "PAGEMASK", read_c0_pagemask());
145 print_cp0(key, 6, "WIRED ", read_c0_wired());
146 //print_cp0(key, 8, "BADVADDR", read_c0_badvaddr());
147 print_cp0(key, 9, "COUNT ", read_c0_count());
148 print_cp0(key, 10, "ENTRYHI ", read_c0_entryhi());
149 print_cp0(key, 11, "COMPARE ", read_c0_compare());
150 print_cp0(key, 12, "STATUS ", read_c0_status());
151 print_cp0(key, 13, "CAUSE ", read_c0_cause() & 0xffff87ff);
152 print_cp0(key, 16, "CONFIG ", read_c0_config());
153 return;
154}
155
156void print_pic(char *key, u32 reg, char *name)
157{
158 printk("%s pic:0x%08x:%s=0x%08x\n", key, reg, name,
159 TX4927_RD(reg));
160 return;
161}
162
163
164void dump_pic(char *key)
165{
166 if (key == NULL)
167 key = "";
168
169 print_pic(key, 0xff1ff600, "IRDEN ");
170 print_pic(key, 0xff1ff604, "IRDM0 ");
171 print_pic(key, 0xff1ff608, "IRDM1 ");
172
173 print_pic(key, 0xff1ff610, "IRLVL0 ");
174 print_pic(key, 0xff1ff614, "IRLVL1 ");
175 print_pic(key, 0xff1ff618, "IRLVL2 ");
176 print_pic(key, 0xff1ff61c, "IRLVL3 ");
177 print_pic(key, 0xff1ff620, "IRLVL4 ");
178 print_pic(key, 0xff1ff624, "IRLVL5 ");
179 print_pic(key, 0xff1ff628, "IRLVL6 ");
180 print_pic(key, 0xff1ff62c, "IRLVL7 ");
181
182 print_pic(key, 0xff1ff640, "IRMSK ");
183 print_pic(key, 0xff1ff660, "IREDC ");
184 print_pic(key, 0xff1ff680, "IRPND ");
185 print_pic(key, 0xff1ff6a0, "IRCS ");
186
187 print_pic(key, 0xff1ff514, "IRFLAG1 "); /* don't read IRLAG0 -- it hangs system */
188
189 print_pic(key, 0xff1ff518, "IRPOL ");
190 print_pic(key, 0xff1ff51c, "IRRCNT ");
191 print_pic(key, 0xff1ff520, "IRMASKINT");
192 print_pic(key, 0xff1ff524, "IRMASKEXT");
193
194 return;
195}
196
197
198void print_addr(char *hdr, char *key, u32 addr)
199{
200 printk("%s %s:0x%08x=0x%08x\n", hdr, key, addr, TX4927_RD(addr));
201 return;
202}
203
204
205void dump_180(char *key)
206{
207 u32 i;
208
209 for (i = 0x80000180; i < 0x80000180 + 0x80; i += 4) {
210 print_addr("180", key, i);
211 }
212 return;
213}
214
215
216void dump_eh0(char *key)
217{
218 int i;
219 extern unsigned long exception_handlers[];
220
221 for (i = (int) exception_handlers;
222 i < (int) (exception_handlers + 20); i += 4) {
223 print_addr("eh0", key, i);
224 }
225
226 return;
227}
228
229void pk0(void)
230{
231 volatile u32 val;
232
233 __asm__ __volatile__("ori %0, $26, 0":"=r"(val)
234 );
235 printk("k0=[0x%08x]\n", val);
236}
237#endif
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/Makefile b/arch/mips/tx4927/toshiba_rbtx4927/Makefile
new file mode 100644
index 000000000000..86ca4cf2d587
--- /dev/null
+++ b/arch/mips/tx4927/toshiba_rbtx4927/Makefile
@@ -0,0 +1,5 @@
1obj-y += toshiba_rbtx4927_prom.o
2obj-y += toshiba_rbtx4927_setup.o
3obj-y += toshiba_rbtx4927_irq.o
4
5EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
new file mode 100644
index 000000000000..fd5b433f83b7
--- /dev/null
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
@@ -0,0 +1,786 @@
1/*
2 * linux/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
3 *
4 * Toshiba RBTX4927 specific interrupt handlers
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * Copyright 2001-2002 MontaVista Software Inc.
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
24 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31
32
33/*
34IRQ Device
3500 RBTX4927-ISA/00
3601 RBTX4927-ISA/01 PS2/Keyboard
3702 RBTX4927-ISA/02 Cascade RBTX4927-ISA (irqs 8-15)
3803 RBTX4927-ISA/03
3904 RBTX4927-ISA/04
4005 RBTX4927-ISA/05
4106 RBTX4927-ISA/06
4207 RBTX4927-ISA/07
4308 RBTX4927-ISA/08
4409 RBTX4927-ISA/09
4510 RBTX4927-ISA/10
4611 RBTX4927-ISA/11
4712 RBTX4927-ISA/12 PS2/Mouse (not supported at this time)
4813 RBTX4927-ISA/13
4914 RBTX4927-ISA/14 IDE
5015 RBTX4927-ISA/15
51
5216 TX4927-CP0/00 Software 0
5317 TX4927-CP0/01 Software 1
5418 TX4927-CP0/02 Cascade TX4927-CP0
5519 TX4927-CP0/03 Multiplexed -- do not use
5620 TX4927-CP0/04 Multiplexed -- do not use
5721 TX4927-CP0/05 Multiplexed -- do not use
5822 TX4927-CP0/06 Multiplexed -- do not use
5923 TX4927-CP0/07 CPU TIMER
60
6124 TX4927-PIC/00
6225 TX4927-PIC/01
6326 TX4927-PIC/02
6427 TX4927-PIC/03 Cascade RBTX4927-IOC
6528 TX4927-PIC/04
6629 TX4927-PIC/05 RBTX4927 RTL-8019AS ethernet
6730 TX4927-PIC/06
6831 TX4927-PIC/07
6932 TX4927-PIC/08 TX4927 SerialIO Channel 0
7033 TX4927-PIC/09 TX4927 SerialIO Channel 1
7134 TX4927-PIC/10
7235 TX4927-PIC/11
7336 TX4927-PIC/12
7437 TX4927-PIC/13
7538 TX4927-PIC/14
7639 TX4927-PIC/15
7740 TX4927-PIC/16 TX4927 PCI PCI-C
7841 TX4927-PIC/17
7942 TX4927-PIC/18
8043 TX4927-PIC/19
8144 TX4927-PIC/20
8245 TX4927-PIC/21
8346 TX4927-PIC/22 TX4927 PCI PCI-ERR
8447 TX4927-PIC/23 TX4927 PCI PCI-PMA (not used)
8548 TX4927-PIC/24
8649 TX4927-PIC/25
8750 TX4927-PIC/26
8851 TX4927-PIC/27
8952 TX4927-PIC/28
9053 TX4927-PIC/29
9154 TX4927-PIC/30
9255 TX4927-PIC/31
93
9456 RBTX4927-IOC/00 FPCIB0 PCI-D PJ4/A PJ5/B SB/C PJ6/D PJ7/A (SouthBridge/NotUsed) [RTL-8139=PJ4]
9557 RBTX4927-IOC/01 FPCIB0 PCI-C PJ4/D PJ5/A SB/B PJ6/C PJ7/D (SouthBridge/NotUsed) [RTL-8139=PJ5]
9658 RBTX4927-IOC/02 FPCIB0 PCI-B PJ4/C PJ5/D SB/A PJ6/B PJ7/C (SouthBridge/IDE/pin=1,INTR) [RTL-8139=NotSupported]
9759 RBTX4927-IOC/03 FPCIB0 PCI-A PJ4/B PJ5/C SB/D PJ6/A PJ7/B (SouthBridge/USB/pin=4) [RTL-8139=PJ6]
9860 RBTX4927-IOC/04
9961 RBTX4927-IOC/05
10062 RBTX4927-IOC/06
10163 RBTX4927-IOC/07
102
103NOTES:
104SouthBridge/INTR is mapped to SouthBridge/A=PCI-B/#58
105SouthBridge/ISA/pin=0 no pci irq used by this device
106SouthBridge/IDE/pin=1 no pci irq used by this device, using INTR via ISA IRQ14
107SouthBridge/USB/pin=4 using pci irq SouthBridge/D=PCI-A=#59
108SouthBridge/PMC/pin=0 no pci irq used by this device
109SuperIO/PS2/Keyboard, using INTR via ISA IRQ1
110SuperIO/PS2/Mouse, using INTR via ISA IRQ12 (mouse not currently supported)
111JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthBridge, JP4, JP5, JP6
112*/
113
114#include <linux/config.h>
115#include <linux/init.h>
116#include <linux/kernel.h>
117#include <linux/types.h>
118#include <linux/mm.h>
119#include <linux/swap.h>
120#include <linux/ioport.h>
121#include <linux/sched.h>
122#include <linux/interrupt.h>
123#include <linux/pci.h>
124#include <linux/timex.h>
125#include <asm/bootinfo.h>
126#include <asm/page.h>
127#include <asm/io.h>
128#include <asm/irq.h>
129#include <asm/pci.h>
130#include <asm/processor.h>
131#include <asm/ptrace.h>
132#include <asm/reboot.h>
133#include <asm/time.h>
134#include <linux/bootmem.h>
135#include <linux/blkdev.h>
136#ifdef CONFIG_RTC_DS1742
137#include <linux/ds1742rtc.h>
138#endif
139#ifdef CONFIG_TOSHIBA_FPCIB0
140#include <asm/tx4927/smsc_fdc37m81x.h>
141#endif
142#include <asm/tx4927/toshiba_rbtx4927.h>
143
144
145#undef TOSHIBA_RBTX4927_IRQ_DEBUG
146
147#ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
148#define TOSHIBA_RBTX4927_IRQ_NONE 0x00000000
149
150#define TOSHIBA_RBTX4927_IRQ_INFO ( 1 << 0 )
151#define TOSHIBA_RBTX4927_IRQ_WARN ( 1 << 1 )
152#define TOSHIBA_RBTX4927_IRQ_EROR ( 1 << 2 )
153
154#define TOSHIBA_RBTX4927_IRQ_IOC_INIT ( 1 << 10 )
155#define TOSHIBA_RBTX4927_IRQ_IOC_STARTUP ( 1 << 11 )
156#define TOSHIBA_RBTX4927_IRQ_IOC_SHUTDOWN ( 1 << 12 )
157#define TOSHIBA_RBTX4927_IRQ_IOC_ENABLE ( 1 << 13 )
158#define TOSHIBA_RBTX4927_IRQ_IOC_DISABLE ( 1 << 14 )
159#define TOSHIBA_RBTX4927_IRQ_IOC_MASK ( 1 << 15 )
160#define TOSHIBA_RBTX4927_IRQ_IOC_ENDIRQ ( 1 << 16 )
161
162#define TOSHIBA_RBTX4927_IRQ_ISA_INIT ( 1 << 20 )
163#define TOSHIBA_RBTX4927_IRQ_ISA_STARTUP ( 1 << 21 )
164#define TOSHIBA_RBTX4927_IRQ_ISA_SHUTDOWN ( 1 << 22 )
165#define TOSHIBA_RBTX4927_IRQ_ISA_ENABLE ( 1 << 23 )
166#define TOSHIBA_RBTX4927_IRQ_ISA_DISABLE ( 1 << 24 )
167#define TOSHIBA_RBTX4927_IRQ_ISA_MASK ( 1 << 25 )
168#define TOSHIBA_RBTX4927_IRQ_ISA_ENDIRQ ( 1 << 26 )
169
170#define TOSHIBA_RBTX4927_SETUP_ALL 0xffffffff
171#endif
172
173
174#ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
175static const u32 toshiba_rbtx4927_irq_debug_flag =
176 (TOSHIBA_RBTX4927_IRQ_NONE | TOSHIBA_RBTX4927_IRQ_INFO |
177 TOSHIBA_RBTX4927_IRQ_WARN | TOSHIBA_RBTX4927_IRQ_EROR
178// | TOSHIBA_RBTX4927_IRQ_IOC_INIT
179// | TOSHIBA_RBTX4927_IRQ_IOC_STARTUP
180// | TOSHIBA_RBTX4927_IRQ_IOC_SHUTDOWN
181// | TOSHIBA_RBTX4927_IRQ_IOC_ENABLE
182// | TOSHIBA_RBTX4927_IRQ_IOC_DISABLE
183// | TOSHIBA_RBTX4927_IRQ_IOC_MASK
184// | TOSHIBA_RBTX4927_IRQ_IOC_ENDIRQ
185// | TOSHIBA_RBTX4927_IRQ_ISA_INIT
186// | TOSHIBA_RBTX4927_IRQ_ISA_STARTUP
187// | TOSHIBA_RBTX4927_IRQ_ISA_SHUTDOWN
188// | TOSHIBA_RBTX4927_IRQ_ISA_ENABLE
189// | TOSHIBA_RBTX4927_IRQ_ISA_DISABLE
190// | TOSHIBA_RBTX4927_IRQ_ISA_MASK
191// | TOSHIBA_RBTX4927_IRQ_ISA_ENDIRQ
192 );
193#endif
194
195
196#ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
197#define TOSHIBA_RBTX4927_IRQ_DPRINTK(flag,str...) \
198 if ( (toshiba_rbtx4927_irq_debug_flag) & (flag) ) \
199 { \
200 char tmp[100]; \
201 sprintf( tmp, str ); \
202 printk( "%s(%s:%u)::%s", __FUNCTION__, __FILE__, __LINE__, tmp ); \
203 }
204#else
205#define TOSHIBA_RBTX4927_IRQ_DPRINTK(flag,str...)
206#endif
207
208
209
210
211#define TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG 0
212#define TOSHIBA_RBTX4927_IRQ_IOC_RAW_END 7
213
214#define TOSHIBA_RBTX4927_IRQ_IOC_BEG ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG) /* 56 */
215#define TOSHIBA_RBTX4927_IRQ_IOC_END ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_END) /* 63 */
216
217
218#define TOSHIBA_RBTX4927_IRQ_ISA_BEG MI8259_IRQ_ISA_BEG
219#define TOSHIBA_RBTX4927_IRQ_ISA_END MI8259_IRQ_ISA_END
220#define TOSHIBA_RBTX4927_IRQ_ISA_MID ((TOSHIBA_RBTX4927_IRQ_ISA_BEG+TOSHIBA_RBTX4927_IRQ_ISA_END+1)/2)
221
222
223#define TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC TX4927_IRQ_NEST_EXT_ON_PIC
224#define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC (TOSHIBA_RBTX4927_IRQ_IOC_BEG+2)
225#define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_ISA (TOSHIBA_RBTX4927_IRQ_ISA_BEG+2)
226
227extern int tx4927_using_backplane;
228
229#ifdef CONFIG_TOSHIBA_FPCIB0
230extern void enable_8259A_irq(unsigned int irq);
231extern void disable_8259A_irq(unsigned int irq);
232extern void mask_and_ack_8259A(unsigned int irq);
233#endif
234
235static unsigned int toshiba_rbtx4927_irq_ioc_startup(unsigned int irq);
236static void toshiba_rbtx4927_irq_ioc_shutdown(unsigned int irq);
237static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq);
238static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq);
239static void toshiba_rbtx4927_irq_ioc_mask_and_ack(unsigned int irq);
240static void toshiba_rbtx4927_irq_ioc_end(unsigned int irq);
241
242#ifdef CONFIG_TOSHIBA_FPCIB0
243static unsigned int toshiba_rbtx4927_irq_isa_startup(unsigned int irq);
244static void toshiba_rbtx4927_irq_isa_shutdown(unsigned int irq);
245static void toshiba_rbtx4927_irq_isa_enable(unsigned int irq);
246static void toshiba_rbtx4927_irq_isa_disable(unsigned int irq);
247static void toshiba_rbtx4927_irq_isa_mask_and_ack(unsigned int irq);
248static void toshiba_rbtx4927_irq_isa_end(unsigned int irq);
249#endif
250
251static DEFINE_SPINLOCK(toshiba_rbtx4927_ioc_lock);
252
253
254#define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC"
255static struct hw_interrupt_type toshiba_rbtx4927_irq_ioc_type = {
256 .typename = TOSHIBA_RBTX4927_IOC_NAME,
257 .startup = toshiba_rbtx4927_irq_ioc_startup,
258 .shutdown = toshiba_rbtx4927_irq_ioc_shutdown,
259 .enable = toshiba_rbtx4927_irq_ioc_enable,
260 .disable = toshiba_rbtx4927_irq_ioc_disable,
261 .ack = toshiba_rbtx4927_irq_ioc_mask_and_ack,
262 .end = toshiba_rbtx4927_irq_ioc_end,
263 .set_affinity = NULL
264};
265#define TOSHIBA_RBTX4927_IOC_INTR_ENAB 0xbc002000
266#define TOSHIBA_RBTX4927_IOC_INTR_STAT 0xbc002006
267
268
269#ifdef CONFIG_TOSHIBA_FPCIB0
270#define TOSHIBA_RBTX4927_ISA_NAME "RBTX4927-ISA"
271static struct hw_interrupt_type toshiba_rbtx4927_irq_isa_type = {
272 .typename = TOSHIBA_RBTX4927_ISA_NAME,
273 .startup = toshiba_rbtx4927_irq_isa_startup,
274 .shutdown = toshiba_rbtx4927_irq_isa_shutdown,
275 .enable = toshiba_rbtx4927_irq_isa_enable,
276 .disable = toshiba_rbtx4927_irq_isa_disable,
277 .ack = toshiba_rbtx4927_irq_isa_mask_and_ack,
278 .end = toshiba_rbtx4927_irq_isa_end,
279 .set_affinity = NULL
280};
281#endif
282
283
284u32 bit2num(u32 num)
285{
286 u32 i;
287
288 for (i = 0; i < (sizeof(num) * 8); i++) {
289 if (num & (1 << i)) {
290 return (i);
291 }
292 }
293 return (0);
294}
295
296int toshiba_rbtx4927_irq_nested(int sw_irq)
297{
298 u32 level3;
299 u32 level4;
300 u32 level5;
301
302 level3 = reg_rd08(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f;
303 if (level3) {
304 sw_irq = TOSHIBA_RBTX4927_IRQ_IOC_BEG + bit2num(level3);
305 if (sw_irq != TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC) {
306 goto RETURN;
307 }
308 }
309#ifdef CONFIG_TOSHIBA_FPCIB0
310 {
311 if (tx4927_using_backplane) {
312 outb(0x0A, 0x20);
313 level4 = inb(0x20) & 0xff;
314 if (level4) {
315 sw_irq =
316 TOSHIBA_RBTX4927_IRQ_ISA_BEG +
317 bit2num(level4);
318 if (sw_irq !=
319 TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_ISA) {
320 goto RETURN;
321 }
322 }
323
324 outb(0x0A, 0xA0);
325 level5 = inb(0xA0) & 0xff;
326 if (level5) {
327 sw_irq =
328 TOSHIBA_RBTX4927_IRQ_ISA_MID +
329 bit2num(level5);
330 goto RETURN;
331 }
332 }
333 }
334#endif
335
336 RETURN:
337 return (sw_irq);
338}
339
340//#define TOSHIBA_RBTX4927_PIC_ACTION(s) { no_action, 0, CPU_MASK_NONE, s, NULL, NULL }
341#define TOSHIBA_RBTX4927_PIC_ACTION(s) { no_action, SA_SHIRQ, CPU_MASK_NONE, s, NULL, NULL }
342static struct irqaction toshiba_rbtx4927_irq_ioc_action =
343TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_IOC_NAME);
344#ifdef CONFIG_TOSHIBA_FPCIB0
345static struct irqaction toshiba_rbtx4927_irq_isa_master =
346TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_ISA_NAME "/M");
347static struct irqaction toshiba_rbtx4927_irq_isa_slave =
348TOSHIBA_RBTX4927_PIC_ACTION(TOSHIBA_RBTX4927_ISA_NAME "/S");
349#endif
350
351
352/**********************************************************************************/
353/* Functions for ioc */
354/**********************************************************************************/
355
356
357static void __init toshiba_rbtx4927_irq_ioc_init(void)
358{
359 int i;
360
361 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_INIT,
362 "beg=%d end=%d\n",
363 TOSHIBA_RBTX4927_IRQ_IOC_BEG,
364 TOSHIBA_RBTX4927_IRQ_IOC_END);
365
366 for (i = TOSHIBA_RBTX4927_IRQ_IOC_BEG;
367 i <= TOSHIBA_RBTX4927_IRQ_IOC_END; i++) {
368 irq_desc[i].status = IRQ_DISABLED;
369 irq_desc[i].action = 0;
370 irq_desc[i].depth = 3;
371 irq_desc[i].handler = &toshiba_rbtx4927_irq_ioc_type;
372 }
373
374 setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC,
375 &toshiba_rbtx4927_irq_ioc_action);
376
377 return;
378}
379
380static unsigned int toshiba_rbtx4927_irq_ioc_startup(unsigned int irq)
381{
382 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_STARTUP,
383 "irq=%d\n", irq);
384
385 if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
386 || irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
387 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
388 "bad irq=%d\n", irq);
389 panic("\n");
390 }
391
392 toshiba_rbtx4927_irq_ioc_enable(irq);
393
394 return (0);
395}
396
397
398static void toshiba_rbtx4927_irq_ioc_shutdown(unsigned int irq)
399{
400 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_SHUTDOWN,
401 "irq=%d\n", irq);
402
403 if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
404 || irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
405 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
406 "bad irq=%d\n", irq);
407 panic("\n");
408 }
409
410 toshiba_rbtx4927_irq_ioc_disable(irq);
411
412 return;
413}
414
415
416static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq)
417{
418 unsigned long flags;
419 volatile unsigned char v;
420
421 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_ENABLE,
422 "irq=%d\n", irq);
423
424 if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
425 || irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
426 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
427 "bad irq=%d\n", irq);
428 panic("\n");
429 }
430
431 spin_lock_irqsave(&toshiba_rbtx4927_ioc_lock, flags);
432
433 v = TX4927_RD08(TOSHIBA_RBTX4927_IOC_INTR_ENAB);
434 v |= (1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG));
435 TOSHIBA_RBTX4927_WR08(TOSHIBA_RBTX4927_IOC_INTR_ENAB, v);
436
437 spin_unlock_irqrestore(&toshiba_rbtx4927_ioc_lock, flags);
438
439 return;
440}
441
442
443static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq)
444{
445 unsigned long flags;
446 volatile unsigned char v;
447
448 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_DISABLE,
449 "irq=%d\n", irq);
450
451 if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
452 || irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
453 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
454 "bad irq=%d\n", irq);
455 panic("\n");
456 }
457
458 spin_lock_irqsave(&toshiba_rbtx4927_ioc_lock, flags);
459
460 v = TX4927_RD08(TOSHIBA_RBTX4927_IOC_INTR_ENAB);
461 v &= ~(1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG));
462 TOSHIBA_RBTX4927_WR08(TOSHIBA_RBTX4927_IOC_INTR_ENAB, v);
463
464 spin_unlock_irqrestore(&toshiba_rbtx4927_ioc_lock, flags);
465
466 return;
467}
468
469
470static void toshiba_rbtx4927_irq_ioc_mask_and_ack(unsigned int irq)
471{
472 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_MASK,
473 "irq=%d\n", irq);
474
475 if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
476 || irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
477 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
478 "bad irq=%d\n", irq);
479 panic("\n");
480 }
481
482 toshiba_rbtx4927_irq_ioc_disable(irq);
483
484 return;
485}
486
487
488static void toshiba_rbtx4927_irq_ioc_end(unsigned int irq)
489{
490 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_ENDIRQ,
491 "irq=%d\n", irq);
492
493 if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
494 || irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
495 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
496 "bad irq=%d\n", irq);
497 panic("\n");
498 }
499
500 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
501 toshiba_rbtx4927_irq_ioc_enable(irq);
502 }
503
504 return;
505}
506
507
508/**********************************************************************************/
509/* Functions for isa */
510/**********************************************************************************/
511
512
513#ifdef CONFIG_TOSHIBA_FPCIB0
514static void __init toshiba_rbtx4927_irq_isa_init(void)
515{
516 int i;
517
518 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_INIT,
519 "beg=%d end=%d\n",
520 TOSHIBA_RBTX4927_IRQ_ISA_BEG,
521 TOSHIBA_RBTX4927_IRQ_ISA_END);
522
523 for (i = TOSHIBA_RBTX4927_IRQ_ISA_BEG;
524 i <= TOSHIBA_RBTX4927_IRQ_ISA_END; i++) {
525 irq_desc[i].status = IRQ_DISABLED;
526 irq_desc[i].action = 0;
527 irq_desc[i].depth =
528 ((i < TOSHIBA_RBTX4927_IRQ_ISA_MID) ? (4) : (5));
529 irq_desc[i].handler = &toshiba_rbtx4927_irq_isa_type;
530 }
531
532 setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC,
533 &toshiba_rbtx4927_irq_isa_master);
534 setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_ISA,
535 &toshiba_rbtx4927_irq_isa_slave);
536
537 /* make sure we are looking at IRR (not ISR) */
538 outb(0x0A, 0x20);
539 outb(0x0A, 0xA0);
540
541 return;
542}
543#endif
544
545
546#ifdef CONFIG_TOSHIBA_FPCIB0
547static unsigned int toshiba_rbtx4927_irq_isa_startup(unsigned int irq)
548{
549 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_STARTUP,
550 "irq=%d\n", irq);
551
552 if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
553 || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
554 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
555 "bad irq=%d\n", irq);
556 panic("\n");
557 }
558
559 toshiba_rbtx4927_irq_isa_enable(irq);
560
561 return (0);
562}
563#endif
564
565
566#ifdef CONFIG_TOSHIBA_FPCIB0
567static void toshiba_rbtx4927_irq_isa_shutdown(unsigned int irq)
568{
569 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_SHUTDOWN,
570 "irq=%d\n", irq);
571
572 if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
573 || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
574 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
575 "bad irq=%d\n", irq);
576 panic("\n");
577 }
578
579 toshiba_rbtx4927_irq_isa_disable(irq);
580
581 return;
582}
583#endif
584
585
586#ifdef CONFIG_TOSHIBA_FPCIB0
587static void toshiba_rbtx4927_irq_isa_enable(unsigned int irq)
588{
589 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_ENABLE,
590 "irq=%d\n", irq);
591
592 if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
593 || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
594 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
595 "bad irq=%d\n", irq);
596 panic("\n");
597 }
598
599 enable_8259A_irq(irq);
600
601 return;
602}
603#endif
604
605
606#ifdef CONFIG_TOSHIBA_FPCIB0
607static void toshiba_rbtx4927_irq_isa_disable(unsigned int irq)
608{
609 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_DISABLE,
610 "irq=%d\n", irq);
611
612 if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
613 || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
614 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
615 "bad irq=%d\n", irq);
616 panic("\n");
617 }
618
619 disable_8259A_irq(irq);
620
621 return;
622}
623#endif
624
625
626#ifdef CONFIG_TOSHIBA_FPCIB0
627static void toshiba_rbtx4927_irq_isa_mask_and_ack(unsigned int irq)
628{
629 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_MASK,
630 "irq=%d\n", irq);
631
632 if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
633 || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
634 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
635 "bad irq=%d\n", irq);
636 panic("\n");
637 }
638
639 mask_and_ack_8259A(irq);
640
641 return;
642}
643#endif
644
645
646#ifdef CONFIG_TOSHIBA_FPCIB0
647static void toshiba_rbtx4927_irq_isa_end(unsigned int irq)
648{
649 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_ISA_ENDIRQ,
650 "irq=%d\n", irq);
651
652 if (irq < TOSHIBA_RBTX4927_IRQ_ISA_BEG
653 || irq > TOSHIBA_RBTX4927_IRQ_ISA_END) {
654 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
655 "bad irq=%d\n", irq);
656 panic("\n");
657 }
658
659 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
660 toshiba_rbtx4927_irq_isa_enable(irq);
661 }
662
663 return;
664}
665#endif
666
667
668void __init arch_init_irq(void)
669{
670 extern void tx4927_irq_init(void);
671
672 local_irq_disable();
673
674 tx4927_irq_init();
675 toshiba_rbtx4927_irq_ioc_init();
676#ifdef CONFIG_TOSHIBA_FPCIB0
677 {
678 if (tx4927_using_backplane) {
679 toshiba_rbtx4927_irq_isa_init();
680 }
681 }
682#endif
683
684 wbflush();
685
686 return;
687}
688
689void toshiba_rbtx4927_irq_dump(char *key)
690{
691#ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
692 {
693 u32 i, j = 0;
694 for (i = 0; i < NR_IRQS; i++) {
695 if (strcmp(irq_desc[i].handler->typename, "none")
696 == 0)
697 continue;
698
699 if ((i >= 1)
700 && (irq_desc[i - 1].handler->typename ==
701 irq_desc[i].handler->typename)) {
702 j++;
703 } else {
704 j = 0;
705 }
706 TOSHIBA_RBTX4927_IRQ_DPRINTK
707 (TOSHIBA_RBTX4927_IRQ_INFO,
708 "%s irq=0x%02x/%3d s=0x%08x h=0x%08x a=0x%08x ah=0x%08x d=%1d n=%s/%02d\n",
709 key, i, i, irq_desc[i].status,
710 (u32) irq_desc[i].handler,
711 (u32) irq_desc[i].action,
712 (u32) (irq_desc[i].action ? irq_desc[i].
713 action->handler : 0),
714 irq_desc[i].depth,
715 irq_desc[i].handler->typename, j);
716 }
717 }
718#endif
719 return;
720}
721
722void toshiba_rbtx4927_irq_dump_pics(char *s)
723{
724 u32 level0_m;
725 u32 level0_s;
726 u32 level1_m;
727 u32 level1_s;
728 u32 level2;
729 u32 level2_p;
730 u32 level2_s;
731 u32 level3_m;
732 u32 level3_s;
733 u32 level4_m;
734 u32 level4_s;
735 u32 level5_m;
736 u32 level5_s;
737
738 if (s == NULL)
739 s = "null";
740
741 level0_m = (read_c0_status() & 0x0000ff00) >> 8;
742 level0_s = (read_c0_cause() & 0x0000ff00) >> 8;
743
744 level1_m = level0_m;
745 level1_s = level0_s & 0x87;
746
747 level2 = TX4927_RD(0xff1ff6a0);
748 level2_p = (((level2 & 0x10000)) ? 0 : 1);
749 level2_s = (((level2 & 0x1f) == 0x1f) ? 0 : (level2 & 0x1f));
750
751 level3_m = reg_rd08(TOSHIBA_RBTX4927_IOC_INTR_ENAB) & 0x1f;
752 level3_s = reg_rd08(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f;
753
754 level4_m = inb(0x21);
755 outb(0x0A, 0x20);
756 level4_s = inb(0x20);
757
758 level5_m = inb(0xa1);
759 outb(0x0A, 0xa0);
760 level5_s = inb(0xa0);
761
762 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
763 "dump_raw_pic() ");
764 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
765 "cp0:m=0x%02x/s=0x%02x ", level0_m,
766 level0_s);
767 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
768 "cp0:m=0x%02x/s=0x%02x ", level1_m,
769 level1_s);
770 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
771 "pic:e=0x%02x/s=0x%02x ", level2_p,
772 level2_s);
773 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
774 "ioc:m=0x%02x/s=0x%02x ", level3_m,
775 level3_s);
776 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
777 "sbm:m=0x%02x/s=0x%02x ", level4_m,
778 level4_s);
779 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
780 "sbs:m=0x%02x/s=0x%02x ", level5_m,
781 level5_s);
782 TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO, "[%s]\n",
783 s);
784
785 return;
786}
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
new file mode 100644
index 000000000000..e4d095d3e192
--- /dev/null
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
@@ -0,0 +1,97 @@
1/*
2 * rbtx4927 specific prom routines
3 *
4 * Author: MontaVista Software, Inc.
5 * source@mvista.com
6 *
7 * Copyright 2001-2002 MontaVista Software Inc.
8 *
9 * Copyright (C) 2004 MontaVista Software Inc.
10 * Author: Manish Lachwani, mlachwani@mvista.com
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32#include <linux/init.h>
33#include <linux/mm.h>
34#include <linux/sched.h>
35#include <linux/bootmem.h>
36
37#include <asm/addrspace.h>
38#include <asm/bootinfo.h>
39#include <asm/cpu.h>
40#include <asm/tx4927/tx4927.h>
41
42void __init prom_init_cmdline(void)
43{
44 int argc = (int) fw_arg0;
45 char **argv = (char **) fw_arg1;
46 int i; /* Always ignore the "-c" at argv[0] */
47
48 /* ignore all built-in args if any f/w args given */
49 if (argc > 1) {
50 *arcs_cmdline = '\0';
51 }
52
53 for (i = 1; i < argc; i++) {
54 if (i != 1) {
55 strcat(arcs_cmdline, " ");
56 }
57 strcat(arcs_cmdline, argv[i]);
58 }
59}
60
61void __init prom_init(void)
62{
63 const char* toshiba_name_list[] = GROUP_TOSHIBA_NAMES;
64 extern int tx4927_get_mem_size(void);
65 extern char* toshiba_name;
66 int msize;
67
68 prom_init_cmdline();
69
70 mips_machgroup = MACH_GROUP_TOSHIBA;
71
72 if ((read_c0_prid() & 0xff) == PRID_REV_TX4927)
73 mips_machtype = MACH_TOSHIBA_RBTX4927;
74 else
75 mips_machtype = MACH_TOSHIBA_RBTX4937;
76
77 toshiba_name = toshiba_name_list[mips_machtype];
78
79 msize = tx4927_get_mem_size();
80 add_memory_region(0, msize << 20, BOOT_MEM_RAM);
81}
82
83unsigned long __init prom_free_prom_memory(void)
84{
85 return 0;
86}
87
88const char *get_system_type(void)
89{
90 return "Toshiba RBTX4927/RBTX4937";
91}
92
93char * __init prom_getcmdline(void)
94{
95 return &(arcs_cmdline[0]);
96}
97
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
new file mode 100644
index 000000000000..8724ea3ae04e
--- /dev/null
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -0,0 +1,1024 @@
1/*
2 * Toshiba rbtx4927 specific setup
3 *
4 * Author: MontaVista Software, Inc.
5 * source@mvista.com
6 *
7 * Copyright 2001-2002 MontaVista Software Inc.
8 *
9 * Copyright (C) 1996, 97, 2001, 04 Ralf Baechle (ralf@linux-mips.org)
10 * Copyright (C) 2000 RidgeRun, Inc.
11 * Author: RidgeRun, Inc.
12 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
13 *
14 * Copyright 2001 MontaVista Software Inc.
15 * Author: jsun@mvista.com or jsun@junsun.net
16 *
17 * Copyright 2002 MontaVista Software Inc.
18 * Author: Michael Pruznick, michael_pruznick@mvista.com
19 *
20 * Copyright (C) 2000-2001 Toshiba Corporation
21 *
22 * Copyright (C) 2004 MontaVista Software Inc.
23 * Author: Manish Lachwani, mlachwani@mvista.com
24 *
25 * This program is free software; you can redistribute it and/or modify it
26 * under the terms of the GNU General Public License as published by the
27 * Free Software Foundation; either version 2 of the License, or (at your
28 * option) any later version.
29 *
30 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
31 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
33 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
34 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
36 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
38 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
39 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 * You should have received a copy of the GNU General Public License along
42 * with this program; if not, write to the Free Software Foundation, Inc.,
43 * 675 Mass Ave, Cambridge, MA 02139, USA.
44 */
45#include <linux/config.h>
46#include <linux/init.h>
47#include <linux/kernel.h>
48#include <linux/types.h>
49#include <linux/mm.h>
50#include <linux/swap.h>
51#include <linux/ioport.h>
52#include <linux/sched.h>
53#include <linux/interrupt.h>
54#include <linux/pci.h>
55#include <linux/timex.h>
56#include <asm/bootinfo.h>
57#include <asm/page.h>
58#include <asm/io.h>
59#include <asm/irq.h>
60#include <asm/processor.h>
61#include <asm/ptrace.h>
62#include <asm/reboot.h>
63#include <asm/time.h>
64#include <linux/bootmem.h>
65#include <linux/blkdev.h>
66#ifdef CONFIG_RTC_DS1742
67#include <linux/ds1742rtc.h>
68#endif
69#ifdef CONFIG_TOSHIBA_FPCIB0
70#include <asm/tx4927/smsc_fdc37m81x.h>
71#endif
72#include <asm/tx4927/toshiba_rbtx4927.h>
73#ifdef CONFIG_PCI
74#include <asm/tx4927/tx4927_pci.h>
75#endif
76#ifdef CONFIG_BLK_DEV_IDEPCI
77#include <linux/hdreg.h>
78#include <linux/ide.h>
79#endif
80
81#undef TOSHIBA_RBTX4927_SETUP_DEBUG
82
83#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
84#define TOSHIBA_RBTX4927_SETUP_NONE 0x00000000
85
86#define TOSHIBA_RBTX4927_SETUP_INFO ( 1 << 0 )
87#define TOSHIBA_RBTX4927_SETUP_WARN ( 1 << 1 )
88#define TOSHIBA_RBTX4927_SETUP_EROR ( 1 << 2 )
89
90#define TOSHIBA_RBTX4927_SETUP_EFWFU ( 1 << 3 )
91#define TOSHIBA_RBTX4927_SETUP_SETUP ( 1 << 4 )
92#define TOSHIBA_RBTX4927_SETUP_TIME_INIT ( 1 << 5 )
93#define TOSHIBA_RBTX4927_SETUP_TIMER_SETUP ( 1 << 6 )
94#define TOSHIBA_RBTX4927_SETUP_PCIBIOS ( 1 << 7 )
95#define TOSHIBA_RBTX4927_SETUP_PCI1 ( 1 << 8 )
96#define TOSHIBA_RBTX4927_SETUP_PCI2 ( 1 << 9 )
97#define TOSHIBA_RBTX4927_SETUP_PCI66 ( 1 << 10 )
98
99#define TOSHIBA_RBTX4927_SETUP_ALL 0xffffffff
100#endif
101
102#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
103static const u32 toshiba_rbtx4927_setup_debug_flag =
104 (TOSHIBA_RBTX4927_SETUP_NONE | TOSHIBA_RBTX4927_SETUP_INFO |
105 TOSHIBA_RBTX4927_SETUP_WARN | TOSHIBA_RBTX4927_SETUP_EROR |
106 TOSHIBA_RBTX4927_SETUP_EFWFU | TOSHIBA_RBTX4927_SETUP_SETUP |
107 TOSHIBA_RBTX4927_SETUP_TIME_INIT | TOSHIBA_RBTX4927_SETUP_TIMER_SETUP
108 | TOSHIBA_RBTX4927_SETUP_PCIBIOS | TOSHIBA_RBTX4927_SETUP_PCI1 |
109 TOSHIBA_RBTX4927_SETUP_PCI2 | TOSHIBA_RBTX4927_SETUP_PCI66);
110#endif
111
112#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
113#define TOSHIBA_RBTX4927_SETUP_DPRINTK(flag,str...) \
114 if ( (toshiba_rbtx4927_setup_debug_flag) & (flag) ) \
115 { \
116 char tmp[100]; \
117 sprintf( tmp, str ); \
118 printk( "%s(%s:%u)::%s", __FUNCTION__, __FILE__, __LINE__, tmp ); \
119 }
120#else
121#define TOSHIBA_RBTX4927_SETUP_DPRINTK(flag,str...)
122#endif
123
124/* These functions are used for rebooting or halting the machine*/
125extern void toshiba_rbtx4927_restart(char *command);
126extern void toshiba_rbtx4927_halt(void);
127extern void toshiba_rbtx4927_power_off(void);
128
129int tx4927_using_backplane = 0;
130
131extern void gt64120_time_init(void);
132extern void toshiba_rbtx4927_irq_setup(void);
133
134#ifdef CONFIG_PCI
135#define CONFIG_TX4927BUG_WORKAROUND
136#undef TX4927_SUPPORT_COMMAND_IO
137#undef TX4927_SUPPORT_PCI_66
138int tx4927_cpu_clock = 100000000; /* 100MHz */
139unsigned long mips_pci_io_base;
140unsigned long mips_pci_io_size;
141unsigned long mips_pci_mem_base;
142unsigned long mips_pci_mem_size;
143/* for legacy I/O, PCI I/O PCI Bus address must be 0 */
144unsigned long mips_pci_io_pciaddr = 0;
145unsigned long mips_memory_upper;
146static int tx4927_ccfg_toeon = 1;
147static int tx4927_pcic_trdyto = 0; /* default: disabled */
148unsigned long tx4927_ce_base[8];
149void tx4927_pci_setup(void);
150void tx4927_reset_pci_pcic(void);
151int tx4927_pci66 = 0; /* 0:auto */
152#endif
153
154char *toshiba_name = "";
155
156#ifdef CONFIG_PCI
157static void tx4927_pcierr_interrupt(int irq, void *dev_id,
158 struct pt_regs *regs)
159{
160#ifdef CONFIG_BLK_DEV_IDEPCI
161 /* ignore MasterAbort for ide probing... */
162 if (irq == TX4927_IRQ_IRC_PCIERR &&
163 ((tx4927_pcicptr->pcistatus >> 16) & 0xf900) ==
164 PCI_STATUS_REC_MASTER_ABORT) {
165 tx4927_pcicptr->pcistatus =
166 (tx4927_pcicptr->
167 pcistatus & 0x0000ffff) | (PCI_STATUS_REC_MASTER_ABORT
168 << 16);
169
170 return;
171 }
172#endif
173 printk("PCI error interrupt (irq 0x%x).\n", irq);
174
175 printk("pcistat:%04x, g2pstatus:%08lx, pcicstatus:%08lx\n",
176 (unsigned short) (tx4927_pcicptr->pcistatus >> 16),
177 tx4927_pcicptr->g2pstatus, tx4927_pcicptr->pcicstatus);
178 printk("ccfg:%08lx, tear:%02lx_%08lx\n",
179 (unsigned long) tx4927_ccfgptr->ccfg,
180 (unsigned long) (tx4927_ccfgptr->tear >> 32),
181 (unsigned long) tx4927_ccfgptr->tear);
182 show_regs(regs);
183}
184
185void __init toshiba_rbtx4927_pci_irq_init(void)
186{
187 return;
188}
189
190void tx4927_reset_pci_pcic(void)
191{
192 /* Reset PCI Bus */
193 *tx4927_pcireset_ptr = 1;
194 /* Reset PCIC */
195 tx4927_ccfgptr->clkctr |= TX4927_CLKCTR_PCIRST;
196 udelay(10000);
197 /* clear PCIC reset */
198 tx4927_ccfgptr->clkctr &= ~TX4927_CLKCTR_PCIRST;
199 *tx4927_pcireset_ptr = 0;
200}
201#endif /* CONFIG_PCI */
202
203#ifdef CONFIG_PCI
204void print_pci_status(void)
205{
206 printk("PCI STATUS %lx\n", tx4927_pcicptr->pcistatus);
207 printk("PCIC STATUS %lx\n", tx4927_pcicptr->pcicstatus);
208}
209
210extern struct pci_controller tx4927_controller;
211
212static struct pci_dev *fake_pci_dev(struct pci_controller *hose,
213 int top_bus, int busnr, int devfn)
214{
215 static struct pci_dev dev;
216 static struct pci_bus bus;
217
218 dev.sysdata = (void *)hose;
219 dev.devfn = devfn;
220 bus.number = busnr;
221 bus.ops = hose->pci_ops;
222 bus.parent = NULL;
223 dev.bus = &bus;
224
225 return &dev;
226}
227
228#define EARLY_PCI_OP(rw, size, type) \
229static int early_##rw##_config_##size(struct pci_controller *hose, \
230 int top_bus, int bus, int devfn, int offset, type value) \
231{ \
232 return pci_##rw##_config_##size( \
233 fake_pci_dev(hose, top_bus, bus, devfn), \
234 offset, value); \
235}
236
237EARLY_PCI_OP(read, byte, u8 *)
238EARLY_PCI_OP(read, word, u16 *)
239EARLY_PCI_OP(read, dword, u32 *)
240EARLY_PCI_OP(write, byte, u8)
241EARLY_PCI_OP(write, word, u16)
242EARLY_PCI_OP(write, dword, u32)
243
244static int __init tx4927_pcibios_init(void)
245{
246 unsigned int id;
247 u32 pci_devfn;
248 int devfn_start = 0;
249 int devfn_stop = 0xff;
250 int busno = 0; /* One bus on the Toshiba */
251 struct pci_controller *hose = &tx4927_controller;
252
253 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCIBIOS,
254 "-\n");
255
256 for (pci_devfn = devfn_start; pci_devfn < devfn_stop; pci_devfn++) {
257 early_read_config_dword(hose, busno, busno, pci_devfn,
258 PCI_VENDOR_ID, &id);
259
260 if (id == 0xffffffff) {
261 continue;
262 }
263
264 if (id == 0x94601055) {
265 u8 v08_64;
266 u32 v32_b0;
267 u8 v08_e1;
268 char *s = " sb/isa --";
269
270 TOSHIBA_RBTX4927_SETUP_DPRINTK
271 (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n",
272 s);
273
274 early_read_config_byte(hose, busno, busno,
275 pci_devfn, 0x64, &v08_64);
276 early_read_config_dword(hose, busno, busno,
277 pci_devfn, 0xb0, &v32_b0);
278 early_read_config_byte(hose, busno, busno,
279 pci_devfn, 0xe1, &v08_e1);
280
281 TOSHIBA_RBTX4927_SETUP_DPRINTK
282 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
283 ":%s beg 0x64 = 0x%02x\n", s, v08_64);
284 TOSHIBA_RBTX4927_SETUP_DPRINTK
285 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
286 ":%s beg 0xb0 = 0x%02x\n", s, v32_b0);
287 TOSHIBA_RBTX4927_SETUP_DPRINTK
288 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
289 ":%s beg 0xe1 = 0x%02x\n", s, v08_e1);
290
291 /* serial irq control */
292 v08_64 = 0xd0;
293
294 /* serial irq pin */
295 v32_b0 |= 0x00010000;
296
297 /* ide irq on isa14 */
298 v08_e1 &= 0xf0;
299 v08_e1 |= 0x0d;
300
301 TOSHIBA_RBTX4927_SETUP_DPRINTK
302 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
303 ":%s mid 0x64 = 0x%02x\n", s, v08_64);
304 TOSHIBA_RBTX4927_SETUP_DPRINTK
305 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
306 ":%s mid 0xb0 = 0x%02x\n", s, v32_b0);
307 TOSHIBA_RBTX4927_SETUP_DPRINTK
308 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
309 ":%s mid 0xe1 = 0x%02x\n", s, v08_e1);
310
311 early_write_config_byte(hose, busno, busno,
312 pci_devfn, 0x64, v08_64);
313 early_write_config_dword(hose, busno, busno,
314 pci_devfn, 0xb0, v32_b0);
315 early_write_config_byte(hose, busno, busno,
316 pci_devfn, 0xe1, v08_e1);
317
318#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
319 {
320 early_read_config_byte(hose, busno, busno,
321 pci_devfn, 0x64,
322 &v08_64);
323 early_read_config_dword(hose, busno, busno,
324 pci_devfn, 0xb0,
325 &v32_b0);
326 early_read_config_byte(hose, busno, busno,
327 pci_devfn, 0xe1,
328 &v08_e1);
329
330 TOSHIBA_RBTX4927_SETUP_DPRINTK
331 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
332 ":%s end 0x64 = 0x%02x\n", s, v08_64);
333 TOSHIBA_RBTX4927_SETUP_DPRINTK
334 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
335 ":%s end 0xb0 = 0x%02x\n", s, v32_b0);
336 TOSHIBA_RBTX4927_SETUP_DPRINTK
337 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
338 ":%s end 0xe1 = 0x%02x\n", s, v08_e1);
339 }
340#endif
341
342 TOSHIBA_RBTX4927_SETUP_DPRINTK
343 (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s end\n",
344 s);
345 }
346
347 if (id == 0x91301055) {
348 u8 v08_04;
349 u8 v08_09;
350 u8 v08_41;
351 u8 v08_43;
352 u8 v08_5c;
353 char *s = " sb/ide --";
354
355 TOSHIBA_RBTX4927_SETUP_DPRINTK
356 (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n",
357 s);
358
359 early_read_config_byte(hose, busno, busno,
360 pci_devfn, 0x04, &v08_04);
361 early_read_config_byte(hose, busno, busno,
362 pci_devfn, 0x09, &v08_09);
363 early_read_config_byte(hose, busno, busno,
364 pci_devfn, 0x41, &v08_41);
365 early_read_config_byte(hose, busno, busno,
366 pci_devfn, 0x43, &v08_43);
367 early_read_config_byte(hose, busno, busno,
368 pci_devfn, 0x5c, &v08_5c);
369
370 TOSHIBA_RBTX4927_SETUP_DPRINTK
371 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
372 ":%s beg 0x04 = 0x%02x\n", s, v08_04);
373 TOSHIBA_RBTX4927_SETUP_DPRINTK
374 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
375 ":%s beg 0x09 = 0x%02x\n", s, v08_09);
376 TOSHIBA_RBTX4927_SETUP_DPRINTK
377 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
378 ":%s beg 0x41 = 0x%02x\n", s, v08_41);
379 TOSHIBA_RBTX4927_SETUP_DPRINTK
380 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
381 ":%s beg 0x43 = 0x%02x\n", s, v08_43);
382 TOSHIBA_RBTX4927_SETUP_DPRINTK
383 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
384 ":%s beg 0x5c = 0x%02x\n", s, v08_5c);
385
386 /* enable ide master/io */
387 v08_04 |= (PCI_COMMAND_MASTER | PCI_COMMAND_IO);
388
389 /* enable ide native mode */
390 v08_09 |= 0x05;
391
392 /* enable primary ide */
393 v08_41 |= 0x80;
394
395 /* enable secondary ide */
396 v08_43 |= 0x80;
397
398 /*
399 * !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!!
400 *
401 * This line of code is intended to provide the user with a work
402 * around solution to the anomalies cited in SMSC's anomaly sheet
403 * entitled, "SLC90E66 Functional Rev.J_0.1 Anomalies"".
404 *
405 * !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!!
406 */
407 v08_5c |= 0x01;
408
409 TOSHIBA_RBTX4927_SETUP_DPRINTK
410 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
411 ":%s mid 0x04 = 0x%02x\n", s, v08_04);
412 TOSHIBA_RBTX4927_SETUP_DPRINTK
413 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
414 ":%s mid 0x09 = 0x%02x\n", s, v08_09);
415 TOSHIBA_RBTX4927_SETUP_DPRINTK
416 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
417 ":%s mid 0x41 = 0x%02x\n", s, v08_41);
418 TOSHIBA_RBTX4927_SETUP_DPRINTK
419 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
420 ":%s mid 0x43 = 0x%02x\n", s, v08_43);
421 TOSHIBA_RBTX4927_SETUP_DPRINTK
422 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
423 ":%s mid 0x5c = 0x%02x\n", s, v08_5c);
424
425 early_write_config_byte(hose, busno, busno,
426 pci_devfn, 0x5c, v08_5c);
427 early_write_config_byte(hose, busno, busno,
428 pci_devfn, 0x04, v08_04);
429 early_write_config_byte(hose, busno, busno,
430 pci_devfn, 0x09, v08_09);
431 early_write_config_byte(hose, busno, busno,
432 pci_devfn, 0x41, v08_41);
433 early_write_config_byte(hose, busno, busno,
434 pci_devfn, 0x43, v08_43);
435
436#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
437 {
438 early_read_config_byte(hose, busno, busno,
439 pci_devfn, 0x04,
440 &v08_04);
441 early_read_config_byte(hose, busno, busno,
442 pci_devfn, 0x09,
443 &v08_09);
444 early_read_config_byte(hose, busno, busno,
445 pci_devfn, 0x41,
446 &v08_41);
447 early_read_config_byte(hose, busno, busno,
448 pci_devfn, 0x43,
449 &v08_43);
450 early_read_config_byte(hose, busno, busno,
451 pci_devfn, 0x5c,
452 &v08_5c);
453
454 TOSHIBA_RBTX4927_SETUP_DPRINTK
455 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
456 ":%s end 0x04 = 0x%02x\n", s, v08_04);
457 TOSHIBA_RBTX4927_SETUP_DPRINTK
458 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
459 ":%s end 0x09 = 0x%02x\n", s, v08_09);
460 TOSHIBA_RBTX4927_SETUP_DPRINTK
461 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
462 ":%s end 0x41 = 0x%02x\n", s, v08_41);
463 TOSHIBA_RBTX4927_SETUP_DPRINTK
464 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
465 ":%s end 0x43 = 0x%02x\n", s, v08_43);
466 TOSHIBA_RBTX4927_SETUP_DPRINTK
467 (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
468 ":%s end 0x5c = 0x%02x\n", s, v08_5c);
469 }
470#endif
471
472 TOSHIBA_RBTX4927_SETUP_DPRINTK
473 (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s end\n",
474 s);
475 }
476
477 }
478
479 register_pci_controller(&tx4927_controller);
480 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCIBIOS,
481 "+\n");
482
483 return 0;
484}
485
486arch_initcall(tx4927_pcibios_init);
487
488extern struct resource pci_io_resource;
489extern struct resource pci_mem_resource;
490
491void tx4927_pci_setup(void)
492{
493 static int called = 0;
494 extern unsigned int tx4927_get_mem_size(void);
495
496 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, "-\n");
497
498 mips_memory_upper = tx4927_get_mem_size() << 20;
499 mips_memory_upper += KSEG0;
500 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
501 "0x%08lx=mips_memory_upper\n",
502 mips_memory_upper);
503 mips_pci_io_base = TX4927_PCIIO;
504 mips_pci_io_size = TX4927_PCIIO_SIZE;
505 mips_pci_mem_base = TX4927_PCIMEM;
506 mips_pci_mem_size = TX4927_PCIMEM_SIZE;
507
508 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
509 "0x%08lx=mips_pci_io_base\n",
510 mips_pci_io_base);
511 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
512 "0x%08lx=mips_pci_io_size\n",
513 mips_pci_io_size);
514 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
515 "0x%08lx=mips_pci_mem_base\n",
516 mips_pci_mem_base);
517 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
518 "0x%08lx=mips_pci_mem_size\n",
519 mips_pci_mem_size);
520 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
521 "0x%08lx=pci_io_resource.start\n",
522 pci_io_resource.start);
523 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
524 "0x%08lx=pci_io_resource.end\n",
525 pci_io_resource.end);
526 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
527 "0x%08lx=pci_mem_resource.start\n",
528 pci_mem_resource.start);
529 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
530 "0x%08lx=pci_mem_resource.end\n",
531 pci_mem_resource.end);
532 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
533 "0x%08lx=mips_io_port_base",
534 mips_io_port_base);
535
536 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
537 "setup pci_io_resource to 0x%08lx 0x%08lx\n",
538 pci_io_resource.start,
539 pci_io_resource.end);
540 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
541 "setup pci_mem_resource to 0x%08lx 0x%08lx\n",
542 pci_mem_resource.start,
543 pci_mem_resource.end);
544
545 if (!called) {
546 printk
547 ("TX4927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n",
548 (unsigned short) (tx4927_pcicptr->pciid >> 16),
549 (unsigned short) (tx4927_pcicptr->pciid & 0xffff),
550 (unsigned short) (tx4927_pcicptr->pciccrev & 0xff),
551 (!(tx4927_ccfgptr->
552 ccfg & TX4927_CCFG_PCIXARB)) ? "External" :
553 "Internal");
554 called = 1;
555 }
556 printk("%s PCIC --%s PCICLK:",toshiba_name,
557 (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : "");
558 if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) {
559 int pciclk = 0;
560 switch ((unsigned long) tx4927_ccfgptr->
561 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
562 case TX4927_CCFG_PCIDIVMODE_2_5:
563 pciclk = tx4927_cpu_clock * 2 / 5;
564 break;
565 case TX4927_CCFG_PCIDIVMODE_3:
566 pciclk = tx4927_cpu_clock / 3;
567 break;
568 case TX4927_CCFG_PCIDIVMODE_5:
569 pciclk = tx4927_cpu_clock / 5;
570 break;
571 case TX4927_CCFG_PCIDIVMODE_6:
572 pciclk = tx4927_cpu_clock / 6;
573 break;
574 }
575 printk("Internal(%dMHz)", pciclk / 1000000);
576 } else {
577 int pciclk = 0;
578 int pciclk_setting = *tx4927_pci_clk_ptr;
579 switch (pciclk_setting & TX4927_PCI_CLK_MASK) {
580 case TX4927_PCI_CLK_33:
581 pciclk = 33333333;
582 break;
583 case TX4927_PCI_CLK_25:
584 pciclk = 25000000;
585 break;
586 case TX4927_PCI_CLK_66:
587 pciclk = 66666666;
588 break;
589 case TX4927_PCI_CLK_50:
590 pciclk = 50000000;
591 break;
592 }
593 printk("External(%dMHz)", pciclk / 1000000);
594 }
595 printk("\n");
596
597
598
599 /* GB->PCI mappings */
600 tx4927_pcicptr->g2piomask = (mips_pci_io_size - 1) >> 4;
601 tx4927_pcicptr->g2piogbase = mips_pci_io_base |
602#ifdef __BIG_ENDIAN
603 TX4927_PCIC_G2PIOGBASE_ECHG
604#else
605 TX4927_PCIC_G2PIOGBASE_BSDIS
606#endif
607 ;
608
609 tx4927_pcicptr->g2piopbase = 0;
610
611 tx4927_pcicptr->g2pmmask[0] = (mips_pci_mem_size - 1) >> 4;
612 tx4927_pcicptr->g2pmgbase[0] = mips_pci_mem_base |
613#ifdef __BIG_ENDIAN
614 TX4927_PCIC_G2PMnGBASE_ECHG
615#else
616 TX4927_PCIC_G2PMnGBASE_BSDIS
617#endif
618 ;
619 tx4927_pcicptr->g2pmpbase[0] = mips_pci_mem_base;
620
621 tx4927_pcicptr->g2pmmask[1] = 0;
622 tx4927_pcicptr->g2pmgbase[1] = 0;
623 tx4927_pcicptr->g2pmpbase[1] = 0;
624 tx4927_pcicptr->g2pmmask[2] = 0;
625 tx4927_pcicptr->g2pmgbase[2] = 0;
626 tx4927_pcicptr->g2pmpbase[2] = 0;
627
628
629 /* PCI->GB mappings (I/O 256B) */
630 tx4927_pcicptr->p2giopbase = 0; /* 256B */
631
632 /* PCI->GB mappings (MEM 512MB) M0 gets all of memory */
633 tx4927_pcicptr->p2gm0plbase = 0;
634 tx4927_pcicptr->p2gm0pubase = 0;
635 tx4927_pcicptr->p2gmgbase[0] = 0 | TX4927_PCIC_P2GMnGBASE_TMEMEN |
636#ifdef __BIG_ENDIAN
637 TX4927_PCIC_P2GMnGBASE_TECHG
638#else
639 TX4927_PCIC_P2GMnGBASE_TBSDIS
640#endif
641 ;
642
643 /* PCI->GB mappings (MEM 16MB) -not used */
644 tx4927_pcicptr->p2gm1plbase = 0xffffffff;
645#ifdef CONFIG_TX4927BUG_WORKAROUND
646 /*
647 * TX4927-PCIC-BUG: P2GM1PUBASE must be 0
648 * if P2GM0PUBASE was 0.
649 */
650 tx4927_pcicptr->p2gm1pubase = 0;
651#else
652 tx4927_pcicptr->p2gm1pubase = 0xffffffff;
653#endif
654 tx4927_pcicptr->p2gmgbase[1] = 0;
655
656 /* PCI->GB mappings (MEM 1MB) -not used */
657 tx4927_pcicptr->p2gm2pbase = 0xffffffff;
658 tx4927_pcicptr->p2gmgbase[2] = 0;
659
660
661 /* Enable Initiator Memory 0 Space, I/O Space, Config */
662 tx4927_pcicptr->pciccfg &= TX4927_PCIC_PCICCFG_LBWC_MASK;
663 tx4927_pcicptr->pciccfg |=
664 TX4927_PCIC_PCICCFG_IMSE0 | TX4927_PCIC_PCICCFG_IISE |
665 TX4927_PCIC_PCICCFG_ICAE | TX4927_PCIC_PCICCFG_ATR;
666
667
668 /* Do not use MEMMUL, MEMINF: YMFPCI card causes M_ABORT. */
669 tx4927_pcicptr->pcicfg1 = 0;
670
671 if (tx4927_pcic_trdyto >= 0) {
672 tx4927_pcicptr->g2ptocnt &= ~0xff;
673 tx4927_pcicptr->g2ptocnt |= (tx4927_pcic_trdyto & 0xff);
674 }
675
676 /* Clear All Local Bus Status */
677 tx4927_pcicptr->pcicstatus = TX4927_PCIC_PCICSTATUS_ALL;
678 /* Enable All Local Bus Interrupts */
679 tx4927_pcicptr->pcicmask = TX4927_PCIC_PCICSTATUS_ALL;
680 /* Clear All Initiator Status */
681 tx4927_pcicptr->g2pstatus = TX4927_PCIC_G2PSTATUS_ALL;
682 /* Enable All Initiator Interrupts */
683 tx4927_pcicptr->g2pmask = TX4927_PCIC_G2PSTATUS_ALL;
684 /* Clear All PCI Status Error */
685 tx4927_pcicptr->pcistatus =
686 (tx4927_pcicptr->pcistatus & 0x0000ffff) |
687 (TX4927_PCIC_PCISTATUS_ALL << 16);
688 /* Enable All PCI Status Error Interrupts */
689 tx4927_pcicptr->pcimask = TX4927_PCIC_PCISTATUS_ALL;
690
691 /* PCIC Int => IRC IRQ16 */
692 tx4927_pcicptr->pcicfg2 =
693 (tx4927_pcicptr->pcicfg2 & 0xffffff00) | TX4927_IR_PCIC;
694
695 if (!(tx4927_ccfgptr->ccfg & TX4927_CCFG_PCIXARB)) {
696 /* XXX */
697 } else {
698 /* Reset Bus Arbiter */
699 tx4927_pcicptr->pbacfg = TX4927_PCIC_PBACFG_RPBA;
700 /* Enable Bus Arbiter */
701 tx4927_pcicptr->pbacfg = TX4927_PCIC_PBACFG_PBAEN;
702 }
703
704 tx4927_pcicptr->pcistatus = PCI_COMMAND_MASTER |
705 PCI_COMMAND_MEMORY |
706 PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
707
708 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
709 ":pci setup complete:\n");
710 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, "+\n");
711}
712
713#endif /* CONFIG_PCI */
714
715void toshiba_rbtx4927_restart(char *command)
716{
717 printk(KERN_NOTICE "System Rebooting...\n");
718
719 /* enable the s/w reset register */
720 reg_wr08(RBTX4927_SW_RESET_ENABLE, RBTX4927_SW_RESET_ENABLE_SET);
721
722 /* wait for enable to be seen */
723 while ((reg_rd08(RBTX4927_SW_RESET_ENABLE) &
724 RBTX4927_SW_RESET_ENABLE_SET) == 0x00);
725
726 /* do a s/w reset */
727 reg_wr08(RBTX4927_SW_RESET_DO, RBTX4927_SW_RESET_DO_SET);
728
729 /* do something passive while waiting for reset */
730 local_irq_disable();
731 while (1)
732 asm_wait();
733
734 /* no return */
735}
736
737
738void toshiba_rbtx4927_halt(void)
739{
740 printk(KERN_NOTICE "System Halted\n");
741 local_irq_disable();
742 while (1) {
743 asm_wait();
744 }
745 /* no return */
746}
747
748void toshiba_rbtx4927_power_off(void)
749{
750 toshiba_rbtx4927_halt();
751 /* no return */
752}
753
754void __init toshiba_rbtx4927_setup(void)
755{
756 vu32 cp0_config;
757 char *argptr;
758
759 printk("CPU is %s\n", toshiba_name);
760
761 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
762 "-\n");
763
764 /* f/w leaves this on at startup */
765 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
766 ":Clearing STO_ERL.\n");
767 clear_c0_status(ST0_ERL);
768
769 /* enable caches -- HCP5 does this, pmon does not */
770 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
771 ":Enabling TX49_CONF_IC,TX49_CONF_DC.\n");
772 cp0_config = read_c0_config();
773 cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC);
774 write_c0_config(cp0_config);
775
776#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
777 {
778 extern void dump_cp0(char *);
779 dump_cp0("toshiba_rbtx4927_early_fw_fixup");
780 }
781#endif
782
783 /* setup irq stuff */
784 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
785 ":Setting up tx4927 pic.\n");
786 TX4927_WR(0xff1ff604, 0x00000400); /* irq trigger */
787 TX4927_WR(0xff1ff608, 0x00000000); /* irq trigger */
788
789 /* setup serial stuff */
790 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
791 ":Setting up tx4927 sio.\n");
792 TX4927_WR(0xff1ff314, 0x00000000); /* h/w flow control off */
793 TX4927_WR(0xff1ff414, 0x00000000); /* h/w flow control off */
794
795 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
796 "+\n");
797
798 set_io_port_base(KSEG1 + TBTX4927_ISA_IO_OFFSET);
799 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
800 ":mips_io_port_base=0x%08lx\n",
801 mips_io_port_base);
802
803 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
804 ":Resource\n");
805 ioport_resource.end = 0xffffffff;
806 iomem_resource.end = 0xffffffff;
807
808 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
809 ":ResetRoutines\n");
810 _machine_restart = toshiba_rbtx4927_restart;
811 _machine_halt = toshiba_rbtx4927_halt;
812 _machine_power_off = toshiba_rbtx4927_power_off;
813
814#ifdef CONFIG_PCI
815
816 /* PCIC */
817 /*
818 * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
819 * PCIDIVMODE[12:11]'s initial value are given by S9[4:3] (ON:0, OFF:1).
820 * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
821 * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
822 * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
823 * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
824 * i.e. S9[3]: ON (83MHz), OFF (100MHz)
825 */
826 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
827 "ccfg is %lx, DIV is %x\n",
828 (unsigned long) tx4927_ccfgptr->
829 ccfg, TX4927_CCFG_PCIDIVMODE_MASK);
830
831 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
832 "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n",
833 (unsigned long) tx4927_ccfgptr->
834 ccfg & TX4927_CCFG_PCI66,
835 (unsigned long) tx4927_ccfgptr->
836 ccfg & TX4927_CCFG_PCIMIDE,
837 (unsigned long) tx4927_ccfgptr->
838 ccfg & TX4927_CCFG_PCIXARB);
839
840 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
841 "PCIDIVMODE is %lx\n",
842 (unsigned long) tx4927_ccfgptr->
843 ccfg & TX4927_CCFG_PCIDIVMODE_MASK);
844
845 switch ((unsigned long) tx4927_ccfgptr->
846 ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
847 case TX4927_CCFG_PCIDIVMODE_2_5:
848 case TX4927_CCFG_PCIDIVMODE_5:
849 tx4927_cpu_clock = 166000000; /* 166MHz */
850 break;
851 default:
852 tx4927_cpu_clock = 200000000; /* 200MHz */
853 }
854
855 /* CCFG */
856 /* enable Timeout BusError */
857 if (tx4927_ccfg_toeon)
858 tx4927_ccfgptr->ccfg |= TX4927_CCFG_TOE;
859
860 /* SDRAMC fixup */
861#ifdef CONFIG_TX4927BUG_WORKAROUND
862 /*
863 * TX4927-BUG: INF 01-01-18/ BUG 01-01-22
864 * G-bus timeout error detection is incorrect
865 */
866 if (tx4927_ccfg_toeon)
867 tx4927_sdramcptr->tr |= 0x02000000; /* RCD:3tck */
868#endif
869
870 tx4927_pci_setup();
871 if (tx4927_using_backplane == 1)
872 printk("backplane board IS installed\n");
873 else
874 printk("No Backplane \n");
875
876 /* this is on ISA bus behind PCI bus, so need PCI up first */
877#ifdef CONFIG_TOSHIBA_FPCIB0
878 {
879 if (tx4927_using_backplane) {
880 TOSHIBA_RBTX4927_SETUP_DPRINTK
881 (TOSHIBA_RBTX4927_SETUP_SETUP,
882 ":fpcibo=yes\n");
883
884 TOSHIBA_RBTX4927_SETUP_DPRINTK
885 (TOSHIBA_RBTX4927_SETUP_SETUP,
886 ":smsc_fdc37m81x_init()\n");
887 smsc_fdc37m81x_init(0x3f0);
888
889 TOSHIBA_RBTX4927_SETUP_DPRINTK
890 (TOSHIBA_RBTX4927_SETUP_SETUP,
891 ":smsc_fdc37m81x_config_beg()\n");
892 smsc_fdc37m81x_config_beg();
893
894 TOSHIBA_RBTX4927_SETUP_DPRINTK
895 (TOSHIBA_RBTX4927_SETUP_SETUP,
896 ":smsc_fdc37m81x_config_set(KBD)\n");
897 smsc_fdc37m81x_config_set(SMSC_FDC37M81X_DNUM,
898 SMSC_FDC37M81X_KBD);
899 smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT, 1);
900 smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT2, 12);
901 smsc_fdc37m81x_config_set(SMSC_FDC37M81X_ACTIVE,
902 1);
903
904 smsc_fdc37m81x_config_end();
905 TOSHIBA_RBTX4927_SETUP_DPRINTK
906 (TOSHIBA_RBTX4927_SETUP_SETUP,
907 ":smsc_fdc37m81x_config_end()\n");
908 } else {
909 TOSHIBA_RBTX4927_SETUP_DPRINTK
910 (TOSHIBA_RBTX4927_SETUP_SETUP,
911 ":fpcibo=not_found\n");
912 }
913 }
914#else
915 {
916 TOSHIBA_RBTX4927_SETUP_DPRINTK
917 (TOSHIBA_RBTX4927_SETUP_SETUP, ":fpcibo=no\n");
918 }
919#endif
920
921#endif /* CONFIG_PCI */
922
923#ifdef CONFIG_SERIAL_TXX9_CONSOLE
924 argptr = prom_getcmdline();
925 if (strstr(argptr, "console=") == NULL) {
926 strcat(argptr, " console=ttyS0,38400");
927 }
928#endif
929
930#ifdef CONFIG_ROOT_NFS
931 argptr = prom_getcmdline();
932 if (strstr(argptr, "root=") == NULL) {
933 strcat(argptr, " root=/dev/nfs rw");
934 }
935#endif
936
937
938#ifdef CONFIG_IP_PNP
939 argptr = prom_getcmdline();
940 if (strstr(argptr, "ip=") == NULL) {
941 strcat(argptr, " ip=any");
942 }
943#endif
944
945
946 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
947 "+\n");
948}
949
950#ifdef CONFIG_RTC_DS1742
951extern unsigned long rtc_ds1742_get_time(void);
952extern int rtc_ds1742_set_time(unsigned long);
953extern void rtc_ds1742_wait(void);
954#endif
955
956void __init
957toshiba_rbtx4927_time_init(void)
958{
959 u32 c1;
960 u32 c2;
961
962 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n");
963
964#ifdef CONFIG_RTC_DS1742
965
966 rtc_get_time = rtc_ds1742_get_time;
967 rtc_set_time = rtc_ds1742_set_time;
968
969 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
970 ":rtc_ds1742_init()-\n");
971 rtc_ds1742_init(0xbc010000);
972 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
973 ":rtc_ds1742_init()+\n");
974
975 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
976 ":Calibrate mips_hpt_frequency-\n");
977 rtc_ds1742_wait();
978
979 /* get the count */
980 c1 = read_c0_count();
981
982 /* wait for the seconds to change again */
983 rtc_ds1742_wait();
984
985 /* get the count again */
986 c2 = read_c0_count();
987
988 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
989 ":Calibrate mips_hpt_frequency+\n");
990 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
991 ":c1=%12u\n", c1);
992 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
993 ":c2=%12u\n", c2);
994
995 /* this diff is as close as we are going to get to counter ticks per sec */
996 mips_hpt_frequency = abs(c2 - c1);
997 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
998 ":f1=%12u\n", mips_hpt_frequency);
999
1000 /* round to 1/10th of a MHz */
1001 mips_hpt_frequency /= (100 * 1000);
1002 mips_hpt_frequency *= (100 * 1000);
1003 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1004 ":f2=%12u\n", mips_hpt_frequency);
1005
1006 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_INFO,
1007 ":mips_hpt_frequency=%uHz (%uMHz)\n",
1008 mips_hpt_frequency,
1009 mips_hpt_frequency / 1000000);
1010#else
1011 mips_hpt_frequency = 100000000;
1012#endif
1013
1014 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n");
1015
1016}
1017
1018void __init toshiba_rbtx4927_timer_setup(struct irqaction *irq)
1019{
1020 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
1021 "-\n");
1022 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
1023 "+\n");
1024}
diff --git a/arch/mips/vr4181/common/Makefile b/arch/mips/vr4181/common/Makefile
new file mode 100644
index 000000000000..f7587ca64ead
--- /dev/null
+++ b/arch/mips/vr4181/common/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for common code of NEC vr4181 based boards
3#
4
5obj-y := irq.o int_handler.o serial.o time.o
6
7EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/vr4181/common/int_handler.S b/arch/mips/vr4181/common/int_handler.S
new file mode 100644
index 000000000000..2c041b8ee52b
--- /dev/null
+++ b/arch/mips/vr4181/common/int_handler.S
@@ -0,0 +1,206 @@
1/*
2 * arch/mips/vr4181/common/int_handler.S
3 *
4 * Adapted to the VR4181 and almost entirely rewritten:
5 * Copyright (C) 1999 Bradley D. LaRonde and Michael Klar
6 *
7 * Clean up to conform to the new IRQ
8 * Copyright (C) 2001 MontaVista Software Inc.
9 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 *
15 */
16
17#include <asm/asm.h>
18#include <asm/regdef.h>
19#include <asm/mipsregs.h>
20#include <asm/stackframe.h>
21
22#include <asm/vr4181/vr4181.h>
23
24/*
25 * [jsun]
26 * See include/asm/vr4181/irq.h for IRQ assignment and strategy.
27 */
28
29 .text
30 .set noreorder
31
32 .align 5
33 NESTED(vr4181_handle_irq, PT_SIZE, ra)
34
35 .set noat
36 SAVE_ALL
37 CLI
38
39 .set at
40 .set noreorder
41
42 mfc0 t0, CP0_CAUSE
43 mfc0 t2, CP0_STATUS
44
45 and t0, t2
46
47 /* we check IP3 first; it happens most frequently */
48 andi t1, t0, STATUSF_IP3
49 bnez t1, ll_cpu_ip3
50 andi t1, t0, STATUSF_IP2
51 bnez t1, ll_cpu_ip2
52 andi t1, t0, STATUSF_IP7 /* cpu timer */
53 bnez t1, ll_cputimer_irq
54 andi t1, t0, STATUSF_IP4
55 bnez t1, ll_cpu_ip4
56 andi t1, t0, STATUSF_IP5
57 bnez t1, ll_cpu_ip5
58 andi t1, t0, STATUSF_IP6
59 bnez t1, ll_cpu_ip6
60 andi t1, t0, STATUSF_IP0 /* software int 0 */
61 bnez t1, ll_cpu_ip0
62 andi t1, t0, STATUSF_IP1 /* software int 1 */
63 bnez t1, ll_cpu_ip1
64 nop
65
66 .set reorder
67do_spurious:
68 j spurious_interrupt
69
70/*
71 * regular CPU irqs
72 */
73ll_cputimer_irq:
74 li a0, VR4181_IRQ_TIMER
75 move a1, sp
76 jal do_IRQ
77 j ret_from_irq
78
79
80ll_cpu_ip0:
81 li a0, VR4181_IRQ_SW1
82 move a1, sp
83 jal do_IRQ
84 j ret_from_irq
85
86ll_cpu_ip1:
87 li a0, VR4181_IRQ_SW2
88 move a1, sp
89 jal do_IRQ
90 j ret_from_irq
91
92ll_cpu_ip3:
93 li a0, VR4181_IRQ_INT1
94 move a1, sp
95 jal do_IRQ
96 j ret_from_irq
97
98ll_cpu_ip4:
99 li a0, VR4181_IRQ_INT2
100 move a1, sp
101 jal do_IRQ
102 j ret_from_irq
103
104ll_cpu_ip5:
105 li a0, VR4181_IRQ_INT3
106 move a1, sp
107 jal do_IRQ
108 j ret_from_irq
109
110ll_cpu_ip6:
111 li a0, VR4181_IRQ_INT4
112 move a1, sp
113 jal do_IRQ
114 j ret_from_irq
115
116/*
117 * One of the sys irq has happend.
118 *
119 * In the interest of speed, we first determine in the following order
120 * which 16-irq block have pending interrupts:
121 * sysint1 (16 sources, including cascading intrs from GPIO)
122 * sysint2
123 * gpio (16 intr sources)
124 *
125 * Then we do binary search to find the exact interrupt source.
126 */
127ll_cpu_ip2:
128
129 lui t3,%hi(VR4181_SYSINT1REG)
130 lhu t0,%lo(VR4181_SYSINT1REG)(t3)
131 lhu t2,%lo(VR4181_MSYSINT1REG)(t3)
132 and t0, 0xfffb /* hack - remove RTC Long 1 intr */
133 and t0, t2
134 beqz t0, check_sysint2
135
136 /* check for GPIO interrupts */
137 andi t1, t0, 0x0100
138 bnez t1, check_gpio_int
139
140 /* so we have an interrupt in sysint1 which is not gpio int */
141 li a0, VR4181_SYS_IRQ_BASE - 1
142 j check_16
143
144check_sysint2:
145
146 lhu t0,%lo(VR4181_SYSINT2REG)(t3)
147 lhu t2,%lo(VR4181_MSYSINT2REG)(t3)
148 and t0, 0xfffe /* hack - remove RTC Long 2 intr */
149 and t0, t2
150 li a0, VR4181_SYS_IRQ_BASE + 16 - 1
151 j check_16
152
153check_gpio_int:
154 lui t3,%hi(VR4181_GPINTMSK)
155 lhu t0,%lo(VR4181_GPINTMSK)(t3)
156 lhu t2,%lo(VR4181_GPINTSTAT)(t3)
157 xori t0, 0xffff /* why? reverse logic? */
158 and t0, t2
159 li a0, VR4181_GPIO_IRQ_BASE - 1
160 j check_16
161
162/*
163 * When we reach check_16, we have 16-bit status in t0 and base irq number
164 * in a0.
165 */
166check_16:
167 andi t1, t0, 0xff
168 bnez t1, check_8
169
170 srl t0, 8
171 addi a0, 8
172 j check_8
173
174/*
175 * When we reach check_8, we have 8-bit status in t0 and base irq number
176 * in a0.
177 */
178check_8:
179 andi t1, t0, 0xf
180 bnez t1, check_4
181
182 srl t0, 4
183 addi a0, 4
184 j check_4
185
186/*
187 * When we reach check_4, we have 4-bit status in t0 and base irq number
188 * in a0.
189 */
190check_4:
191 andi t0, t0, 0xf
192 beqz t0, do_spurious
193
194loop:
195 andi t2, t0, 0x1
196 srl t0, 1
197 addi a0, 1
198 beqz t2, loop
199
200found_it:
201 move a1, sp
202 jal do_IRQ
203
204 j ret_from_irq
205
206 END(vr4181_handle_irq)
diff --git a/arch/mips/vr4181/common/irq.c b/arch/mips/vr4181/common/irq.c
new file mode 100644
index 000000000000..2cdf77c5cb3e
--- /dev/null
+++ b/arch/mips/vr4181/common/irq.c
@@ -0,0 +1,239 @@
1/*
2 * Copyright (C) 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
5 *
6 * linux/arch/mips/vr4181/common/irq.c
7 * Completely re-written to use the new irq.c
8 *
9 * Credits to Bradley D. LaRonde and Michael Klar for writing the original
10 * irq.c file which was derived from the common irq.c file.
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file "COPYING" in the main directory of this archive
14 * for more details.
15 */
16#include <linux/types.h>
17#include <linux/init.h>
18#include <linux/kernel_stat.h>
19#include <linux/signal.h>
20#include <linux/sched.h>
21#include <linux/interrupt.h>
22#include <linux/slab.h>
23#include <linux/random.h>
24
25#include <asm/irq.h>
26#include <asm/mipsregs.h>
27#include <asm/gdb-stub.h>
28
29#include <asm/vr4181/vr4181.h>
30
31/*
32 * Strategy:
33 *
34 * We essentially have three irq controllers, CPU, system, and gpio.
35 *
36 * CPU irq controller is taken care by arch/mips/kernel/irq_cpu.c and
37 * CONFIG_IRQ_CPU config option.
38 *
39 * We here provide sys_irq and gpio_irq controller code.
40 */
41
42static int sys_irq_base;
43static int gpio_irq_base;
44
45/* ---------------------- sys irq ------------------------ */
46static void
47sys_irq_enable(unsigned int irq)
48{
49 irq -= sys_irq_base;
50 if (irq < 16) {
51 *VR4181_MSYSINT1REG |= (u16)(1 << irq);
52 } else {
53 irq -= 16;
54 *VR4181_MSYSINT2REG |= (u16)(1 << irq);
55 }
56}
57
58static void
59sys_irq_disable(unsigned int irq)
60{
61 irq -= sys_irq_base;
62 if (irq < 16) {
63 *VR4181_MSYSINT1REG &= ~((u16)(1 << irq));
64 } else {
65 irq -= 16;
66 *VR4181_MSYSINT2REG &= ~((u16)(1 << irq));
67 }
68
69}
70
71static unsigned int
72sys_irq_startup(unsigned int irq)
73{
74 sys_irq_enable(irq);
75 return 0;
76}
77
78#define sys_irq_shutdown sys_irq_disable
79#define sys_irq_ack sys_irq_disable
80
81static void
82sys_irq_end(unsigned int irq)
83{
84 if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
85 sys_irq_enable(irq);
86}
87
88static hw_irq_controller sys_irq_controller = {
89 "vr4181_sys_irq",
90 sys_irq_startup,
91 sys_irq_shutdown,
92 sys_irq_enable,
93 sys_irq_disable,
94 sys_irq_ack,
95 sys_irq_end,
96 NULL /* no affinity stuff for UP */
97};
98
99/* ---------------------- gpio irq ------------------------ */
100/* gpio irq lines use reverse logic */
101static void
102gpio_irq_enable(unsigned int irq)
103{
104 irq -= gpio_irq_base;
105 *VR4181_GPINTMSK &= ~((u16)(1 << irq));
106}
107
108static void
109gpio_irq_disable(unsigned int irq)
110{
111 irq -= gpio_irq_base;
112 *VR4181_GPINTMSK |= (u16)(1 << irq);
113}
114
115static unsigned int
116gpio_irq_startup(unsigned int irq)
117{
118 gpio_irq_enable(irq);
119
120 irq -= gpio_irq_base;
121 *VR4181_GPINTEN |= (u16)(1 << irq );
122
123 return 0;
124}
125
126static void
127gpio_irq_shutdown(unsigned int irq)
128{
129 gpio_irq_disable(irq);
130
131 irq -= gpio_irq_base;
132 *VR4181_GPINTEN &= ~((u16)(1 << irq ));
133}
134
135static void
136gpio_irq_ack(unsigned int irq)
137{
138 u16 irqtype;
139 u16 irqshift;
140
141 gpio_irq_disable(irq);
142
143 /* we clear interrupt if it is edge triggered */
144 irq -= gpio_irq_base;
145 if (irq < 8) {
146 irqtype = *VR4181_GPINTTYPL;
147 irqshift = 2 << (irq*2);
148 } else {
149 irqtype = *VR4181_GPINTTYPH;
150 irqshift = 2 << ((irq-8)*2);
151 }
152 if ( ! (irqtype & irqshift) ) {
153 *VR4181_GPINTSTAT = (u16) (1 << irq);
154 }
155}
156
157static void
158gpio_irq_end(unsigned int irq)
159{
160 if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
161 gpio_irq_enable(irq);
162}
163
164static hw_irq_controller gpio_irq_controller = {
165 "vr4181_gpio_irq",
166 gpio_irq_startup,
167 gpio_irq_shutdown,
168 gpio_irq_enable,
169 gpio_irq_disable,
170 gpio_irq_ack,
171 gpio_irq_end,
172 NULL /* no affinity stuff for UP */
173};
174
175/* --------------------- IRQ init stuff ---------------------- */
176
177extern asmlinkage void vr4181_handle_irq(void);
178extern void breakpoint(void);
179extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
180extern void mips_cpu_irq_init(u32 irq_base);
181
182static struct irqaction cascade =
183 { no_action, SA_INTERRUPT, CPU_MASK_NONE, "cascade", NULL, NULL };
184static struct irqaction reserved =
185 { no_action, SA_INTERRUPT, CPU_MASK_NONE, "cascade", NULL, NULL };
186
187void __init arch_init_irq(void)
188{
189 int i;
190
191 set_except_vector(0, vr4181_handle_irq);
192
193 /* init CPU irqs */
194 mips_cpu_irq_init(VR4181_CPU_IRQ_BASE);
195
196 /* init sys irqs */
197 sys_irq_base = VR4181_SYS_IRQ_BASE;
198 for (i=sys_irq_base; i < sys_irq_base + VR4181_NUM_SYS_IRQ; i++) {
199 irq_desc[i].status = IRQ_DISABLED;
200 irq_desc[i].action = NULL;
201 irq_desc[i].depth = 1;
202 irq_desc[i].handler = &sys_irq_controller;
203 }
204
205 /* init gpio irqs */
206 gpio_irq_base = VR4181_GPIO_IRQ_BASE;
207 for (i=gpio_irq_base; i < gpio_irq_base + VR4181_NUM_GPIO_IRQ; i++) {
208 irq_desc[i].status = IRQ_DISABLED;
209 irq_desc[i].action = NULL;
210 irq_desc[i].depth = 1;
211 irq_desc[i].handler = &gpio_irq_controller;
212 }
213
214 /* Default all ICU IRQs to off ... */
215 *VR4181_MSYSINT1REG = 0;
216 *VR4181_MSYSINT2REG = 0;
217
218 /* We initialize the level 2 ICU registers to all bits disabled. */
219 *VR4181_MPIUINTREG = 0;
220 *VR4181_MAIUINTREG = 0;
221 *VR4181_MKIUINTREG = 0;
222
223 /* disable all GPIO intrs */
224 *VR4181_GPINTMSK = 0xffff;
225
226 /* vector handler. What these do is register the IRQ as non-sharable */
227 setup_irq(VR4181_IRQ_INT0, &cascade);
228 setup_irq(VR4181_IRQ_GIU, &cascade);
229
230 /*
231 * RTC interrupts are interesting. They have two destinations.
232 * One is at sys irq controller, and the other is at CPU IP3 and IP4.
233 * RTC timer is used as system timer.
234 * We enable them here, but timer routine will register later
235 * with CPU IP3/IP4.
236 */
237 setup_irq(VR4181_IRQ_RTCL1, &reserved);
238 setup_irq(VR4181_IRQ_RTCL2, &reserved);
239}
diff --git a/arch/mips/vr4181/common/serial.c b/arch/mips/vr4181/common/serial.c
new file mode 100644
index 000000000000..3f62c62b107f
--- /dev/null
+++ b/arch/mips/vr4181/common/serial.c
@@ -0,0 +1,51 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/vr4181/common/serial.c
6 * initialize serial port on vr4181.
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 * [jsun, 010925]
17 * You need to make sure rs_table has at least one element in
18 * drivers/char/serial.c file. There is no good way to do it right
19 * now. A workaround is to include CONFIG_SERIAL_MANY_PORTS in your
20 * configure file, which would gives you 64 ports and wastes 11K ram.
21 */
22
23#include <linux/types.h>
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/serial.h>
27
28#include <asm/vr4181/vr4181.h>
29
30void __init vr4181_init_serial(void)
31{
32 struct serial_struct s;
33
34 /* turn on UART clock */
35 *VR4181_CMUCLKMSK |= VR4181_CMUCLKMSK_MSKSIU;
36
37 /* clear memory */
38 memset(&s, 0, sizeof(s));
39
40 s.line = 0; /* we set the first one */
41 s.baud_base = 1152000;
42 s.irq = VR4181_IRQ_SIU;
43 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; /* STD_COM_FLAGS */
44 s.iomem_base = (u8*)VR4181_SIURB;
45 s.iomem_reg_shift = 0;
46 s.io_type = SERIAL_IO_MEM;
47 if (early_serial_setup(&s) != 0) {
48 panic("vr4181_init_serial() failed!");
49 }
50}
51
diff --git a/arch/mips/vr4181/common/time.c b/arch/mips/vr4181/common/time.c
new file mode 100644
index 000000000000..17814076b6f4
--- /dev/null
+++ b/arch/mips/vr4181/common/time.c
@@ -0,0 +1,145 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * rtc and time ops for vr4181. Part of code is drived from
6 * linux-vr, originally written by Bradley D. LaRonde & Michael Klar.
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#include <linux/kernel.h>
16#include <linux/spinlock.h>
17#include <linux/param.h> /* for HZ */
18#include <linux/time.h>
19#include <linux/interrupt.h>
20
21#include <asm/system.h>
22#include <asm/time.h>
23
24#include <asm/vr4181/vr4181.h>
25
26#define COUNTS_PER_JIFFY ((32768 + HZ/2) / HZ)
27
28/*
29 * RTC ops
30 */
31
32DEFINE_SPINLOCK(rtc_lock);
33
34/* per VR41xx docs, bad data can be read if between 2 counts */
35static inline unsigned short
36read_time_reg(volatile unsigned short *reg)
37{
38 unsigned short value;
39 do {
40 value = *reg;
41 barrier();
42 } while (value != *reg);
43 return value;
44}
45
46static unsigned long
47vr4181_rtc_get_time(void)
48{
49 unsigned short regh, regm, regl;
50
51 // why this crazy order, you ask? to guarantee that neither m
52 // nor l wrap before all 3 read
53 do {
54 regm = read_time_reg(VR4181_ETIMEMREG);
55 barrier();
56 regh = read_time_reg(VR4181_ETIMEHREG);
57 barrier();
58 regl = read_time_reg(VR4181_ETIMELREG);
59 } while (regm != read_time_reg(VR4181_ETIMEMREG));
60 return ((regh << 17) | (regm << 1) | (regl >> 15));
61}
62
63static int
64vr4181_rtc_set_time(unsigned long timeval)
65{
66 unsigned short intreg;
67 unsigned long flags;
68
69 spin_lock_irqsave(&rtc_lock, flags);
70 intreg = *VR4181_RTCINTREG & 0x05;
71 barrier();
72 *VR4181_ETIMELREG = timeval << 15;
73 *VR4181_ETIMEMREG = timeval >> 1;
74 *VR4181_ETIMEHREG = timeval >> 17;
75 barrier();
76 // assume that any ints that just triggered are invalid, since the
77 // time value is written non-atomically in 3 separate regs
78 *VR4181_RTCINTREG = 0x05 ^ intreg;
79 spin_unlock_irqrestore(&rtc_lock, flags);
80
81 return 0;
82}
83
84
85/*
86 * timer interrupt routine (wrapper)
87 *
88 * we need our own interrupt routine because we need to clear
89 * RTC1 interrupt.
90 */
91static void
92vr4181_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
93{
94 /* Clear the interrupt. */
95 *VR4181_RTCINTREG = 0x2;
96
97 /* call the generic one */
98 timer_interrupt(irq, dev_id, regs);
99}
100
101
102/*
103 * vr4181_time_init:
104 *
105 * We pick the following choices:
106 * . we use elapsed timer as the RTC. We set some reasonable init data since
107 * it does not persist across reset
108 * . we use RTC1 as the system timer interrupt source.
109 * . we use CPU counter for fast_gettimeoffset and we calivrate the cpu
110 * frequency. In other words, we use calibrate_div64_gettimeoffset().
111 * . we use our own timer interrupt routine which clears the interrupt
112 * and then calls the generic high-level timer interrupt routine.
113 *
114 */
115
116extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
117
118static void
119vr4181_timer_setup(struct irqaction *irq)
120{
121 /* over-write the handler to be our own one */
122 irq->handler = vr4181_timer_interrupt;
123
124 /* sets up the frequency */
125 *VR4181_RTCL1LREG = COUNTS_PER_JIFFY;
126 *VR4181_RTCL1HREG = 0;
127
128 /* and ack any pending ints */
129 *VR4181_RTCINTREG = 0x2;
130
131 /* setup irqaction */
132 setup_irq(VR4181_IRQ_INT1, irq);
133
134}
135
136void
137vr4181_init_time(void)
138{
139 /* setup hookup functions */
140 rtc_get_time = vr4181_rtc_get_time;
141 rtc_set_time = vr4181_rtc_set_time;
142
143 board_timer_setup = vr4181_timer_setup;
144}
145
diff --git a/arch/mips/vr4181/osprey/Makefile b/arch/mips/vr4181/osprey/Makefile
new file mode 100644
index 000000000000..34be05790883
--- /dev/null
+++ b/arch/mips/vr4181/osprey/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for common code of NEC Osprey board
3#
4
5obj-y := setup.o prom.o reset.o
6
7obj-$(CONFIG_KGDB) += dbg_io.o
diff --git a/arch/mips/vr4181/osprey/dbg_io.c b/arch/mips/vr4181/osprey/dbg_io.c
new file mode 100644
index 000000000000..5e8a84072d5b
--- /dev/null
+++ b/arch/mips/vr4181/osprey/dbg_io.c
@@ -0,0 +1,136 @@
1/*
2 * kgdb io functions for osprey. We use the serial port on debug board.
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 0xb7fffff0
18#define MAX_BAUD 115200
19
20/* distance in bytes between two serial registers */
21#define REG_OFFSET 1
22
23/*
24 * 0 - kgdb does serial init
25 * 1 - kgdb skip serial init
26 */
27static int remoteDebugInitialized = 1;
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 buad 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/vr4181/osprey/prom.c b/arch/mips/vr4181/osprey/prom.c
new file mode 100644
index 000000000000..af0d14561619
--- /dev/null
+++ b/arch/mips/vr4181/osprey/prom.c
@@ -0,0 +1,49 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/vr4181/osprey/prom.c
6 * prom code for osprey.
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#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/string.h>
17#include <linux/mm.h>
18#include <linux/bootmem.h>
19#include <asm/bootinfo.h>
20#include <asm/addrspace.h>
21
22const char *get_system_type(void)
23{
24 return "NEC_Vr41xx Osprey";
25}
26
27/*
28 * [jsun] right now we assume it is the nec debug monitor, which does
29 * not pass any arguments.
30 */
31void __init prom_init(void)
32{
33 // cmdline is now set in default config
34 // strcpy(arcs_cmdline, "ip=bootp ");
35 // strcat(arcs_cmdline, "ether=46,0x03fe0300,eth0 ");
36 // strcpy(arcs_cmdline, "ether=0,0x0300,eth0 "
37 // strcat(arcs_cmdline, "video=vr4181fb:xres:240,yres:320,bpp:8 ");
38
39 mips_machgroup = MACH_GROUP_NEC_VR41XX;
40 mips_machtype = MACH_NEC_OSPREY;
41
42 /* 16MB fixed */
43 add_memory_region(0, 16 << 20, BOOT_MEM_RAM);
44}
45
46unsigned long __init prom_free_prom_memory(void)
47{
48 return 0;
49}
diff --git a/arch/mips/vr4181/osprey/reset.c b/arch/mips/vr4181/osprey/reset.c
new file mode 100644
index 000000000000..036ae83d89d6
--- /dev/null
+++ b/arch/mips/vr4181/osprey/reset.c
@@ -0,0 +1,40 @@
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/cacheflush.h>
15#include <asm/processor.h>
16#include <asm/reboot.h>
17#include <asm/system.h>
18
19void nec_osprey_restart(char *command)
20{
21 set_c0_status(ST0_ERL);
22 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
23 flush_cache_all();
24 write_c0_wired(0);
25 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
26}
27
28void nec_osprey_halt(void)
29{
30 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
31 while (1)
32 __asm__(".set\tmips3\n\t"
33 "wait\n\t"
34 ".set\tmips0");
35}
36
37void nec_osprey_power_off(void)
38{
39 nec_osprey_halt();
40}
diff --git a/arch/mips/vr4181/osprey/setup.c b/arch/mips/vr4181/osprey/setup.c
new file mode 100644
index 000000000000..2ff7140e7ed7
--- /dev/null
+++ b/arch/mips/vr4181/osprey/setup.c
@@ -0,0 +1,68 @@
1/*
2 * linux/arch/mips/vr4181/setup.c
3 *
4 * VR41xx setup routines
5 *
6 * Copyright (C) 1999 Bradley D. LaRonde
7 * Copyright (C) 1999, 2000 Michael Klar
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 * Author: jsun@mvista.com or jsun@junsun.net
11 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
12 *
13 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details.
16 *
17 */
18
19#include <linux/ide.h>
20#include <linux/init.h>
21#include <linux/delay.h>
22#include <asm/reboot.h>
23#include <asm/vr4181/vr4181.h>
24#include <asm/io.h>
25
26
27extern void nec_osprey_restart(char* c);
28extern void nec_osprey_halt(void);
29extern void nec_osprey_power_off(void);
30
31extern void vr4181_init_serial(void);
32extern void vr4181_init_time(void);
33
34static void __init nec_osprey_setup(void)
35{
36 set_io_port_base(VR4181_PORT_BASE);
37 isa_slot_offset = VR4181_ISAMEM_BASE;
38
39 vr4181_init_serial();
40 vr4181_init_time();
41
42 _machine_restart = nec_osprey_restart;
43 _machine_halt = nec_osprey_halt;
44 _machine_power_off = nec_osprey_power_off;
45
46 /* setup resource limit */
47 ioport_resource.end = 0xffffffff;
48 iomem_resource.end = 0xffffffff;
49
50 /* [jsun] hack */
51 /*
52 printk("[jsun] hack to change external ISA control register, %x -> %x\n",
53 (*VR4181_XISACTL),
54 (*VR4181_XISACTL) | 0x2);
55 *VR4181_XISACTL |= 0x2;
56 */
57
58 // *VR4181_GPHIBSTH = 0x2000;
59 // *VR4181_GPMD0REG = 0x00c0;
60 // *VR4181_GPINTEN = 1<<6;
61
62 /* [jsun] I believe this will get the interrupt type right
63 * for the ether port.
64 */
65 *VR4181_GPINTTYPL = 0x3000;
66}
67
68early_initcall(nec_osprey_setup);
diff --git a/arch/mips/vr41xx/casio-e55/Makefile b/arch/mips/vr41xx/casio-e55/Makefile
new file mode 100644
index 000000000000..d4c03cc8eb05
--- /dev/null
+++ b/arch/mips/vr41xx/casio-e55/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the CASIO CASSIOPEIA E-55/65 specific parts of the kernel
3#
4
5obj-y += setup.o
diff --git a/arch/mips/vr41xx/casio-e55/setup.c b/arch/mips/vr41xx/casio-e55/setup.c
new file mode 100644
index 000000000000..aa8605ab76ff
--- /dev/null
+++ b/arch/mips/vr41xx/casio-e55/setup.c
@@ -0,0 +1,40 @@
1/*
2 * setup.c, Setup for the CASIO CASSIOPEIA E-11/15/55/65.
3 *
4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/ioport.h>
22
23#include <asm/io.h>
24#include <asm/vr41xx/e55.h>
25
26const char *get_system_type(void)
27{
28 return "CASIO CASSIOPEIA E-11/15/55/65";
29}
30
31static int __init casio_e55_setup(void)
32{
33 set_io_port_base(IO_PORT_BASE);
34 ioport_resource.start = IO_PORT_RESOURCE_START;
35 ioport_resource.end = IO_PORT_RESOURCE_END;
36
37 return 0;
38}
39
40arch_initcall(casio_e55_setup);
diff --git a/arch/mips/vr41xx/common/Makefile b/arch/mips/vr41xx/common/Makefile
new file mode 100644
index 000000000000..92c11e9bbb3f
--- /dev/null
+++ b/arch/mips/vr41xx/common/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for common code of the NEC VR4100 series.
3#
4
5obj-y += bcu.o cmu.o giu.o icu.o init.o int-handler.o pmu.o
6obj-$(CONFIG_VRC4173) += vrc4173.o
7
8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/vr41xx/common/bcu.c b/arch/mips/vr41xx/common/bcu.c
new file mode 100644
index 000000000000..cdfa4273a1c5
--- /dev/null
+++ b/arch/mips/vr41xx/common/bcu.c
@@ -0,0 +1,222 @@
1/*
2 * bcu.c, Bus Control Unit routines for the NEC VR4100 series.
3 *
4 * Copyright (C) 2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>
6 * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22/*
23 * Changes:
24 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
25 * - New creation, NEC VR4122 and VR4131 are supported.
26 * - Added support for NEC VR4111 and VR4121.
27 *
28 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
29 * - Added support for NEC VR4133.
30 */
31#include <linux/kernel.h>
32#include <linux/module.h>
33#include <linux/smp.h>
34#include <linux/types.h>
35
36#include <asm/cpu.h>
37#include <asm/io.h>
38
39#define CLKSPEEDREG_TYPE1 (void __iomem *)KSEG1ADDR(0x0b000014)
40#define CLKSPEEDREG_TYPE2 (void __iomem *)KSEG1ADDR(0x0f000014)
41 #define CLKSP(x) ((x) & 0x001f)
42 #define CLKSP_VR4133(x) ((x) & 0x0007)
43
44 #define DIV2B 0x8000
45 #define DIV3B 0x4000
46 #define DIV4B 0x2000
47
48 #define DIVT(x) (((x) & 0xf000) >> 12)
49 #define DIVVT(x) (((x) & 0x0f00) >> 8)
50
51 #define TDIVMODE(x) (2 << (((x) & 0x1000) >> 12))
52 #define VTDIVMODE(x) (((x) & 0x0700) >> 8)
53
54static unsigned long vr41xx_vtclock;
55static unsigned long vr41xx_tclock;
56
57unsigned long vr41xx_get_vtclock_frequency(void)
58{
59 return vr41xx_vtclock;
60}
61
62EXPORT_SYMBOL_GPL(vr41xx_get_vtclock_frequency);
63
64unsigned long vr41xx_get_tclock_frequency(void)
65{
66 return vr41xx_tclock;
67}
68
69EXPORT_SYMBOL_GPL(vr41xx_get_tclock_frequency);
70
71static inline uint16_t read_clkspeed(void)
72{
73 switch (current_cpu_data.cputype) {
74 case CPU_VR4111:
75 case CPU_VR4121: return readw(CLKSPEEDREG_TYPE1);
76 case CPU_VR4122:
77 case CPU_VR4131:
78 case CPU_VR4133: return readw(CLKSPEEDREG_TYPE2);
79 default:
80 printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
81 break;
82 }
83
84 return 0;
85}
86
87static inline unsigned long calculate_pclock(uint16_t clkspeed)
88{
89 unsigned long pclock = 0;
90
91 switch (current_cpu_data.cputype) {
92 case CPU_VR4111:
93 case CPU_VR4121:
94 pclock = 18432000 * 64;
95 pclock /= CLKSP(clkspeed);
96 break;
97 case CPU_VR4122:
98 pclock = 18432000 * 98;
99 pclock /= CLKSP(clkspeed);
100 break;
101 case CPU_VR4131:
102 pclock = 18432000 * 108;
103 pclock /= CLKSP(clkspeed);
104 break;
105 case CPU_VR4133:
106 switch (CLKSP_VR4133(clkspeed)) {
107 case 0:
108 pclock = 133000000;
109 break;
110 case 1:
111 pclock = 149000000;
112 break;
113 case 2:
114 pclock = 165900000;
115 break;
116 case 3:
117 pclock = 199100000;
118 break;
119 case 4:
120 pclock = 265900000;
121 break;
122 default:
123 printk(KERN_INFO "Unknown PClock speed for NEC VR4133\n");
124 break;
125 }
126 break;
127 default:
128 printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
129 break;
130 }
131
132 printk(KERN_INFO "PClock: %ldHz\n", pclock);
133
134 return pclock;
135}
136
137static inline unsigned long calculate_vtclock(uint16_t clkspeed, unsigned long pclock)
138{
139 unsigned long vtclock = 0;
140
141 switch (current_cpu_data.cputype) {
142 case CPU_VR4111:
143 /* The NEC VR4111 doesn't have the VTClock. */
144 break;
145 case CPU_VR4121:
146 vtclock = pclock;
147 /* DIVVT == 9 Divide by 1.5 . VTClock = (PClock * 6) / 9 */
148 if (DIVVT(clkspeed) == 9)
149 vtclock = pclock * 6;
150 /* DIVVT == 10 Divide by 2.5 . VTClock = (PClock * 4) / 10 */
151 else if (DIVVT(clkspeed) == 10)
152 vtclock = pclock * 4;
153 vtclock /= DIVVT(clkspeed);
154 printk(KERN_INFO "VTClock: %ldHz\n", vtclock);
155 break;
156 case CPU_VR4122:
157 if(VTDIVMODE(clkspeed) == 7)
158 vtclock = pclock / 1;
159 else if(VTDIVMODE(clkspeed) == 1)
160 vtclock = pclock / 2;
161 else
162 vtclock = pclock / VTDIVMODE(clkspeed);
163 printk(KERN_INFO "VTClock: %ldHz\n", vtclock);
164 break;
165 case CPU_VR4131:
166 case CPU_VR4133:
167 vtclock = pclock / VTDIVMODE(clkspeed);
168 printk(KERN_INFO "VTClock: %ldHz\n", vtclock);
169 break;
170 default:
171 printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
172 break;
173 }
174
175 return vtclock;
176}
177
178static inline unsigned long calculate_tclock(uint16_t clkspeed, unsigned long pclock,
179 unsigned long vtclock)
180{
181 unsigned long tclock = 0;
182
183 switch (current_cpu_data.cputype) {
184 case CPU_VR4111:
185 if (!(clkspeed & DIV2B))
186 tclock = pclock / 2;
187 else if (!(clkspeed & DIV3B))
188 tclock = pclock / 3;
189 else if (!(clkspeed & DIV4B))
190 tclock = pclock / 4;
191 break;
192 case CPU_VR4121:
193 tclock = pclock / DIVT(clkspeed);
194 break;
195 case CPU_VR4122:
196 case CPU_VR4131:
197 case CPU_VR4133:
198 tclock = vtclock / TDIVMODE(clkspeed);
199 break;
200 default:
201 printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
202 break;
203 }
204
205 printk(KERN_INFO "TClock: %ldHz\n", tclock);
206
207 return tclock;
208}
209
210void vr41xx_calculate_clock_frequency(void)
211{
212 unsigned long pclock;
213 uint16_t clkspeed;
214
215 clkspeed = read_clkspeed();
216
217 pclock = calculate_pclock(clkspeed);
218 vr41xx_vtclock = calculate_vtclock(clkspeed, pclock);
219 vr41xx_tclock = calculate_tclock(clkspeed, pclock, vr41xx_vtclock);
220}
221
222EXPORT_SYMBOL_GPL(vr41xx_calculate_clock_frequency);
diff --git a/arch/mips/vr41xx/common/cmu.c b/arch/mips/vr41xx/common/cmu.c
new file mode 100644
index 000000000000..fcd3cb8cdd9d
--- /dev/null
+++ b/arch/mips/vr41xx/common/cmu.c
@@ -0,0 +1,257 @@
1/*
2 * cmu.c, Clock Mask Unit routines for the NEC VR4100 series.
3 *
4 * Copyright (C) 2001-2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copuright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22/*
23 * Changes:
24 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
25 * - New creation, NEC VR4122 and VR4131 are supported.
26 * - Added support for NEC VR4111 and VR4121.
27 *
28 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
29 * - Added support for NEC VR4133.
30 */
31#include <linux/init.h>
32#include <linux/ioport.h>
33#include <linux/module.h>
34#include <linux/smp.h>
35#include <linux/spinlock.h>
36#include <linux/types.h>
37
38#include <asm/cpu.h>
39#include <asm/io.h>
40#include <asm/vr41xx/vr41xx.h>
41
42#define CMU_TYPE1_BASE 0x0b000060UL
43#define CMU_TYPE1_SIZE 0x4
44
45#define CMU_TYPE2_BASE 0x0f000060UL
46#define CMU_TYPE2_SIZE 0x4
47
48#define CMU_TYPE3_BASE 0x0f000060UL
49#define CMU_TYPE3_SIZE 0x8
50
51#define CMUCLKMSK 0x0
52 #define MSKPIU 0x0001
53 #define MSKSIU 0x0002
54 #define MSKAIU 0x0004
55 #define MSKKIU 0x0008
56 #define MSKFIR 0x0010
57 #define MSKDSIU 0x0820
58 #define MSKCSI 0x0040
59 #define MSKPCIU 0x0080
60 #define MSKSSIU 0x0100
61 #define MSKSHSP 0x0200
62 #define MSKFFIR 0x0400
63 #define MSKSCSI 0x1000
64 #define MSKPPCIU 0x2000
65#define CMUCLKMSK2 0x4
66 #define MSKCEU 0x0001
67 #define MSKMAC0 0x0002
68 #define MSKMAC1 0x0004
69
70static void __iomem *cmu_base;
71static uint16_t cmuclkmsk, cmuclkmsk2;
72static spinlock_t cmu_lock;
73
74#define cmu_read(offset) readw(cmu_base + (offset))
75#define cmu_write(offset, value) writew((value), cmu_base + (offset))
76
77void vr41xx_supply_clock(vr41xx_clock_t clock)
78{
79 spin_lock_irq(&cmu_lock);
80
81 switch (clock) {
82 case PIU_CLOCK:
83 cmuclkmsk |= MSKPIU;
84 break;
85 case SIU_CLOCK:
86 cmuclkmsk |= MSKSIU | MSKSSIU;
87 break;
88 case AIU_CLOCK:
89 cmuclkmsk |= MSKAIU;
90 break;
91 case KIU_CLOCK:
92 cmuclkmsk |= MSKKIU;
93 break;
94 case FIR_CLOCK:
95 cmuclkmsk |= MSKFIR | MSKFFIR;
96 break;
97 case DSIU_CLOCK:
98 if (current_cpu_data.cputype == CPU_VR4111 ||
99 current_cpu_data.cputype == CPU_VR4121)
100 cmuclkmsk |= MSKDSIU;
101 else
102 cmuclkmsk |= MSKSIU | MSKDSIU;
103 break;
104 case CSI_CLOCK:
105 cmuclkmsk |= MSKCSI | MSKSCSI;
106 break;
107 case PCIU_CLOCK:
108 cmuclkmsk |= MSKPCIU;
109 break;
110 case HSP_CLOCK:
111 cmuclkmsk |= MSKSHSP;
112 break;
113 case PCI_CLOCK:
114 cmuclkmsk |= MSKPPCIU;
115 break;
116 case CEU_CLOCK:
117 cmuclkmsk2 |= MSKCEU;
118 break;
119 case ETHER0_CLOCK:
120 cmuclkmsk2 |= MSKMAC0;
121 break;
122 case ETHER1_CLOCK:
123 cmuclkmsk2 |= MSKMAC1;
124 break;
125 default:
126 break;
127 }
128
129 if (clock == CEU_CLOCK || clock == ETHER0_CLOCK ||
130 clock == ETHER1_CLOCK)
131 cmu_write(CMUCLKMSK2, cmuclkmsk2);
132 else
133 cmu_write(CMUCLKMSK, cmuclkmsk);
134
135 spin_unlock_irq(&cmu_lock);
136}
137
138EXPORT_SYMBOL_GPL(vr41xx_supply_clock);
139
140void vr41xx_mask_clock(vr41xx_clock_t clock)
141{
142 spin_lock_irq(&cmu_lock);
143
144 switch (clock) {
145 case PIU_CLOCK:
146 cmuclkmsk &= ~MSKPIU;
147 break;
148 case SIU_CLOCK:
149 if (current_cpu_data.cputype == CPU_VR4111 ||
150 current_cpu_data.cputype == CPU_VR4121) {
151 cmuclkmsk &= ~(MSKSIU | MSKSSIU);
152 } else {
153 if (cmuclkmsk & MSKDSIU)
154 cmuclkmsk &= ~MSKSSIU;
155 else
156 cmuclkmsk &= ~(MSKSIU | MSKSSIU);
157 }
158 break;
159 case AIU_CLOCK:
160 cmuclkmsk &= ~MSKAIU;
161 break;
162 case KIU_CLOCK:
163 cmuclkmsk &= ~MSKKIU;
164 break;
165 case FIR_CLOCK:
166 cmuclkmsk &= ~(MSKFIR | MSKFFIR);
167 break;
168 case DSIU_CLOCK:
169 if (current_cpu_data.cputype == CPU_VR4111 ||
170 current_cpu_data.cputype == CPU_VR4121) {
171 cmuclkmsk &= ~MSKDSIU;
172 } else {
173 if (cmuclkmsk & MSKSSIU)
174 cmuclkmsk &= ~MSKDSIU;
175 else
176 cmuclkmsk &= ~(MSKSIU | MSKDSIU);
177 }
178 break;
179 case CSI_CLOCK:
180 cmuclkmsk &= ~(MSKCSI | MSKSCSI);
181 break;
182 case PCIU_CLOCK:
183 cmuclkmsk &= ~MSKPCIU;
184 break;
185 case HSP_CLOCK:
186 cmuclkmsk &= ~MSKSHSP;
187 break;
188 case PCI_CLOCK:
189 cmuclkmsk &= ~MSKPPCIU;
190 break;
191 case CEU_CLOCK:
192 cmuclkmsk2 &= ~MSKCEU;
193 break;
194 case ETHER0_CLOCK:
195 cmuclkmsk2 &= ~MSKMAC0;
196 break;
197 case ETHER1_CLOCK:
198 cmuclkmsk2 &= ~MSKMAC1;
199 break;
200 default:
201 break;
202 }
203
204 if (clock == CEU_CLOCK || clock == ETHER0_CLOCK ||
205 clock == ETHER1_CLOCK)
206 cmu_write(CMUCLKMSK2, cmuclkmsk2);
207 else
208 cmu_write(CMUCLKMSK, cmuclkmsk);
209
210 spin_unlock_irq(&cmu_lock);
211}
212
213EXPORT_SYMBOL_GPL(vr41xx_mask_clock);
214
215static int __init vr41xx_cmu_init(void)
216{
217 unsigned long start, size;
218
219 switch (current_cpu_data.cputype) {
220 case CPU_VR4111:
221 case CPU_VR4121:
222 start = CMU_TYPE1_BASE;
223 size = CMU_TYPE1_SIZE;
224 break;
225 case CPU_VR4122:
226 case CPU_VR4131:
227 start = CMU_TYPE2_BASE;
228 size = CMU_TYPE2_SIZE;
229 break;
230 case CPU_VR4133:
231 start = CMU_TYPE3_BASE;
232 size = CMU_TYPE3_SIZE;
233 break;
234 default:
235 panic("Unexpected CPU of NEC VR4100 series");
236 break;
237 }
238
239 if (request_mem_region(start, size, "CMU") == NULL)
240 return -EBUSY;
241
242 cmu_base = ioremap(start, size);
243 if (cmu_base == NULL) {
244 release_mem_region(start, size);
245 return -EBUSY;
246 }
247
248 cmuclkmsk = cmu_read(CMUCLKMSK);
249 if (current_cpu_data.cputype == CPU_VR4133)
250 cmuclkmsk2 = cmu_read(CMUCLKMSK2);
251
252 spin_lock_init(&cmu_lock);
253
254 return 0;
255}
256
257core_initcall(vr41xx_cmu_init);
diff --git a/arch/mips/vr41xx/common/giu.c b/arch/mips/vr41xx/common/giu.c
new file mode 100644
index 000000000000..9c6b21a79e8f
--- /dev/null
+++ b/arch/mips/vr41xx/common/giu.c
@@ -0,0 +1,455 @@
1/*
2 * giu.c, General-purpose I/O Unit Interrupt routines for NEC VR4100 series.
3 *
4 * Copyright (C) 2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2003-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23/*
24 * Changes:
25 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
26 * - New creation, NEC VR4111, VR4121, VR4122 and VR4131 are supported.
27 *
28 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
29 * - Added support for NEC VR4133.
30 * - Removed board_irq_init.
31 */
32#include <linux/errno.h>
33#include <linux/init.h>
34#include <linux/irq.h>
35#include <linux/kernel.h>
36#include <linux/module.h>
37#include <linux/smp.h>
38#include <linux/types.h>
39
40#include <asm/cpu.h>
41#include <asm/io.h>
42#include <asm/vr41xx/vr41xx.h>
43
44#define GIUIOSELL_TYPE1 KSEG1ADDR(0x0b000100)
45#define GIUIOSELL_TYPE2 KSEG1ADDR(0x0f000140)
46
47#define GIUIOSELL 0x00
48#define GIUIOSELH 0x02
49#define GIUINTSTATL 0x08
50#define GIUINTSTATH 0x0a
51#define GIUINTENL 0x0c
52#define GIUINTENH 0x0e
53#define GIUINTTYPL 0x10
54#define GIUINTTYPH 0x12
55#define GIUINTALSELL 0x14
56#define GIUINTALSELH 0x16
57#define GIUINTHTSELL 0x18
58#define GIUINTHTSELH 0x1a
59#define GIUFEDGEINHL 0x20
60#define GIUFEDGEINHH 0x22
61#define GIUREDGEINHL 0x24
62#define GIUREDGEINHH 0x26
63
64static uint32_t giu_base;
65
66static struct irqaction giu_cascade = {
67 .handler = no_action,
68 .mask = CPU_MASK_NONE,
69 .name = "cascade",
70};
71
72#define read_giuint(offset) readw(giu_base + (offset))
73#define write_giuint(val, offset) writew((val), giu_base + (offset))
74
75#define GIUINT_HIGH_OFFSET 16
76
77static inline uint16_t set_giuint(uint8_t offset, uint16_t set)
78{
79 uint16_t res;
80
81 res = read_giuint(offset);
82 res |= set;
83 write_giuint(res, offset);
84
85 return res;
86}
87
88static inline uint16_t clear_giuint(uint8_t offset, uint16_t clear)
89{
90 uint16_t res;
91
92 res = read_giuint(offset);
93 res &= ~clear;
94 write_giuint(res, offset);
95
96 return res;
97}
98
99static unsigned int startup_giuint_low_irq(unsigned int irq)
100{
101 unsigned int pin;
102
103 pin = GIU_IRQ_TO_PIN(irq);
104 write_giuint((uint16_t)1 << pin, GIUINTSTATL);
105 set_giuint(GIUINTENL, (uint16_t)1 << pin);
106
107 return 0;
108}
109
110static void shutdown_giuint_low_irq(unsigned int irq)
111{
112 clear_giuint(GIUINTENL, (uint16_t)1 << GIU_IRQ_TO_PIN(irq));
113}
114
115static void enable_giuint_low_irq(unsigned int irq)
116{
117 set_giuint(GIUINTENL, (uint16_t)1 << GIU_IRQ_TO_PIN(irq));
118}
119
120#define disable_giuint_low_irq shutdown_giuint_low_irq
121
122static void ack_giuint_low_irq(unsigned int irq)
123{
124 unsigned int pin;
125
126 pin = GIU_IRQ_TO_PIN(irq);
127 clear_giuint(GIUINTENL, (uint16_t)1 << pin);
128 write_giuint((uint16_t)1 << pin, GIUINTSTATL);
129}
130
131static void end_giuint_low_irq(unsigned int irq)
132{
133 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
134 set_giuint(GIUINTENL, (uint16_t)1 << GIU_IRQ_TO_PIN(irq));
135}
136
137static struct hw_interrupt_type giuint_low_irq_type = {
138 .typename = "GIUINTL",
139 .startup = startup_giuint_low_irq,
140 .shutdown = shutdown_giuint_low_irq,
141 .enable = enable_giuint_low_irq,
142 .disable = disable_giuint_low_irq,
143 .ack = ack_giuint_low_irq,
144 .end = end_giuint_low_irq,
145};
146
147static unsigned int startup_giuint_high_irq(unsigned int irq)
148{
149 unsigned int pin;
150
151 pin = GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET);
152 write_giuint((uint16_t)1 << pin, GIUINTSTATH);
153 set_giuint(GIUINTENH, (uint16_t)1 << pin);
154
155 return 0;
156}
157
158static void shutdown_giuint_high_irq(unsigned int irq)
159{
160 clear_giuint(GIUINTENH, (uint16_t)1 << GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET));
161}
162
163static void enable_giuint_high_irq(unsigned int irq)
164{
165 set_giuint(GIUINTENH, (uint16_t)1 << GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET));
166}
167
168#define disable_giuint_high_irq shutdown_giuint_high_irq
169
170static void ack_giuint_high_irq(unsigned int irq)
171{
172 unsigned int pin;
173
174 pin = GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET);
175 clear_giuint(GIUINTENH, (uint16_t)1 << pin);
176 write_giuint((uint16_t)1 << pin, GIUINTSTATH);
177}
178
179static void end_giuint_high_irq(unsigned int irq)
180{
181 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
182 set_giuint(GIUINTENH, (uint16_t)1 << GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET));
183}
184
185static struct hw_interrupt_type giuint_high_irq_type = {
186 .typename = "GIUINTH",
187 .startup = startup_giuint_high_irq,
188 .shutdown = shutdown_giuint_high_irq,
189 .enable = enable_giuint_high_irq,
190 .disable = disable_giuint_high_irq,
191 .ack = ack_giuint_high_irq,
192 .end = end_giuint_high_irq,
193};
194
195void __init init_vr41xx_giuint_irq(void)
196{
197 int i;
198
199 for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) {
200 if (i < (GIU_IRQ_BASE + GIUINT_HIGH_OFFSET))
201 irq_desc[i].handler = &giuint_low_irq_type;
202 else
203 irq_desc[i].handler = &giuint_high_irq_type;
204 }
205
206 setup_irq(GIUINT_CASCADE_IRQ, &giu_cascade);
207}
208
209void vr41xx_set_irq_trigger(int pin, int trigger, int hold)
210{
211 uint16_t mask;
212
213 if (pin < GIUINT_HIGH_OFFSET) {
214 mask = (uint16_t)1 << pin;
215 if (trigger != TRIGGER_LEVEL) {
216 set_giuint(GIUINTTYPL, mask);
217 if (hold == SIGNAL_HOLD)
218 set_giuint(GIUINTHTSELL, mask);
219 else
220 clear_giuint(GIUINTHTSELL, mask);
221 if (current_cpu_data.cputype == CPU_VR4133) {
222 switch (trigger) {
223 case TRIGGER_EDGE_FALLING:
224 set_giuint(GIUFEDGEINHL, mask);
225 clear_giuint(GIUREDGEINHL, mask);
226 break;
227 case TRIGGER_EDGE_RISING:
228 clear_giuint(GIUFEDGEINHL, mask);
229 set_giuint(GIUREDGEINHL, mask);
230 break;
231 default:
232 set_giuint(GIUFEDGEINHL, mask);
233 set_giuint(GIUREDGEINHL, mask);
234 break;
235 }
236 }
237 } else {
238 clear_giuint(GIUINTTYPL, mask);
239 clear_giuint(GIUINTHTSELL, mask);
240 }
241 write_giuint(mask, GIUINTSTATL);
242 } else {
243 mask = (uint16_t)1 << (pin - GIUINT_HIGH_OFFSET);
244 if (trigger != TRIGGER_LEVEL) {
245 set_giuint(GIUINTTYPH, mask);
246 if (hold == SIGNAL_HOLD)
247 set_giuint(GIUINTHTSELH, mask);
248 else
249 clear_giuint(GIUINTHTSELH, mask);
250 if (current_cpu_data.cputype == CPU_VR4133) {
251 switch (trigger) {
252 case TRIGGER_EDGE_FALLING:
253 set_giuint(GIUFEDGEINHH, mask);
254 clear_giuint(GIUREDGEINHH, mask);
255 break;
256 case TRIGGER_EDGE_RISING:
257 clear_giuint(GIUFEDGEINHH, mask);
258 set_giuint(GIUREDGEINHH, mask);
259 break;
260 default:
261 set_giuint(GIUFEDGEINHH, mask);
262 set_giuint(GIUREDGEINHH, mask);
263 break;
264 }
265 }
266 } else {
267 clear_giuint(GIUINTTYPH, mask);
268 clear_giuint(GIUINTHTSELH, mask);
269 }
270 write_giuint(mask, GIUINTSTATH);
271 }
272}
273
274EXPORT_SYMBOL(vr41xx_set_irq_trigger);
275
276void vr41xx_set_irq_level(int pin, int level)
277{
278 uint16_t mask;
279
280 if (pin < GIUINT_HIGH_OFFSET) {
281 mask = (uint16_t)1 << pin;
282 if (level == LEVEL_HIGH)
283 set_giuint(GIUINTALSELL, mask);
284 else
285 clear_giuint(GIUINTALSELL, mask);
286 write_giuint(mask, GIUINTSTATL);
287 } else {
288 mask = (uint16_t)1 << (pin - GIUINT_HIGH_OFFSET);
289 if (level == LEVEL_HIGH)
290 set_giuint(GIUINTALSELH, mask);
291 else
292 clear_giuint(GIUINTALSELH, mask);
293 write_giuint(mask, GIUINTSTATH);
294 }
295}
296
297EXPORT_SYMBOL(vr41xx_set_irq_level);
298
299#define GIUINT_NR_IRQS 32
300
301enum {
302 GIUINT_NO_CASCADE,
303 GIUINT_CASCADE
304};
305
306struct vr41xx_giuint_cascade {
307 unsigned int flag;
308 int (*get_irq_number)(int irq);
309};
310
311static struct vr41xx_giuint_cascade giuint_cascade[GIUINT_NR_IRQS];
312
313static int no_irq_number(int irq)
314{
315 return -EINVAL;
316}
317
318int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq))
319{
320 unsigned int pin;
321 int retval;
322
323 if (irq < GIU_IRQ(0) || irq > GIU_IRQ(31))
324 return -EINVAL;
325
326 if(!get_irq_number)
327 return -EINVAL;
328
329 pin = GIU_IRQ_TO_PIN(irq);
330 giuint_cascade[pin].flag = GIUINT_CASCADE;
331 giuint_cascade[pin].get_irq_number = get_irq_number;
332
333 retval = setup_irq(irq, &giu_cascade);
334 if (retval != 0) {
335 giuint_cascade[pin].flag = GIUINT_NO_CASCADE;
336 giuint_cascade[pin].get_irq_number = no_irq_number;
337 }
338
339 return retval;
340}
341
342EXPORT_SYMBOL(vr41xx_cascade_irq);
343
344static inline int get_irq_pin_number(void)
345{
346 uint16_t pendl, pendh, maskl, maskh;
347 int i;
348
349 pendl = read_giuint(GIUINTSTATL);
350 pendh = read_giuint(GIUINTSTATH);
351 maskl = read_giuint(GIUINTENL);
352 maskh = read_giuint(GIUINTENH);
353
354 maskl &= pendl;
355 maskh &= pendh;
356
357 if (maskl) {
358 for (i = 0; i < 16; i++) {
359 if (maskl & ((uint16_t)1 << i))
360 return i;
361 }
362 } else if (maskh) {
363 for (i = 0; i < 16; i++) {
364 if (maskh & ((uint16_t)1 << i))
365 return i + GIUINT_HIGH_OFFSET;
366 }
367 }
368
369 printk(KERN_ERR "spurious GIU interrupt: %04x(%04x),%04x(%04x)\n",
370 maskl, pendl, maskh, pendh);
371
372 atomic_inc(&irq_err_count);
373
374 return -1;
375}
376
377static inline void ack_giuint_irq(int pin)
378{
379 if (pin < GIUINT_HIGH_OFFSET) {
380 clear_giuint(GIUINTENL, (uint16_t)1 << pin);
381 write_giuint((uint16_t)1 << pin, GIUINTSTATL);
382 } else {
383 pin -= GIUINT_HIGH_OFFSET;
384 clear_giuint(GIUINTENH, (uint16_t)1 << pin);
385 write_giuint((uint16_t)1 << pin, GIUINTSTATH);
386 }
387}
388
389static inline void end_giuint_irq(int pin)
390{
391 if (pin < GIUINT_HIGH_OFFSET)
392 set_giuint(GIUINTENL, (uint16_t)1 << pin);
393 else
394 set_giuint(GIUINTENH, (uint16_t)1 << (pin - GIUINT_HIGH_OFFSET));
395}
396
397void giuint_irq_dispatch(struct pt_regs *regs)
398{
399 struct vr41xx_giuint_cascade *cascade;
400 unsigned int giuint_irq;
401 int pin;
402
403 pin = get_irq_pin_number();
404 if (pin < 0)
405 return;
406
407 disable_irq(GIUINT_CASCADE_IRQ);
408
409 cascade = &giuint_cascade[pin];
410 giuint_irq = GIU_IRQ(pin);
411 if (cascade->flag == GIUINT_CASCADE) {
412 int irq = cascade->get_irq_number(giuint_irq);
413 ack_giuint_irq(pin);
414 if (irq >= 0)
415 do_IRQ(irq, regs);
416 end_giuint_irq(pin);
417 } else {
418 do_IRQ(giuint_irq, regs);
419 }
420
421 enable_irq(GIUINT_CASCADE_IRQ);
422}
423
424static int __init vr41xx_giu_init(void)
425{
426 int i;
427
428 switch (current_cpu_data.cputype) {
429 case CPU_VR4111:
430 case CPU_VR4121:
431 giu_base = GIUIOSELL_TYPE1;
432 break;
433 case CPU_VR4122:
434 case CPU_VR4131:
435 case CPU_VR4133:
436 giu_base = GIUIOSELL_TYPE2;
437 break;
438 default:
439 printk(KERN_ERR "GIU: Unexpected CPU of NEC VR4100 series\n");
440 return -EINVAL;
441 }
442
443 for (i = 0; i < GIUINT_NR_IRQS; i++) {
444 if (i < GIUINT_HIGH_OFFSET)
445 clear_giuint(GIUINTENL, (uint16_t)1 << i);
446 else
447 clear_giuint(GIUINTENH, (uint16_t)1 << (i - GIUINT_HIGH_OFFSET));
448 giuint_cascade[i].flag = GIUINT_NO_CASCADE;
449 giuint_cascade[i].get_irq_number = no_irq_number;
450 }
451
452 return 0;
453}
454
455early_initcall(vr41xx_giu_init);
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
new file mode 100644
index 000000000000..c842661144cb
--- /dev/null
+++ b/arch/mips/vr41xx/common/icu.c
@@ -0,0 +1,757 @@
1/*
2 * icu.c, Interrupt Control Unit routines for the NEC VR4100 series.
3 *
4 * Copyright (C) 2001-2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2003-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23/*
24 * Changes:
25 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
26 * - New creation, NEC VR4122 and VR4131 are supported.
27 * - Added support for NEC VR4111 and VR4121.
28 *
29 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
30 * - Coped with INTASSIGN of NEC VR4133.
31 */
32#include <linux/errno.h>
33#include <linux/init.h>
34#include <linux/interrupt.h>
35#include <linux/irq.h>
36#include <linux/module.h>
37#include <linux/smp.h>
38#include <linux/types.h>
39
40#include <asm/cpu.h>
41#include <asm/io.h>
42#include <asm/irq.h>
43#include <asm/irq_cpu.h>
44#include <asm/vr41xx/vr41xx.h>
45
46extern asmlinkage void vr41xx_handle_interrupt(void);
47
48extern void init_vr41xx_giuint_irq(void);
49extern void giuint_irq_dispatch(struct pt_regs *regs);
50
51static uint32_t icu1_base;
52static uint32_t icu2_base;
53
54static struct irqaction icu_cascade = {
55 .handler = no_action,
56 .mask = CPU_MASK_NONE,
57 .name = "cascade",
58};
59
60static unsigned char sysint1_assign[16] = {
61 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
62static unsigned char sysint2_assign[16] = {
63 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
64
65#define SYSINT1REG_TYPE1 KSEG1ADDR(0x0b000080)
66#define SYSINT2REG_TYPE1 KSEG1ADDR(0x0b000200)
67
68#define SYSINT1REG_TYPE2 KSEG1ADDR(0x0f000080)
69#define SYSINT2REG_TYPE2 KSEG1ADDR(0x0f0000a0)
70
71#define SYSINT1REG 0x00
72#define PIUINTREG 0x02
73#define INTASSIGN0 0x04
74#define INTASSIGN1 0x06
75#define GIUINTLREG 0x08
76#define DSIUINTREG 0x0a
77#define MSYSINT1REG 0x0c
78#define MPIUINTREG 0x0e
79#define MAIUINTREG 0x10
80#define MKIUINTREG 0x12
81#define MGIUINTLREG 0x14
82#define MDSIUINTREG 0x16
83#define NMIREG 0x18
84#define SOFTREG 0x1a
85#define INTASSIGN2 0x1c
86#define INTASSIGN3 0x1e
87
88#define SYSINT2REG 0x00
89#define GIUINTHREG 0x02
90#define FIRINTREG 0x04
91#define MSYSINT2REG 0x06
92#define MGIUINTHREG 0x08
93#define MFIRINTREG 0x0a
94#define PCIINTREG 0x0c
95 #define PCIINT0 0x0001
96#define SCUINTREG 0x0e
97 #define SCUINT0 0x0001
98#define CSIINTREG 0x10
99#define MPCIINTREG 0x12
100#define MSCUINTREG 0x14
101#define MCSIINTREG 0x16
102#define BCUINTREG 0x18
103 #define BCUINTR 0x0001
104#define MBCUINTREG 0x1a
105
106#define SYSINT1_IRQ_TO_PIN(x) ((x) - SYSINT1_IRQ_BASE) /* Pin 0-15 */
107#define SYSINT2_IRQ_TO_PIN(x) ((x) - SYSINT2_IRQ_BASE) /* Pin 0-15 */
108
109#define read_icu1(offset) readw(icu1_base + (offset))
110#define write_icu1(val, offset) writew((val), icu1_base + (offset))
111
112#define read_icu2(offset) readw(icu2_base + (offset))
113#define write_icu2(val, offset) writew((val), icu2_base + (offset))
114
115#define INTASSIGN_MAX 4
116#define INTASSIGN_MASK 0x0007
117
118static inline uint16_t set_icu1(uint8_t offset, uint16_t set)
119{
120 uint16_t res;
121
122 res = read_icu1(offset);
123 res |= set;
124 write_icu1(res, offset);
125
126 return res;
127}
128
129static inline uint16_t clear_icu1(uint8_t offset, uint16_t clear)
130{
131 uint16_t res;
132
133 res = read_icu1(offset);
134 res &= ~clear;
135 write_icu1(res, offset);
136
137 return res;
138}
139
140static inline uint16_t set_icu2(uint8_t offset, uint16_t set)
141{
142 uint16_t res;
143
144 res = read_icu2(offset);
145 res |= set;
146 write_icu2(res, offset);
147
148 return res;
149}
150
151static inline uint16_t clear_icu2(uint8_t offset, uint16_t clear)
152{
153 uint16_t res;
154
155 res = read_icu2(offset);
156 res &= ~clear;
157 write_icu2(res, offset);
158
159 return res;
160}
161
162/*=======================================================================*/
163
164void vr41xx_enable_piuint(uint16_t mask)
165{
166 irq_desc_t *desc = irq_desc + PIU_IRQ;
167 unsigned long flags;
168
169 if (current_cpu_data.cputype == CPU_VR4111 ||
170 current_cpu_data.cputype == CPU_VR4121) {
171 spin_lock_irqsave(&desc->lock, flags);
172 set_icu1(MPIUINTREG, mask);
173 spin_unlock_irqrestore(&desc->lock, flags);
174 }
175}
176
177EXPORT_SYMBOL(vr41xx_enable_piuint);
178
179void vr41xx_disable_piuint(uint16_t mask)
180{
181 irq_desc_t *desc = irq_desc + PIU_IRQ;
182 unsigned long flags;
183
184 if (current_cpu_data.cputype == CPU_VR4111 ||
185 current_cpu_data.cputype == CPU_VR4121) {
186 spin_lock_irqsave(&desc->lock, flags);
187 clear_icu1(MPIUINTREG, mask);
188 spin_unlock_irqrestore(&desc->lock, flags);
189 }
190}
191
192EXPORT_SYMBOL(vr41xx_disable_piuint);
193
194void vr41xx_enable_aiuint(uint16_t mask)
195{
196 irq_desc_t *desc = irq_desc + AIU_IRQ;
197 unsigned long flags;
198
199 if (current_cpu_data.cputype == CPU_VR4111 ||
200 current_cpu_data.cputype == CPU_VR4121) {
201 spin_lock_irqsave(&desc->lock, flags);
202 set_icu1(MAIUINTREG, mask);
203 spin_unlock_irqrestore(&desc->lock, flags);
204 }
205}
206
207EXPORT_SYMBOL(vr41xx_enable_aiuint);
208
209void vr41xx_disable_aiuint(uint16_t mask)
210{
211 irq_desc_t *desc = irq_desc + AIU_IRQ;
212 unsigned long flags;
213
214 if (current_cpu_data.cputype == CPU_VR4111 ||
215 current_cpu_data.cputype == CPU_VR4121) {
216 spin_lock_irqsave(&desc->lock, flags);
217 clear_icu1(MAIUINTREG, mask);
218 spin_unlock_irqrestore(&desc->lock, flags);
219 }
220}
221
222EXPORT_SYMBOL(vr41xx_disable_aiuint);
223
224void vr41xx_enable_kiuint(uint16_t mask)
225{
226 irq_desc_t *desc = irq_desc + KIU_IRQ;
227 unsigned long flags;
228
229 if (current_cpu_data.cputype == CPU_VR4111 ||
230 current_cpu_data.cputype == CPU_VR4121) {
231 spin_lock_irqsave(&desc->lock, flags);
232 set_icu1(MKIUINTREG, mask);
233 spin_unlock_irqrestore(&desc->lock, flags);
234 }
235}
236
237EXPORT_SYMBOL(vr41xx_enable_kiuint);
238
239void vr41xx_disable_kiuint(uint16_t mask)
240{
241 irq_desc_t *desc = irq_desc + KIU_IRQ;
242 unsigned long flags;
243
244 if (current_cpu_data.cputype == CPU_VR4111 ||
245 current_cpu_data.cputype == CPU_VR4121) {
246 spin_lock_irqsave(&desc->lock, flags);
247 clear_icu1(MKIUINTREG, mask);
248 spin_unlock_irqrestore(&desc->lock, flags);
249 }
250}
251
252EXPORT_SYMBOL(vr41xx_disable_kiuint);
253
254void vr41xx_enable_dsiuint(uint16_t mask)
255{
256 irq_desc_t *desc = irq_desc + DSIU_IRQ;
257 unsigned long flags;
258
259 spin_lock_irqsave(&desc->lock, flags);
260 set_icu1(MDSIUINTREG, mask);
261 spin_unlock_irqrestore(&desc->lock, flags);
262}
263
264EXPORT_SYMBOL(vr41xx_enable_dsiuint);
265
266void vr41xx_disable_dsiuint(uint16_t mask)
267{
268 irq_desc_t *desc = irq_desc + DSIU_IRQ;
269 unsigned long flags;
270
271 spin_lock_irqsave(&desc->lock, flags);
272 clear_icu1(MDSIUINTREG, mask);
273 spin_unlock_irqrestore(&desc->lock, flags);
274}
275
276EXPORT_SYMBOL(vr41xx_disable_dsiuint);
277
278void vr41xx_enable_firint(uint16_t mask)
279{
280 irq_desc_t *desc = irq_desc + FIR_IRQ;
281 unsigned long flags;
282
283 spin_lock_irqsave(&desc->lock, flags);
284 set_icu2(MFIRINTREG, mask);
285 spin_unlock_irqrestore(&desc->lock, flags);
286}
287
288EXPORT_SYMBOL(vr41xx_enable_firint);
289
290void vr41xx_disable_firint(uint16_t mask)
291{
292 irq_desc_t *desc = irq_desc + FIR_IRQ;
293 unsigned long flags;
294
295 spin_lock_irqsave(&desc->lock, flags);
296 clear_icu2(MFIRINTREG, mask);
297 spin_unlock_irqrestore(&desc->lock, flags);
298}
299
300EXPORT_SYMBOL(vr41xx_disable_firint);
301
302void vr41xx_enable_pciint(void)
303{
304 irq_desc_t *desc = irq_desc + PCI_IRQ;
305 unsigned long flags;
306
307 if (current_cpu_data.cputype == CPU_VR4122 ||
308 current_cpu_data.cputype == CPU_VR4131 ||
309 current_cpu_data.cputype == CPU_VR4133) {
310 spin_lock_irqsave(&desc->lock, flags);
311 write_icu2(PCIINT0, MPCIINTREG);
312 spin_unlock_irqrestore(&desc->lock, flags);
313 }
314}
315
316EXPORT_SYMBOL(vr41xx_enable_pciint);
317
318void vr41xx_disable_pciint(void)
319{
320 irq_desc_t *desc = irq_desc + PCI_IRQ;
321 unsigned long flags;
322
323 if (current_cpu_data.cputype == CPU_VR4122 ||
324 current_cpu_data.cputype == CPU_VR4131 ||
325 current_cpu_data.cputype == CPU_VR4133) {
326 spin_lock_irqsave(&desc->lock, flags);
327 write_icu2(0, MPCIINTREG);
328 spin_unlock_irqrestore(&desc->lock, flags);
329 }
330}
331
332EXPORT_SYMBOL(vr41xx_disable_pciint);
333
334void vr41xx_enable_scuint(void)
335{
336 irq_desc_t *desc = irq_desc + SCU_IRQ;
337 unsigned long flags;
338
339 if (current_cpu_data.cputype == CPU_VR4122 ||
340 current_cpu_data.cputype == CPU_VR4131 ||
341 current_cpu_data.cputype == CPU_VR4133) {
342 spin_lock_irqsave(&desc->lock, flags);
343 write_icu2(SCUINT0, MSCUINTREG);
344 spin_unlock_irqrestore(&desc->lock, flags);
345 }
346}
347
348EXPORT_SYMBOL(vr41xx_enable_scuint);
349
350void vr41xx_disable_scuint(void)
351{
352 irq_desc_t *desc = irq_desc + SCU_IRQ;
353 unsigned long flags;
354
355 if (current_cpu_data.cputype == CPU_VR4122 ||
356 current_cpu_data.cputype == CPU_VR4131 ||
357 current_cpu_data.cputype == CPU_VR4133) {
358 spin_lock_irqsave(&desc->lock, flags);
359 write_icu2(0, MSCUINTREG);
360 spin_unlock_irqrestore(&desc->lock, flags);
361 }
362}
363
364EXPORT_SYMBOL(vr41xx_disable_scuint);
365
366void vr41xx_enable_csiint(uint16_t mask)
367{
368 irq_desc_t *desc = irq_desc + CSI_IRQ;
369 unsigned long flags;
370
371 if (current_cpu_data.cputype == CPU_VR4122 ||
372 current_cpu_data.cputype == CPU_VR4131 ||
373 current_cpu_data.cputype == CPU_VR4133) {
374 spin_lock_irqsave(&desc->lock, flags);
375 set_icu2(MCSIINTREG, mask);
376 spin_unlock_irqrestore(&desc->lock, flags);
377 }
378}
379
380EXPORT_SYMBOL(vr41xx_enable_csiint);
381
382void vr41xx_disable_csiint(uint16_t mask)
383{
384 irq_desc_t *desc = irq_desc + CSI_IRQ;
385 unsigned long flags;
386
387 if (current_cpu_data.cputype == CPU_VR4122 ||
388 current_cpu_data.cputype == CPU_VR4131 ||
389 current_cpu_data.cputype == CPU_VR4133) {
390 spin_lock_irqsave(&desc->lock, flags);
391 clear_icu2(MCSIINTREG, mask);
392 spin_unlock_irqrestore(&desc->lock, flags);
393 }
394}
395
396EXPORT_SYMBOL(vr41xx_disable_csiint);
397
398void vr41xx_enable_bcuint(void)
399{
400 irq_desc_t *desc = irq_desc + BCU_IRQ;
401 unsigned long flags;
402
403 if (current_cpu_data.cputype == CPU_VR4122 ||
404 current_cpu_data.cputype == CPU_VR4131 ||
405 current_cpu_data.cputype == CPU_VR4133) {
406 spin_lock_irqsave(&desc->lock, flags);
407 write_icu2(BCUINTR, MBCUINTREG);
408 spin_unlock_irqrestore(&desc->lock, flags);
409 }
410}
411
412EXPORT_SYMBOL(vr41xx_enable_bcuint);
413
414void vr41xx_disable_bcuint(void)
415{
416 irq_desc_t *desc = irq_desc + BCU_IRQ;
417 unsigned long flags;
418
419 if (current_cpu_data.cputype == CPU_VR4122 ||
420 current_cpu_data.cputype == CPU_VR4131 ||
421 current_cpu_data.cputype == CPU_VR4133) {
422 spin_lock_irqsave(&desc->lock, flags);
423 write_icu2(0, MBCUINTREG);
424 spin_unlock_irqrestore(&desc->lock, flags);
425 }
426}
427
428EXPORT_SYMBOL(vr41xx_disable_bcuint);
429
430/*=======================================================================*/
431
432static unsigned int startup_sysint1_irq(unsigned int irq)
433{
434 set_icu1(MSYSINT1REG, (uint16_t)1 << SYSINT1_IRQ_TO_PIN(irq));
435
436 return 0; /* never anything pending */
437}
438
439static void shutdown_sysint1_irq(unsigned int irq)
440{
441 clear_icu1(MSYSINT1REG, (uint16_t)1 << SYSINT1_IRQ_TO_PIN(irq));
442}
443
444static void enable_sysint1_irq(unsigned int irq)
445{
446 set_icu1(MSYSINT1REG, (uint16_t)1 << SYSINT1_IRQ_TO_PIN(irq));
447}
448
449#define disable_sysint1_irq shutdown_sysint1_irq
450#define ack_sysint1_irq shutdown_sysint1_irq
451
452static void end_sysint1_irq(unsigned int irq)
453{
454 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
455 set_icu1(MSYSINT1REG, (uint16_t)1 << SYSINT1_IRQ_TO_PIN(irq));
456}
457
458static struct hw_interrupt_type sysint1_irq_type = {
459 .typename = "SYSINT1",
460 .startup = startup_sysint1_irq,
461 .shutdown = shutdown_sysint1_irq,
462 .enable = enable_sysint1_irq,
463 .disable = disable_sysint1_irq,
464 .ack = ack_sysint1_irq,
465 .end = end_sysint1_irq,
466};
467
468/*=======================================================================*/
469
470static unsigned int startup_sysint2_irq(unsigned int irq)
471{
472 set_icu2(MSYSINT2REG, (uint16_t)1 << SYSINT2_IRQ_TO_PIN(irq));
473
474 return 0; /* never anything pending */
475}
476
477static void shutdown_sysint2_irq(unsigned int irq)
478{
479 clear_icu2(MSYSINT2REG, (uint16_t)1 << SYSINT2_IRQ_TO_PIN(irq));
480}
481
482static void enable_sysint2_irq(unsigned int irq)
483{
484 set_icu2(MSYSINT2REG, (uint16_t)1 << SYSINT2_IRQ_TO_PIN(irq));
485}
486
487#define disable_sysint2_irq shutdown_sysint2_irq
488#define ack_sysint2_irq shutdown_sysint2_irq
489
490static void end_sysint2_irq(unsigned int irq)
491{
492 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
493 set_icu2(MSYSINT2REG, (uint16_t)1 << SYSINT2_IRQ_TO_PIN(irq));
494}
495
496static struct hw_interrupt_type sysint2_irq_type = {
497 .typename = "SYSINT2",
498 .startup = startup_sysint2_irq,
499 .shutdown = shutdown_sysint2_irq,
500 .enable = enable_sysint2_irq,
501 .disable = disable_sysint2_irq,
502 .ack = ack_sysint2_irq,
503 .end = end_sysint2_irq,
504};
505
506/*=======================================================================*/
507
508static inline int set_sysint1_assign(unsigned int irq, unsigned char assign)
509{
510 irq_desc_t *desc = irq_desc + irq;
511 uint16_t intassign0, intassign1;
512 unsigned int pin;
513
514 pin = SYSINT1_IRQ_TO_PIN(irq);
515
516 spin_lock_irq(&desc->lock);
517
518 intassign0 = read_icu1(INTASSIGN0);
519 intassign1 = read_icu1(INTASSIGN1);
520
521 switch (pin) {
522 case 0:
523 intassign0 &= ~INTASSIGN_MASK;
524 intassign0 |= (uint16_t)assign;
525 break;
526 case 1:
527 intassign0 &= ~(INTASSIGN_MASK << 3);
528 intassign0 |= (uint16_t)assign << 3;
529 break;
530 case 2:
531 intassign0 &= ~(INTASSIGN_MASK << 6);
532 intassign0 |= (uint16_t)assign << 6;
533 break;
534 case 3:
535 intassign0 &= ~(INTASSIGN_MASK << 9);
536 intassign0 |= (uint16_t)assign << 9;
537 break;
538 case 8:
539 intassign0 &= ~(INTASSIGN_MASK << 12);
540 intassign0 |= (uint16_t)assign << 12;
541 break;
542 case 9:
543 intassign1 &= ~INTASSIGN_MASK;
544 intassign1 |= (uint16_t)assign;
545 break;
546 case 11:
547 intassign1 &= ~(INTASSIGN_MASK << 6);
548 intassign1 |= (uint16_t)assign << 6;
549 break;
550 case 12:
551 intassign1 &= ~(INTASSIGN_MASK << 9);
552 intassign1 |= (uint16_t)assign << 9;
553 break;
554 default:
555 return -EINVAL;
556 }
557
558 sysint1_assign[pin] = assign;
559 write_icu1(intassign0, INTASSIGN0);
560 write_icu1(intassign1, INTASSIGN1);
561
562 spin_unlock_irq(&desc->lock);
563
564 return 0;
565}
566
567static inline int set_sysint2_assign(unsigned int irq, unsigned char assign)
568{
569 irq_desc_t *desc = irq_desc + irq;
570 uint16_t intassign2, intassign3;
571 unsigned int pin;
572
573 pin = SYSINT2_IRQ_TO_PIN(irq);
574
575 spin_lock_irq(&desc->lock);
576
577 intassign2 = read_icu1(INTASSIGN2);
578 intassign3 = read_icu1(INTASSIGN3);
579
580 switch (pin) {
581 case 0:
582 intassign2 &= ~INTASSIGN_MASK;
583 intassign2 |= (uint16_t)assign;
584 break;
585 case 1:
586 intassign2 &= ~(INTASSIGN_MASK << 3);
587 intassign2 |= (uint16_t)assign << 3;
588 break;
589 case 3:
590 intassign2 &= ~(INTASSIGN_MASK << 6);
591 intassign2 |= (uint16_t)assign << 6;
592 break;
593 case 4:
594 intassign2 &= ~(INTASSIGN_MASK << 9);
595 intassign2 |= (uint16_t)assign << 9;
596 break;
597 case 5:
598 intassign2 &= ~(INTASSIGN_MASK << 12);
599 intassign2 |= (uint16_t)assign << 12;
600 break;
601 case 6:
602 intassign3 &= ~INTASSIGN_MASK;
603 intassign3 |= (uint16_t)assign;
604 break;
605 case 7:
606 intassign3 &= ~(INTASSIGN_MASK << 3);
607 intassign3 |= (uint16_t)assign << 3;
608 break;
609 case 8:
610 intassign3 &= ~(INTASSIGN_MASK << 6);
611 intassign3 |= (uint16_t)assign << 6;
612 break;
613 case 9:
614 intassign3 &= ~(INTASSIGN_MASK << 9);
615 intassign3 |= (uint16_t)assign << 9;
616 break;
617 case 10:
618 intassign3 &= ~(INTASSIGN_MASK << 12);
619 intassign3 |= (uint16_t)assign << 12;
620 break;
621 default:
622 return -EINVAL;
623 }
624
625 sysint2_assign[pin] = assign;
626 write_icu1(intassign2, INTASSIGN2);
627 write_icu1(intassign3, INTASSIGN3);
628
629 spin_unlock_irq(&desc->lock);
630
631 return 0;
632}
633
634int vr41xx_set_intassign(unsigned int irq, unsigned char intassign)
635{
636 int retval = -EINVAL;
637
638 if (current_cpu_data.cputype != CPU_VR4133)
639 return -EINVAL;
640
641 if (intassign > INTASSIGN_MAX)
642 return -EINVAL;
643
644 if (irq >= SYSINT1_IRQ_BASE && irq <= SYSINT1_IRQ_LAST)
645 retval = set_sysint1_assign(irq, intassign);
646 else if (irq >= SYSINT2_IRQ_BASE && irq <= SYSINT2_IRQ_LAST)
647 retval = set_sysint2_assign(irq, intassign);
648
649 return retval;
650}
651
652EXPORT_SYMBOL(vr41xx_set_intassign);
653
654/*=======================================================================*/
655
656asmlinkage void irq_dispatch(unsigned char intnum, struct pt_regs *regs)
657{
658 uint16_t pend1, pend2;
659 uint16_t mask1, mask2;
660 int i;
661
662 pend1 = read_icu1(SYSINT1REG);
663 mask1 = read_icu1(MSYSINT1REG);
664
665 pend2 = read_icu2(SYSINT2REG);
666 mask2 = read_icu2(MSYSINT2REG);
667
668 mask1 &= pend1;
669 mask2 &= pend2;
670
671 if (mask1) {
672 for (i = 0; i < 16; i++) {
673 if (intnum == sysint1_assign[i] &&
674 (mask1 & ((uint16_t)1 << i))) {
675 if (i == 8)
676 giuint_irq_dispatch(regs);
677 else
678 do_IRQ(SYSINT1_IRQ(i), regs);
679 return;
680 }
681 }
682 }
683
684 if (mask2) {
685 for (i = 0; i < 16; i++) {
686 if (intnum == sysint2_assign[i] &&
687 (mask2 & ((uint16_t)1 << i))) {
688 do_IRQ(SYSINT2_IRQ(i), regs);
689 return;
690 }
691 }
692 }
693
694 printk(KERN_ERR "spurious ICU interrupt: %04x,%04x\n", pend1, pend2);
695
696 atomic_inc(&irq_err_count);
697}
698
699/*=======================================================================*/
700
701static int __init vr41xx_icu_init(void)
702{
703 switch (current_cpu_data.cputype) {
704 case CPU_VR4111:
705 case CPU_VR4121:
706 icu1_base = SYSINT1REG_TYPE1;
707 icu2_base = SYSINT2REG_TYPE1;
708 break;
709 case CPU_VR4122:
710 case CPU_VR4131:
711 case CPU_VR4133:
712 icu1_base = SYSINT1REG_TYPE2;
713 icu2_base = SYSINT2REG_TYPE2;
714 break;
715 default:
716 printk(KERN_ERR "ICU: Unexpected CPU of NEC VR4100 series\n");
717 return -EINVAL;
718 }
719
720 write_icu1(0, MSYSINT1REG);
721 write_icu1(0xffff, MGIUINTLREG);
722
723 write_icu2(0, MSYSINT2REG);
724 write_icu2(0xffff, MGIUINTHREG);
725
726 return 0;
727}
728
729early_initcall(vr41xx_icu_init);
730
731/*=======================================================================*/
732
733static inline void init_vr41xx_icu_irq(void)
734{
735 int i;
736
737 for (i = SYSINT1_IRQ_BASE; i <= SYSINT1_IRQ_LAST; i++)
738 irq_desc[i].handler = &sysint1_irq_type;
739
740 for (i = SYSINT2_IRQ_BASE; i <= SYSINT2_IRQ_LAST; i++)
741 irq_desc[i].handler = &sysint2_irq_type;
742
743 setup_irq(INT0_CASCADE_IRQ, &icu_cascade);
744 setup_irq(INT1_CASCADE_IRQ, &icu_cascade);
745 setup_irq(INT2_CASCADE_IRQ, &icu_cascade);
746 setup_irq(INT3_CASCADE_IRQ, &icu_cascade);
747 setup_irq(INT4_CASCADE_IRQ, &icu_cascade);
748}
749
750void __init arch_init_irq(void)
751{
752 mips_cpu_irq_init(MIPS_CPU_IRQ_BASE);
753 init_vr41xx_icu_irq();
754 init_vr41xx_giuint_irq();
755
756 set_except_vector(0, vr41xx_handle_interrupt);
757}
diff --git a/arch/mips/vr41xx/common/init.c b/arch/mips/vr41xx/common/init.c
new file mode 100644
index 000000000000..e03be896cbc4
--- /dev/null
+++ b/arch/mips/vr41xx/common/init.c
@@ -0,0 +1,85 @@
1/*
2 * init.c, Common initialization routines for NEC VR4100 series.
3 *
4 * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/ioport.h>
22#include <linux/irq.h>
23#include <linux/string.h>
24
25#include <asm/bootinfo.h>
26#include <asm/time.h>
27#include <asm/vr41xx/vr41xx.h>
28
29#define IO_MEM_RESOURCE_START 0UL
30#define IO_MEM_RESOURCE_END 0x1fffffffUL
31
32static void __init iomem_resource_init(void)
33{
34 iomem_resource.start = IO_MEM_RESOURCE_START;
35 iomem_resource.end = IO_MEM_RESOURCE_END;
36}
37
38static void __init setup_timer_frequency(void)
39{
40 unsigned long tclock;
41
42 tclock = vr41xx_get_tclock_frequency();
43 if (current_cpu_data.processor_id == PRID_VR4131_REV2_0 ||
44 current_cpu_data.processor_id == PRID_VR4131_REV2_1)
45 mips_hpt_frequency = tclock / 2;
46 else
47 mips_hpt_frequency = tclock / 4;
48}
49
50static void __init setup_timer_irq(struct irqaction *irq)
51{
52 setup_irq(TIMER_IRQ, irq);
53}
54
55static void __init timer_init(void)
56{
57 board_time_init = setup_timer_frequency;
58 board_timer_setup = setup_timer_irq;
59}
60
61void __init prom_init(void)
62{
63 int argc, i;
64 char **argv;
65
66 argc = fw_arg0;
67 argv = (char **)fw_arg1;
68
69 for (i = 1; i < argc; i++) {
70 strcat(arcs_cmdline, argv[i]);
71 if (i < (argc - 1))
72 strcat(arcs_cmdline, " ");
73 }
74
75 vr41xx_calculate_clock_frequency();
76
77 timer_init();
78
79 iomem_resource_init();
80}
81
82unsigned long __init prom_free_prom_memory (void)
83{
84 return 0UL;
85}
diff --git a/arch/mips/vr41xx/common/int-handler.S b/arch/mips/vr41xx/common/int-handler.S
new file mode 100644
index 000000000000..38ff89b505f2
--- /dev/null
+++ b/arch/mips/vr41xx/common/int-handler.S
@@ -0,0 +1,114 @@
1/*
2 * FILE NAME
3 * arch/mips/vr41xx/common/int-handler.S
4 *
5 * BRIEF MODULE DESCRIPTION
6 * Interrupt dispatcher for the NEC VR4100 series.
7 *
8 * Author: Yoichi Yuasa
9 * yyuasa@mvista.com or source@mvista.com
10 *
11 * Copyright 2001 MontaVista Software Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */
33/*
34 * Changes:
35 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
36 * - New creation, NEC VR4100 series are supported.
37 *
38 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
39 * - Coped with INTASSIGN of NEC VR4133.
40 */
41#include <asm/asm.h>
42#include <asm/regdef.h>
43#include <asm/mipsregs.h>
44#include <asm/stackframe.h>
45
46 .text
47 .set noreorder
48
49 .align 5
50 NESTED(vr41xx_handle_interrupt, PT_SIZE, ra)
51 .set noat
52 SAVE_ALL
53 CLI
54 .set at
55 .set noreorder
56
57 /*
58 * Get the pending interrupts
59 */
60 mfc0 t0, CP0_CAUSE
61 mfc0 t1, CP0_STATUS
62 andi t0, 0xff00
63 and t0, t0, t1
64
65 andi t1, t0, CAUSEF_IP7 # MIPS timer interrupt
66 bnez t1, handle_irq
67 li a0, 7
68
69 andi t1, t0, 0x7800 # check for Int1-4
70 beqz t1, 1f
71
72 andi t1, t0, CAUSEF_IP3 # check for Int1
73 bnez t1, handle_int
74 li a0, 1
75
76 andi t1, t0, CAUSEF_IP4 # check for Int2
77 bnez t1, handle_int
78 li a0, 2
79
80 andi t1, t0, CAUSEF_IP5 # check for Int3
81 bnez t1, handle_int
82 li a0, 3
83
84 andi t1, t0, CAUSEF_IP6 # check for Int4
85 bnez t1, handle_int
86 li a0, 4
87
881:
89 andi t1, t0, CAUSEF_IP2 # check for Int0
90 bnez t1, handle_int
91 li a0, 0
92
93 andi t1, t0, CAUSEF_IP0 # check for IP0
94 bnez t1, handle_irq
95 li a0, 0
96
97 andi t1, t0, CAUSEF_IP1 # check for IP1
98 bnez t1, handle_irq
99 li a0, 1
100
101 j spurious_interrupt
102 nop
103
104handle_int:
105 jal irq_dispatch
106 move a1, sp
107 j ret_from_irq
108 nop
109
110handle_irq:
111 jal do_IRQ
112 move a1, sp
113 j ret_from_irq
114 END(vr41xx_handle_interrupt)
diff --git a/arch/mips/vr41xx/common/pmu.c b/arch/mips/vr41xx/common/pmu.c
new file mode 100644
index 000000000000..c5f1043de938
--- /dev/null
+++ b/arch/mips/vr41xx/common/pmu.c
@@ -0,0 +1,81 @@
1/*
2 * pmu.c, Power Management Unit routines for NEC VR4100 series.
3 *
4 * Copyright (C) 2003-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/smp.h>
23#include <linux/types.h>
24
25#include <asm/cpu.h>
26#include <asm/io.h>
27#include <asm/reboot.h>
28#include <asm/system.h>
29
30#define PMUCNT2REG KSEG1ADDR(0x0f0000c6)
31 #define SOFTRST 0x0010
32
33static inline void software_reset(void)
34{
35 uint16_t val;
36
37 switch (current_cpu_data.cputype) {
38 case CPU_VR4122:
39 case CPU_VR4131:
40 case CPU_VR4133:
41 val = readw(PMUCNT2REG);
42 val |= SOFTRST;
43 writew(val, PMUCNT2REG);
44 break;
45 default:
46 break;
47 }
48}
49
50static void vr41xx_restart(char *command)
51{
52 local_irq_disable();
53 software_reset();
54 printk(KERN_NOTICE "\nYou can reset your system\n");
55 while (1) ;
56}
57
58static void vr41xx_halt(void)
59{
60 local_irq_disable();
61 printk(KERN_NOTICE "\nYou can turn off the power supply\n");
62 while (1) ;
63}
64
65static void vr41xx_power_off(void)
66{
67 local_irq_disable();
68 printk(KERN_NOTICE "\nYou can turn off the power supply\n");
69 while (1) ;
70}
71
72static int __init vr41xx_pmu_init(void)
73{
74 _machine_restart = vr41xx_restart;
75 _machine_halt = vr41xx_halt;
76 _machine_power_off = vr41xx_power_off;
77
78 return 0;
79}
80
81early_initcall(vr41xx_pmu_init);
diff --git a/arch/mips/vr41xx/common/vrc4173.c b/arch/mips/vr41xx/common/vrc4173.c
new file mode 100644
index 000000000000..5475dd72e264
--- /dev/null
+++ b/arch/mips/vr41xx/common/vrc4173.c
@@ -0,0 +1,581 @@
1/*
2 * vrc4173.c, NEC VRC4173 base driver for NEC VR4122/VR4131.
3 *
4 * Copyright (C) 2001-2003 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>
6 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#include <linux/init.h>
24#include <linux/module.h>
25#include <linux/interrupt.h>
26#include <linux/irq.h>
27#include <linux/pci.h>
28#include <linux/spinlock.h>
29#include <linux/types.h>
30
31#include <asm/vr41xx/vr41xx.h>
32#include <asm/vr41xx/vrc4173.h>
33
34MODULE_DESCRIPTION("NEC VRC4173 base driver for NEC VR4122/4131");
35MODULE_AUTHOR("Yoichi Yuasa <yyuasa@mvista.com>");
36MODULE_LICENSE("GPL");
37
38#define VRC4173_CMUCLKMSK 0x040
39 #define MSKPIU 0x0001
40 #define MSKKIU 0x0002
41 #define MSKAIU 0x0004
42 #define MSKPS2CH1 0x0008
43 #define MSKPS2CH2 0x0010
44 #define MSKUSB 0x0020
45 #define MSKCARD1 0x0040
46 #define MSKCARD2 0x0080
47 #define MSKAC97 0x0100
48 #define MSK48MUSB 0x0400
49 #define MSK48MPIN 0x0800
50 #define MSK48MOSC 0x1000
51#define VRC4173_CMUSRST 0x042
52 #define USBRST 0x0001
53 #define CARD1RST 0x0002
54 #define CARD2RST 0x0004
55 #define AC97RST 0x0008
56
57#define VRC4173_SYSINT1REG 0x060
58#define VRC4173_MSYSINT1REG 0x06c
59#define VRC4173_MPIUINTREG 0x06e
60#define VRC4173_MAIUINTREG 0x070
61#define VRC4173_MKIUINTREG 0x072
62
63#define VRC4173_SELECTREG 0x09e
64 #define SEL3 0x0008
65 #define SEL2 0x0004
66 #define SEL1 0x0002
67 #define SEL0 0x0001
68
69static struct pci_device_id vrc4173_id_table[] __devinitdata = {
70 { .vendor = PCI_VENDOR_ID_NEC,
71 .device = PCI_DEVICE_ID_NEC_VRC4173,
72 .subvendor = PCI_ANY_ID,
73 .subdevice = PCI_ANY_ID, },
74 { .vendor = 0, },
75};
76
77unsigned long vrc4173_io_offset = 0;
78
79EXPORT_SYMBOL(vrc4173_io_offset);
80
81static int vrc4173_initialized;
82static uint16_t vrc4173_cmuclkmsk;
83static uint16_t vrc4173_selectreg;
84static spinlock_t vrc4173_cmu_lock;
85static spinlock_t vrc4173_giu_lock;
86
87static inline void set_cmusrst(uint16_t val)
88{
89 uint16_t cmusrst;
90
91 cmusrst = vrc4173_inw(VRC4173_CMUSRST);
92 cmusrst |= val;
93 vrc4173_outw(cmusrst, VRC4173_CMUSRST);
94}
95
96static inline void clear_cmusrst(uint16_t val)
97{
98 uint16_t cmusrst;
99
100 cmusrst = vrc4173_inw(VRC4173_CMUSRST);
101 cmusrst &= ~val;
102 vrc4173_outw(cmusrst, VRC4173_CMUSRST);
103}
104
105void vrc4173_supply_clock(vrc4173_clock_t clock)
106{
107 if (vrc4173_initialized) {
108 spin_lock_irq(&vrc4173_cmu_lock);
109
110 switch (clock) {
111 case VRC4173_PIU_CLOCK:
112 vrc4173_cmuclkmsk |= MSKPIU;
113 break;
114 case VRC4173_KIU_CLOCK:
115 vrc4173_cmuclkmsk |= MSKKIU;
116 break;
117 case VRC4173_AIU_CLOCK:
118 vrc4173_cmuclkmsk |= MSKAIU;
119 break;
120 case VRC4173_PS2_CH1_CLOCK:
121 vrc4173_cmuclkmsk |= MSKPS2CH1;
122 break;
123 case VRC4173_PS2_CH2_CLOCK:
124 vrc4173_cmuclkmsk |= MSKPS2CH2;
125 break;
126 case VRC4173_USBU_PCI_CLOCK:
127 set_cmusrst(USBRST);
128 vrc4173_cmuclkmsk |= MSKUSB;
129 break;
130 case VRC4173_CARDU1_PCI_CLOCK:
131 set_cmusrst(CARD1RST);
132 vrc4173_cmuclkmsk |= MSKCARD1;
133 break;
134 case VRC4173_CARDU2_PCI_CLOCK:
135 set_cmusrst(CARD2RST);
136 vrc4173_cmuclkmsk |= MSKCARD2;
137 break;
138 case VRC4173_AC97U_PCI_CLOCK:
139 set_cmusrst(AC97RST);
140 vrc4173_cmuclkmsk |= MSKAC97;
141 break;
142 case VRC4173_USBU_48MHz_CLOCK:
143 set_cmusrst(USBRST);
144 vrc4173_cmuclkmsk |= MSK48MUSB;
145 break;
146 case VRC4173_EXT_48MHz_CLOCK:
147 if (vrc4173_cmuclkmsk & MSK48MOSC)
148 vrc4173_cmuclkmsk |= MSK48MPIN;
149 else
150 printk(KERN_WARNING
151 "vrc4173_supply_clock: "
152 "Please supply VRC4173_48MHz_CLOCK first "
153 "rather than VRC4173_EXT_48MHz_CLOCK.\n");
154 break;
155 case VRC4173_48MHz_CLOCK:
156 vrc4173_cmuclkmsk |= MSK48MOSC;
157 break;
158 default:
159 printk(KERN_WARNING
160 "vrc4173_supply_clock: Invalid CLOCK value %u\n", clock);
161 break;
162 }
163
164 vrc4173_outw(vrc4173_cmuclkmsk, VRC4173_CMUCLKMSK);
165
166 switch (clock) {
167 case VRC4173_USBU_PCI_CLOCK:
168 case VRC4173_USBU_48MHz_CLOCK:
169 clear_cmusrst(USBRST);
170 break;
171 case VRC4173_CARDU1_PCI_CLOCK:
172 clear_cmusrst(CARD1RST);
173 break;
174 case VRC4173_CARDU2_PCI_CLOCK:
175 clear_cmusrst(CARD2RST);
176 break;
177 case VRC4173_AC97U_PCI_CLOCK:
178 clear_cmusrst(AC97RST);
179 break;
180 default:
181 break;
182 }
183
184 spin_unlock_irq(&vrc4173_cmu_lock);
185 }
186}
187
188EXPORT_SYMBOL(vrc4173_supply_clock);
189
190void vrc4173_mask_clock(vrc4173_clock_t clock)
191{
192 if (vrc4173_initialized) {
193 spin_lock_irq(&vrc4173_cmu_lock);
194
195 switch (clock) {
196 case VRC4173_PIU_CLOCK:
197 vrc4173_cmuclkmsk &= ~MSKPIU;
198 break;
199 case VRC4173_KIU_CLOCK:
200 vrc4173_cmuclkmsk &= ~MSKKIU;
201 break;
202 case VRC4173_AIU_CLOCK:
203 vrc4173_cmuclkmsk &= ~MSKAIU;
204 break;
205 case VRC4173_PS2_CH1_CLOCK:
206 vrc4173_cmuclkmsk &= ~MSKPS2CH1;
207 break;
208 case VRC4173_PS2_CH2_CLOCK:
209 vrc4173_cmuclkmsk &= ~MSKPS2CH2;
210 break;
211 case VRC4173_USBU_PCI_CLOCK:
212 set_cmusrst(USBRST);
213 vrc4173_cmuclkmsk &= ~MSKUSB;
214 break;
215 case VRC4173_CARDU1_PCI_CLOCK:
216 set_cmusrst(CARD1RST);
217 vrc4173_cmuclkmsk &= ~MSKCARD1;
218 break;
219 case VRC4173_CARDU2_PCI_CLOCK:
220 set_cmusrst(CARD2RST);
221 vrc4173_cmuclkmsk &= ~MSKCARD2;
222 break;
223 case VRC4173_AC97U_PCI_CLOCK:
224 set_cmusrst(AC97RST);
225 vrc4173_cmuclkmsk &= ~MSKAC97;
226 break;
227 case VRC4173_USBU_48MHz_CLOCK:
228 set_cmusrst(USBRST);
229 vrc4173_cmuclkmsk &= ~MSK48MUSB;
230 break;
231 case VRC4173_EXT_48MHz_CLOCK:
232 vrc4173_cmuclkmsk &= ~MSK48MPIN;
233 break;
234 case VRC4173_48MHz_CLOCK:
235 vrc4173_cmuclkmsk &= ~MSK48MOSC;
236 break;
237 default:
238 printk(KERN_WARNING "vrc4173_mask_clock: Invalid CLOCK value %u\n", clock);
239 break;
240 }
241
242 vrc4173_outw(vrc4173_cmuclkmsk, VRC4173_CMUCLKMSK);
243
244 switch (clock) {
245 case VRC4173_USBU_PCI_CLOCK:
246 case VRC4173_USBU_48MHz_CLOCK:
247 clear_cmusrst(USBRST);
248 break;
249 case VRC4173_CARDU1_PCI_CLOCK:
250 clear_cmusrst(CARD1RST);
251 break;
252 case VRC4173_CARDU2_PCI_CLOCK:
253 clear_cmusrst(CARD2RST);
254 break;
255 case VRC4173_AC97U_PCI_CLOCK:
256 clear_cmusrst(AC97RST);
257 break;
258 default:
259 break;
260 }
261
262 spin_unlock_irq(&vrc4173_cmu_lock);
263 }
264}
265
266EXPORT_SYMBOL(vrc4173_mask_clock);
267
268static inline void vrc4173_cmu_init(void)
269{
270 vrc4173_cmuclkmsk = vrc4173_inw(VRC4173_CMUCLKMSK);
271
272 spin_lock_init(&vrc4173_cmu_lock);
273}
274
275void vrc4173_select_function(vrc4173_function_t function)
276{
277 if (vrc4173_initialized) {
278 spin_lock_irq(&vrc4173_giu_lock);
279
280 switch(function) {
281 case PS2_CHANNEL1:
282 vrc4173_selectreg |= SEL2;
283 break;
284 case PS2_CHANNEL2:
285 vrc4173_selectreg |= SEL1;
286 break;
287 case TOUCHPANEL:
288 vrc4173_selectreg &= SEL2 | SEL1 | SEL0;
289 break;
290 case KEYBOARD_8SCANLINES:
291 vrc4173_selectreg &= SEL3 | SEL2 | SEL1;
292 break;
293 case KEYBOARD_10SCANLINES:
294 vrc4173_selectreg &= SEL3 | SEL2;
295 break;
296 case KEYBOARD_12SCANLINES:
297 vrc4173_selectreg &= SEL3;
298 break;
299 case GPIO_0_15PINS:
300 vrc4173_selectreg |= SEL0;
301 break;
302 case GPIO_16_20PINS:
303 vrc4173_selectreg |= SEL3;
304 break;
305 }
306
307 vrc4173_outw(vrc4173_selectreg, VRC4173_SELECTREG);
308
309 spin_unlock_irq(&vrc4173_giu_lock);
310 }
311}
312
313EXPORT_SYMBOL(vrc4173_select_function);
314
315static inline void vrc4173_giu_init(void)
316{
317 vrc4173_selectreg = vrc4173_inw(VRC4173_SELECTREG);
318
319 spin_lock_init(&vrc4173_giu_lock);
320}
321
322void vrc4173_enable_piuint(uint16_t mask)
323{
324 irq_desc_t *desc = irq_desc + VRC4173_PIU_IRQ;
325 unsigned long flags;
326 uint16_t val;
327
328 spin_lock_irqsave(&desc->lock, flags);
329 val = vrc4173_inw(VRC4173_MPIUINTREG);
330 val |= mask;
331 vrc4173_outw(val, VRC4173_MPIUINTREG);
332 spin_unlock_irqrestore(&desc->lock, flags);
333}
334
335EXPORT_SYMBOL(vrc4173_enable_piuint);
336
337void vrc4173_disable_piuint(uint16_t mask)
338{
339 irq_desc_t *desc = irq_desc + VRC4173_PIU_IRQ;
340 unsigned long flags;
341 uint16_t val;
342
343 spin_lock_irqsave(&desc->lock, flags);
344 val = vrc4173_inw(VRC4173_MPIUINTREG);
345 val &= ~mask;
346 vrc4173_outw(val, VRC4173_MPIUINTREG);
347 spin_unlock_irqrestore(&desc->lock, flags);
348}
349
350EXPORT_SYMBOL(vrc4173_disable_piuint);
351
352void vrc4173_enable_aiuint(uint16_t mask)
353{
354 irq_desc_t *desc = irq_desc + VRC4173_AIU_IRQ;
355 unsigned long flags;
356 uint16_t val;
357
358 spin_lock_irqsave(&desc->lock, flags);
359 val = vrc4173_inw(VRC4173_MAIUINTREG);
360 val |= mask;
361 vrc4173_outw(val, VRC4173_MAIUINTREG);
362 spin_unlock_irqrestore(&desc->lock, flags);
363}
364
365EXPORT_SYMBOL(vrc4173_enable_aiuint);
366
367void vrc4173_disable_aiuint(uint16_t mask)
368{
369 irq_desc_t *desc = irq_desc + VRC4173_AIU_IRQ;
370 unsigned long flags;
371 uint16_t val;
372
373 spin_lock_irqsave(&desc->lock, flags);
374 val = vrc4173_inw(VRC4173_MAIUINTREG);
375 val &= ~mask;
376 vrc4173_outw(val, VRC4173_MAIUINTREG);
377 spin_unlock_irqrestore(&desc->lock, flags);
378}
379
380EXPORT_SYMBOL(vrc4173_disable_aiuint);
381
382void vrc4173_enable_kiuint(uint16_t mask)
383{
384 irq_desc_t *desc = irq_desc + VRC4173_KIU_IRQ;
385 unsigned long flags;
386 uint16_t val;
387
388 spin_lock_irqsave(&desc->lock, flags);
389 val = vrc4173_inw(VRC4173_MKIUINTREG);
390 val |= mask;
391 vrc4173_outw(val, VRC4173_MKIUINTREG);
392 spin_unlock_irqrestore(&desc->lock, flags);
393}
394
395EXPORT_SYMBOL(vrc4173_enable_kiuint);
396
397void vrc4173_disable_kiuint(uint16_t mask)
398{
399 irq_desc_t *desc = irq_desc + VRC4173_KIU_IRQ;
400 unsigned long flags;
401 uint16_t val;
402
403 spin_lock_irqsave(&desc->lock, flags);
404 val = vrc4173_inw(VRC4173_MKIUINTREG);
405 val &= ~mask;
406 vrc4173_outw(val, VRC4173_MKIUINTREG);
407 spin_unlock_irqrestore(&desc->lock, flags);
408}
409
410EXPORT_SYMBOL(vrc4173_disable_kiuint);
411
412static void enable_vrc4173_irq(unsigned int irq)
413{
414 uint16_t val;
415
416 val = vrc4173_inw(VRC4173_MSYSINT1REG);
417 val |= (uint16_t)1 << (irq - VRC4173_IRQ_BASE);
418 vrc4173_outw(val, VRC4173_MSYSINT1REG);
419}
420
421static void disable_vrc4173_irq(unsigned int irq)
422{
423 uint16_t val;
424
425 val = vrc4173_inw(VRC4173_MSYSINT1REG);
426 val &= ~((uint16_t)1 << (irq - VRC4173_IRQ_BASE));
427 vrc4173_outw(val, VRC4173_MSYSINT1REG);
428}
429
430static unsigned int startup_vrc4173_irq(unsigned int irq)
431{
432 enable_vrc4173_irq(irq);
433 return 0; /* never anything pending */
434}
435
436#define shutdown_vrc4173_irq disable_vrc4173_irq
437#define ack_vrc4173_irq disable_vrc4173_irq
438
439static void end_vrc4173_irq(unsigned int irq)
440{
441 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
442 enable_vrc4173_irq(irq);
443}
444
445static struct hw_interrupt_type vrc4173_irq_type = {
446 .typename = "VRC4173",
447 .startup = startup_vrc4173_irq,
448 .shutdown = shutdown_vrc4173_irq,
449 .enable = enable_vrc4173_irq,
450 .disable = disable_vrc4173_irq,
451 .ack = ack_vrc4173_irq,
452 .end = end_vrc4173_irq,
453};
454
455static int vrc4173_get_irq_number(int irq)
456{
457 uint16_t status, mask;
458 int i;
459
460 status = vrc4173_inw(VRC4173_SYSINT1REG);
461 mask = vrc4173_inw(VRC4173_MSYSINT1REG);
462
463 status &= mask;
464 if (status) {
465 for (i = 0; i < 16; i++)
466 if (status & (0x0001 << i))
467 return VRC4173_IRQ(i);
468 }
469
470 return -EINVAL;
471}
472
473static inline int vrc4173_icu_init(int cascade_irq)
474{
475 int i;
476
477 if (cascade_irq < GIU_IRQ(0) || cascade_irq > GIU_IRQ(15))
478 return -EINVAL;
479
480 vrc4173_outw(0, VRC4173_MSYSINT1REG);
481
482 vr41xx_set_irq_trigger(GIU_IRQ_TO_PIN(cascade_irq), TRIGGER_LEVEL, SIGNAL_THROUGH);
483 vr41xx_set_irq_level(GIU_IRQ_TO_PIN(cascade_irq), LEVEL_LOW);
484
485 for (i = VRC4173_IRQ_BASE; i <= VRC4173_IRQ_LAST; i++)
486 irq_desc[i].handler = &vrc4173_irq_type;
487
488 return 0;
489}
490
491static int __devinit vrc4173_probe(struct pci_dev *dev,
492 const struct pci_device_id *id)
493{
494 unsigned long start, flags;
495 int err;
496
497 err = pci_enable_device(dev);
498 if (err < 0) {
499 printk(KERN_ERR "vrc4173: Failed to enable PCI device, aborting\n");
500 return err;
501 }
502
503 pci_set_master(dev);
504
505 start = pci_resource_start(dev, 0);
506 if (start == 0) {
507 printk(KERN_ERR "vrc4173:No such PCI I/O resource, aborting\n");
508 return -ENXIO;
509 }
510
511 flags = pci_resource_flags(dev, 0);
512 if ((flags & IORESOURCE_IO) == 0) {
513 printk(KERN_ERR "vrc4173: No such PCI I/O resource, aborting\n");
514 return -ENXIO;
515 }
516
517 err = pci_request_regions(dev, "NEC VRC4173");
518 if (err < 0) {
519 printk(KERN_ERR "vrc4173: PCI resources are busy, aborting\n");
520 return err;
521 }
522
523 set_vrc4173_io_offset(start);
524
525 vrc4173_cmu_init();
526 vrc4173_giu_init();
527
528 err = vrc4173_icu_init(dev->irq);
529 if (err < 0) {
530 printk(KERN_ERR "vrc4173: Invalid IRQ %d, aborting\n", dev->irq);
531 return err;
532 }
533
534 err = vr41xx_cascade_irq(dev->irq, vrc4173_get_irq_number);
535 if (err < 0) {
536 printk(KERN_ERR "vrc4173: IRQ resource %d is busy, aborting\n", dev->irq);
537 return err;
538 }
539
540 printk(KERN_INFO
541 "NEC VRC4173 at 0x%#08lx, IRQ is cascaded to %d\n", start, dev->irq);
542
543 return 0;
544}
545
546static void vrc4173_remove(struct pci_dev *dev)
547{
548 free_irq(dev->irq, NULL);
549
550 pci_release_regions(dev);
551}
552
553static struct pci_driver vrc4173_driver = {
554 .name = "NEC VRC4173",
555 .probe = vrc4173_probe,
556 .remove = vrc4173_remove,
557 .id_table = vrc4173_id_table,
558};
559
560static int __devinit vrc4173_init(void)
561{
562 int err;
563
564 err = pci_module_init(&vrc4173_driver);
565 if (err < 0)
566 return err;
567
568 vrc4173_initialized = 1;
569
570 return 0;
571}
572
573static void __devexit vrc4173_exit(void)
574{
575 vrc4173_initialized = 0;
576
577 pci_unregister_driver(&vrc4173_driver);
578}
579
580module_init(vrc4173_init);
581module_exit(vrc4173_exit);
diff --git a/arch/mips/vr41xx/ibm-workpad/Makefile b/arch/mips/vr41xx/ibm-workpad/Makefile
new file mode 100644
index 000000000000..5ffaff0f0f89
--- /dev/null
+++ b/arch/mips/vr41xx/ibm-workpad/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the IBM WorkPad z50 specific parts of the kernel
3#
4
5obj-y += setup.o
diff --git a/arch/mips/vr41xx/ibm-workpad/setup.c b/arch/mips/vr41xx/ibm-workpad/setup.c
new file mode 100644
index 000000000000..cff44602d3d4
--- /dev/null
+++ b/arch/mips/vr41xx/ibm-workpad/setup.c
@@ -0,0 +1,40 @@
1/*
2 * setup.c, Setup for the IBM WorkPad z50.
3 *
4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/ioport.h>
22
23#include <asm/io.h>
24#include <asm/vr41xx/workpad.h>
25
26const char *get_system_type(void)
27{
28 return "IBM WorkPad z50";
29}
30
31static int __init ibm_workpad_setup(void)
32{
33 set_io_port_base(IO_PORT_BASE);
34 ioport_resource.start = IO_PORT_RESOURCE_START;
35 ioport_resource.end = IO_PORT_RESOURCE_END;
36
37 return 0;
38}
39
40arch_initcall(ibm_workpad_setup);
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/Makefile b/arch/mips/vr41xx/nec-cmbvr4133/Makefile
new file mode 100644
index 000000000000..5835cae54aca
--- /dev/null
+++ b/arch/mips/vr41xx/nec-cmbvr4133/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for the NEC-CMBVR4133
3#
4
5obj-y := init.o setup.o
6
7obj-$(CONFIG_PCI) += m1535plus.o
8obj-$(CONFIG_ROCKHOPPER) += irq.o
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/init.c b/arch/mips/vr41xx/nec-cmbvr4133/init.c
new file mode 100644
index 000000000000..87f06b3f5a9c
--- /dev/null
+++ b/arch/mips/vr41xx/nec-cmbvr4133/init.c
@@ -0,0 +1,78 @@
1/*
2 * arch/mips/vr41xx/nec-cmbvr4133/init.c
3 *
4 * PROM library initialisation code for NEC CMB-VR4133 board.
5 *
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and
7 * Jun Sun <jsun@mvista.com, or source@mvista.com> and
8 * Alex Sapkov <asapkov@ru.mvista.com>
9 *
10 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 *
15 * Support for NEC-CMBVR4133 in 2.6
16 * Manish Lachwani (mlachwani@mvista.com)
17 */
18#include <linux/config.h>
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <linux/string.h>
22
23#include <asm/bootinfo.h>
24
25#ifdef CONFIG_ROCKHOPPER
26#include <asm/io.h>
27#include <linux/pci.h>
28
29#define PCICONFDREG 0xaf000c14
30#define PCICONFAREG 0xaf000c18
31#endif
32
33const char *get_system_type(void)
34{
35 return "NEC CMB-VR4133";
36}
37
38#ifdef CONFIG_ROCKHOPPER
39void disable_pcnet(void)
40{
41 u32 data;
42
43 /*
44 * Workaround for the bug in PMON on VR4133. PMON leaves
45 * AMD PCNet controller (on Rockhopper) initialized and running in
46 * bus master mode. We have do disable it before doing any
47 * further initialization. Or we get problems with PCI bus 2
48 * and random lockups and crashes.
49 */
50
51 writel((2 << 16) |
52 (PCI_DEVFN(1,0) << 8) |
53 (0 & 0xfc) |
54 1UL,
55 PCICONFAREG);
56
57 data = readl(PCICONFDREG);
58
59 writel((2 << 16) |
60 (PCI_DEVFN(1,0) << 8) |
61 (4 & 0xfc) |
62 1UL,
63 PCICONFAREG);
64
65 data = readl(PCICONFDREG);
66
67 writel((2 << 16) |
68 (PCI_DEVFN(1,0) << 8) |
69 (4 & 0xfc) |
70 1UL,
71 PCICONFAREG);
72
73 data &= ~4;
74
75 writel(data, PCICONFDREG);
76}
77#endif
78
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/irq.c b/arch/mips/vr41xx/nec-cmbvr4133/irq.c
new file mode 100644
index 000000000000..31db6b61a39e
--- /dev/null
+++ b/arch/mips/vr41xx/nec-cmbvr4133/irq.c
@@ -0,0 +1,114 @@
1/*
2 * arch/mips/vr41xx/nec-cmbvr4133/irq.c
3 *
4 * Interrupt routines for the NEC CMB-VR4133 board.
5 *
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and
7 * Alex Sapkov <asapkov@ru.mvista.com>
8 *
9 * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 *
14 * Support for NEC-CMBVR4133 in 2.6
15 * Manish Lachwani (mlachwani@mvista.com)
16 */
17#include <linux/bitops.h>
18#include <linux/errno.h>
19#include <linux/init.h>
20#include <linux/ioport.h>
21#include <linux/interrupt.h>
22
23#include <asm/io.h>
24#include <asm/vr41xx/cmbvr4133.h>
25
26extern void enable_8259A_irq(unsigned int irq);
27extern void disable_8259A_irq(unsigned int irq);
28extern void mask_and_ack_8259A(unsigned int irq);
29extern void init_8259A(int hoge);
30
31extern int vr4133_rockhopper;
32
33static unsigned int startup_i8259_irq(unsigned int irq)
34{
35 enable_8259A_irq(irq - I8259_IRQ_BASE);
36 return 0;
37}
38
39static void shutdown_i8259_irq(unsigned int irq)
40{
41 disable_8259A_irq(irq - I8259_IRQ_BASE);
42}
43
44static void enable_i8259_irq(unsigned int irq)
45{
46 enable_8259A_irq(irq - I8259_IRQ_BASE);
47}
48
49static void disable_i8259_irq(unsigned int irq)
50{
51 disable_8259A_irq(irq - I8259_IRQ_BASE);
52}
53
54static void ack_i8259_irq(unsigned int irq)
55{
56 mask_and_ack_8259A(irq - I8259_IRQ_BASE);
57}
58
59static void end_i8259_irq(unsigned int irq)
60{
61 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
62 enable_8259A_irq(irq - I8259_IRQ_BASE);
63}
64
65static struct hw_interrupt_type i8259_irq_type = {
66 .typename = "XT-PIC",
67 .startup = startup_i8259_irq,
68 .shutdown = shutdown_i8259_irq,
69 .enable = enable_i8259_irq,
70 .disable = disable_i8259_irq,
71 .ack = ack_i8259_irq,
72 .end = end_i8259_irq,
73};
74
75static int i8259_get_irq_number(int irq)
76{
77 unsigned long isr;
78
79 isr = inb(0x20);
80 irq = ffz(~isr);
81 if (irq == 2) {
82 isr = inb(0xa0);
83 irq = 8 + ffz(~isr);
84 }
85
86 if (irq < 0 || irq > 15)
87 return -EINVAL;
88
89 return I8259_IRQ_BASE + irq;
90}
91
92static struct irqaction i8259_slave_cascade = {
93 .handler = &no_action,
94 .name = "cascade",
95};
96
97void __init rockhopper_init_irq(void)
98{
99 int i;
100
101 if(!vr4133_rockhopper) {
102 printk(KERN_ERR "Not a Rockhopper Board \n");
103 return;
104 }
105
106 for (i = I8259_IRQ_BASE; i <= I8259_IRQ_LAST; i++)
107 irq_desc[i].handler = &i8259_irq_type;
108
109 setup_irq(I8259_SLAVE_IRQ, &i8259_slave_cascade);
110
111 vr41xx_set_irq_trigger(CMBVR41XX_INTC_PIN, TRIGGER_LEVEL, SIGNAL_THROUGH);
112 vr41xx_set_irq_level(CMBVR41XX_INTC_PIN, LEVEL_HIGH);
113 vr41xx_cascade_irq(CMBVR41XX_INTC_IRQ, i8259_get_irq_number);
114}
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c b/arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c
new file mode 100644
index 000000000000..1f6b24ef8695
--- /dev/null
+++ b/arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c
@@ -0,0 +1,250 @@
1/*
2 * arch/mips/vr41xx/nec-cmbvr4133/m1535plus.c
3 *
4 * Initialize for ALi M1535+(included M5229 and M5237).
5 *
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and
7 * Alex Sapkov <asapkov@ru.mvista.com>
8 *
9 * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 *
14 * Support for NEC-CMBVR4133 in 2.6
15 * Author: Manish Lachwani (mlachwani@mvista.com)
16 */
17#include <linux/config.h>
18#include <linux/init.h>
19#include <linux/types.h>
20#include <linux/serial.h>
21
22#include <asm/vr41xx/cmbvr4133.h>
23#include <linux/pci.h>
24#include <asm/io.h>
25
26#define CONFIG_PORT(port) ((port) ? 0x3f0 : 0x370)
27#define DATA_PORT(port) ((port) ? 0x3f1 : 0x371)
28#define INDEX_PORT(port) CONFIG_PORT(port)
29
30#define ENTER_CONFIG_MODE(port) \
31 do { \
32 outb_p(0x51, CONFIG_PORT(port)); \
33 outb_p(0x23, CONFIG_PORT(port)); \
34 } while(0)
35
36#define SELECT_LOGICAL_DEVICE(port, dev_no) \
37 do { \
38 outb_p(0x07, INDEX_PORT(port)); \
39 outb_p((dev_no), DATA_PORT(port)); \
40 } while(0)
41
42#define WRITE_CONFIG_DATA(port,index,data) \
43 do { \
44 outb_p((index), INDEX_PORT(port)); \
45 outb_p((data), DATA_PORT(port)); \
46 } while(0)
47
48#define EXIT_CONFIG_MODE(port) outb(0xbb, CONFIG_PORT(port))
49
50#define PCI_CONFIG_ADDR KSEG1ADDR(0x0f000c18)
51#define PCI_CONFIG_DATA KSEG1ADDR(0x0f000c14)
52
53#ifdef CONFIG_BLK_DEV_FD
54
55void __devinit ali_m1535plus_fdc_init(int port)
56{
57 ENTER_CONFIG_MODE(port);
58 SELECT_LOGICAL_DEVICE(port, 0); /* FDC */
59 WRITE_CONFIG_DATA(port, 0x30, 0x01); /* FDC: enable */
60 WRITE_CONFIG_DATA(port, 0x60, 0x03); /* I/O port base: 0x3f0 */
61 WRITE_CONFIG_DATA(port, 0x61, 0xf0);
62 WRITE_CONFIG_DATA(port, 0x70, 0x06); /* IRQ: 6 */
63 WRITE_CONFIG_DATA(port, 0x74, 0x02); /* DMA: channel 2 */
64 WRITE_CONFIG_DATA(port, 0xf0, 0x08);
65 WRITE_CONFIG_DATA(port, 0xf1, 0x00);
66 WRITE_CONFIG_DATA(port, 0xf2, 0xff);
67 WRITE_CONFIG_DATA(port, 0xf4, 0x00);
68 EXIT_CONFIG_MODE(port);
69}
70
71#endif
72
73void __devinit ali_m1535plus_parport_init(int port)
74{
75 ENTER_CONFIG_MODE(port);
76 SELECT_LOGICAL_DEVICE(port, 3); /* Parallel Port */
77 WRITE_CONFIG_DATA(port, 0x30, 0x01);
78 WRITE_CONFIG_DATA(port, 0x60, 0x03); /* I/O port base: 0x378 */
79 WRITE_CONFIG_DATA(port, 0x61, 0x78);
80 WRITE_CONFIG_DATA(port, 0x70, 0x07); /* IRQ: 7 */
81 WRITE_CONFIG_DATA(port, 0x74, 0x04); /* DMA: None */
82 WRITE_CONFIG_DATA(port, 0xf0, 0x8c); /* IRQ polarity: Active Low */
83 WRITE_CONFIG_DATA(port, 0xf1, 0xc5);
84 EXIT_CONFIG_MODE(port);
85}
86
87void __devinit ali_m1535plus_keyboard_init(int port)
88{
89 ENTER_CONFIG_MODE(port);
90 SELECT_LOGICAL_DEVICE(port, 7); /* KEYBOARD */
91 WRITE_CONFIG_DATA(port, 0x30, 0x01); /* KEYBOARD: eable */
92 WRITE_CONFIG_DATA(port, 0x70, 0x01); /* IRQ: 1 */
93 WRITE_CONFIG_DATA(port, 0x72, 0x0c); /* PS/2 Mouse IRQ: 12 */
94 WRITE_CONFIG_DATA(port, 0xf0, 0x00);
95 EXIT_CONFIG_MODE(port);
96}
97
98void __devinit ali_m1535plus_hotkey_init(int port)
99{
100 ENTER_CONFIG_MODE(port);
101 SELECT_LOGICAL_DEVICE(port, 0xc); /* HOTKEY */
102 WRITE_CONFIG_DATA(port, 0x30, 0x00);
103 WRITE_CONFIG_DATA(port, 0xf0, 0x35);
104 WRITE_CONFIG_DATA(port, 0xf1, 0x14);
105 WRITE_CONFIG_DATA(port, 0xf2, 0x11);
106 WRITE_CONFIG_DATA(port, 0xf3, 0x71);
107 WRITE_CONFIG_DATA(port, 0xf5, 0x05);
108 EXIT_CONFIG_MODE(port);
109}
110
111void ali_m1535plus_init(struct pci_dev *dev)
112{
113 pci_write_config_byte(dev, 0x40, 0x18); /* PCI Interface Control */
114 pci_write_config_byte(dev, 0x41, 0xc0); /* PS2 keyb & mouse enable */
115 pci_write_config_byte(dev, 0x42, 0x41); /* ISA bus cycle control */
116 pci_write_config_byte(dev, 0x43, 0x00); /* ISA bus cycle control 2 */
117 pci_write_config_byte(dev, 0x44, 0x5d); /* IDE enable & IRQ 14 */
118 pci_write_config_byte(dev, 0x45, 0x0b); /* PCI int polling mode */
119 pci_write_config_byte(dev, 0x47, 0x00); /* BIOS chip select control */
120
121 /* IRQ routing */
122 pci_write_config_byte(dev, 0x48, 0x03); /* INTA IRQ10, INTB disable */
123 pci_write_config_byte(dev, 0x49, 0x00); /* INTC and INTD disable */
124 pci_write_config_byte(dev, 0x4a, 0x00); /* INTE and INTF disable */
125 pci_write_config_byte(dev, 0x4b, 0x90); /* Audio IRQ11, Modem disable */
126
127 pci_write_config_word(dev, 0x50, 0x4000); /* Parity check IDE enable */
128 pci_write_config_word(dev, 0x52, 0x0000); /* USB & RTC disable */
129 pci_write_config_word(dev, 0x54, 0x0002); /* ??? no info */
130 pci_write_config_word(dev, 0x56, 0x0002); /* PCS1J signal disable */
131
132 pci_write_config_byte(dev, 0x59, 0x00); /* PCSDS */
133 pci_write_config_byte(dev, 0x5a, 0x00);
134 pci_write_config_byte(dev, 0x5b, 0x00);
135 pci_write_config_word(dev, 0x5c, 0x0000);
136 pci_write_config_byte(dev, 0x5e, 0x00);
137 pci_write_config_byte(dev, 0x5f, 0x00);
138 pci_write_config_word(dev, 0x60, 0x0000);
139
140 pci_write_config_byte(dev, 0x6c, 0x00);
141 pci_write_config_byte(dev, 0x6d, 0x48); /* ROM address mapping */
142 pci_write_config_byte(dev, 0x6e, 0x00); /* ??? what for? */
143
144 pci_write_config_byte(dev, 0x70, 0x12); /* Serial IRQ control */
145 pci_write_config_byte(dev, 0x71, 0xEF); /* DMA channel select */
146 pci_write_config_byte(dev, 0x72, 0x03); /* USB IDSEL */
147 pci_write_config_byte(dev, 0x73, 0x00); /* ??? no info */
148
149 /*
150 * IRQ setup ALi M5237 USB Host Controller
151 * IRQ: 9
152 */
153 pci_write_config_byte(dev, 0x74, 0x01); /* USB IRQ9 */
154
155 pci_write_config_byte(dev, 0x75, 0x1f); /* IDE2 IRQ 15 */
156 pci_write_config_byte(dev, 0x76, 0x80); /* ACPI disable */
157 pci_write_config_byte(dev, 0x77, 0x40); /* Modem disable */
158 pci_write_config_dword(dev, 0x78, 0x20000000); /* Pin select 2 */
159 pci_write_config_byte(dev, 0x7c, 0x00); /* Pin select 3 */
160 pci_write_config_byte(dev, 0x81, 0x00); /* ID read/write control */
161 pci_write_config_byte(dev, 0x90, 0x00); /* PCI PM block control */
162 pci_write_config_word(dev, 0xa4, 0x0000); /* PMSCR */
163
164#ifdef CONFIG_BLK_DEV_FD
165 ali_m1535plus_fdc_init(1);
166#endif
167
168 ali_m1535plus_keyboard_init(1);
169 ali_m1535plus_hotkey_init(1);
170}
171
172static inline void ali_config_writeb(u8 reg, u8 val, int devfn)
173{
174 u32 data;
175 int shift;
176
177 writel((1 << 16) | (devfn << 8) | (reg & 0xfc) | 1UL, PCI_CONFIG_ADDR);
178 data = readl(PCI_CONFIG_DATA);
179
180 shift = (reg & 3) << 3;
181 data &= ~(0xff << shift);
182 data |= (((u32)val) << shift);
183
184 writel(data, PCI_CONFIG_DATA);
185}
186
187static inline u8 ali_config_readb(u8 reg, int devfn)
188{
189 u32 data;
190
191 writel((1 << 16) | (devfn << 8) | (reg & 0xfc) | 1UL, PCI_CONFIG_ADDR);
192 data = readl(PCI_CONFIG_DATA);
193
194 return (u8)(data >> ((reg & 3) << 3));
195}
196
197static inline u16 ali_config_readw(u8 reg, int devfn)
198{
199 u32 data;
200
201 writel((1 << 16) | (devfn << 8) | (reg & 0xfc) | 1UL, PCI_CONFIG_ADDR);
202 data = readl(PCI_CONFIG_DATA);
203
204 return (u16)(data >> ((reg & 2) << 3));
205}
206
207int vr4133_rockhopper = 0;
208void __init ali_m5229_preinit(void)
209{
210 if (ali_config_readw(PCI_VENDOR_ID,16) == PCI_VENDOR_ID_AL &&
211 ali_config_readw(PCI_DEVICE_ID,16) == PCI_DEVICE_ID_AL_M1533) {
212 printk(KERN_INFO "Found an NEC Rockhopper \n");
213 vr4133_rockhopper = 1;
214 /*
215 * Enable ALi M5229 IDE Controller (both channels)
216 * IDSEL: A27
217 */
218 ali_config_writeb(0x58, 0x4c, 16);
219 }
220}
221
222void __init ali_m5229_init(struct pci_dev *dev)
223{
224 /*
225 * Enable Primary/Secondary Channel Cable Detect 40-Pin
226 */
227 pci_write_config_word(dev, 0x4a, 0xc023);
228
229 /*
230 * Set only the 3rd byteis for the master IDE's cycle and
231 * enable Internal IDE Function
232 */
233 pci_write_config_byte(dev, 0x50, 0x23); /* Class code attr register */
234
235 pci_write_config_byte(dev, 0x09, 0xff); /* Set native mode & stuff */
236 pci_write_config_byte(dev, 0x52, 0x00); /* use timing registers */
237 pci_write_config_byte(dev, 0x58, 0x02); /* Primary addr setup timing */
238 pci_write_config_byte(dev, 0x59, 0x22); /* Primary cmd block timing */
239 pci_write_config_byte(dev, 0x5a, 0x22); /* Pr drv 0 R/W timing */
240 pci_write_config_byte(dev, 0x5b, 0x22); /* Pr drv 1 R/W timing */
241 pci_write_config_byte(dev, 0x5c, 0x02); /* Sec addr setup timing */
242 pci_write_config_byte(dev, 0x5d, 0x22); /* Sec cmd block timing */
243 pci_write_config_byte(dev, 0x5e, 0x22); /* Sec drv 0 R/W timing */
244 pci_write_config_byte(dev, 0x5f, 0x22); /* Sec drv 1 R/W timing */
245 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20);
246 pci_write_config_word(dev, PCI_COMMAND,
247 PCI_COMMAND_PARITY | PCI_COMMAND_MASTER |
248 PCI_COMMAND_IO);
249}
250
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/setup.c b/arch/mips/vr41xx/nec-cmbvr4133/setup.c
new file mode 100644
index 000000000000..db686ce42e85
--- /dev/null
+++ b/arch/mips/vr41xx/nec-cmbvr4133/setup.c
@@ -0,0 +1,96 @@
1/*
2 * arch/mips/vr41xx/nec-cmbvr4133/setup.c
3 *
4 * Setup for the NEC CMB-VR4133.
5 *
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and
7 * Alex Sapkov <asapkov@ru.mvista.com>
8 *
9 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 *
14 * Support for CMBVR4133 board in 2.6
15 * Author: Manish Lachwani (mlachwani@mvista.com)
16 */
17#include <linux/config.h>
18#include <linux/init.h>
19#include <linux/ide.h>
20#include <linux/ioport.h>
21
22#include <asm/reboot.h>
23#include <asm/time.h>
24#include <asm/vr41xx/cmbvr4133.h>
25#include <asm/bootinfo.h>
26
27#ifdef CONFIG_MTD
28#include <linux/mtd/physmap.h>
29#include <linux/mtd/partitions.h>
30#include <linux/mtd/mtd.h>
31#include <linux/mtd/map.h>
32
33static struct mtd_partition cmbvr4133_mtd_parts[] = {
34 {
35 .name = "User FS",
36 .size = 0x1be0000,
37 .offset = 0,
38 .mask_flags = 0,
39 },
40 {
41 .name = "PMON",
42 .size = 0x140000,
43 .offset = MTDPART_OFS_APPEND,
44 .mask_flags = MTD_WRITEABLE, /* force read-only */
45 },
46 {
47 .name = "User FS2",
48 .size = MTDPART_SIZ_FULL,
49 .offset = MTDPART_OFS_APPEND,
50 .mask_flags = 0,
51 }
52};
53
54#define number_partitions (sizeof(cmbvr4133_mtd_parts)/sizeof(struct mtd_partition))
55#endif
56
57extern void i8259_init(void);
58
59static int __init nec_cmbvr4133_setup(void)
60{
61#ifdef CONFIG_ROCKHOPPER
62 extern void disable_pcnet(void);
63
64 disable_pcnet();
65#endif
66 set_io_port_base(KSEG1ADDR(0x16000000));
67
68 mips_machgroup = MACH_GROUP_NEC_VR41XX;
69 mips_machtype = MACH_NEC_CMBVR4133;
70
71#ifdef CONFIG_PCI
72#ifdef CONFIG_ROCKHOPPER
73 ali_m5229_preinit();
74#endif
75#endif
76
77#ifdef CONFIG_ROCKHOPPER
78 rockhopper_init_irq();
79#endif
80
81#ifdef CONFIG_MTD
82 /* we use generic physmap mapping driver and we use partitions */
83 physmap_configure(0x1C000000, 0x02000000, 4, NULL);
84 physmap_set_partitions(cmbvr4133_mtd_parts, number_partitions);
85#endif
86
87 /* 128 MB memory support */
88 add_memory_region(0, 0x08000000, BOOT_MEM_RAM);
89
90#ifdef CONFIG_ROCKHOPPER
91 i8259_init();
92#endif
93 return 0;
94}
95
96early_initcall(nec_cmbvr4133_setup);
diff --git a/arch/mips/vr41xx/tanbac-tb0226/Makefile b/arch/mips/vr41xx/tanbac-tb0226/Makefile
new file mode 100644
index 000000000000..372f953d240b
--- /dev/null
+++ b/arch/mips/vr41xx/tanbac-tb0226/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the TANBAC TB0226 specific parts of the kernel
3#
4
5obj-y += setup.o
diff --git a/arch/mips/vr41xx/tanbac-tb0226/setup.c b/arch/mips/vr41xx/tanbac-tb0226/setup.c
new file mode 100644
index 000000000000..60027e5dea25
--- /dev/null
+++ b/arch/mips/vr41xx/tanbac-tb0226/setup.c
@@ -0,0 +1,24 @@
1/*
2 * setup.c, Setup for the TANBAC TB0226.
3 *
4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21const char *get_system_type(void)
22{
23 return "TANBAC TB0226";
24}
diff --git a/arch/mips/vr41xx/tanbac-tb0229/Makefile b/arch/mips/vr41xx/tanbac-tb0229/Makefile
new file mode 100644
index 000000000000..9c6b864ef2ef
--- /dev/null
+++ b/arch/mips/vr41xx/tanbac-tb0229/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the TANBAC TB0229(VR4131DIMM) specific parts of the kernel
3#
4
5obj-y := setup.o
diff --git a/arch/mips/vr41xx/tanbac-tb0229/setup.c b/arch/mips/vr41xx/tanbac-tb0229/setup.c
new file mode 100644
index 000000000000..5c1b757bfb0c
--- /dev/null
+++ b/arch/mips/vr41xx/tanbac-tb0229/setup.c
@@ -0,0 +1,27 @@
1/*
2 * setup.c, Setup for the TANBAC TB0229 (VR4131DIMM)
3 *
4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * Modified for TANBAC TB0229:
7 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24const char *get_system_type(void)
25{
26 return "TANBAC TB0229";
27}
diff --git a/arch/mips/vr41xx/victor-mpc30x/Makefile b/arch/mips/vr41xx/victor-mpc30x/Makefile
new file mode 100644
index 000000000000..a2e8086a31a6
--- /dev/null
+++ b/arch/mips/vr41xx/victor-mpc30x/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the Victor MP-C303/304 specific parts of the kernel
3#
4
5obj-y += setup.o
diff --git a/arch/mips/vr41xx/victor-mpc30x/setup.c b/arch/mips/vr41xx/victor-mpc30x/setup.c
new file mode 100644
index 000000000000..f591e36726e6
--- /dev/null
+++ b/arch/mips/vr41xx/victor-mpc30x/setup.c
@@ -0,0 +1,24 @@
1/*
2 * setup.c, Setup for the Victor MP-C303/304.
3 *
4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21const char *get_system_type(void)
22{
23 return "Victor MP-C303/304";
24}
diff --git a/arch/mips/vr41xx/zao-capcella/Makefile b/arch/mips/vr41xx/zao-capcella/Makefile
new file mode 100644
index 000000000000..cf420197cd23
--- /dev/null
+++ b/arch/mips/vr41xx/zao-capcella/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the ZAO Networks Capcella specific parts of the kernel
3#
4
5obj-y += setup.o
diff --git a/arch/mips/vr41xx/zao-capcella/setup.c b/arch/mips/vr41xx/zao-capcella/setup.c
new file mode 100644
index 000000000000..17bade241fe2
--- /dev/null
+++ b/arch/mips/vr41xx/zao-capcella/setup.c
@@ -0,0 +1,24 @@
1/*
2 * setup.c, Setup for the ZAO Networks Capcella.
3 *
4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21const char *get_system_type(void)
22{
23 return "ZAO Networks Capcella";
24}